/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Font dimuat via <link> di index.html (dengan preconnect) — bukan @import,
   supaya tidak render-blocking di mobile */

:root {
    --bg: #0a0a0a;
    --surface: #1a1a1a;
    --surface2: #252525;
    --border: #333;
    --text: #ffffff;
    --text-dim: #888;
    --accent: #ffffff;
    --danger: #ff4444;
    --success: #44ff44;
    --warning: #ffaa00;
    --glow: 0 0 20px rgba(255,255,255,0.1);
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
    user-select: none;
    -webkit-user-select: none;
}

/* ===== CANVAS ===== */
#gameCanvas {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    z-index: 1;
}

/* ===== SCREENS ===== */
.screen {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.65);
    z-index: 10;
    backdrop-filter: blur(2px);
}

.screen.active {
    display: flex;
    animation: screenFadeIn 0.3s ease-out;
}

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

/* ===== MAIN MENU (SPLIT LAYOUT) ===== */
#mainMenu {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
}

/* Split layout container */
.menu-split {
    display: flex;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* LEFT PANEL */
.menu-left {
    flex: 0 0 45%;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 3rem;
    z-index: 2;
    position: relative;
}

.menu-left-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    max-width: 420px;
    animation: fadeInUp 0.8s ease-out;
}

.game-title h1 {
    font-family: 'Press Start 2P', monospace;
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: -2px;
    line-height: 0.9;
    text-shadow: 0 0 40px rgba(255,255,255,0.15);
    margin-top: 2rem;
}

.game-title .title-accent {
    font-size: 4.5rem;
    background: linear-gradient(90deg, #fff 0%, #aaa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.title-line {
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #fff, transparent);
    margin: 1.2rem 0;
    border-radius: 2px;
}

.subtitle {
    color: var(--text-dim);
    font-size: 0.85rem;
    letter-spacing: 4px;
    text-transform: uppercase;
}

.menu-spacer {
    flex: 1;
    min-height: 2rem;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin: 1rem 0;
}

/* RIGHT PANEL */
.menu-right {
    flex: 0 0 55%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-right-overlay {
    position: absolute;
    bottom: 3rem;
    right: 2rem;
    z-index: 2;
}

.menu-features {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 1rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    animation: fadeInUp 0.5s ease-out;
    animation-delay: calc(0.3s + var(--i, 0) * 0.15s);
    animation-fill-mode: both;
}

.feature-item:nth-child(1) { --i: 0; }
.feature-item:nth-child(2) { --i: 1; }
.feature-item:nth-child(3) { --i: 2; }

.feature-icon {
    font-size: 1.3rem;
}

.feature-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 1px;
}

/* Mobile fallback */
.menu-mobile {
    display: none;
    text-align: center;
    padding: 2rem;
    max-width: 480px;
    width: 100%;
    animation: fadeInUp 0.8s ease-out;
}

.menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 1rem 2rem;
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

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

.menu-btn:hover {
    border-color: var(--text);
    background: var(--surface2);
    transform: translateY(-2px);
    box-shadow: var(--glow);
}

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

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

.menu-btn.primary {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

.menu-btn.primary:hover {
    background: #ddd;
    box-shadow: 0 0 30px rgba(255,255,255,0.2);
}

.menu-btn.exit {
    border-color: var(--danger);
    color: var(--danger);
}

.menu-btn.exit:hover {
    background: var(--danger);
    color: var(--bg);
}

.btn-icon {
    font-size: 1.2rem;
}

.menu-footer {
    margin-top: 2rem;
    color: var(--text-dim);
    font-size: 0.85rem;
}

.menu-footer p {
    padding: 0.8rem;
    border: 1px dashed var(--border);
    border-radius: 4px;
}

/* ===== LOADING ===== */
.loading-container {
    text-align: center;
    animation: fadeIn 0.3s ease-out;
}

.loading-runner {
    width: 100px;
    height: 80px;
    margin: 0 auto 1.5rem;
}

.loading-container h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.2rem;
    letter-spacing: 4px;
    margin-bottom: 1.5rem;
    animation: pulse 1.5s infinite;
}

.loading-bar {
    width: 280px;
    height: 4px;
    background: var(--surface2);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto;
}

.loading-fill {
    height: 100%;
    background: var(--text);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
    animation: loadingFill 1.5s ease-in-out forwards;
}

@keyframes loadingFill {
    0% { width: 0%; }
    50% { width: 60%; }
    100% { width: 100%; }
}

.loading-container p {
    margin-top: 1rem;
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* ===== MODE SELECT ===== */
.mode-container {
    text-align: center;
    padding: 2rem;
    animation: fadeInUp 0.5s ease-out;
}

.mode-container h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.5rem;
    margin-bottom: 2rem;
    letter-spacing: 3px;
}

.mode-buttons {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.mode-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    padding: 2.5rem 1.5rem;
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
}

.mode-btn:hover {
    border-color: var(--text);
    background: var(--surface2);
    transform: translateY(-4px);
    box-shadow: var(--glow);
}

.mode-btn.solo:hover {
    box-shadow: 0 0 30px rgba(255,255,255,0.1);
}

.mode-btn.multiplayer:hover {
    box-shadow: 0 0 30px rgba(100,200,255,0.15);
}

.mode-icon {
    font-size: 3rem;
}

.mode-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.2rem;
    letter-spacing: 2px;
}

.mode-desc {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.back-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.8rem 1.5rem;
    transition: color 0.3s;
    letter-spacing: 1px;
}

.back-btn:hover {
    color: var(--text);
}

/* ===== MULTIPLAYER ===== */
.mp-container {
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    text-align: center;
    animation: fadeInUp 0.5s ease-out;
}

.mp-container h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    letter-spacing: 3px;
}

.mp-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 2rem;
    border: 2px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.mp-tab {
    flex: 1;
    padding: 0.8rem 1rem;
    background: var(--surface);
    border: none;
    color: var(--text-dim);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 1px;
}

.mp-tab.active {
    background: var(--text);
    color: var(--bg);
}

.mp-tab:hover:not(.active) {
    background: var(--surface2);
    color: var(--text);
}

.mp-panel {
    display: none;
    text-align: left;
}

.mp-panel.active {
    display: block;
}

.mp-room-code {
    text-align: center;
    padding: 1.5rem;
    border: 2px dashed var(--border);
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.mp-room-code p {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.mp-room-code h3 {
    font-family: 'Press Start 2P', monospace;
    font-size: 2rem;
    letter-spacing: 8px;
    color: var(--text);
}

.mp-input-group {
    margin-bottom: 1.2rem;
}

.mp-input-group label {
    display: block;
    color: var(--text-dim);
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mp-input-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.mp-input-group input:focus {
    border-color: var(--text);
}

.mp-status {
    margin-top: 1rem;
    padding: 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
    text-align: center;
}

.mp-status.error {
    background: rgba(255,68,68,0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.mp-status.success {
    background: rgba(68,255,68,0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.mp-status.info {
    background: rgba(255,170,0,0.1);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.mp-players {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
}

.mp-player {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    transition: all 0.3s;
}

.mp-player .player-icon {
    font-size: 1.5rem;
}

.mp-player .player-name {
    font-weight: 600;
}

.mp-player .player-status {
    margin-left: auto;
    color: var(--success);
    font-size: 0.8rem;
}

.mp-players-count {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.9rem;
    color: var(--text-dim);
    margin: 1rem 0;
}

.mp-hint {
    color: var(--text-dim);
    font-size: 0.8rem;
    margin: 0.3rem 0;
}

/* ===== HUD ===== */
#gameOverlay {
    display: none;
}

#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1rem 1.5rem;
    z-index: 100;
    pointer-events: none;
}

.hud-left, .hud-center, .hud-right {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    pointer-events: auto;
}

.hud-center {
    align-items: center;
}

.hud-right {
    align-items: flex-end;
}

.hud-lives {
    font-size: 1.3rem;
    letter-spacing: 2px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.hud-score {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.8rem;
    color: var(--text);
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.hud-distance {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.1rem;
    color: var(--text);
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.hud-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--text);
    padding: 0.5rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.hud-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: var(--text);
}

/* ===== OVERLAYS ===== */
.overlay-hidden {
    display: none !important;
}

.overlay-active {
    display: flex !important;
}

/* Countdown */
#countdownOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    z-index: 200;
    background: rgba(0,0,0,0.7);
}

.countdown-number {
    font-family: 'Press Start 2P', monospace;
    font-size: 8rem;
    color: var(--text);
    animation: countPop 0.8s ease-out;
    text-shadow: 0 0 60px rgba(255,255,255,0.3);
}

@keyframes countPop {
    0% { transform: scale(2); opacity: 0; }
    50% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0.8); opacity: 0.5; }
}

/* Voice indicator */
#voiceIndicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: rgba(0,0,0,0.8);
    border: 1px solid var(--border);
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    z-index: 150;
    backdrop-filter: blur(10px);
}

.voice-pulse {
    width: 12px;
    height: 12px;
    background: var(--success);
    border-radius: 50%;
    animation: voicePulse 1s infinite;
}

.voice-pulse.listening {
    background: var(--warning);
}

.voice-pulse.success {
    background: var(--success);
}

.voice-pulse.error {
    background: var(--danger);
}

@keyframes voicePulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

#voiceText {
    color: var(--text-dim);
    font-size: 0.85rem;
    font-weight: 500;
}

/* Pause Menu */
#pauseMenu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.8);
    z-index: 300;
    backdrop-filter: blur(5px);
}

.pause-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 2rem;
}

.pause-container h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

/* Game Over */
#gameOverScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.9);
    z-index: 300;
    backdrop-filter: blur(5px);
}

.gameover-container {
    text-align: center;
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    animation: fadeInUp 0.5s ease-out;
}

.gameover-container h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--danger);
}

.gameover-container.win h2 {
    color: var(--success);
}

.gameover-stats {
    margin-bottom: 1.5rem;
}

.gameover-stats p {
    font-size: 1.2rem;
    margin: 0.5rem 0;
    color: var(--text-dim);
}

.gameover-stats p span {
    color: var(--text);
    font-weight: 700;
}

/* Skor akhir + catatan jarak kematian */
.gameover-stats .go-score {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.3rem;
}

.gameover-stats .go-score span {
    color: var(--warning);
    font-size: 1.9rem;
}

.gameover-stats .go-death {
    font-size: 1.05rem;
    color: var(--danger);
    margin-top: 0.15rem;
}

.gameover-stats .go-death span {
    color: var(--danger);
    font-weight: 800;
}

.gameover-input {
    margin-bottom: 1rem;
}

.gameover-input input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    text-align: center;
    outline: none;
    transition: border-color 0.3s;
}

.gameover-input input:focus {
    border-color: var(--text);
}

.gameover-container .menu-btn {
    margin-top: 0.5rem;
}

/* Win Screen */
#winScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.9);
    z-index: 300;
    backdrop-filter: blur(5px);
}

/* ===== LEADERBOARD ===== */
.lb-container {
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    text-align: center;
    animation: fadeInUp 0.5s ease-out;
}

.lb-container h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    letter-spacing: 3px;
}

.lb-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border: 2px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.lb-tab {
    flex: 1;
    padding: 0.7rem 1rem;
    background: var(--surface);
    border: none;
    color: var(--text-dim);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 1px;
}

.lb-tab.active {
    background: var(--text);
    color: var(--bg);
}

.lb-tab:hover:not(.active) {
    background: var(--surface2);
    color: var(--text);
}

.lb-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 1.5rem;
}

.lb-list::-webkit-scrollbar {
    width: 4px;
}

.lb-list::-webkit-scrollbar-track {
    background: var(--surface);
}

.lb-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.lb-empty {
    padding: 2rem;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.lb-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--surface2);
    transition: background 0.3s;
}

.lb-item:hover {
    background: var(--surface);
}

.lb-rank {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.9rem;
    color: var(--text-dim);
    min-width: 30px;
}

.lb-rank.gold { color: #ffd700; }
.lb-rank.silver { color: #c0c0c0; }
.lb-rank.bronze { color: #cd7f32; }

.lb-name {
    flex: 1;
    font-weight: 600;
    text-align: left;
}

.lb-score {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.8rem;
    color: var(--text);
}

/* ===== SETTINGS ===== */
.settings-container {
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    animation: fadeInUp 0.5s ease-out;
}

.settings-container h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    text-align: center;
    letter-spacing: 3px;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem;
    border: 1px solid var(--surface2);
    border-radius: 8px;
    margin-bottom: 0.8rem;
    transition: all 0.3s;
}

.setting-item:hover {
    background: var(--surface);
    border-color: var(--border);
}

.setting-item.danger {
    border-color: rgba(255,68,68,0.3);
}

.setting-item.danger:hover {
    border-color: var(--danger);
    background: rgba(255,68,68,0.05);
}

.setting-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.setting-label {
    font-weight: 700;
    font-size: 1rem;
}

.setting-desc {
    color: var(--text-dim);
    font-size: 0.8rem;
}

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    cursor: pointer;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--surface2);
    border-radius: 26px;
    transition: all 0.3s;
    border: 2px solid var(--border);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--text-dim);
    border-radius: 50%;
    transition: all 0.3s;
}

.toggle input:checked + .toggle-slider {
    background: var(--text);
    border-color: var(--text);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(24px);
    background: var(--bg);
}

/* Slider */
.setting-slider {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.setting-slider input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 120px;
    height: 4px;
    background: var(--surface2);
    border-radius: 2px;
    outline: none;
}

.setting-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--text);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

.setting-slider input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.setting-slider input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--text);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

#micSensValue {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.75rem;
    min-width: 45px;
    color: var(--text);
}

.danger-btn {
    padding: 0.6rem 1.2rem;
    background: transparent;
    border: 2px solid var(--danger);
    color: var(--danger);
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
    letter-spacing: 1px;
}

.danger-btn:hover {
    background: var(--danger);
    color: var(--bg);
}

/* ===== EXIT CONFIRM ===== */
#exitConfirm {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.8);
    z-index: 400;
    backdrop-filter: blur(5px);
}

.confirm-dialog {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    max-width: 350px;
    width: 90%;
    animation: fadeInUp 0.3s ease-out;
}

.confirm-dialog h3 {
    font-family: 'Press Start 2P', monospace;
    font-size: 1rem;
    margin-bottom: 0.8rem;
}

.confirm-dialog p {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.confirm-dialog .ad-note {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin: 0.5rem 0;
    font-style: italic;
}

.confirm-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ===== AD PLACEHOLDER ===== */
#adPlaceholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.85);
    z-index: 500;
    backdrop-filter: blur(5px);
}

/* ===== MULTIPLAYER RESULTS ===== */
.mp-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--surface2);
}

.mp-result-item:first-child {
    background: rgba(255,215,0,0.1);
    border-radius: 8px 8px 0 0;
}

.mp-result-rank {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-right: 1rem;
}

.mp-result-name {
    flex: 1;
    text-align: left;
    font-weight: 600;
}

.mp-result-score {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.8rem;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== VOLUME INDICATOR (HUD) ===== */
.volume-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.3rem;
    opacity: 0.8;
}

.volume-bar-bg {
    width: 60px;
    height: 6px;
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}

.volume-bar-fill {
    height: 100%;
    width: 0%;
    background: #44ff44;
    border-radius: 3px;
    transition: width 0.05s, background 0.2s;
}

.volume-label {
    font-size: 0.65rem;
    color: var(--text-dim);
    min-width: 65px;
    font-weight: 600;
}

/* ===== CHECKPOINT NOTIFICATION ===== */
.checkpoint-notif {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Press Start 2P', monospace;
    font-size: 1.2rem;
    color: #64c8ff;
    text-shadow: 0 0 30px rgba(100, 200, 255, 0.5);
    z-index: 180;
    pointer-events: none;
    white-space: nowrap;
}

.checkpoint-notif.cp-animate {
    animation: cpPopIn 0.5s ease-out, cpFadeOut 1.5s ease-in 0.5s forwards;
}

@keyframes cpPopIn {
    0% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes cpFadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* ===== INSTRUCTIONS OVERLAY ===== */
.instructions-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.9);
    z-index: 700;
    backdrop-filter: blur(8px);
    padding: 1rem;
}

.instructions-overlay.overlay-active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.instructions-content {
    max-width: 520px;
    width: 100%;
    padding: 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-align: center;
    animation: fadeInUp 0.4s ease-out;
}

.instructions-content h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    letter-spacing: 2px;
}

.instruction-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.instruction-item {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.8rem;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.06);
}

.instr-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.instruction-item strong {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

.instruction-item p {
    color: var(--text-dim);
    font-size: 0.8rem;
    line-height: 1.4;
}

.instruction-volumes {
    display: flex;
    gap: 0.5rem;
}

.vol-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.8rem 0.5rem;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.03);
}

.vol-icon {
    font-size: 1.5rem;
}

.vol-desc {
    font-size: 0.7rem;
    color: var(--text);
    text-align: center;
    font-weight: 600;
}

.vol-type {
    font-size: 0.65rem;
    color: var(--text-dim);
}

.vol-item.low { border-color: rgba(68,255,68,0.3); }
.vol-item.mid { border-color: rgba(255,170,0,0.3); }
.vol-item.high { border-color: rgba(255,68,68,0.3); }

/* ===== PAUSE FADE-IN ===== */
#pauseMenu {
    animation: fadeIn 0.2s ease-out;
}

.pause-container {
    animation: fadeInUp 0.3s ease-out;
}

/* ===== RESPONSIVE UPDATES ===== */
@media (max-width: 600px) {
    .instructions-content { padding: 1.2rem; }
    .instructions-content h2 { font-size: 0.9rem; }
    .instruction-volumes { flex-direction: column; }
    .vol-item { flex-direction: row; padding: 0.5rem 0.8rem; }
    .checkpoint-notif { font-size: 0.9rem; }
    .volume-bar-bg { width: 40px; }
    .volume-label { font-size: 0.55rem; min-width: 50px; }
}

/* ===== MIC PERMISSION DIALOG ===== */
#micPermissionOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.85);
    z-index: 600;
    backdrop-filter: blur(8px);
}

.mic-dialog .mic-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: pulse 1.5s infinite;
}

.mic-dialog h3 {
    font-size: 1.1rem !important;
}

.mic-detail {
    font-size: 0.8rem !important;
    color: var(--text-dim);
    font-style: italic;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .menu-split { flex-direction: column-reverse; }
    .menu-left, .menu-right { flex: none; width: 100%; }
    .menu-left { height: auto; padding: 1.5rem; align-items: center; justify-content: center; }
    .menu-left-inner { max-width: 100%; text-align: center; }
    .menu-right { height: 40%; }
    .title-line { margin: 1rem auto; }
    .menu-features { flex-direction: row; gap: 0.5rem; }
    .feature-item { padding: 0.4rem 0.6rem; }
    .feature-text { font-size: 0.7rem; }
    .menu-mobile { display: none; }
}

@media (max-width: 600px) {
    .menu-split { display: none; }
    .menu-mobile { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; }
    .game-title h1 { font-size: 2.5rem; }
    .game-title .title-accent { font-size: 3.5rem; }
    .mode-buttons { flex-direction: column; }
    .mode-btn { padding: 1.5rem; }
    .hud-score { font-size: 0.65rem; }
    .hud-distance { font-size: 0.85rem; }
    .hud-lives { font-size: 1rem; }
    .countdown-number { font-size: 5rem; }
    #voiceIndicator { bottom: 1rem; padding: 0.6rem 1rem; }
    #voiceText { font-size: 0.75rem; }
}

@media (max-width: 400px) {
    .game-title h1 { font-size: 1.8rem; }
    .game-title .title-accent { font-size: 2.5rem; }
    .menu-btn { padding: 0.8rem 1.2rem; font-size: 0.85rem; }
}

/* ===== PERF MOBILE: kurangi backdrop-filter (mahal di GPU HP) ===== */
@media (max-width: 768px), (pointer: coarse) {
    #voiceIndicator { backdrop-filter: none; background: rgba(0,0,0,0.9); }
    #pauseMenu, #gameOverScreen, #winScreen { backdrop-filter: none; }
}

/* ===== SCROLLBAR ===== */
body::-webkit-scrollbar {
    width: 0;
}
