* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    min-height: 100vh;
    color: #333;
    background: #000; /* Prevent white background showing through */
}

/* Desktop only - prevent scrolling */
@media (min-width: 769px) {
    body {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }
}

/* Header height variable */
:root {
    --header-height: 80px;
}

/* Background Video */
.background-video {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    height: calc(100% - var(--header-height));
    object-fit: cover;
    z-index: -1;
}

/* Mute Button */
.mute-btn {
    position: fixed;
    bottom: 20px;  /* Moved to bottom instead of top */
    left: 20px;    /* Moved to left instead of right to avoid burger menu */
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    cursor: pointer;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1001; /* Above header so it's always accessible */
    transition: all 0.3s ease;
}

.mute-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.mute-btn:active {
    transform: scale(0.95);
}

/* Start Screen */
.start-screen {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    height: calc(100% - var(--header-height));
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 40px;
    z-index: 100;
}

.game-title {
    font-size: 3rem;
    color: white;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.8),
                 0 2px 4px rgba(0, 0, 0, 0.6);
    text-align: center;
    padding: 0 20px;
    max-width: 100%;
    white-space: nowrap;
}

.start-screen .btn-primary {
    font-size: 1.5rem;
    padding: 20px 60px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    transform: scale(1);
    transition: all 0.3s ease;
}

.start-screen .btn-primary:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.start-screen .btn-primary:disabled {
    opacity: 0.6;
}

.start-screen.hidden {
    display: none;
}

.container {
    width: 95%;
    padding: 5px 20px 10px 20px;
    overflow-y: hidden;
    max-height: calc(100vh - var(--header-height));
    margin: 0 auto;
    position: relative;
    z-index: 1001;  /* Higher than header (1000) so modals can appear above it */
    display: flex;
    flex-direction: column;
}

.container.hidden {
    display: none;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 10px;
    flex-shrink: 0;
}

header h1 {
    font-size: 2rem;
    margin-top: 3px;
    margin-bottom: 10px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.round-display-top {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 20px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.round-display-top .round-label {
    font-size: 1rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.round-display-top .round-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

.game-container {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
}

.video-wrapper {
    position: relative;
    width: 95%;
    margin: 0 auto 15px;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.game-video {
    width: 100%;
    max-height: 100%;
    display: block;
    object-fit: contain;
}

.overlay-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.overlay-canvas.flash-human {
    animation: flashGreen 0.3s ease;
}

.overlay-canvas.flash-ai {
    animation: flashRed 0.3s ease;
}

@keyframes flashGreen {
    0%, 100% { background: transparent; }
    50% { background: rgba(76, 175, 80, 0.3); }
}

@keyframes flashRed {
    0%, 100% { background: transparent; }
    50% { background: rgba(244, 67, 54, 0.3); }
}

.warning-indicator {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(244, 67, 54, 0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    animation: pulse 0.5s infinite;
}

.warning-indicator.hidden {
    display: none;
}

.too-early-notification {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    padding: 15px 30px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1.5rem;
    animation: pulse 0.5s infinite;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.too-early-notification.hidden {
    display: none;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    width: 0;
    transition: width 0.1s linear;
}

.timeline-markers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.timeline-marker {
    position: absolute;
    bottom: 2px;
    transform: translateX(-50%);
    z-index: 100;
}

.marker-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    position: relative;
}

.timeline-marker-human .marker-circle {
    background: #2196F3;
    border-color: #1976D2;
}

.timeline-marker-ai .marker-circle {
    background: #f44336;
    border-color: #c62828;
}

.marker-line {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 40px;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

.timeline-marker-human .marker-line {
    background: #2196F3;
}

.timeline-marker-ai .marker-line {
    background: #f44336;
}

.marker-label {
    position: absolute;
    bottom: 26px;
    left: 12px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    color: white;
}

.timeline-marker-human .marker-label {
    background: rgba(33, 150, 243, 0.9);
}

.timeline-marker-ai .marker-label {
    background: rgba(244, 67, 54, 0.9);
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.btn {
    padding: 12px 30px;
    font-size: 1.1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn.hidden {
    display: none;
}

/* Score displays at bottom */
.score-human,
.score-ai {
    position: absolute;
    bottom: 60px;  /* Moved up from 30px to clear progress bar */
    display: flex;
    align-items: center;
    gap: 22px;
    background: rgba(255, 255, 255, 0.95);
    padding: 22px 38px;
    border-radius: 75px;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.3);
    z-index: 50;
}

.score-human {
    left: 30px;
}

.score-ai {
    right: 30px;
}

.score-icon {
    width: 75px;
    height: 75px;
    object-fit: contain;
}

.score-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.score-label {
    font-size: 1.28rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.75px;
    font-weight: 600;
}

.score-value {
    font-size: 3rem;
    font-weight: bold;
    color: #333;
    line-height: 1;
}

/* Brake button */
.brake-btn {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: white;
    padding: 22px 38px;
    border-radius: 75px;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.5);
    z-index: 100;
    border: none;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 2px;
    min-width: 200px;
}

.brake-btn:hover {
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.brake-btn:active {
    transform: translateX(-50%) scale(0.98);
}

.brake-btn.next-mode {
    background: #667eea;
}

.feedback-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px 40px;
    border-left: 5px solid #2196F3;
    animation: slideIn 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    z-index: 9999;  /* Very high to be above headers */
    max-width: 80%;
    max-height: 90vh;  /* Prevent vertical overflow */
    overflow-y: auto;  /* Scroll if content too tall */
    text-align: center;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.feedback-panel.hidden {
    display: none;
}

.feedback-panel.feedback-human-win {
    border-left-color: #2196F3;
    background: rgba(33, 150, 243, 0.92);
    color: white;
}

.feedback-panel.feedback-ai-win {
    border-left-color: #f44336;
    background: rgba(244, 67, 54, 0.92);
    color: white;
}

.feedback-panel.feedback-negative {
    border-left-color: #ff9800;
    background: rgba(255, 152, 0, 0.92);
    color: white;
}

.feedback-panel.feedback-neutral {
    border-left-color: #9e9e9e;
    background: rgba(158, 158, 158, 0.92);
    color: white;
}

.feedback-panel h3 {
    margin-bottom: 15px;
    color: inherit;
    font-size: 1.8rem;
}

.feedback-panel p {
    margin-bottom: 15px;
    color: inherit;
    font-size: 1.1rem;
    line-height: 1.5;
}

.timing-info {
    display: flex;
    gap: 30px;
    margin-top: 15px;
    justify-content: center;
}

.timing-item {
    display: flex;
    gap: 10px;
    align-items: center;
}

.timing-label {
    color: inherit;
    font-size: 1rem;
    opacity: 0.9;
}

.timing-value {
    font-weight: bold;
    color: inherit;
    font-size: 1.1rem;
}

.countdown-container {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 1.2rem;
}

.countdown-text {
    color: inherit;
    opacity: 0.9;
}

.countdown-value {
    font-weight: bold;
    font-size: 1.5rem;
    color: inherit;
}

/* Report button in feedback panel */
.report-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    font-size: 1.2rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.report-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Report modal */
.report-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;  /* Very high to be above headers */
    pointer-events: auto;
}

.report-modal.hidden {
    display: none;
}

.report-modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
}

.report-modal-content h3 {
    margin-bottom: 10px;
    color: #333;
    font-size: 1.5rem;
}

.report-modal-content p {
    margin-bottom: 15px;
    color: #666;
}

.report-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 20px;
}

.report-textarea:focus {
    outline: none;
    border-color: #667eea;
}

.report-modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.instructions {
    background: #f0f4f8;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.instructions h3 {
    margin-bottom: 15px;
    color: #333;
}

.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
}

.instructions li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

kbd {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 2px 6px;
    font-family: monospace;
    box-shadow: 0 2px 0 #ddd;
}

.game-over {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    z-index: 9999;  /* Very high to be above headers */
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.game-over.hidden {
    display: none;
}

.game-over h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #333;
}

.final-scores {
    display: flex;
    justify-content: space-around;
    margin: 30px 0;
}

.final-score-item {
    text-align: center;
}

.final-score-item span:first-child {
    display: block;
    color: #666;
    margin-bottom: 10px;
}

.final-score-item span:last-child {
    display: block;
    font-size: 3rem;
    font-weight: bold;
    color: #333;
}

#winner {
    font-size: 1.5rem;
    margin: 20px 0;
}

.winner-human {
    color: #4CAF50;
}

.winner-ai {
    color: #f44336;
}

.winner-tie {
    color: #2196F3;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    color: white;
    font-size: 1.2rem;
}

/* Responsive Design - Mobile */
@media (max-width: 768px) {
    :root {
        --header-height: 64px;
    }

    body {
        overflow-y: auto;
    }

    /* Start screen */
    .game-title {
        font-size: 1.8rem;
        white-space: normal;
        line-height: 1.2;
    }

    .start-screen .btn-primary {
        font-size: 1.2rem;
        padding: 15px 40px;
    }

    /* Header */
    header h1 {
        font-size: 1.5rem;
    }

    .round-display-top {
        padding: 8px 16px;
        gap: 8px;
    }

    .round-display-top .round-label {
        font-size: 0.9rem;
    }

    .round-display-top .round-value {
        font-size: 1.2rem;
    }

    /* Game container */
    .container {
        padding: 5px 10px;
        overflow-y: visible;
        max-height: none;
    }

    .game-container {
        padding: 10px;
    }

    .video-wrapper {
        width: 100%;
        margin-bottom: 10px;
    }

    /* Scores - much smaller on mobile portrait, aligned with brake button */
    .score-human,
    .score-ai {
        padding: 8px 12px;
        gap: 8px;
    }

    .score-human {
        left: 5px;
    }

    .score-ai {
        right: 5px;
    }

    /* In portrait mode, move scores below video */
    @media (max-width: 896px) and (orientation: portrait) {
        .score-human,
        .score-ai {
            position: relative;
            bottom: auto;
            left: auto;
            right: auto;
            display: inline-flex;
            margin: 10px 5px;
        }

        .game-container {
            display: flex;
            flex-direction: column;
        }

        .score-human {
            order: 10;  /* After video */
        }

        .score-ai {
            order: 11;  /* After video */
        }

        .video-wrapper {
            order: 1;
        }

        .brake-btn {
            order: 12;  /* After scores */
        }
    }

    .score-icon {
        width: 25px;
        height: 25px;
    }

    .score-label {
        font-size: 0.55rem;
    }

    .score-value {
        font-size: 1rem;
    }

    /* Brake button - smaller on mobile portrait */
    .brake-btn {
        padding: 10px 30px;
        font-size: 1rem;
        bottom: 10px;
        min-width: 150px;
    }

    /* Mute button */
    .mute-btn {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
        bottom: 10px;  /* Keep at bottom on mobile */
        left: 10px;    /* Keep at left on mobile */
    }

    /* Controls */
    .controls {
        margin-bottom: 5px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    /* Feedback panel */
    .feedback-panel {
        position: fixed;  /* Fixed positioning on mobile to prevent cut-off */
        max-width: 95%;
        max-height: 85vh;  /* Extra safety margin on mobile */
        padding: 20px;
    }

    .feedback-panel h3 {
        font-size: 1.3rem;
    }

    .feedback-panel p {
        font-size: 0.9rem;
    }

    .timing-info {
        flex-direction: column;
        gap: 10px;
    }

    .timing-label {
        font-size: 0.85rem;
    }

    .timing-value {
        font-size: 0.95rem;
    }

    /* Game over */
    .game-over {
        padding: 30px 20px;
        max-width: 90%;
    }

    .game-over h2 {
        font-size: 1.8rem;
    }

    .final-score-item span:last-child {
        font-size: 2rem;
    }
}

/* Landscape mode on mobile */
@media (max-width: 896px) and (orientation: landscape) {
    .container {
        padding: 5px 10px;
        overflow-y: visible;
    }

    header {
        margin-bottom: 5px;
        padding: 5px 10px;
    }

    header h1 {
        font-size: 1rem;
        margin-bottom: 5px;
    }

    .round-display-top {
        padding: 4px 10px;
        gap: 6px;
    }

    .round-display-top .round-label {
        font-size: 0.65rem;
    }

    .round-display-top .round-value {
        font-size: 0.85rem;
    }

    .game-container {
        padding: 5px;
    }

    .video-wrapper {
        width: 100%;
        height: 70vh;
        margin: 0 auto 5px;
    }

    .game-video {
        max-height: 70vh;
        width: 100%;
        object-fit: contain;
    }

    .score-human,
    .score-ai {
        padding: 6px 12px;
        gap: 6px;
        bottom: 10px;
    }

    .score-icon {
        width: 30px;
        height: 30px;
    }

    .score-label {
        font-size: 0.55rem;
    }

    .score-value {
        font-size: 1rem;
    }

    .brake-btn {
        padding: 8px 25px;
        font-size: 0.9rem;
        bottom: 10px;
    }

    .controls {
        margin-bottom: 3px;
    }

    .feedback-panel {
        position: fixed;  /* Fixed positioning on small screens to prevent cut-off */
        max-width: 90%;
        max-height: 80vh;  /* Prevent overflow on small screens */
        padding: 15px 20px;
    }

    .feedback-panel h3 {
        font-size: 1rem;
    }

    .feedback-panel p {
        font-size: 0.75rem;
    }
}

/* Restart button spacing */
#restartBtn {
    margin-top: 30px;
}

/* Social Sharing Styles */
.share-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid rgba(102, 126, 234, 0.3);
}

.share-prompt {
    color: #333;
    font-size: 18px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 600;
}

.share-buttons-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-width: 300px;
    margin: 0 auto;
}

.share-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    background: rgba(102, 126, 234, 0.05);
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 80px;
    position: relative;
}

.share-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.share-button:active {
    transform: translateY(0);
}

.share-icon {
    width: 32px;
    height: 32px;
    fill: currentColor;
    margin-bottom: 4px;
}

/* Platform-specific colors on hover */
.twitter-share:hover {
    background: #000;
    border-color: #000;
    color: #fff;
}

.facebook-share:hover {
    background: #1877F2;
    border-color: #1877F2;
    color: #fff;
}

.whatsapp-share:hover {
    background: #25D366;
    border-color: #25D366;
    color: #fff;
}

.linkedin-share:hover {
    background: #0A66C2;
    border-color: #0A66C2;
    color: #fff;
}

.telegram-share:hover {
    background: #24A1DE;
    border-color: #24A1DE;
    color: #fff;
}

.copy-link {
    flex-direction: row;
    gap: 8px;
}

.copy-link:hover {
    background: #4CAF50;
    border-color: #4CAF50;
    color: #fff;
}

.copy-text {
    font-size: 14px;
    font-weight: 600;
}

.copy-feedback {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #4CAF50;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 10000;
}

.copy-feedback.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Focus styles for accessibility */
.share-button:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

.share-button:focus:not(:focus-visible) {
    outline: none;
}

/* Mobile responsiveness for share buttons */
@media (max-width: 480px) {
    .share-buttons-grid {
        gap: 8px;
        max-width: 280px;
    }

    .share-button {
        min-height: 70px;
        padding: 10px;
    }

    .share-icon {
        width: 28px;
        height: 28px;
    }

    .share-prompt {
        font-size: 16px;
    }
}

/* Tablet adjustments for share buttons */
@media (min-width: 481px) and (max-width: 768px) {
    .share-buttons-grid {
        max-width: 320px;
        gap: 10px;
    }
}
/* High Score Display */
.header-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 15px;
}

.high-score-display {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 600;
    color: #fbbf24;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.high-score-label {
    color: #fff;
}

.high-score-value {
    color: #fbbf24;
    font-size: 20px;
    font-weight: 700;
}

/* Driver Score Section */
.driver-score-section {
    margin: 30px 0;
    padding: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.driver-score-title {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
    text-align: center;
}

.driver-score-value {
    color: #fbbf24;
    font-size: 32px;
    font-weight: 800;
}

.driver-score-description {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    text-align: center;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .header-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .high-score-display {
        font-size: 16px;
    }
    
    .high-score-value {
        font-size: 18px;
    }
    
    .driver-score-title {
        font-size: 20px;
    }
    
    .driver-score-value {
        font-size: 28px;
    }
    
    .driver-score-description {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .header-stats {
        font-size: 14px;
    }
    
    .high-score-display {
        font-size: 14px;
    }
    
    .high-score-value {
        font-size: 16px;
    }
}

/* Leaderboard Button in Header */
.leaderboard-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

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

.leaderboard-btn:active {
    transform: translateY(0);
}

/* Modal Overlay */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;  /* Very high to be above all headers and elements */
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.hidden {
    display: none !important;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    position: relative;
}

/* Leaderboard Submission Modal */
.leaderboard-submit-content {
    max-width: 500px;
}

.leaderboard-submit-content h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 28px;
    text-align: center;
}

.leaderboard-submit-content p {
    color: #666;
    text-align: center;
    margin-bottom: 25px;
}

.country-detection {
    background: #f3f4f6;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.country-label {
    font-weight: 600;
    color: #333;
}

.detected-country {
    font-size: 20px;
    font-weight: 700;
    color: #667eea;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.nickname-input {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

.nickname-input:focus {
    outline: none;
    border-color: #667eea;
}

.char-counter {
    text-align: right;
    font-size: 14px;
    color: #9ca3af;
    margin-top: 5px;
}

.submit-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.submit-buttons .btn {
    flex: 1;
    max-width: 200px;
}

.submission-status {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
}

.submission-status.success-message {
    background: #d1fae5;
    color: #065f46;
}

.submission-status.error-message {
    background: #fee2e2;
    color: #991b1b;
}

.spinner-small {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Leaderboard Display Modal */
.leaderboard-content {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 28px;
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 36px;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
    padding: 5px;  /* Add padding for easier tapping */
    width: 46px;   /* Larger tap target */
    height: 46px;  /* Larger tap target */
    min-width: 46px;  /* Prevent shrinking */
    flex-shrink: 0;   /* Prevent flexbox from shrinking it */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.close-modal-btn:hover {
    color: #333;
}

.leaderboard-loading {
    text-align: center;
    padding: 40px;
}

.leaderboard-loading .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

.leaderboard-stats {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

.leaderboard-stats .stat-value {
    display: block;
    font-size: 32px;
    font-weight: 800;
    color: #fbbf24;
}

.leaderboard-stats .stat-label {
    display: block;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 5px;
}

.leaderboard-table-wrapper {
    overflow-y: auto;
    max-height: 500px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table thead {
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 10;
}

.leaderboard-table th {
    padding: 15px 10px;
    text-align: left;
    color: white;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
}

.leaderboard-table th:first-child {
    text-align: center;
    width: 80px;
}

.leaderboard-table th:last-child {
    text-align: center;
    width: 80px;
}

.leaderboard-table th:nth-child(3) {
    text-align: right;
}

.leaderboard-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.2s ease;
}

.leaderboard-table tbody tr:hover {
    background-color: #f9fafb;
}

.leaderboard-table tbody tr.user-row {
    background-color: #fef3c7;
    font-weight: 700;
}

.leaderboard-table tbody tr.user-row:hover {
    background-color: #fde68a;
}

.leaderboard-table td {
    padding: 12px 10px;
    color: #333;
}

.rank-cell {
    text-align: center;
    font-weight: 700;
    font-size: 18px;
}

.nickname-cell {
    font-weight: 600;
}

.score-cell {
    text-align: right;
    font-weight: 700;
    color: #667eea;
}

.country-cell {
    text-align: center;
    font-size: 24px;
}

.user-rank-section {
    margin-top: 20px;
    padding: 15px;
    background: #fef3c7;
    border-radius: 10px;
    text-align: center;
}

.user-rank-section p {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.user-rank-section strong {
    color: #667eea;
    font-size: 24px;
}

.error-message {
    padding: 15px;
    background: #fee2e2;
    border-radius: 8px;
    color: #991b1b;
    text-align: center;
    margin-top: 20px;
}

/* Button Styles */
.btn-secondary {
    background: #6b7280;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #4b5563;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .modal-content {
        padding: 25px;
        width: 95%;
    }

    .leaderboard-submit-content h3,
    .modal-header h3 {
        font-size: 22px;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 10px 5px;
        font-size: 13px;
    }

    .rank-cell {
        font-size: 16px;
    }

    .country-cell {
        font-size: 20px;
    }

    .leaderboard-btn {
        padding: 8px 12px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: 20px;
    }

    .leaderboard-table th:nth-child(2) {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .nickname-cell {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

.submit-score-btn {
    width: 100%;
    margin-bottom: 20px;
    padding: 15px;
    font-size: 18px;
}

.score-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    text-align: center;
}

.score-display .score-label {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    margin-bottom: 8px;
}

.score-display .score-to-submit {
    display: block;
    color: #fbbf24;
    font-size: 32px;
    font-weight: 800;
}

/* Mobile close button visibility */
@media (max-width: 768px) {
    .close-modal-btn {
        font-size: 32px;
        width: 44px;
        height: 44px;
        padding: 6px;
        background: rgba(255, 255, 255, 0.8);
        border-radius: 50%;
    }
}

@media (max-width: 480px) {
    .modal-header {
        margin-bottom: 15px;
    }
    
    .modal-header h3 {
        font-size: 20px;
        flex: 1;
        text-align: left;
    }
    
    .close-modal-btn {
        font-size: 28px;
        width: 40px;
        height: 40px;
        background: rgba(200, 200, 200, 0.9);
        border-radius: 50%;
        color: #333;
    }
}

/* Blur background video during gameplay */
.background-video.blurred {
    filter: blur(10px);
    opacity: 0.3;
    transition: filter 0.5s ease, opacity 0.5s ease;
}
