/* ============================================
   HIGHER OR LOWER - PREMIUM NEON CASINO DESIGN
   Glassmorphism + Neon + Sophisticated Animations
   ============================================ */

/* ============================================
   CSS VARIABLES - DESIGN SYSTEM
   ============================================ */
:root {
    /* Colors - Dark Mode (Default) */
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a3e;
    --bg-tertiary: #252545;

    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --card-hover-bg: rgba(102, 126, 234, 0.1);
    --card-hover-border: rgba(102, 126, 234, 0.6);

    --text-primary: #ffffff;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --text-muted: #64748b;

    --accent-primary: #667eea;
    --accent-secondary: #764ba2;
    --accent-neon: #a78bfa;

    --success: #4ade80;
    --success-glow: rgba(74, 222, 128, 0.4);
    --error: #f87171;
    --error-glow: rgba(248, 113, 113, 0.4);
    --warning: #fbbf24;

    /* Spacing */
    --space-xs: 8px;
    --space-sm: 12px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 40px rgba(102, 126, 234, 0.3);

    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Light Mode Variables */
body:not(.dark-mode) {
    --bg-primary: #e2e5f0;
    --bg-secondary: #c8d0ea;
    --bg-tertiary: #ddd6fe;

    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(102, 126, 234, 0.2);
    --card-hover-bg: rgba(255, 255, 255, 0.95);
    --card-hover-border: rgba(102, 126, 234, 0.8);

    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --text-muted: #94a3b8;

    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-neon: #7c3aed;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.2);
}

/* ============================================
   BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Animated Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(167, 139, 250, 0.08) 0%, transparent 50%);
    animation: backgroundShift 15s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 0;
}

@keyframes backgroundShift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-20px, -20px) scale(1.05); }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-lg);
    position: relative;
    z-index: 1;
}

.game-container {
    background: rgba(30, 30, 50, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    backdrop-filter: blur(40px);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

/* Subtle shine effect on game container */
.game-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.03) 50%,
        transparent 70%
    );
    animation: shine 8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes shine {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    50% { transform: translate(-30%, -30%) rotate(45deg); }
}

/* ============================================
   START SCREEN - FIT TO VIEWPORT
   ============================================ */
.start-screen {
    text-align: center;
    padding: var(--space-lg) var(--space-lg);
    animation: fadeInUp 0.8s var(--transition-base) backwards;
    max-height: calc(100vh - 160px);
    max-height: calc(100dvh - 160px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow-y: auto;
}

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.start-title {
    font-size: clamp(28px, 6vw, 36px);
    font-weight: 800;
    letter-spacing: -1.5px;
    margin-bottom: var(--space-xs);
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 40px rgba(102, 126, 234, 0.3);
    animation: titlePulse 3s ease-in-out infinite;
}

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

.start-subtitle {
    font-size: clamp(14px, 2.5vw, 16px);
    color: var(--text-tertiary);
    margin-bottom: var(--space-lg);
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.rules-box {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    text-align: left;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-md);
    animation: fadeInUp 0.8s 0.2s var(--transition-base) backwards;
    flex-shrink: 0;
}

.rules-box h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.rules-box h3::before {
    content: '📋';
    font-size: 20px;
}

.rules-box ul {
    list-style: none;
    padding: 0;
}

.rules-box li {
    padding: 4px 0;
    padding-left: 32px;
    position: relative;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    transition: var(--transition-fast);
}

.rules-box li:hover {
    color: var(--text-primary);
    transform: translateX(4px);
}

.rules-box li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent-neon);
    font-weight: bold;
    font-size: 18px;
    transition: var(--transition-fast);
}

.rules-box li:hover::before {
    transform: translateX(4px);
}

.difficulty-selection {
    animation: fadeInUp 0.8s 0.4s var(--transition-base) backwards;
    flex-shrink: 0;
}

.difficulty-selection h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.diff-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-sm);
}

.start-diff-btn {
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-sm);
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text-primary);
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
}

.start-diff-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.start-diff-btn:hover::before {
    left: 100%;
}

.start-diff-btn:hover {
    border-color: var(--accent-neon);
    background: var(--card-hover-bg);
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.4), 0 0 0 1px rgba(167, 139, 250, 0.5);
}

.start-diff-btn:active {
    transform: translateY(-4px) scale(1);
}

.diff-emoji {
    font-size: 32px;
    display: block;
    animation: emojiFloat 3s ease-in-out infinite;
}

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

.diff-name {
    font-size: 18px;
    font-weight: 700;
    display: block;
    letter-spacing: -0.5px;
}

.diff-desc {
    font-size: 13px;
    color: var(--text-tertiary);
    display: block;
    font-weight: 500;
}

/* ============================================
   INFO BAR - MODERN STATS CARDS
   ============================================ */
.info-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeInDown 0.6s var(--transition-base);
}

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

.info-bar.hidden {
    display: none;
}

.streak-info {
    display: flex;
    gap: var(--space-md);
}

.current-streak,
.best-streak {
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-lg);
    backdrop-filter: blur(10px);
    transition: var(--transition-base);
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 100px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.current-streak {
    box-shadow: 0 2px 8px rgba(74, 222, 128, 0.1);
}

.current-streak:hover {
    background: rgba(74, 222, 128, 0.05);
    border-color: rgba(74, 222, 128, 0.2);
    transform: translateY(-2px);
}

.best-streak {
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.1);
}

.best-streak:hover {
    background: rgba(251, 191, 36, 0.05);
    border-color: rgba(251, 191, 36, 0.2);
    transform: translateY(-2px);
}

.current-streak span:first-child,
.best-streak span:first-child {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.current-streak #streak,
.best-streak #bestStreak {
    font-size: 28px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.current-streak #streak {
    color: var(--success);
}

.best-streak #bestStreak {
    color: var(--warning);
}

/* Light mode stat items styling */
body:not(.dark-mode) .current-streak,
body:not(.dark-mode) .best-streak {
    background: rgba(0, 0, 0, 0.04);
    border: 1.5px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ============================================
   CARDS CONTAINER - VS CENTERED BETWEEN CARDS
   ============================================ */
.cards-container {
    display: flex;
    gap: var(--space-lg);
    justify-content: center;
    align-items: center;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    position: relative;
}

/* ============================================
   CARD DESIGN - PREMIUM GLASSMORPHISM
   ============================================ */
.card {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl) var(--space-lg);
    text-align: center;
    transition: all var(--transition-base);
    box-shadow:
        var(--shadow-md),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
    animation: cardEntrance 0.6s var(--transition-bounce) backwards;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    opacity: 0;
    transition: opacity var(--transition-base);
}

.card:hover::before {
    opacity: 1;
}

.card-left {
    animation-delay: 0.1s;
}

.card-right {
    animation-delay: 0.2s;
}

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.card.clickable {
    cursor: pointer;
}

.card.clickable:hover {
    border-color: var(--card-hover-border);
    background: var(--card-hover-bg);
    transform: translateY(-12px) scale(1.02);
    box-shadow:
        0 16px 48px rgba(102, 126, 234, 0.3),
        0 0 60px rgba(167, 139, 250, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.card.clickable:active {
    transform: translateY(-8px) scale(1);
    transition: all var(--transition-fast);
}

.card-click-hint {
    position: absolute;
    bottom: var(--space-sm);
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity var(--transition-base);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card.clickable:hover .card-click-hint {
    opacity: 1;
}

.card.disabled {
    pointer-events: none;
    opacity: 0.6;
}

/* Correct/Wrong States */
.card.correct {
    border-color: var(--success);
    background: rgba(74, 222, 128, 0.1);
    box-shadow:
        0 0 40px var(--success-glow),
        0 0 80px var(--success-glow);
    animation: pulseCorrect 0.6s ease;
}

.card.wrong {
    border-color: var(--error);
    background: rgba(248, 113, 113, 0.1);
    box-shadow:
        0 0 40px var(--error-glow),
        0 0 80px var(--error-glow);
    animation: shakeWrong 0.6s ease;
}

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

@keyframes shakeWrong {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(-12px) rotate(-2deg); }
    75% { transform: translateX(12px) rotate(2deg); }
}

/* Card Content */
.card-category {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: var(--space-md);
    padding: 6px 16px;
    background: rgba(167, 139, 250, 0.15);
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: var(--radius-full);
    display: inline-block;
}

.card-label {
    font-size: clamp(16px, 3vw, 18px);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.4;
    letter-spacing: -0.3px;
}

.card-value {
    font-size: clamp(32px, 6vw, 48px);
    font-weight: 800;
    color: var(--accent-neon);
    margin-bottom: var(--space-sm);
    transition: all var(--transition-base);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 20px rgba(167, 139, 250, 0.3);
}

.card-value.revealed {
    font-size: clamp(40px, 8vw, 64px);
    color: var(--warning);
    text-shadow: 0 0 30px rgba(251, 191, 36, 0.5);
    animation: revealNumber 0.5s var(--transition-bounce);
}

@keyframes revealNumber {
    from {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.card-info {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-tertiary);
    opacity: 0.8;
}

/* ============================================
   VS BADGE - MINIMAL CLEAN DESIGN
   ============================================ */
.vs-badge {
    font-size: 32px;
    font-weight: 900;
    color: #667eea;
    letter-spacing: 2px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    position: relative;
    z-index: 5;
}

/* ============================================
   EXPLANATION & ACTIONS
   ============================================ */
.explanation {
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    min-height: 48px;
    padding: 0 var(--space-lg);
    line-height: 1.7;
    animation: fadeIn 0.5s var(--transition-base);
}

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

.action-buttons {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    margin-bottom: var(--space-md);
}

.action-btn {
    flex: 1;
    max-width: 240px;
    min-height: 64px;
    padding: var(--space-lg) var(--space-xl);
    border: none;
    border-radius: var(--radius-md);
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.action-btn:active::before {
    width: 300px;
    height: 300px;
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

.btn-left {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #fff;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.btn-left:hover:not(:disabled) {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.5);
}

.btn-left:active:not(:disabled) {
    transform: translateY(-2px);
}

.btn-right {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: #fff;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
}

.btn-right:hover:not(:disabled) {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.5);
}

.btn-right:active:not(:disabled) {
    transform: translateY(-2px);
}

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

.skip-btn {
    display: block;
    width: 100%;
    max-width: 240px;
    margin: 0 auto;
    padding: var(--space-md) var(--space-lg);
    background: rgba(239, 68, 68, 0.15);
    border: 2px solid rgba(239, 68, 68, 0.4);
    color: rgba(239, 68, 68, 0.9);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.skip-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.6);
    color: rgba(239, 68, 68, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

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

/* ============================================
   GAME OVER SCREEN
   ============================================ */
.game-over {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    animation: fadeInUp 0.8s var(--transition-base);
}

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

.result-icon {
    font-size: 80px;
    margin-bottom: var(--space-lg);
    animation: iconBounce 1s ease-in-out;
}

@keyframes iconBounce {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.2) rotate(-10deg); }
    75% { transform: scale(0.9) rotate(10deg); }
}

.result-title {
    font-size: clamp(28px, 5vw, 36px);
    font-weight: 800;
    margin-bottom: var(--space-md);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-message {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
    font-weight: 500;
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-2xl);
    margin-bottom: var(--space-xl);
}

.stat {
    text-align: center;
    padding: var(--space-lg);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    backdrop-filter: blur(20px);
    min-width: 140px;
    transition: var(--transition-base);
}

.stat:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
}

.stat-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 48px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-neon));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-variant-numeric: tabular-nums;
}

.result-buttons {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
}

.retry-btn,
.change-diff-btn {
    padding: var(--space-lg) var(--space-xl);
    border: none;
    border-radius: var(--radius-md);
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
    min-height: 56px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.retry-btn {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: #fff;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

.retry-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.6);
}

.change-diff-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.change-diff-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-4px);
}

/* ============================================
   LOADING & ERROR
   ============================================ */
.loading-area,
.error-area {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
}

.loading-area.hidden,
.error-area.hidden {
    display: none;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-neon);
    border-radius: 50%;
    margin: 0 auto var(--space-lg);
    animation: spin 1s linear infinite;
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.3);
}

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

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

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    .container {
        padding: var(--space-xs);
    }

    .game-container {
        padding: var(--space-md);
    }

    /* 게임 진행 중 info-bar 마진 축소 */
    .info-bar {
        margin-bottom: var(--space-sm);
        padding-bottom: var(--space-sm);
    }

    /* 카드 컨테이너 마진 축소 */
    .cards-container {
        margin-bottom: var(--space-sm);
    }

    /* 카드 패딩 대폭 축소 */
    .card {
        padding: var(--space-md) var(--space-sm);
    }

    /* 카드 라벨 min-height 축소 */
    .card-label {
        min-height: 32px;
        font-size: 14px;
        margin-bottom: var(--space-sm);
    }

    /* 카드 숫자 크기 축소 */
    .card-value {
        font-size: clamp(24px, 8vw, 36px);
        margin-bottom: var(--space-xs);
    }

    .card-value.revealed {
        font-size: clamp(28px, 10vw, 44px);
    }

    /* 설명 영역 마진 축소 */
    .explanation {
        min-height: 32px;
        margin-bottom: var(--space-sm);
        font-size: 13px;
    }

    /* skip 버튼 컴팩트하게 */
    .skip-btn {
        padding: var(--space-sm) var(--space-md);
        font-size: 13px;
    }

    .start-screen {
        padding: var(--space-md);
        max-height: calc(100vh - 140px);
    }

    .start-title {
        font-size: 24px;
        margin-bottom: 6px;
    }

    .start-subtitle {
        font-size: 13px;
        margin-bottom: var(--space-md);
    }

    .rules-box {
        padding: var(--space-sm);
        margin-bottom: var(--space-md);
    }

    .rules-box h3 {
        font-size: 16px;
        margin-bottom: var(--space-sm);
    }

    .rules-box h3::before {
        font-size: 18px;
    }

    .rules-box li {
        padding: 2px 0;
        padding-left: 28px;
        font-size: 13px;
    }

    .difficulty-selection h3 {
        font-size: 16px;
        margin-bottom: var(--space-sm);
    }

    .diff-buttons {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .start-diff-btn {
        padding: var(--space-sm) var(--space-xs);
    }

    .diff-emoji {
        font-size: 24px;
    }

    .diff-name {
        font-size: 16px;
    }

    .diff-desc {
        font-size: 12px;
    }

    .info-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .streak-info {
        justify-content: center;
        flex-wrap: wrap;
        gap: var(--space-sm);
    }

    .cards-container {
        flex-direction: column;
        align-items: stretch;
    }

    .card {
        max-width: 100%;
        width: 100%;
    }

    .vs-badge {
        font-size: 24px;
        transform: rotate(90deg);
        margin: var(--space-sm) auto;
    }

    .card-value {
        font-size: clamp(28px, 10vw, 40px);
    }

    .card-value.revealed {
        font-size: clamp(36px, 12vw, 56px);
    }

    .action-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .action-btn {
        max-width: 100%;
    }

    .result-stats {
        flex-direction: column;
        gap: var(--space-md);
    }

    .stat {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .start-title {
        font-size: 22px;
    }

    .start-subtitle {
        font-size: 12px;
    }

    .rules-box h3 {
        font-size: 15px;
    }

    .rules-box li {
        font-size: 12px;
    }

    .difficulty-selection h3 {
        font-size: 15px;
    }

    .card-label {
        font-size: 15px;
        min-height: 40px;
    }

    .current-streak #streak,
    .best-streak #bestStreak {
        font-size: 24px;
    }
}

@media (max-height: 700px) {
    .start-screen {
        max-height: calc(100vh - 120px);
        padding: var(--space-sm) var(--space-md);
    }

    .start-title {
        font-size: 26px;
        margin-bottom: 4px;
    }

    .start-subtitle {
        margin-bottom: var(--space-sm);
    }

    .rules-box {
        padding: var(--space-sm);
        margin-bottom: var(--space-sm);
    }

    .rules-box h3 {
        font-size: 16px;
        margin-bottom: var(--space-xs);
    }

    .rules-box li {
        padding: 2px 0;
        font-size: 13px;
    }

    .difficulty-selection h3 {
        margin-bottom: var(--space-sm);
    }

    .diff-buttons {
        gap: 8px;
    }

    .start-diff-btn {
        padding: 10px 8px;
    }

    .diff-emoji {
        font-size: 28px;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.action-btn:focus,
.start-diff-btn:focus,
.retry-btn:focus,
.change-diff-btn:focus,
.skip-btn:focus {
    outline: 3px solid var(--accent-neon);
    outline-offset: 3px;
}

.card.clickable:focus {
    outline: 2px solid var(--accent-neon);
    outline-offset: 4px;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   LIGHT MODE REFINEMENTS
   ============================================ */
body:not(.dark-mode) .game-container {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(102, 126, 234, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

body:not(.dark-mode) .vs-badge {
    background: none !important;
    box-shadow: none !important;
    border: none !important;
}

body:not(.dark-mode) .spinner {
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: var(--accent-primary);
}
