/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Better tap highlighting on mobile */
    -webkit-tap-highlight-color: rgba(102, 126, 234, 0.3);
    -webkit-touch-callout: none;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    font-size: 16px;
    /* Prevent text selection on game elements */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Smooth scrolling */
    -webkit-overflow-scrolling: touch;
}

/* Increase base font size on mobile for better readability */
@media (max-width: 768px) {
    body {
        font-size: 18px;
    }
}

/* Allow text selection in input fields and chat */
input, textarea, .chat-container {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    padding-top: 20px; /* No fixed top menu bar - using floating button */
    padding-bottom: 100px; /* Space for fixed footer */
}

h1 {
    text-align: center;
    color: white;
    font-size: 1.2em;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.game-description {
    text-align: center;
    color: white;
    margin-top: -15px;
    margin-bottom: 20px;
    font-size: 0.95em;
    line-height: 1.4;
}

/* Mobile styles for description */
@media (max-width: 768px) {
    .game-description {
        font-size: 1em;
        padding: 0 10px;
        margin-bottom: 25px;
    }
}

@media (max-width: 480px) {
    .game-description {
        font-size: 1.05em;
        line-height: 1.5;
    }
}

/* Game container layout */
.game-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
}

.game-section, .chat-section, .leaderboard-section {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.game-section {
    flex: 1;
    max-width: 500px;
    min-width: 350px;
}

.chat-section {
    flex: 1;
    max-width: 500px;
    min-width: 350px;
    display: flex;
    flex-direction: column;
    padding-bottom: 100px; /* Space for fixed footer on mobile */
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    max-width: 400px;
    width: 90%;
    animation: modalFadeIn 0.3s ease-in-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #667eea;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 1em;
    margin-bottom: 20px;
    outline: none;
}

.modal-content input:focus {
    border-color: #667eea;
}

.modal-content button {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
    min-height: 44px; /* Better touch target */
    touch-action: manipulation;
}

.modal-content button:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.modal-content button:active {
    transform: scale(0.98);
}

/* Player info */
.player-info {
    text-align: center;
    margin-bottom: 20px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
}

.player-info p {
    margin: 5px 0;
    color: #333;
}

/* Country badge with native title tooltip */
.country-badge {
    cursor: help;
    font-size: 1.1em;
    transition: transform 0.2s ease;
    display: none; /* Hidden by default until country info is loaded */
}

.country-badge:hover {
    transform: scale(1.2);
}

.small-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 6px 15px;
    font-size: 0.85em;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 5px 5px 0 5px;
    display: inline-block;
}

.small-btn:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.leaderboard-link {
    text-decoration: none;
    display: inline-block;
}

/* Leaderboard Page Styles */
.leaderboard-page {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    max-width: 1000px;
    margin: 0 auto;
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.back-btn {
    background: #667eea;
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 25px;
    transition: all 0.3s ease;
    display: inline-block;
}

.back-btn:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.leaderboard-stats {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
}

.leaderboard-stats p {
    margin: 0;
    color: #333;
}

.leaderboard-full {
    overflow-x: auto;
}

/* Leaderboard styles */
.leaderboard-section h2 {
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

.leaderboard-container {
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.leaderboard-table th {
    background: #667eea;
    color: white;
    padding: 12px 8px;
    font-size: 0.9em;
    position: sticky;
    top: 0;
    z-index: 1;
    text-align: center;
}

.leaderboard-table td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

.leaderboard-table tr:hover {
    background: #f8f9fa;
}

.leaderboard-table tr.highlight {
    background: #fff3cd;
    font-weight: bold;
}

.leaderboard-table tr.highlight:hover {
    background: #ffe69c;
}

/* Special column styling */
.rank-cell {
    font-weight: bold;
    color: #667eea;
}

.player-cell {
    font-weight: 600;
    text-align: left;
    padding-left: 15px;
}

.win-cell {
    color: #28a745;
    font-weight: bold;
}

.loss-cell {
    color: #dc3545;
    font-weight: bold;
}

.draw-cell {
    color: #ffc107;
    font-weight: bold;
}

.empty-text, .loading-text {
    text-align: center;
    color: #999;
    padding: 20px;
    font-style: italic;
}

/* Game status */
.game-status {
    text-align: center;
    margin-bottom: 25px;
}

.game-status p {
    font-size: 1.2em;
    margin-bottom: 15px;
    color: #333;
    font-weight: bold;
}

#timer-container {
    height: 24px;
    margin-top: 5px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 24px; /* Ensure space is always reserved */
}

#move-timer {
    margin: 0;
    height: 24px;
    line-height: 24px;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

#button-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

#rematch-btn {
    background: #4ecdc4;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1em;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px; /* Better touch target */
    touch-action: manipulation;
}

#rematch-btn:hover {
    background: #45b7af;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#rematch-btn:active {
    transform: scale(0.98);
}

#rematch-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
}

#reset-btn, #new-game-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1em;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px; /* Better touch target */
    touch-action: manipulation;
}

#reset-btn:hover, #new-game-btn:hover {
    background: #ff5252;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#reset-btn:active, #new-game-btn:active {
    transform: scale(0.98);
}

/* Board container */
.board-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    box-sizing: border-box;
    width: 100%;
    margin: 0 auto;
}


/* Tic-tac-toe board */
.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 3px;
    width: min(300px, calc(100vw - 60px));
    height: min(300px, calc(100vw - 60px));
    margin: 0;
    background: #333;
    border-radius: 10px;
    padding: 3px;
    touch-action: manipulation; /* Better touch handling */
    box-sizing: border-box;
    max-width: 100%;
    flex-shrink: 0;
}

.cell {
    background: white;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation; /* Better touch handling */
    -webkit-tap-highlight-color: transparent;
}

.cell:hover {
    background: #f0f0f0;
    transform: scale(0.95);
}

/* Active state for better mobile feedback */
.cell:active {
    background: #e0e0e0;
    transform: scale(0.9);
}

.cell.x {
    color: #ff6b6b;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.cell.o {
    color: #4ecdc4;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

/* Collision animation for Blind Tic-Tac-Toe */
@keyframes collision-flash {
    0%, 100% {
        background: rgba(255, 255, 255, 0.9);
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 100, 100, 0.8);
    }
    25% {
        background: rgba(255, 107, 107, 0.7);
        transform: scale(1.15);
        box-shadow: 0 0 30px rgba(255, 107, 107, 1);
    }
    50% {
        background: rgba(255, 217, 61, 0.7);
        transform: scale(0.95);
        box-shadow: 0 0 35px rgba(255, 217, 61, 1);
    }
    75% {
        background: rgba(107, 207, 127, 0.7);
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(107, 207, 127, 1);
    }
}

/* Blink reveal animation for collision-revealed positions */
.blink-reveal {
    animation: blinkReveal 0.6s ease-in-out 2;
}

@keyframes advantage-glow {
    0%, 100% {
        background-color: transparent;
        box-shadow: 0 0 0 rgba(76, 175, 80, 0);
    }
    50% {
        background-color: rgba(76, 175, 80, 0.3);
        box-shadow: 0 0 15px rgba(76, 175, 80, 0.8);
    }
}

.advantage-reveal {
    position: relative;
}

@keyframes blinkReveal {
    0%, 100% {
        background-color: transparent;
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    }
    50% {
        background-color: rgba(255, 215, 0, 0.3);
        box-shadow: 0 0 25px rgba(255, 215, 0, 1);
    }
}

/* Chat section */
.chat-section h2 {
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.chat-container {
    height: 350px;
    border: 2px solid #eee;
    border-radius: 10px;
    padding: 15px;
    overflow-y: auto;
    margin-bottom: 15px;
    background: #fafafa;
    flex-grow: 1;
}

.chat-message {
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 15px;
    line-height: 1.4;
    background: #e3f2fd;
    margin-right: 20px;
    border-bottom-left-radius: 5px;
}

.chat-message.own-message {
    background: #f3e5f5;
    margin-left: 20px;
    margin-right: 0;
    border-bottom-right-radius: 5px;
    border-bottom-left-radius: 15px;
}

.user-message {
    background: #e3f2fd;
    margin-left: 20px;
    border-bottom-right-radius: 5px;
}

.ai-message {
    background: #f3e5f5;
    margin-right: 20px;
    border-bottom-left-radius: 5px;
}

.chat-message strong {
    color: #666;
}

/* Chat input */
.chat-input-container {
    display: flex;
    gap: 10px;
}

.chat-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.sound-btn {
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.sound-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.sound-btn.sound-off {
    background: linear-gradient(135deg, #7f8c8d 0%, #95a5a6 100%);
}

#chat-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 1em;
    outline: none;
    transition: border-color 0.3s ease;
}

#chat-input:focus {
    border-color: #667eea;
}

.chat-input-container button {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
    min-height: 44px; /* Better touch target */
    touch-action: manipulation;
}

.chat-input-container button:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.chat-input-container button:active {
    transform: scale(0.98);
}

/* Scrollbar styling */
.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Mobile touch optimization */
@media (hover: none) and (pointer: coarse) {
    /* Better tap targets for mobile */
    .cell {
        min-height: 80px;
        min-width: 80px;
    }

    button, .small-btn, .back-btn {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 20px;
    }

    /* Disable hover effects on touch devices */
    .cell:hover {
        background: white;
        transform: none;
    }

    /* Active state for touch feedback */
    .cell:active {
        background: #e0e0e0;
        transform: scale(0.95);
    }

    button:active, .small-btn:active {
        transform: scale(0.98);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
        padding-top: 20px; /* Extra top padding to account for top menu bar */
    }

    h1 {
        font-size: 1.3em;
        margin-bottom: 20px;
    }

    .game-container {
        flex-direction: column;
        gap: 20px;
    }

    .game-section, .chat-section {
        padding: 20px;
        padding-top: 25px; /* Extra top padding on mobile to avoid edge */
        max-width: 100%;
        min-width: auto;
    }
    
    .chat-section {
        padding-bottom: 150px; /* Extra space for fixed footer on mobile */
    }
    
    .board-container {
        padding: 15px 15px 0 15px; /* Add padding on all sides, especially top on mobile */
        margin-top: 10px; /* Extra space from top edge */
    }

    .board {
        width: min(350px, calc(100vw - 60px));
        height: min(350px, calc(100vw - 60px));
        gap: 4px;
        padding: 4px;
    }
    
    

    .cell {
        font-size: 3em;
        border-radius: 8px;
    }

    .chat-container {
        height: 280px;
        font-size: 1.05em;
    }

    .chat-input-container {
        flex-wrap: nowrap;
        margin-top: 15px; /* Add space between chat container and send button */
        margin-bottom: 10px; /* Add space from bottom edge */
        padding-top: 5px; /* Extra top padding */
    }

    #chat-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 14px;
    }

    .chat-input-container button {
        padding: 14px 20px;
        font-size: 1.05em;
    }

    .leaderboard-page {
        padding: 20px;
    }

    .leaderboard-table {
        font-size: 1em;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 10px 6px;
    }

    .player-info {
        font-size: 1em;
        padding: 12px;
    }

    .player-info p {
        margin: 8px 0;
    }

    .game-status p {
        font-size: 1.3em;
        margin-bottom: 18px;
    }

    #reset-btn, #new-game-btn, #rematch-btn {
        padding: 12px 24px;
        font-size: 1.05em;
        min-height: 48px;
    }

    #button-container {
        gap: 12px;
    }

    .small-btn {
        padding: 10px 18px;
        font-size: 0.95em;
    }

    .modal-content {
        padding: 35px 25px;
        width: 85%;
    }

    .modal-content h2 {
        font-size: 1.6em;
        margin-bottom: 25px;
    }

    .modal-content p {
        font-size: 1.05em;
    }

    .modal-content input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 14px;
    }

    .modal-content button {
        padding: 14px 32px;
        font-size: 1.05em;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.2em;
        margin-bottom: 15px;
    }

    .container p {
        font-size: 1em;
        margin-bottom: 18px !important;
    }

    .game-section, .chat-section {
        padding: 18px;
        padding-top: 23px; /* Extra top padding on mobile to avoid edge */
    }
    
    .chat-section {
        padding-bottom: 150px; /* Extra space for fixed footer on mobile */
    }

    .board-container {
        padding: 15px 15px 0 15px; /* Add padding on all sides, especially top on mobile */
        margin-top: 10px; /* Extra space from top edge */
    }
    
    .board {
        width: min(320px, calc(100vw - 60px));
        height: min(320px, calc(100vw - 60px));
        gap: 3px;
        padding: 3px;
    }
    
    

    .cell {
        font-size: 2.8em;
    }

    .chat-container {
        height: 240px;
        font-size: 1em;
    }

    .chat-message {
        padding: 10px 14px;
        font-size: 1em;
        margin-bottom: 14px;
    }

    .chat-controls {
        flex-direction: column;
        gap: 10px;
    }

    .sound-btn {
        width: 100%;
        padding: 12px;
        font-size: 1em;
    }

    .chat-input-container {
        gap: 10px;
        margin-top: 15px; /* Add space between chat container and send button */
        margin-bottom: 10px; /* Add space from bottom edge */
        padding-top: 5px; /* Extra top padding */
    }

    #chat-input {
        padding: 12px;
        font-size: 16px;
    }

    .chat-input-container button {
        padding: 12px 18px;
        font-size: 1em;
    }

    .leaderboard-page {
        padding: 15px;
    }

    .leaderboard-table {
        font-size: 0.9em;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 8px 4px;
    }

    .leaderboard-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .back-btn {
        text-align: center;
        padding: 12px 20px;
        font-size: 1em;
    }

    .player-info {
        font-size: 0.95em;
        padding: 10px;
    }

    .player-info p {
        font-size: 1em;
        margin: 6px 0;
    }

    .game-status p {
        font-size: 1.2em;
        margin-bottom: 15px;
    }

    #reset-btn, #new-game-btn, #rematch-btn {
        padding: 12px 20px;
        font-size: 1em;
        min-height: 48px;
    }

    #button-container {
        gap: 10px;
    }

    .small-btn {
        padding: 10px 16px;
        font-size: 0.9em;
    }

    .modal-content {
        padding: 30px 20px;
        width: 90%;
    }

    .modal-content h2 {
        font-size: 1.5em;
        margin-bottom: 20px;
    }

    .modal-content p {
        font-size: 1em;
    }

    .modal-content input {
        padding: 12px;
        font-size: 16px;
    }

    .modal-content button {
        padding: 12px 28px;
        font-size: 1em;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    h1 {
        font-size: 1.1em;
    }
    
    .board-container {
        padding: 15px 15px 0 15px; /* Add padding on all sides, especially top on mobile */
        margin-top: 10px; /* Extra space from top edge */
    }

    .board {
        width: min(280px, calc(100vw - 60px));
        height: min(280px, calc(100vw - 60px));
    }
    
    

    .cell {
        font-size: 2.4em;
    }

    .game-section, .chat-section {
        padding: 15px;
    }
    
    .chat-section {
        padding-bottom: 150px; /* Extra space for fixed footer on mobile */
    }

    .player-info {
        padding: 10px;
    }

    .game-status p {
        font-size: 1.1em;
    }
    
    #timer-container {
        height: 22px;
        margin-top: 4px;
        margin-bottom: 4px;
    }
    
    #move-timer {
        font-size: 0.9em;
        height: 22px;
        line-height: 22px;
    }

    #reset-btn, #new-game-btn, #rematch-btn {
        padding: 11px 18px;
        font-size: 0.95em;
    }
}

/* Landscape orientation on mobile */
@media (max-height: 600px) and (orientation: landscape) {
    .container {
        padding: 5px;
    }

    h1 {
        font-size: 1.2em;
        margin-bottom: 5px;
    }

    .container p {
        font-size: 0.8em;
        margin-top: -10px !important;
        margin-bottom: 10px !important;
    }

    .game-container {
        flex-direction: row;
        gap: 10px;
    }

    .game-section, .chat-section {
        padding: 10px;
        flex: 1;
        padding-bottom: 80px; /* Space for fixed footer in landscape */
    }
    
    .chat-section {
        padding-bottom: 100px; /* Space for fixed footer in landscape */
    }
    
    .board-container {
        padding: 15px 15px 0 15px; /* Add padding on all sides, especially top on mobile */
        margin-top: 10px; /* Extra space from top edge */
    }

    .board {
        width: min(200px, calc(100vw - 60px));
        height: min(200px, calc(100vw - 60px));
    }
    
    

    .cell {
        font-size: 1.5em;
    }

    .player-info {
        padding: 6px;
        font-size: 0.75em;
        margin-bottom: 8px;
    }

    .player-info p {
        margin: 3px 0;
        line-height: 1.2;
    }

    .game-status p {
        font-size: 0.85em;
        margin: 4px 0;
    }
    
    #timer-container {
        height: 20px;
        margin-top: 3px;
        margin-bottom: 3px;
    }
    
    #move-timer {
        font-size: 0.8em;
        height: 20px;
        line-height: 20px;
    }

    #reset-btn, #new-game-btn, #rematch-btn {
        padding: 8px 14px;
        font-size: 0.8em;
        min-height: 40px;
    }
    
    #button-container {
        gap: 6px;
        margin-top: 6px;
    }

    .chat-container {
        height: 180px;
    }
}

/* Loading spinner */
.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes scoreUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); color: #FFD700; }
    100% { transform: scale(1); }
}

/* Navigation Panel Styles */
/* Top Header Bar - styled like footer but scrolls with page */
.top-header-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
    z-index: 100;
}

/* Menu Button inside header bar - styled like footer elements */
.nav-menu-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8em;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-menu-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
}

.nav-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 85%;
    max-width: 400px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    z-index: 1001;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.nav-panel[style*="display: block"] {
    transform: translateX(0);
}

.nav-panel-content {
    padding: 20px;
}

.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.nav-header h2 {
    margin: 0;
    color: #667eea;
}

.nav-close {
    background: #f44336;
    color: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 1.2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.nav-tab {
    background: none;
    border: none;
    padding: 12px 20px;
    font-size: 1em;
    cursor: pointer;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.nav-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: bold;
}

.nav-tab-content {
    display: none;
}

.nav-tab-content.active {
    display: block;
}

.rules-content {
    line-height: 1.6;
    color: #333;
}

.rules-content ul {
    margin: 15px 0;
    padding-left: 25px;
}

.rules-content li {
    margin: 10px 0;
}

.rules-content strong {
    color: #667eea;
}

/* Chat notification */
@keyframes slideUp {
    from { transform: translateX(-50%) translateY(20px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@keyframes slideDown {
    from { transform: translateX(-50%) translateY(0); opacity: 1; }
    to { transform: translateX(-50%) translateY(20px); opacity: 0; }
}
