/* ============================================
   TGI FRIDAYS ORDER MEMORY - STYLES
   ============================================ */

/* ============================================
   CSS RESET & BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    overflow: hidden;
    touch-action: manipulation;
}

body {
    font-family: 'Barlow', sans-serif;
    background-color: #1A1A1A;
    color: #FFFFFF;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    position: relative;
}

/* ============================================
   BACKGROUND PATTERN - Christmas Theme
   ============================================ */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 20px,
            rgba(200, 16, 46, 0.05) 20px,
            rgba(200, 16, 46, 0.05) 40px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 60px,
            rgba(34, 139, 34, 0.03) 60px,
            rgba(34, 139, 34, 0.03) 80px
        );
    pointer-events: none;
    z-index: 0;
}

/* ============================================
   SNOWFLAKES ANIMATION
   ============================================ */
.snowflakes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.snowflake {
    position: absolute;
    top: -20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1em;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    animation: snowfall linear infinite;
}

.snowflake:nth-child(1) { left: 5%; animation-duration: 10s; animation-delay: 0s; font-size: 0.8em; }
.snowflake:nth-child(2) { left: 15%; animation-duration: 12s; animation-delay: 1s; font-size: 1.2em; }
.snowflake:nth-child(3) { left: 25%; animation-duration: 8s; animation-delay: 2s; font-size: 0.9em; }
.snowflake:nth-child(4) { left: 35%; animation-duration: 14s; animation-delay: 0.5s; font-size: 1em; }
.snowflake:nth-child(5) { left: 45%; animation-duration: 11s; animation-delay: 3s; font-size: 0.7em; }
.snowflake:nth-child(6) { left: 55%; animation-duration: 9s; animation-delay: 1.5s; font-size: 1.1em; }
.snowflake:nth-child(7) { left: 65%; animation-duration: 13s; animation-delay: 2.5s; font-size: 0.85em; }
.snowflake:nth-child(8) { left: 75%; animation-duration: 10s; animation-delay: 4s; font-size: 1em; }
.snowflake:nth-child(9) { left: 85%; animation-duration: 15s; animation-delay: 0s; font-size: 0.75em; }
.snowflake:nth-child(10) { left: 95%; animation-duration: 8s; animation-delay: 2s; font-size: 1.3em; }

@keyframes snowfall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0.3;
    }
}

/* ============================================
   ELF CHARACTER
   ============================================ */
.elf-container {
    position: absolute;
    bottom: 60px;
    right: 20px;
    font-size: 48px;
    animation: elfBounce 2s ease-in-out infinite;
    filter: drop-shadow(0 0 10px rgba(34, 139, 34, 0.5));
}

.elf-speech {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    color: #1A1A1A;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    margin-bottom: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.elf-speech::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 20px;
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.95) transparent transparent;
}

@keyframes elfBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ============================================
   CHRISTMAS LIGHTS BORDER
   ============================================ */
.christmas-lights {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(
        90deg,
        #ff0000 0%, #ff0000 10%,
        #00ff00 10%, #00ff00 20%,
        #ffff00 20%, #ffff00 30%,
        #0000ff 30%, #0000ff 40%,
        #ff00ff 40%, #ff00ff 50%,
        #ff0000 50%, #ff0000 60%,
        #00ff00 60%, #00ff00 70%,
        #ffff00 70%, #ffff00 80%,
        #0000ff 80%, #0000ff 90%,
        #ff00ff 90%, #ff00ff 100%
    );
    background-size: 200% 100%;
    animation: lightsMove 3s linear infinite;
    z-index: 1000;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

@keyframes lightsMove {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3 {
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 2px;
}

/* ============================================
   LAYOUT CONTAINERS
   ============================================ */
.screen {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.screen.active {
    display: flex;
}

/* ============================================
   START SCREEN
   ============================================ */
#start-screen {
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 30px;
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.brand-badge {
    background: linear-gradient(135deg, #C8102E 0%, #8B0A1E 100%);
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    box-shadow: 0 4px 15px rgba(200, 16, 46, 0.4);
}

.game-title {
    font-size: clamp(48px, 15vw, 80px);
    color: #FFFFFF;
    text-shadow:
        0 0 10px rgba(200, 16, 46, 0.8),
        0 0 20px rgba(200, 16, 46, 0.6),
        0 0 40px rgba(200, 16, 46, 0.4);
    line-height: 1;
}

.game-subtitle {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 10px;
}

.high-score-display {
    background: rgba(212, 168, 83, 0.15);
    border: 2px solid #D4A853;
    border-radius: 12px;
    padding: 15px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.high-score-label {
    font-size: 12px;
    color: #D4A853;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.high-score-value {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 36px;
    color: #D4A853;
}

.leader-name {
    font-size: 14px;
    color: rgba(212, 168, 83, 0.8);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    letter-spacing: 3px;
    padding: 18px 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.2s ease;
    min-height: 60px;
    width: 100%;
    max-width: 320px;
}

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

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

.btn-primary {
    background: linear-gradient(135deg, #C8102E 0%, #A00D25 100%);
    color: #FFFFFF;
    box-shadow:
        0 4px 15px rgba(200, 16, 46, 0.5),
        0 0 30px rgba(200, 16, 46, 0.3);
}

.btn-secondary {
    background: transparent;
    color: #FFFFFF;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-gold {
    background: linear-gradient(135deg, #D4A853 0%, #B8923F 100%);
    color: #1A1A1A;
    box-shadow: 0 4px 15px rgba(212, 168, 83, 0.4);
}

.btn-small {
    font-size: 18px;
    padding: 12px 24px;
    min-height: 48px;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 320px;
}

/* ============================================
   GAME SCREEN
   ============================================ */
#game-screen {
    padding: 0;
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.5);
    border-bottom: 2px solid rgba(200, 16, 46, 0.3);
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 28px;
    color: #FFFFFF;
}

.stat-value.score {
    color: #D4A853;
}

/* Game Area */
.game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
}

/* Order Display (Memorize Phase) */
.order-display {
    text-align: center;
    padding: 30px 20px;
    max-width: 100%;
}

.order-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 15px;
}

.order-text {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(24px, 7vw, 36px);
    color: #FFFFFF;
    line-height: 1.3;
    text-shadow: 0 0 20px rgba(200, 16, 46, 0.5);
    animation: fadeInOrder 0.5s ease;
}

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

.countdown-display {
    margin-top: 30px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 72px;
    color: #C8102E;
    text-shadow: 0 0 30px rgba(200, 16, 46, 0.8);
    animation: pulse 1s ease infinite;
}

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

/* Menu Grid (Select Phase) */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 400px;
    padding: 10px;
}

.menu-item {
    aspect-ratio: 1;
    background: linear-gradient(145deg, #2A2A2A 0%, #1A1A1A 100%);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 8px;
    cursor: pointer;
    transition: transform 0.1s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    min-height: 90px;
}

.menu-item:active {
    transform: scale(0.92);
}

.menu-item.selected {
    border-color: #D4A853;
    box-shadow: 0 0 15px rgba(212, 168, 83, 0.4);
    background: linear-gradient(145deg, #3A3A3A 0%, #2A2A2A 100%);
}

.menu-item.correct {
    border-color: #4CAF50;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.6);
    animation: correctFlash 0.3s ease;
}

@keyframes correctFlash {
    0% { background: rgba(76, 175, 80, 0.4); }
    100% { background: linear-gradient(145deg, #2A2A2A 0%, #1A1A1A 100%); }
}

.menu-item.wrong {
    border-color: #C8102E;
    box-shadow: 0 0 20px rgba(200, 16, 46, 0.6);
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-8px); }
    80% { transform: translateX(8px); }
}

.menu-item.disabled {
    opacity: 0.3;
    pointer-events: none;
}

.menu-icon {
    font-size: 28px;
    margin-bottom: 4px;
}

.menu-name {
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.2;
}

/* Selection Progress */
.selection-progress {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.progress-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

.progress-dot.filled {
    background: #D4A853;
    border-color: #D4A853;
    box-shadow: 0 0 10px rgba(212, 168, 83, 0.5);
}

/* Bottom Bar */
.bottom-bar {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.5);
    border-top: 2px solid rgba(200, 16, 46, 0.3);
}

.timer-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.timer-fill {
    height: 100%;
    background: linear-gradient(90deg, #C8102E 0%, #D4A853 100%);
    border-radius: 3px;
    transition: width 0.1s linear;
    box-shadow: 0 0 10px rgba(200, 16, 46, 0.5);
}

.streak-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.streak-icon {
    font-size: 16px;
}

.streak-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.streak-count {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 18px;
    color: #D4A853;
}

.multiplier {
    background: #D4A853;
    color: #1A1A1A;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 14px;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 5px;
}

/* ============================================
   GAME OVER SCREEN
   ============================================ */
#gameover-screen {
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 25px;
}

.gameover-title {
    font-size: clamp(48px, 12vw, 72px);
    color: #C8102E;
    text-shadow: 0 0 30px rgba(200, 16, 46, 0.6);
}

.ramsay-quote {
    max-width: 320px;
    padding: 15px 20px;
    background: rgba(200, 16, 46, 0.1);
    border-left: 4px solid #C8102E;
    border-radius: 0 8px 8px 0;
    text-align: left;
}

.ramsay-text {
    display: block;
    font-size: 14px;
    font-style: italic;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.4;
    margin-bottom: 8px;
}

.ramsay-name {
    display: block;
    font-size: 12px;
    color: #C8102E;
    font-weight: 600;
}

.final-stats {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 280px;
}

.final-stat {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.final-stat-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.final-stat-value {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 28px;
    color: #FFFFFF;
}

.new-high-score {
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.2) 0%, rgba(212, 168, 83, 0.1) 100%);
    border: 2px solid #D4A853;
    border-radius: 12px;
    padding: 15px 25px;
    animation: glowPulse 1.5s ease infinite;
}

@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(212, 168, 83, 0.3); }
    50% { box-shadow: 0 0 40px rgba(212, 168, 83, 0.6); }
}

.new-high-score-text {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    color: #D4A853;
}

/* ============================================
   LEADERBOARD SCREEN
   ============================================ */
#leaderboard-screen {
    justify-content: flex-start;
    align-items: center;
    padding-top: 40px;
    gap: 20px;
}

.leaderboard-title {
    font-size: clamp(36px, 10vw, 56px);
    color: #D4A853;
    text-shadow: 0 0 20px rgba(212, 168, 83, 0.5);
}

.leaderboard-list {
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    gap: 12px;
}

.leaderboard-entry.top-3 {
    background: rgba(212, 168, 83, 0.1);
    border-color: rgba(212, 168, 83, 0.3);
}

.leaderboard-entry.highlight {
    background: rgba(200, 16, 46, 0.2);
    border-color: #C8102E;
    animation: highlightPulse 2s ease infinite;
}

@keyframes highlightPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(200, 16, 46, 0.3); }
    50% { box-shadow: 0 0 20px rgba(200, 16, 46, 0.5); }
}

.leaderboard-rank {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    color: #D4A853;
    width: 40px;
    text-align: center;
}

.leaderboard-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.leaderboard-name {
    font-weight: 600;
    font-size: 16px;
}

.leaderboard-rounds {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.leaderboard-score {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    color: #FFFFFF;
}

.leaderboard-loading,
.leaderboard-empty {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    padding: 40px 20px;
}

/* ============================================
   EMAIL MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: linear-gradient(145deg, #2A2A2A 0%, #1A1A1A 100%);
    border: 2px solid rgba(200, 16, 46, 0.3);
    border-radius: 16px;
    padding: 30px;
    width: 100%;
    max-width: 340px;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 28px;
    color: #D4A853;
    margin-bottom: 10px;
}

.modal-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 20px;
}

.player-name-display {
    background: rgba(212, 168, 83, 0.15);
    border: 1px solid rgba(212, 168, 83, 0.3);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.player-name-label {
    display: block;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.player-name-input {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    color: #D4A853;
    background: transparent;
    border: none;
    border-bottom: 2px solid rgba(212, 168, 83, 0.5);
    text-align: center;
    outline: none;
    transition: border-color 0.2s ease;
}

.player-name-input:focus {
    border-bottom-color: #D4A853;
}

.player-name-input::placeholder {
    color: rgba(212, 168, 83, 0.4);
}

.email-input {
    width: 100%;
    padding: 14px 16px;
    font-family: 'Barlow', sans-serif;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #FFFFFF;
    margin-bottom: 8px;
    outline: none;
    transition: border-color 0.2s ease;
}

.email-input:focus {
    border-color: #D4A853;
}

.email-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.email-input.error {
    border-color: #C8102E;
}

.email-error {
    font-size: 12px;
    color: #C8102E;
    margin-bottom: 15px;
    min-height: 18px;
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ============================================
   TOAST NOTIFICATION
   ============================================ */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(76, 175, 80, 0.95);
    color: #FFFFFF;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 200;
}

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

.toast.error {
    background: rgba(200, 16, 46, 0.95);
}

/* Phase indicator */
.phase-indicator {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Loading spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #D4A853;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

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

/* ============================================
   CREDITS
   ============================================ */
.credits {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Bebas Neue', sans-serif;
    font-size: 14px;
    letter-spacing: 3px;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-height: 700px) {
    .menu-item {
        min-height: 75px;
    }

    .menu-icon {
        font-size: 24px;
    }

    .countdown-display {
        font-size: 56px;
    }

    #leaderboard-screen {
        padding-top: 20px;
    }
}

@media (min-width: 768px) {
    .menu-grid {
        max-width: 500px;
        gap: 15px;
    }

    .menu-item {
        min-height: 110px;
    }

    .menu-icon {
        font-size: 36px;
    }

    .menu-name {
        font-size: 12px;
    }
}
