/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: #1d1d1d;
    color: #eee;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
header {
    background: #1d1d1d;
    padding: 0.75rem 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

/* Main Game Area */
main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    position: relative;
}

#game {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    touch-action: manipulation; /* Enable touch events */
    pointer-events: auto; /* Ensure clicks/touches work */
}

/* Ensure canvas receives touch events */
#game canvas {
    touch-action: manipulation;
    pointer-events: auto;
}

/* HUD Styles */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
}

.hud-top {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hud-right {
    position: absolute;
    top: 10px;
    right: 10px;
    text-align: right;
}

.hud-bottom-left {
    position: absolute;
    bottom: 10px;
    left: 10px;
}

#score {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}
#lives { background: transparent; padding: 0; border-radius: 0; text-shadow: none; }

/* Life Bar */
.life-bar {
    width: 160px;
    height: 16px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.25), 0 2px 8px rgba(0,0,0,0.15);
}

.life-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #4ade80, #16a34a); /* default healthy */
    border-radius: 999px;
    transition: width 200ms ease, background 200ms ease, box-shadow 200ms ease;
}

.life-bar-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
    pointer-events: none;
}

/* Health-state colors */
.life-bar-fill.life-good {
    background: linear-gradient(90deg, #4ade80, #16a34a);
    box-shadow: 0 0 10px rgba(34,197,94,0.45);
}
.life-bar-fill.life-warn {
    background: linear-gradient(90deg, #fde047, #f59e0b);
    box-shadow: 0 0 10px rgba(245,158,11,0.45);
}
.life-bar-fill.life-low {
    background: linear-gradient(90deg, #fb923c, #f97316);
    box-shadow: 0 0 10px rgba(249,115,22,0.45);
}
.life-bar-fill.life-crit {
    background: linear-gradient(90deg, #f87171, #ef4444);
    box-shadow: 0 0 12px rgba(239,68,68,0.55);
}


/* Desktop tuning */
@media (min-width: 900px) {
    .life-bar { width: 220px; height: 18px; }
    .life-bar-text { font-size: 0.85rem; }
    #score { font-size: 1.05rem; }
}

#active-effects {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.effect-indicator {
    background: rgba(0, 255, 0, 0.8);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    animation: pulse 1s infinite;
}

.effect-indicator.shield {
    background: rgba(0, 150, 255, 0.8);
}

.effect-indicator.slowmo {
    background: rgba(255, 150, 0, 0.8);
}

/* Overlay Styles */
.overlay {
    position: fixed; /* Changed from absolute to fixed for better mobile support */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Much higher z-index */
    pointer-events: auto; /* Explicitly enable pointer events */
}

.menu-content, .quiz-content, .gameover-content, .leaderboard-section {
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    max-width: 400px;
    width: 90%;
    position: relative;
    z-index: 1002; /* Higher than buttons */
    pointer-events: auto !important;
    touch-action: manipulation !important;
    
    /* Mobile optimizations */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

.menu-content h2, .quiz-content h3 {
    color: #ffffff;
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.menu-content p {
    color: #ffffff;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

/* Button Styles */
.btn-primary, .btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    pointer-events: auto !important; /* Force buttons to work on mobile */
    touch-action: manipulation !important; /* Optimize touch response */
    user-select: none; /* Prevent text selection */
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0.5rem;
    min-width: 120px;
    position: relative; /* Ensure proper stacking */
    z-index: 1001; /* Higher than overlay background */
    
    /* Mobile-specific optimizations */
    -webkit-tap-highlight-color: transparent; /* Remove iOS tap highlight */
    -webkit-touch-callout: none; /* Disable callout */
    -webkit-user-select: none; /* Disable selection */
}

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

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

.btn-secondary {
    background: #2a2a2a;
    color: #ffffff;
    border: 1px solid #333;
}

.btn-secondary:hover {
    background: #343434;
    border-color: #444;
    transform: translateY(-1px);
}

.btn-primary:active, .btn-secondary:active {
    transform: translateY(0);
}

/* Quiz Specific Styles */
#quiz-question {
    font-size: 1.2rem;
    color: #eee;
    margin: 1rem 0;
    font-weight: bold;
}

#quiz-choices {
    display: grid;
    gap: 0.5rem;
    margin: 1rem 0;
}

.quiz-choice {
    padding: 0.75rem;
    border: 1px solid #3a3a3a;
    border-radius: 10px;
    background: #2a2a2a;
    color: #eee;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.quiz-choice:hover {
    border-color: #4a4a4a;
    background: #2f2f2f;
}

.quiz-choice.selected {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

/* Ensure selected state remains visible on mobile where .quiz-choice uses !important */
#quiz-overlay .quiz-choice.selected {
    background: #667eea !important;
    border-color: #667eea !important;
    color: #fff !important;
}

/* Tactile press feedback */
#quiz-overlay .quiz-choice:active {
    filter: brightness(1.08);
}

.quiz-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

/* Leaderboard Styles (dark theme) */
.leaderboard-section h3 {
    color: #ffffff;
    margin-bottom: 0.75rem;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 55vh;
    overflow: auto;
    padding: 0.25rem;
}

.leaderboard-entry {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.9rem;
    background: #222;
    border: 1px solid #333;
    border-radius: 12px;
    color: #eee;
}

.leaderboard-entry .rank { color: #bbb; font-weight: 700; }
.leaderboard-entry .name { color: #eee; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-entry .score { color: #fff; font-weight: 800; }

.leaderboard-entry.current-user {
    border-color: #4ade80;
    box-shadow: 0 0 0 1px rgba(74,222,128,0.25), 0 8px 20px rgba(0,0,0,0.25);
}

.leaderboard-buttons {
    margin-top: 0.75rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.leaderboard-list .loading,
.leaderboard-list .no-data {
    color: #ddd;
    background: #222;
    border: 1px dashed #333;
    border-radius: 10px;
    padding: 0.75rem;
    text-align: center;
}

/* Auth (dark theme) */
.auth-section h3 { color: #fff; }
.auth-error { color: #fff; background: rgba(244,67,54,0.2); border: 1px solid rgba(244,67,54,0.4); padding: 0.5rem 0.75rem; border-radius: 8px; margin: 0.5rem 0; }
.form-field input {
    width: 100%;
    background: #2a2a2a;
    color: #eee;
    border: 1px solid #333;
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
}
.form-field input::placeholder { color: #888; }
.form-field input:focus { outline: 2px solid #444; border-color: #555; }

/* Settings Styles */
.setting-item {
    margin: 1rem 0;
    text-align: left;
}

.setting-item label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #eee;
}

input[type="range"] {
    width: 100%;
    margin: 0.5rem 0;
    pointer-events: auto; /* Ensure sliders work on mobile */
    touch-action: manipulation;
}

input[type="checkbox"] {
    margin-right: 0.5rem;
    pointer-events: auto; /* Ensure checkboxes work on mobile */
    touch-action: manipulation;
}

select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #333;
    background: #2a2a2a;
    color: #eee;
    border-radius: 5px;
    font-size: 1rem;
    pointer-events: auto; /* Ensure select works on mobile */
    touch-action: manipulation;
}

/* Quiz Overlay Mobile Optimizations */
#quiz-overlay {
    z-index: 3000 !important; /* Higher than everything */
    background: rgba(0, 0, 0, 0.95) !important; /* Darker background to block game */
}

#quiz-overlay .quiz-content {
    padding: 1.5rem !important;
    max-width: 95% !important;
    width: 400px !important;
    z-index: 3001 !important;
    position: relative !important;
    background: #1d1d1d !important;
    color: #fff !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
}

#quiz-overlay button {
    font-size: 1.1rem !important;
    padding: 0.8rem 1.5rem !important;
    min-height: 48px !important;
    min-width: 140px !important;
    margin: 0.5rem !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    z-index: 3002 !important;
    position: relative !important;
}

.quiz-choice {
    font-size: 1rem !important;
    padding: 0.8rem !important;
    min-height: 44px !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    z-index: 3002 !important;
    position: relative !important;
    background: #2a2a2a !important;
    border: 1px solid #3a3a3a !important;
    color: #eee !important;
    margin: 0.4rem 0 !important;
}

/* Game Over Screen Mobile Optimizations */
#gameover-screen {
    z-index: 2000 !important;
}

#gameover-screen .menu-content {
    padding: 2rem !important;
    max-width: 90% !important;
    width: 350px !important;
}

#gameover-screen button {
    font-size: 1.2rem !important;
    padding: 1rem 2rem !important;
    min-height: 50px !important;
    min-width: 150px !important;
    margin: 0.75rem !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    z-index: 2001 !important;
    position: relative !important;
}

/* Footer */
footer {
    background: linear-gradient(0deg, rgba(0,0,0,0.25), rgba(0,0,0,0.15));
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    padding: 0.75rem 1rem calc(env(safe-area-inset-bottom) + 0.75rem);
    font-size: 0.85rem;
    border-top: 1px solid rgba(255,255,255,0.25);
    backdrop-filter: blur(8px);
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.15);
}

/* Utility Classes */
.hidden {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    z-index: -1 !important; /* Send to back when hidden */
}

/* Mobile-specific overlay fixes */
.overlay.hidden {
    position: fixed !important;
    top: -9999px !important; /* Move completely off screen */
    left: -9999px !important;
    width: 0 !important;
    height: 0 !important;
    pointer-events: none !important;
    touch-action: none !important;
    z-index: -1 !important;
}

/* Ensure visible overlays work */
.overlay:not(.hidden) {
    pointer-events: auto !important;
    touch-action: manipulation !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: auto !important;
    height: auto !important;
}

.blink {
    animation: blink 0.5s ease-in-out infinite alternate;
}

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

@keyframes blink {
    0% { opacity: 1; }
    100% { opacity: 0.3; }
}

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

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* Theme Variations */
body.high-contrast {
    --bg-color: #000;
    --text-color: #fff;
    --accent-color: #ffff00;
}

body.high-contrast .menu-content,
body.high-contrast .quiz-content {
    background: #000;
    color: #fff;
    border: 3px solid #fff;
}

body.high-contrast .btn-primary {
    background: #ffff00;
    color: #000;
}

body.colorblind {
    --primary-color: #0173b2;
    --secondary-color: #de8f05;
    --success-color: #029e73;
    --warning-color: #cc78bc;
}
@media (min-width: 1200px) {
    .menu-content, .quiz-content {
        max-width: 1200px;
    }
    
}
/* Responsive Design - Compact Mobile Layout */
@media (max-width: 768px) {
    /* Header kompakter */
    header {
        padding: 0.5rem;
    }
    
    header h1 {
        font-size: 1.4rem;
        margin: 0;
    }
    
    /* Main Menu - Viewport optimiert */
    .overlay {
        padding: 0.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 100vh;
    }
    
    .menu-content, .quiz-content {
        padding: 1rem;
        margin: 0;
        width: 95%;
        max-width: 380px;
        max-height: 85vh;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }
    
    .menu-content h2 {
        font-size: 1.5rem;
        margin-bottom: 0.8rem;
    }
    
    .menu-content p {
        font-size: 0.85rem;
        margin-bottom: 1rem;
        line-height: 1.3;
    }
    
    /* Auth Section kompakter */
    .auth-section {
        margin: 1rem 0;
        padding: 1rem;
        border-radius: 12px;
    }
    
    .auth-container h3 {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
    }
    
    .form-field input {
        padding: 0.7rem 0.9rem;
        font-size: 16px; /* Verhindert iOS Zoom */
        border-radius: 8px;
    }
    
    .auth-buttons {
        gap: 0.6rem;
        margin-top: 1rem;
    }
    
    .btn-primary, .btn-secondary {
        padding: 0.7rem 1rem;
        font-size: 0.85rem;
        min-height: 44px;
        border-radius: 10px;
    }
    
    .auth-switch {
        margin-top: 1rem;
        font-size: 0.8rem;
    }
    
    /* Game Controls kompakter */
    .game-controls {
        gap: 0.6rem;
        margin-top: 1rem;
        flex-shrink: 0;
    }
    
    /* User Stats kompakter wenn eingeloggt */
    .user-info {
        max-width: 100%;
    }
    
    .user-profile {
        padding: 1.2rem;
        border-radius: 12px;
    }
    
    .user-profile h3 {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
    }
    
    .user-stats {
        padding: 0.8rem;
        gap: 0.4rem;
        margin: 0.8rem 0;
        border-radius: 8px;
    }
    
    .stat-item {
        padding: 0.3rem 0;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    .stat-value {
        font-size: 0.9rem;
    }
    
    #hud {
        font-size: 0.9rem;
    }
    
    #score, #speed, #lives {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
}

/* Ultra-compact für sehr kleine Screens */
@media (max-width: 480px) {
    /* Header ultra-kompakt */
    header {
        padding: 0.3rem;
    }
    
    header h1 {
        font-size: 1.2rem;
        margin: 0;
    }
    
    main {
        padding: 0.3rem;
    }
    
    /* Menu ultra-kompakt */
    .overlay {
        padding: 0.3rem;
    }
    
    .menu-content, .quiz-content {
        padding: 0.8rem;
        margin: 0;
        width: 98%;
        max-height: 90vh;
    }
    
    .menu-content h2 {
        font-size: 1.3rem;
        margin-bottom: 0.6rem;
    }
    
    .menu-content p {
        font-size: 0.8rem;
        margin-bottom: 0.8rem;
        line-height: 1.2;
    }
    
    /* Auth Section ultra-kompakt */
    .auth-section {
        margin: 0.8rem 0;
        padding: 0.8rem;
        border-radius: 10px;
    }
    
    .auth-container h3 {
        font-size: 1rem;
        margin-bottom: 0.6rem;
    }
    
    .form-field input {
        padding: 0.6rem 0.8rem;
        font-size: 16px;
        border-radius: 6px;
    }
    
    .auth-buttons {
        gap: 0.5rem;
        margin-top: 0.8rem;
    }
    
    .btn-primary, .btn-secondary {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
        min-height: 40px;
        border-radius: 8px;
    }
    
    .auth-switch {
        margin-top: 0.8rem;
        font-size: 0.75rem;
    }
    
    /* Game Controls ultra-kompakt */
    .game-controls {
        gap: 0.5rem;
        margin-top: 0.8rem;
    }
    
    /* User Stats ultra-kompakt */
    .user-profile {
        padding: 1rem;
        border-radius: 10px;
    }
    
    .user-profile h3 {
        font-size: 1rem;
        margin-bottom: 0.6rem;
    }
    
    .user-stats {
        padding: 0.6rem;
        gap: 0.3rem;
        margin: 0.6rem 0;
        border-radius: 6px;
    }
    
    .stat-item {
        padding: 0.2rem 0;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .stat-value {
        font-size: 0.8rem;
    }
    
    .quiz-actions {
        flex-direction: column;
        gap: 0.4rem;
    }
    
    
}

@media (max-width: 360px) {
    .menu-content h2 {
        font-size: 1.5rem;
    }
    
    .btn-primary, .btn-secondary {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        margin: 0.25rem;
    }
    
    #quiz-question {
        font-size: 1rem;
    }
    
    .quiz-choice {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
}

/* High DPI / Retina Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    #game {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .overlay {
        display: none !important;
    }
}

/* Authentication Styles */
.auth-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #1d1d1d;
    border-radius: 10px;
    backdrop-filter: blur(5px);
}

.auth-container h3,
.user-info h3,
.leaderboard-section h3 {
    color: white;
    margin-bottom: 1rem;
    text-align: center;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-field {
    display: flex;
    flex-direction: column;
}

.form-field input {
    padding: 0.8rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    background: rgba(146, 143, 143, 0.9);
    font-size: 1rem;
    transition: all 0.3s ease;
}


.form-field input:focus {
    outline: none;
    border-color: #667eea;
    background: rgb(133, 133, 133);
}

.auth-error {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    padding: 0.5rem;
    border-radius: 5px;
    font-size: 0.9rem;
    display: none;
    text-align: center;
}

.auth-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
}

.auth-buttons button {
    flex: 1;
}

.auth-switch {
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

.link-btn {
    background: none;
    border: none;
    color: #ffd700;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    margin-left: 0.5rem;
    font-size: inherit;
}

.link-btn:hover {
    color: #ffed4e;
}

/* Authentication Styles - Modern Design */
.auth-section {
    margin: 2rem 0;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    border-radius: 20px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.auth-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ffed4e, #ff6b6b, #4ecdc4, #45b7d1);
    background-size: 300% 100%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.auth-container {
    max-width: 400px;
    margin: 0 auto;
    position: relative;
}

.auth-container h3 {
    color: #fff;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.form-field {
    position: relative;
    display: flex;
    flex-direction: column;
}

.form-field input {
    padding: 1rem 1.2rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    background: rgba(138, 138, 138, 0.95);
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    color: #333;
}

.form-field input::placeholder {
    color: rgba(0, 0, 0, 0.5);
    font-weight: 400;
}

.form-field input:focus {
    outline: 2px solid #444;
    border-color: #555;
    background: #2f2f2f;
    color: #eee;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.auth-error {
    color: #fff;
    font-size: 0.9rem;
    text-align: center;
    min-height: 1.2rem;
    background: rgba(244, 67, 54, 0.2);
    padding: 0.75rem;
    border-radius: 10px;
    margin: 0.5rem 0;
    border: 1px solid rgba(244, 67, 54, 0.4);
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

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

.auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Button Styles - Modern Design */
.btn-primary {
    background: linear-gradient(135deg, #ffed4e 0%, #ffcc02 50%, #ffd700 100%);
    color: #1a1a1a;
    border: none;
    padding: 1rem 2rem;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    box-shadow: 0 8px 30px rgba(255, 237, 78, 0.4);
    position: relative;
    overflow: hidden;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

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

.btn-primary:hover {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 50%, #ffcc02 100%);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 40px rgba(255, 237, 78, 0.6);
}

.btn-primary:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 5px 20px rgba(255, 237, 78, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 1rem 2rem;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(15px);
    position: relative;
    overflow: hidden;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

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

.btn-secondary:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.1));
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.2);
}

.btn-secondary:active {
    transform: translateY(0) scale(0.98);
}

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.link-btn {
    background: none;
    border: none;
    color: #ffed4e;
    text-decoration: none;
    cursor: pointer;
    font-size: inherit;
    margin-left: 0.5rem;
    transition: all 0.3s ease;
    font-weight: 600;
    position: relative;
}

.link-btn::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #ffed4e;
    transition: width 0.3s ease;
}

.link-btn:hover::after {
    width: 100%;
}

.link-btn:hover {
    color: #fff;
    transform: translateY(-1px);
}

/* User Info Styles - Modern Card Design */
.user-info {
    max-width: 420px;
    margin: 0 auto;
}

.user-profile {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.user-profile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4ecdc4, #45b7d1, #96ceb4, #feca57);
    background-size: 300% 100%;
    animation: gradientShift 4s ease infinite;
}

.user-profile h3 {
    margin-bottom: 2rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
    position: relative;
}

.user-profile h3::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #ffed4e, #ffd700);
    border-radius: 2px;
}

.user-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #ffed4e, #ffd700);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 237, 78, 0.2);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.08));
}

.stat-item:hover::before {
    opacity: 1;
}

.stat-label {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-label::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffed4e;
    box-shadow: 0 0 8px rgba(255, 237, 78, 0.5);
}

.stat-value {
    font-weight: 800;
    color: #ffed4e;
    font-size: 1.2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    padding: 0.3rem 0.8rem;
    background: rgba(255, 237, 78, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 237, 78, 0.3);
}

/* Game Controls Styles */
.game-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Game Over Screen Styles */
.gameover-content {
    background: #1d1d1d;
    border-radius: 25px;
    padding: 2rem;
    backdrop-filter: none;
    border: 1px solid #333;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    animation: gameoverSlideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.gameover-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: #2a2a2a;
    background-size: auto;
    animation: none;
}

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

.gameover-header {
    text-align: center;
    margin-bottom: 2rem;
}

.gameover-header h2 {
    color: #eee;
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.score-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.current-score, .highscore-display {
    background: #2a2a2a;
    border-radius: 15px;
    padding: 1.5rem 1rem;
    text-align: center;
    border: 1px solid #3a3a3a;
    transition: all 0.3s ease;
}

.current-score:hover, .highscore-display:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

.score-label {
    display: block;
    color: #bbb;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.score-value {
    font-size: 2.5rem;
    font-weight: 900;
    color: #ffed4e;
    text-shadow: 0 3px 6px rgba(255, 237, 78, 0.4);
    line-height: 1;
}

.score-value.highscore {
    color: #06ffa5;
    text-shadow: 0 3px 6px rgba(6, 255, 165, 0.4);
}

.new-record-badge {
    background: linear-gradient(135deg, #feca57, #ff6b6b);
    color: #fff;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: 1px;
    animation: recordPulse 1.5s ease infinite;
    box-shadow: 0 8px 20px rgba(254, 202, 87, 0.4);
    margin-top: 1rem;
}

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

.gameover-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #2a2a2a;
    border-radius: 12px;
    padding: 1.2rem 0.8rem;
    text-align: center;
    border: 1px solid #3a3a3a;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::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;
}

.stat-card:hover::before {
    left: 100%;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.stat-icon {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    display: block;
}

.stat-title {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    display: block;
    color: #ffed4e;
    font-size: 1.3rem;
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(255, 237, 78, 0.3);
}

.gameover-actions {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.primary-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.secondary-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.2rem 1rem !important;
    font-size: 0.9rem !important;
    min-height: 70px;
}

.small-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1rem !important;
    font-size: 0.85rem !important;
    min-height: 45px;
}

.btn-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.small-btn .btn-icon {
    font-size: 1.1rem;
}

/* Google Icon Styles */
.google-icon {
    width: 20px;
    height: 20px;
    margin-right: 0.5rem;
    vertical-align: middle;
    filter: brightness(1.1);
    transition: filter 0.3s ease;
}

.btn-secondary:hover .google-icon {
    filter: brightness(1.3);
}

.btn-tertiary {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.btn-tertiary:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    color: #fff;
}

/* Leaderboard Styles */
.leaderboard-section {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: #1d1d1d;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.leaderboard-section h3 {
    color: #fff;
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.leaderboard-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    margin: 0.5rem 0;
    background: #222;
    border: 1px solid #333;
    border-radius: 12px;
    color: #eee;
    transition: all 0.3s ease;
}

.leaderboard-entry:hover {
    background: #2f2f2f;
    border-color: #4a4a4a;
}

.leaderboard-entry.current-user {
    border-color: #4ade80;
    box-shadow: 0 0 0 1px rgba(74,222,128,0.25), 0 8px 20px rgba(0,0,0,0.25);
}

.leaderboard-rank {
    font-weight: bold;
    min-width: 2rem;
    text-align: center;
}

.leaderboard-name {
    flex: 1;
    margin: 0 1rem;
    text-align: left;
}

.leaderboard-score {
    font-weight: bold;
    color: #ffed4e;
}

.loading {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    padding: 1rem;
}

/* User Info Styles */
.user-info {
    text-align: center;
}

.user-profile {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.user-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    margin: 1rem 0;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    color: white;
}

.stat-label {
    font-weight: bold;
}

.stat-value {
    color: #ffd700;
}

/* Leaderboard Styles */
.leaderboard-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    backdrop-filter: blur(5px);
}

.leaderboard-list {
    max-height: 300px;
    overflow-y: auto;
    margin: 1rem 0;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    margin: 0.5rem 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    color: white;
    transition: all 0.3s ease;
}

.leaderboard-entry:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.leaderboard-entry.current-user {
    background: rgba(255, 215, 0, 0.2);
    border: 2px solid #ffd700;
}

.leaderboard-entry .rank {
    font-weight: bold;
    min-width: 30px;
}

.leaderboard-entry .name {
    flex: 1;
    margin: 0 1rem;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.leaderboard-entry .score {
    color: #ffd700;
    font-weight: bold;
}

.loading {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    padding: 2rem;
}

.no-data {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    padding: 2rem;
}

/* Auth Responsive Adjustments */
@media (max-width: 768px) {
    /* Compact mobile layout - no scrolling needed */
    header {
        padding: 8px 16px;
        height: 50px;
    }
    
    header h1 {
        font-size: 1.8rem;
        margin: 0;
        line-height: 1.2;
    }
    
    .menu-content {
        padding: 16px;
        gap: 12px;
    }
    
    .menu-content h2 {
        font-size: 1.6rem;
        margin-bottom: 8px;
    }
    
    .menu-content p {
        font-size: 0.9rem;
        margin-bottom: 12px;
    }
    
    .auth-section {
        height: auto;
        padding: 12px 16px;
    }
    
    .auth-buttons {
        flex-direction: column;
        gap: 12px;
        margin: 12px 0 8px 0;
    }
    
    .auth-buttons button {
        width: 100%;
        min-height: 44px;
        font-size: 15px;
        padding: 12px 16px;
    }
    
    .auth-container {
        max-width: 320px;
        margin: 0 auto;
        padding: 16px;
        background: rgba(45, 45, 60, 0.95);
        border-radius: 12px;
    }
    
    .auth-container h3 {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }
    
    .auth-form {
        gap: 12px;
    }
    
    .form-field input {
        padding: 12px;
        font-size: 16px;
        height: 44px;
        box-sizing: border-box;
    }
    
    /* Clean Google button styling */
    #auth-google {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        background: linear-gradient(135deg, #4285f4 0%, #3367d6 100%);
        color: white;
        border: none;
        font-weight: 500;
        box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
    }
    
    #auth-google:hover {
        background: linear-gradient(135deg, #3367d6 0%, #2851a3 100%);
        transform: translateY(-1px);
    }
    
    #auth-google .google-icon {
        width: 18px;
        height: 18px;
        background-color: white;
        border-radius: 3px;
        padding: 2px;
    }
    
    .stat-label, .stat-value {
        font-size: 0.8rem;
    }
    
    /* Compact game controls */
    .game-controls {
        gap: 10px;
        margin-top: 12px;
    }
    
    .game-controls button {
        min-height: 44px;
        font-size: 15px;
        padding: 12px 16px;
    }
    
    /* Game Over Screen Mobile */
    .gameover-content {
        padding: 1.8rem;
        margin: 1rem;
        border-radius: 20px;
        max-width: 95%;
    }
    
    .gameover-header h2 {
        font-size: 1.5rem;
        margin-bottom: 1.2rem;
    }
    
    .score-section {
        grid-template-columns: 1fr;
        gap: 0.8rem;
        margin-bottom: 1.2rem;
    }
    
    .current-score, .highscore-display {
        padding: 1.2rem 0.8rem;
    }
    
    .score-value {
        font-size: 2rem;
    }
    
    .new-record-badge {
        font-size: 0.95rem;
        padding: 0.6rem 1.2rem;
    }
    
    .gameover-stats {
        grid-template-columns: 1fr;
        gap: 0.8rem;
        margin-bottom: 1.5rem;
    }
    
    .stat-card {
        padding: 1rem;
        display: flex;
        align-items: center;
        text-align: left;
        gap: 1rem;
    }
    
    .stat-icon {
        font-size: 1.5rem;
        margin-bottom: 0;
        flex-shrink: 0;
    }
    
    .stat-info {
        flex: 1;
    }
    
    .stat-title {
        font-size: 0.75rem;
        margin-bottom: 0.2rem;
    }
    
    .stat-number {
        font-size: 1.1rem;
    }
    
    .primary-actions {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .secondary-actions {
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
    }
    
    .action-btn {
        padding: 1rem 0.8rem !important;
        min-height: 60px;
        font-size: 0.85rem !important;
    }
    
    .small-btn {
        padding: 0.7rem 0.8rem !important;
        min-height: 42px;
        font-size: 0.8rem !important;
    }
    
    .btn-icon {
        font-size: 1.2rem;
    }
    
    .small-btn .btn-icon {
        font-size: 1rem;
    }
}

/* Extra small mobile - Game Over */
@media (max-width: 480px) {
    .gameover-content {
        padding: 1.5rem;
        margin: 0.5rem;
        max-height: 85vh;
        width: 95%;
    }
    
    .gameover-header h2 {
        font-size: 1.3rem;
    }
    
    .score-value {
        font-size: 1.8rem;
    }
    
    .gameover-stats {
        margin-bottom: 1.2rem;
    }
    
    .stat-card {
        padding: 0.8rem;
        gap: 0.8rem;
    }
    
    .secondary-actions {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .action-btn {
        min-height: 55px;
    }
    
    .small-btn {
        min-height: 40px;
    }
}

/* iPhone XR and smaller devices (414px and below) - Login specific fixes */
@media (max-width: 414px) {
    /* Main menu content optimization */
    .menu-content {
        padding: -3px 0px -1px -1px;
        gap: 8px;
        height: 100vh;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        position: relative;
        z-index: 1;
    }
    
    .menu-content h2 {
        font-size: 1.4rem;
        margin-bottom: 4px;
        color: #fff;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
        font-weight: 700;
        transform: translateY(-7px);
    }
    
    .menu-content p {
        font-size: 0.85rem;
        margin-bottom: 8px;
        color: rgba(255, 255, 255, 0.95);
        text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
        font-weight: 500;
        background: transparent;
        padding: 6px 12px;
        border-radius: 8px;
        transform: translateY(-16px);
    }
    
    /* Auth section fixes */
    .auth-section {
        margin: -4rem -1rem -1rem -1rem;
        padding: 0.3rem;
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
        border-radius: 20px;
        backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
        transition: all 0.3s ease;
        position: relative;
        overflow: hidden;
        z-index: 2;
        transform: translateY(40px);
    }
    
    .auth-container {
        max-width: 420px;
        width: calc(100% - 0px);
        padding: 14px;
        margin: 0;
        background: #1d1d1d;
        border-radius: 12px;
    }
    
    .auth-container h3 {
        font-size: 1.2rem;
        margin-bottom: 12px;
        text-align: center;
    }
    
    .auth-form {
        gap: 12px;
    }
    
    .form-field input {
        padding: 12px;
        font-size: 15px;
        height: 44px;
        border-radius: 8px;
    }
    
    /* Auth buttons optimization */
    .auth-buttons {
        gap: 10px;
        margin-top: 14px;
        margin-bottom: 10px;
    }
    
    .auth-buttons button {
        width: 94%;
        min-height: 46px;
        font-size: 15px;
        padding: 12px 16px;
        border-radius: 12px;
    }
    
    /* Google button specific styling */
    #auth-google {
        display: flex !important;
        align-items: center;
        justify-content: center;
        gap: 8px;
        background: linear-gradient(135deg, #4285f4 0%, #3367d6 100%) !important;
        color: white;
        border: none;
        font-weight: 500;
        box-shadow: 0 3px 8px rgba(66, 133, 244, 0.3);
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    #auth-google:hover {
        background: linear-gradient(135deg, #3367d6 0%, #2851a3 100%) !important;
        transform: translateY(-1px);
    }
    
    #auth-google .google-icon {
        width: 16px;
        height: 16px;
        background-color: white;
        border-radius: 2px;
        padding: 1px;
        flex-shrink: 0;
    }
    
    /* Auth switch section */
    .auth-switch {
        text-align: center;
        margin-top: 10px;
        font-size: 0.85rem;
    }
    
    /* Ensure everything is contained */
    .overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Header adjustments */
    header {
        padding: 6px 12px;
        height: 45px;
        flex-shrink: 0;
    }
    
    header h1 {
        font-size: 1.6rem;
        margin: 0;
        line-height: 1.1;
    }
    
    /* Game controls positioning */
    .game-controls {
        margin-top: 2rem;
        gap: 12px;
        padding: 0 16px;
        transform: translateY(20px);
    }
    
    .game-controls button {
        min-height: 48px;
        font-size: 15px;
        padding: 14px 20px;
    }
}

/* iPhone SE specific adjustments (375px and smaller) */
@media (max-width: 375px) {
    /* More compact layout for very small screens */
    .auth-container {
        max-width: 300px;
        width: calc(100% - 30px);
        padding: 12px;
    }
    
    .form-field input {
        padding: 10px;
        font-size: 14px;
        height: 42px;
    }
    
    .auth-buttons button {
        min-height: 44px;
        font-size: 14px;
        padding: 10px 16px;
    }

    .menu-content h2 {
        font-size: 1.4rem;
        margin-bottom: 4px;
        color: #fff;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
        font-weight: 700;
        transform: translateY(0px);
    }
}