body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: Arial, sans-serif;
}
#game-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

#game-canvas canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

body.game-active.touch-device #game-canvas {
    pointer-events: auto;
}

#ui-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

body.menu-open #ui-container {
    pointer-events: auto;
}

body.menu-open #score-container,
body.menu-open #combo-container,
body.menu-open #multiplier-container,
body.menu-open #level-container,
body.menu-open #timer-container,
body.menu-open #mute-button,
body.menu-open #mobile-pause-button,
body.menu-open #fps-container,
body.menu-open #mobile-hint,
body.menu-open #audio-blocked-banner,
body.menu-open #crosshair {
    pointer-events: none;
}
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    pointer-events: none;
}
#crosshair::before, #crosshair::after {
    content: '';
    position: absolute;
    background-color: white;
}
#crosshair::before {
    width: 2px;
    height: 20px;
    left: 9px;
    top: 0;
}
#crosshair::after {
    width: 20px;
    height: 2px;
    left: 0;
    top: 9px;
}

body.menu-open #crosshair {
    visibility: hidden;
}

#score-container {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    font-size: 28px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 10px rgba(255, 64, 129, 0.8);
    background-color: rgba(0, 0, 0, 0.4);
    padding: 10px 15px;
    border-radius: 10px;
    font-weight: bold;
}
#combo-container {
    position: absolute;
    top: 80px;
    left: 20px;
    color: white;
    font-size: 22px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 10px rgba(255, 64, 129, 0.8);
    background-color: rgba(0, 0, 0, 0.4);
    padding: 8px 15px;
    border-radius: 10px;
    font-weight: bold;
}
#level-container {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 28px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 10px rgba(255, 64, 129, 0.8);
    text-align: right;
    background-color: rgba(0, 0, 0, 0.4);
    padding: 10px 15px;
    border-radius: 10px;
    font-weight: bold;
}
#timer-container {
    position: absolute;
    top: 80px;
    right: 20px;
    color: white;
    font-size: 22px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 10px rgba(255, 64, 129, 0.8);
    text-align: right;
    background-color: rgba(0, 0, 0, 0.4);
    padding: 8px 15px;
    border-radius: 10px;
    font-weight: bold;
}
#mute-button {
    position: absolute;
    top: 140px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.4);
    color: white;
    border: none;
    padding: 8px 12px;
    font-size: 18px;
    border-radius: 10px;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.3s;
}
#mute-button:hover {
    background-color: rgba(255, 64, 129, 0.5);
}
#high-score-container {
    color: white;
    font-size: 20px;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    background-color: rgba(0, 0, 0, 0.4);
    padding: 10px 20px;
    border-radius: 10px;
}
#new-high-score {
    color: #ffeb3b;
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 10px;
    display: none;
}
#fps-container {
    position: absolute;
    bottom: 20px;
    left: 20px;
    color: #7cff7c;
    font-family: monospace;
    font-size: 14px;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 4px 8px;
    border-radius: 4px;
}
#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
    padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
    box-sizing: border-box;
}
#game-title {
    color: white;
    font-size: 60px;
    margin-bottom: 50px;
    text-shadow: 0 0 10px #ff4081, 0 0 20px #ff4081;
}
#start-button {
    background-color: #ff4081;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 24px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    margin-bottom: 20px;
}
#start-button:hover {
    background-color: #f50057;
    transform: scale(1.05);
}
#help-button {
    background-color: rgba(255, 255, 255, 0.8);
    color: #ff4081;
    border: none;
    padding: 12px 25px;
    font-size: 20px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    pointer-events: auto;
    text-decoration: none;
    display: inline-block;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}
#help-button:hover {
    background-color: rgba(255, 255, 255, 0.95);
    transform: scale(1.05);
}
#game-over-screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    text-align: center;
    pointer-events: auto;
    z-index: 200;
    touch-action: manipulation;
}
#game-over-title {
    font-size: 50px;
    margin-bottom: 20px;
    color: #ff4081;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
}
#game-over-message {
    font-size: 20px;
    margin-bottom: 30px;
    max-width: 600px;
}
#final-score-container {
    font-size: 24px;
    margin-bottom: 20px;
}
button {
    background-color: #ff4081;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 20px;
    border-radius: 5px;
    cursor: pointer;
    margin: 10px;
    transition: background-color 0.3s;
}
button:hover {
    background-color: #ff6699;
}
#pause-screen {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.7);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
    pointer-events: auto;
    touch-action: manipulation;
    display: none;
}
#pause-title {
    color: white;
    font-size: 48px;
    margin-bottom: 30px;
    text-shadow: 0 0 10px #ff4081, 0 0 20px #ff4081;
}
#resume-button {
    background-color: #ff4081;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 24px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    pointer-events: auto;
    margin-bottom: 20px;
}
#resume-button:hover {
    background-color: #f50057;
    transform: scale(1.05);
}
#pause-help-button {
    background-color: rgba(255, 255, 255, 0.8);
    color: #ff4081;
    border: none;
    padding: 12px 25px;
    font-size: 20px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    pointer-events: auto;
    text-decoration: none;
    display: inline-block;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
}
#pause-help-button:hover {
    background-color: rgba(255, 255, 255, 0.95);
    transform: scale(1.05);
}
#pause-quit-button {
    background-color: rgba(255, 64, 129, 0.3);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 18px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    pointer-events: auto;
}
#pause-quit-button:hover {
    background-color: rgba(255, 64, 129, 0.5);
}

.hidden {
    display: none !important;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid #ffeb3b;
    outline-offset: 2px;
}

#mobile-pause-button {
    position: absolute;
    top: 140px;
    left: 20px;
    background-color: rgba(0, 0, 0, 0.4);
    color: white;
    border: none;
    padding: 8px 12px;
    font-size: 18px;
    border-radius: 10px;
    cursor: pointer;
    pointer-events: auto;
}

#mobile-hint {
    position: absolute;
    bottom: 20px;
    right: 20px;
    color: white;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 14px;
}

#multiplier-container {
    position: absolute;
    top: 130px;
    left: 20px;
    color: #00e5ff;
    font-size: 18px;
    font-weight: bold;
    background-color: rgba(0, 0, 0, 0.4);
    padding: 6px 12px;
    border-radius: 10px;
}

.mode-select {
    color: white;
    background-color: rgba(0, 0, 0, 0.4);
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    margin-bottom: 20px;
}

.mode-select label {
    display: block;
    margin: 6px 0;
    cursor: pointer;
}

#achievements-panel {
    color: white;
    background-color: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    padding: 12px 20px;
    margin-bottom: 20px;
    max-width: 320px;
}

#achievements-panel h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

#achievements-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 14px;
}

#achievements-list .earned {
    color: #ffeb3b;
}

#achievements-list .locked {
    color: rgba(255, 255, 255, 0.6);
}

.level-banner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 48px;
    font-weight: bold;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    text-align: center;
}

.level-banner-sub {
    display: block;
    font-size: 24px;
    margin-top: 10px;
}

.level-banner-warning {
    display: block;
    font-size: 20px;
    margin-top: 10px;
    color: #ff0000;
}

.combo-milestone,
.powerup-message {
    position: absolute;
    top: 42%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffeb3b;
    font-size: 36px;
    font-weight: bold;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
    z-index: 1001;
    pointer-events: none;
}

.powerup-message {
    color: #00e5ff;
}

.achievement-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    z-index: 2000;
    text-align: center;
}

.share-confirmation {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px;
    border-radius: 10px;
    z-index: 1000;
    text-align: center;
}

.points-indicator {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 100;
    transition: all 1s ease-out;
}

.points-indicator.negative {
    font-size: 32px;
    text-shadow: 2px 2px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
}

.points-indicator.fade-out {
    opacity: 0;
    transform: translateY(-50px);
}

.points-indicator.negative.fade-out {
    transform: translateY(-80px) scale(1.2);
}

@keyframes screen-shake {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-4px, 2px); }
    50% { transform: translate(4px, -2px); }
    75% { transform: translate(-2px, -2px); }
}

body.screen-shake {
    animation: screen-shake 0.3s ease;
}

body.reduced-motion .points-indicator,
body.reduced-motion .combo-milestone,
body.reduced-motion .powerup-message,
body.reduced-motion.screen-shake {
    animation: none !important;
    transition: none !important;
}

#start-screen {
    pointer-events: auto;
    overflow-y: auto;
}

#start-screen button,
#start-screen a,
#start-screen input {
    pointer-events: auto;
}

#audio-blocked-banner {
    position: absolute;
    top: 140px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #ffeb3b;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    pointer-events: auto;
    cursor: pointer;
    z-index: 100;
}

#fatal-error-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.92);
    z-index: 3000;
    pointer-events: auto;
}

#fatal-error-screen.hidden {
    display: none;
}

.fatal-error-panel {
    max-width: 520px;
    margin: 20px;
    padding: 28px;
    border-radius: 12px;
    background: #1a1a2e;
    color: white;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.fatal-error-panel h1 {
    margin: 0 0 12px;
    color: #ff4081;
}

.fatal-error-panel p {
    margin: 0 0 12px;
    line-height: 1.5;
}

#fatal-error-details {
    font-size: 14px;
    color: #ccc;
}

#fatal-error-retry {
    margin-top: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    background: #ff4081;
    color: white;
    cursor: pointer;
}
