* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    overflow: hidden;
    background-color: #000;
}

#game-canvas {
    display: block;
    width: 100vw;
    height: 100vh;
}

#ui-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    background: rgba(0, 0, 0, 0.7);
    padding: 40px 60px;
    border-radius: 20px;
    border: 3px solid #9370db;
    box-shadow: 0 0 30px rgba(147, 112, 219, 0.5);
    pointer-events: auto;
    max-width: 540px;
}

.screen h1 {
    font-size: 48px;
    margin-bottom: 20px;
    color: #e6d5ff;
    text-shadow: 0 0 10px rgba(147, 112, 219, 0.8);
}

.screen p {
    font-size: 20px;
    margin: 10px 0;
}

.screen strong {
    color: #ffd700;
    font-size: 24px;
}

.high-score {
    margin-top: 20px;
    font-size: 18px;
    color: #ffd700;
}

.final-score {
    font-size: 24px;
    color: #87ceeb;
    margin-bottom: 15px;
}

.hidden {
    display: none !important;
}

#game-ui {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    font-size: 24px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

#score {
    margin-bottom: 10px;
}

#score span,
#speed span {
    color: #ffd700;
    font-weight: bold;
}

#fatigue-bar {
    margin-top: 12px;
    max-width: 260px;
}

.meter-label {
    display: block;
    font-size: 16px;
    margin-bottom: 6px;
    color: #ffeabf;
    letter-spacing: 1px;
}

.meter-track {
    position: relative;
    width: 100%;
    height: 18px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15);
    overflow: hidden;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.25);
}

.meter-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #ff5c5c, #ffd966, #bee96c);
    transition: width 0.2s ease-out;
    box-shadow: 0 0 12px rgba(255, 213, 102, 0.45);
}

#fatigue-bar.low .meter-fill {
    background: linear-gradient(90deg, #ff3b3b, #ff7b3d);
    box-shadow: 0 0 16px rgba(255, 59, 59, 0.5);
}

.meter-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(255, 220, 150, 0.35) 0%, rgba(255, 140, 40, 0) 70%);
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

#fatigue-bar.ready .meter-pulse {
    opacity: 0.8;
}

#ultra-hint {
    margin-top: 10px;
    font-size: 16px;
    color: #ffe066;
    text-shadow: 0 0 8px rgba(255, 224, 102, 0.7);
    letter-spacing: 1px;
}

#ultra-hint.ready {
    animation: pulseGlow 1.2s ease-in-out infinite;
}

#shield-indicator {
    margin-top: 6px;
    font-size: 15px;
    color: #9ad8ff;
    text-shadow: 0 0 8px rgba(154, 216, 255, 0.7);
}

#shield-indicator.active {
    animation: pulseShield 1.4s ease-in-out infinite;
}

@keyframes pulseShield {
    0%, 100% { opacity: 0.5; }
    40% { opacity: 1; }
    60% { opacity: 0.8; }
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.logo {
    font-size: 52px;
    margin-bottom: 10px;
    color: #f0e6ff;
    text-shadow: 0 0 18px rgba(205, 173, 255, 0.85);
    letter-spacing: 2px;
}

.tagline {
    font-size: 18px;
    color: #c8d6ff;
    margin-bottom: 24px;
}

.menu-section {
    margin: 22px 0;
}

.menu-section h2 {
    font-size: 22px;
    margin-bottom: 12px;
    color: #ffeabf;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#theme-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.theme-option {
    padding: 10px 18px;
    border-radius: 14px;
    border: 2px solid rgba(158, 123, 255, 0.6);
    background: rgba(25, 18, 40, 0.75);
    color: #e8ddff;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    pointer-events: auto;
}

.theme-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 12px rgba(155, 125, 255, 0.5);
}

.theme-option.selected {
    border-color: #ffd966;
    box-shadow: 0 0 16px rgba(255, 217, 102, 0.6);
    background: rgba(60, 35, 85, 0.85);
}

.theme-label {
    margin-top: 10px;
    font-size: 16px;
    color: #ffeabf;
}

.primary-button,
.secondary-button {
    pointer-events: auto;
    cursor: pointer;
    border-radius: 16px;
    padding: 12px 32px;
    font-size: 18px;
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-weight: 600;
}

.primary-button {
    background: linear-gradient(120deg, #7f4fff, #c08bff);
    color: white;
    box-shadow: 0 0 16px rgba(192, 139, 255, 0.5);
}

.primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 24px rgba(192, 139, 255, 0.7);
}

.secondary-button {
    background: rgba(35, 30, 60, 0.85);
    color: #d4c6ff;
    border: 1px solid rgba(140, 120, 210, 0.6);
    margin-top: 12px;
}

.secondary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 16px rgba(140, 120, 210, 0.6);
}

.menu-hint {
    margin-top: 14px;
    font-size: 16px;
    color: #d5dcff;
}

.leaderboard ol {
    list-style: none;
    padding-left: 0;
}

.leaderboard li {
    margin: 4px 0;
    font-size: 16px;
    color: #f6f3ff;
    text-align: left;
}

.high-score.secondary {
    color: #c7fbff;
    font-size: 16px;
}

#touch-controls {
    position: absolute;
    bottom: 48px;
    right: 32px;
    pointer-events: auto;
}

.touch-btn {
    background: rgba(20, 18, 40, 0.75);
    color: #f4f3ff;
    border: 2px solid rgba(130, 110, 200, 0.7);
    border-radius: 16px;
    padding: 14px 28px;
    font-size: 18px;
    min-width: 120px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.touch-btn:active {
    transform: scale(0.95);
    box-shadow: 0 0 12px rgba(160, 130, 255, 0.6);
}

.touch-btn.accent {
    background: rgba(110, 40, 120, 0.85);
    border-color: rgba(240, 180, 255, 0.85);
    box-shadow: 0 0 16px rgba(240, 180, 255, 0.45);
}
