/* استایل کلی */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', 'Amiri', sans-serif;
    background-color: #f5f1e8;
    color: #333;
    direction: rtl;
    overflow-x: hidden;
    height: 100vh;
}

.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 10px;
    position: relative;
    min-height: 100vh;
}

.paper-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" fill="%23f5f1e8"/><path d="M0 50 L100 50 M50 0 L50 100" stroke="%23e8e4db" stroke-width="0.5"/></svg>');
    opacity: 0.6;
    z-index: -1;
}

/* استایل هدر بازی */
.game-header {
    background-color: #4a6fa5;
    color: white;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.game-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff9a00, #ffd166);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    font-size: 28px;
    color: #ffd166;
}

.logo h1 {
    font-size: 22px;
    font-weight: 700;
}

.game-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.score-board {
    display: flex;
    align-items: center;
    gap: 15px;
    background-color: rgba(255, 255, 255, 0.15);
    padding: 8px 15px;
    border-radius: 8px;
}

.player-score {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.player-name {
    font-size: 14px;
    opacity: 0.9;
}

.score-value {
    font-size: 24px;
    font-weight: 700;
    color: #ffd166;
}

.vs {
    font-size: 18px;
    font-weight: 600;
}

.round-info {
    display: flex;
    align-items: center;
    gap: 5px;
    background-color: rgba(255, 255, 255, 0.15);
    padding: 8px 15px;
    border-radius: 8px;
}

.round-label {
    font-size: 14px;
}

.round-value {
    font-size: 24px;
    font-weight: 700;
    color: #ffd166;
}

.round-total {
    font-size: 16px;
    opacity: 0.8;
}

/* استایل کارت کاغذی */
.paper-card {
    background-color: #fff;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0dcd3;
    position: relative;
    overflow: hidden;
}

.paper-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, #4a6fa5, #6d98d6);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px dashed #e8e4db;
}

.card-header i {
    font-size: 28px;
    color: #4a6fa5;
}

.card-header h2 {
    font-size: 22px;
    color: #333;
    font-weight: 700;
}

/* استایل اسکرین‌ها */
.screen {
    display: none;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* استایل صفحه اتصال */
.connection-container {
    max-width: 600px;
    margin: 0 auto;
}

.room-info {
    margin-bottom: 30px;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding: 12px 15px;
    background-color: #f9f7f2;
    border-radius: 8px;
    border-right: 4px solid #4a6fa5;
}

.info-row i {
    font-size: 20px;
    color: #4a6fa5;
    width: 30px;
    text-align: center;
}

.info-text {
    display: flex;
    flex-direction: column;
}

.label {
    font-size: 14px;
    color: #666;
}

.value {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.players-waiting, .game-started {
    margin-top: 25px;
}

.waiting-header, .started-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.waiting-header i, .started-header i {
    font-size: 24px;
    color: #ff9a00;
}

.waiting-header h3, .started-header h3 {
    font-size: 20px;
    color: #333;
}

.started-text {
    text-align: center;
    font-size: 18px;
    color: #4a6fa5;
    padding: 15px;
    background-color: #f0f7ff;
    border-radius: 8px;
}

.players-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.player {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.active-player {
    background-color: #e8f5e9;
    border-right: 4px solid #4caf50;
}

.inactive-player {
    background-color: #f5f5f5;
    border-right: 4px solid #9e9e9e;
}

.player-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #4a6fa5;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.inactive-player .player-avatar {
    background-color: #9e9e9e;
}

.player-info {
    display: flex;
    flex-direction: column;
}

.player-name {
    font-size: 18px;
    font-weight: 600;
}

.player-status {
    font-size: 14px;
    color: #666;
}

/* استایل صفحه انتخاب حرف */
.letter-container {
    max-width: 500px;
    margin: 0 auto;
}

.letter-display {
    text-align: center;
    margin-bottom: 30px;
}

.letter-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4a6fa5, #6d98d6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 8px 20px rgba(74, 111, 165, 0.3);
}

.letter-circle span {
    font-size: 70px;
    font-weight: 700;
    font-family: 'Amiri', serif;
}

.letter-instruction {
    font-size: 18px;
    color: #666;
}

.timer-section {
    text-align: center;
}

.timer {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background-color: #f0f7ff;
    padding: 15px 30px;
    border-radius: 50px;
    margin-bottom: 10px;
}

.timer i {
    font-size: 24px;
    color: #ff9a00;
}

.timer span:nth-child(2) {
    font-size: 32px;
    font-weight: 700;
    color: #333;
    min-width: 40px;
    text-align: center;
}

.timer span:nth-child(3) {
    font-size: 18px;
    color: #666;
}

.timer-text {
    font-size: 16px;
    color: #666;
}

/* استایل صفحه اصلی بازی */
.game-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.game-header-section {
    background-color: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.current-letter-section {
    display: flex;
    align-items: center;
    gap: 20px;
}

.current-letter {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
}

.current-letter .letter {
    font-size: 32px;
    font-weight: 700;
    color: #4a6fa5;
    background-color: #f0f7ff;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-family: 'Amiri', serif;
}

.timer-game {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #fff8e1;
    padding: 10px 20px;
    border-radius: 50px;
    color: #ff8f00;
}

.timer-game i {
    font-size: 20px;
}

.timer-game span:nth-child(2) {
    font-size: 28px;
    font-weight: 700;
    min-width: 40px;
    text-align: center;
}

.game-table-container {
    background-color: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
}

.game-table {
    width: 100%;
    border-collapse: collapse;
}

.game-table th {
    padding: 15px 10px;
    text-align: center;
    background-color: #f5f7fa;
    font-weight: 700;
    color: #4a6fa5;
    border-bottom: 2px solid #e0e0e0;
}

.category-header {
    width: 30%;
}

.player-header {
    width: 30%;
}

.points-header {
    width: 10%;
}

.game-table td {
    padding: 12px 10px;
    text-align: center;
    border-bottom: 1px dashed #e0e0e0;
}

.game-table tbody tr:last-child td {
    border-bottom: none;
}

.game-table input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 16px;
    text-align: center;
    transition: all 0.3s;
}

.game-table input:focus {
    outline: none;
    border-color: #4a6fa5;
    box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.2);
}

.points-cell {
    font-weight: 700;
    color: #4a6fa5;
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.submit-btn {
    background-color: #4caf50;
    color: white;
    flex: 2;
}

.submit-btn:hover {
    background-color: #3d8b40;
    transform: translateY(-2px);
}

.skip-btn {
    background-color: #ff9800;
    color: white;
    flex: 1;
}

.skip-btn:hover {
    background-color: #e68900;
    transform: translateY(-2px);
}

/* استایل صفحه نتایج */
.results-container {
    max-width: 800px;
    margin: 0 auto;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px dashed #e8e4db;
}

.result-letter, .round-number {
    font-size: 18px;
    font-weight: 600;
}

.result-letter span, .round-number span {
    color: #4a6fa5;
}

.results-table {
    margin: 25px 0;
    overflow-x: auto;
}

.results-table table {
    width: 100%;
    border-collapse: collapse;
}

.results-table th {
    padding: 12px 10px;
    background-color: #f5f7fa;
    font-weight: 700;
    color: #4a6fa5;
    border-bottom: 2px solid #e0e0e0;
}

.results-table td {
    padding: 12px 10px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
}

.results-table tbody tr:last-child td {
    border-bottom: none;
}

.correct-answer {
    color: #4caf50;
    font-weight: 600;
}

.wrong-answer {
    color: #f44336;
}

.empty-answer {
    color: #9e9e9e;
    font-style: italic;
}

.round-scores {
    display: flex;
    justify-content: space-around;
    margin: 30px 0;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.score-label {
    font-size: 16px;
    color: #666;
}

.score-value {
    font-size: 32px;
    font-weight: 700;
}

.you-score .score-value {
    color: #4caf50;
}

.opponent-score .score-value {
    color: #f44336;
}

.total-scores {
    display: flex;
    justify-content: space-around;
    margin: 20px 0 30px;
    padding: 20px;
    background-color: #f0f7ff;
    border-radius: 8px;
}

.total-score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.total-label {
    font-size: 18px;
    font-weight: 600;
}

.total-value {
    font-size: 28px;
    font-weight: 700;
    color: #4a6fa5;
}

.next-round-section {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px dashed #e8e4db;
}

.countdown {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background-color: #f5f5f5;
    padding: 12px 25px;
    border-radius: 50px;
    margin-bottom: 20px;
}

.countdown i {
    color: #ff9800;
}

.countdown span:nth-child(2) {
    font-size: 24px;
    font-weight: 700;
    min-width: 30px;
}

.next-round-btn {
    background-color: #4a6fa5;
    color: white;
    margin: 0 auto;
    padding: 15px 40px;
}

.next-round-btn:hover {
    background-color: #3a5a85;
}

/* استایل صفحه پایان بازی */
.game-over-container {
    max-width: 700px;
    margin: 0 auto;
}

.final-results {
    text-align: center;
}

.winner-section {
    margin: 20px 0 30px;
}

.winner-crown {
    font-size: 60px;
    color: #ffd700;
    margin-bottom: 15px;
}

.winner-section h3 {
    font-size: 24px;
    color: #333;
    margin-bottom: 10px;
}

.winner-section p {
    font-size: 32px;
    font-weight: 700;
    color: #4a6fa5;
}

.final-scores {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin: 30px 0;
}

.final-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px;
    border-radius: 12px;
    min-width: 150px;
}

.final-you {
    background-color: #e8f5e9;
}

.final-opponent {
    background-color: #ffebee;
}

.vs-final {
    font-size: 24px;
    font-weight: 700;
    color: #666;
}

.final-player {
    font-size: 20px;
    font-weight: 600;
}

.final-points {
    font-size: 40px;
    font-weight: 700;
}

.final-you .final-points {
    color: #4caf50;
}

.final-opponent .final-points {
    color: #f44336;
}

.final-label {
    font-size: 16px;
    color: #666;
}

.game-summary {
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin: 25px 0;
    text-align: right;
}

.game-summary h4 {
    font-size: 20px;
    color: #4a6fa5;
    margin-bottom: 15px;
    text-align: center;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px dashed #ddd;
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-label {
    color: #666;
}

.summary-value {
    font-weight: 600;
    color: #333;
}

.final-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.play-again-btn {
    background-color: #4caf50;
    color: white;
    flex: 1;
}

.play-again-btn:hover {
    background-color: #3d8b40;
}

.exit-btn {
    background-color: #f44336;
    color: white;
    flex: 1;
}

.exit-btn:hover {
    background-color: #d32f2f;
}

/* رسپانسیو */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .game-info {
        width: 100%;
        justify-content: space-between;
    }
    
    .score-board {
        padding: 6px 12px;
    }
    
    .score-value {
        font-size: 20px;
    }
    
    .round-value {
        font-size: 20px;
    }
    
    .letter-circle {
        width: 120px;
        height: 120px;
    }
    
    .letter-circle span {
        font-size: 60px;
    }
    
    .current-letter-section {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .timer-game {
        align-self: flex-start;
    }
    
    .category-header, .player-header, .points-header {
        min-width: 100px;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .round-scores, .total-scores {
        flex-direction: column;
        gap: 20px;
    }
    
    .final-scores {
        flex-direction: column;
        gap: 20px;
    }
    
    .final-actions {
        flex-direction: column;
    }
}