* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    height: 100%;
    overflow: hidden;
}

body {
    background: #000;
    overflow: hidden;
    height: 100%;
}

#game-container {
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* dynamic viewport — fixes Android Chrome toolbar bug */
    position: relative;
}

#game-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}



/* ── Title Screen High Score Panel ─────────────────────────────────────── */
@keyframes am-hs-pulse {
    0%,100% { text-shadow: 0 0 10px #ffe000, 0 0 22px #ffe000; }
    50%     { text-shadow: 0 0 22px #ffe000, 0 0 44px #ffe000, 0 0 66px #ffa500; }
}
@keyframes am-row-in {
    from { opacity: 0; transform: translateX(-18px); }
    to   { opacity: 1; transform: translateX(0); }
}

#am-hs-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -42%);
    font-family: 'Arial Black', Arial, sans-serif;
    text-align: center;
    pointer-events: none;
    z-index: 50;
    min-width: 320px;
}

.am-hs-title {
    font-size: clamp(18px, 3.5vw, 32px);
    font-weight: 900;
    letter-spacing: 6px;
    color: #ffe000;
    animation: am-hs-pulse 2s ease-in-out infinite;
    margin-bottom: 14px;
}

.am-hs-list {
    background: rgba(255, 224, 0, 0.04);
    border: 1px solid rgba(255, 224, 0, 0.25);
    border-radius: 10px;
    padding: 8px 20px;
}

.am-hs-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    font-size: clamp(14px, 2.4vw, 22px);
    font-weight: bold;
    animation: am-row-in 0.35s ease both;
}
.am-hs-row:last-child { border-bottom: none; }

.am-hs-rank  { color: rgba(255,255,255,0.35); font-size: 0.75em; width: 36px; text-align: left; }
.am-hs-name  { color: #00ccff; letter-spacing: 4px; width: 100px; text-align: center; text-shadow: 0 0 8px #00ccff; }
.am-hs-score { color: #cc88ff; text-shadow: 0 0 8px #cc88ff; flex: 1; text-align: right; }

.am-hs-row.top .am-hs-name  { color: #ffe000; text-shadow: 0 0 10px #ffe000; }
.am-hs-row.top .am-hs-score { color: #ffe000; text-shadow: 0 0 10px #ffe000; }
.am-hs-row.top .am-hs-rank  { color: #ffe000; }

.am-hs-empty { color: #555; font-size: clamp(12px, 2vw, 16px); padding: 12px 0; letter-spacing: 2px; }

/* ── Arcade Info Panel ──────────────────────────────────────────────────── */
@keyframes am-info-in  { from { opacity:0; transform:translate(-50%,-42%) scale(0.94); } to { opacity:1; transform:translate(-50%,-42%) scale(1); } }
@keyframes am-info-out { from { opacity:1; } to { opacity:0; } }

#am-info-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -42%);
    font-family: 'Arial Black', Arial, sans-serif;
    text-align: center;
    pointer-events: none;
    z-index: 50;
    min-width: 300px;
    max-width: 92vw;
}

.am-info-title {
    font-size: clamp(14px, 2.8vw, 26px);
    font-weight: 900;
    letter-spacing: 5px;
    color: #ff6600;
    text-shadow: 0 0 12px #ff6600, 0 0 28px #ff4400;
    margin-bottom: 12px;
}

.am-info-box {
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,102,0,0.3);
    border-radius: 10px;
    padding: 8px 16px 10px;
}

.am-info-section {
    margin-bottom: 6px;
}

.am-info-sep {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin: 6px 0;
}

.am-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: clamp(11px, 2vw, 17px);
    font-weight: bold;
    letter-spacing: 1px;
}

.am-info-icon {
    font-size: clamp(14px, 2.4vw, 20px);
    width: 26px;
    text-align: center;
    flex-shrink: 0;
}

.am-info-label {
    color: #aaaaaa;
    flex: 1;
    text-align: left;
    font-size: 0.85em;
    letter-spacing: 1px;
}

.am-info-pts {
    color: #ffee00;
    text-shadow: 0 0 6px #ffee00;
    min-width: 52px;
    text-align: right;
}

.am-info-note {
    font-size: clamp(10px, 1.7vw, 14px);
    color: #888;
    letter-spacing: 2px;
    padding: 2px 0;
    text-align: left;
    line-height: 1.4;
}

.am-info-note span { color: #ff8844; font-weight: bold; }

/* ── High Score Overlay ─────────────────────────────────────────────────── */
#hs-overlay {
    position: fixed; inset: 0; display: none; flex-direction: column;
    align-items: center; justify-content: center;
    background: rgba(0,0,0,0.88); color: #fff;
    font-family: Arial, sans-serif; text-align: center;
    z-index: 1000; touch-action: none;
}
#hs-title {
    font-size: 44px; font-weight: bold; color: #ffe000;
    text-shadow: 0 0 10px #ffe000; margin-bottom: 20px;
    letter-spacing: 4px;
}
#score-list {
    background: rgba(255,224,0,0.08); border: 2px solid #ffe000;
    border-radius: 8px; padding: 18px 30px; min-width: 340px;
    margin-bottom: 24px;
}
.score-row {
    display: flex; justify-content: space-between;
    padding: 8px 0; border-bottom: 1px solid rgba(255,224,0,0.25);
    font-size: 22px; font-weight: bold;
}
.score-row:last-child { border-bottom: none; }
.score-rank { color: #888; width: 40px; }
.score-name { color: #fff; flex: 1; text-align: center; letter-spacing: 3px; }
.score-val  { color: #00ffaa; text-align: right; }
.score-row.top .score-name, .score-row.top .score-val { color: #ffe000; }

#hs-new-label {
    font-size: 28px; font-weight: bold; color: #ffe000;
    text-shadow: 0 0 14px #ffe000, 0 0 28px #ffe000;
    letter-spacing: 4px; margin-bottom: 6px;
    animation: amPulse 1s ease-in-out infinite;
}
@keyframes amPulse {
    0%,100% { text-shadow: 0 0 10px #ffe000, 0 0 20px #ffe000; }
    50%      { text-shadow: 0 0 24px #ffe000, 0 0 48px #ffe000; }
}
#hs-enter-label { font-size: 20px; color: #ccc; margin-bottom: 10px; }
#initials-box {
    display: none; flex-direction: column; align-items: center;
    gap: 12px; margin-bottom: 24px;
}

/* Spinners */
#spinner-row { display: flex; gap: 20px; justify-content: center; margin: 8px 0; }
.spinner-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.spin-btn {
    width: 72px; height: 44px; font-size: 22px; font-weight: bold;
    background: rgba(255,224,0,0.15); color: #ffe000;
    border: 2px solid #ffe000; border-radius: 8px;
    cursor: pointer; touch-action: manipulation;
    user-select: none; -webkit-tap-highlight-color: transparent;
    transition: background 0.1s;
}
.spin-btn:active, .spin-btn:hover { background: rgba(255,224,0,0.4); }
.spin-window {
    width: 72px; height: 180px; overflow: hidden; position: relative;
    border: 2px solid #ffe000; border-radius: 8px; background: rgba(0,0,0,0.5);
}
.spin-window::before {
    content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none;
    background: linear-gradient(to bottom,
        rgba(0,0,0,0.8) 0%, transparent 28%, transparent 72%, rgba(0,0,0,0.8) 100%);
}
.spin-window::after {
    content: ''; position: absolute; z-index: 3; pointer-events: none;
    top: 60px; left: 0; right: 0; height: 60px;
    border-top: 1px solid rgba(255,224,0,0.55);
    border-bottom: 1px solid rgba(255,224,0,0.55);
    background: rgba(255,224,0,0.05);
}
.spinner-col.active-col .spin-window { box-shadow: 0 0 16px #ffe000; }
.spin-strip { display: flex; flex-direction: column; }
.spin-cell {
    height: 60px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 36px; font-weight: bold; color: rgba(255,224,0,0.28);
}
.spin-cell.curr { color: #ffe000; text-shadow: 0 0 12px #ffe000, 0 0 24px #ffe000; }

#hs-confirm-btn {
    margin-top: 10px; padding: 12px 40px; font-size: 20px; font-weight: bold;
    background: #1a3a1a; color: #00ffaa; border: 2px solid #00ffaa;
    border-radius: 8px; cursor: pointer; touch-action: manipulation;
    transition: background 0.2s; letter-spacing: 2px;
    user-select: none; -webkit-tap-highlight-color: transparent;
}
#hs-confirm-btn:active, #hs-confirm-btn:hover { background: #2ecc71; color: #fff; }

#close-hs-btn {
    display: none; padding: 12px 30px; font-size: 20px; font-weight: bold;
    background: #1a1a3a; color: #fff; border: 2px solid #aaa;
    border-radius: 8px; cursor: pointer; transition: background 0.2s;
    touch-action: manipulation;
}
#close-hs-btn:hover { background: #333; }

/* ── D-Pad ──────────────────────────────────────────────────────────────── */
#dpad {
    position: fixed;
    width: 270px; height: 270px;
    display: none; /* shown on touch via media query */
    z-index: 200;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    pointer-events: auto;
}
@media (pointer: coarse) {
    #dpad { display: block; }
}
.dpad-btn {
    position: absolute;
    width: 90px; height: 90px;
    background: rgba(255,255,255,0.18);
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 38px; color: rgba(255,255,255,0.9);
    cursor: pointer; touch-action: manipulation;
    transition: background 0.08s;
}
.dpad-btn:active { background: rgba(255,255,255,0.5); }
#dpad-up    { top: 0;     left: 90px; }
#dpad-down  { top: 180px; left: 90px; }
#dpad-left  { top: 90px;  left: 0; }
#dpad-right { top: 90px;  left: 180px; }
#dpad-hyper {
    top: 90px; left: 90px;
    background: rgba(0,255,255,0.18);
    border-color: rgba(0,255,255,0.7);
    color: #00ffff;
    font-size: 32px;
    border-radius: 50%;
}
#dpad-hyper:active { background: rgba(0,255,255,0.5); }

/* Pause overlay */
#pause-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 50;
    align-items: center; justify-content: center;
    font-family: Arial, sans-serif;
    color: #ffe000;
    font-size: 64px;
    font-weight: bold;
    letter-spacing: 8px;
    text-shadow: 0 0 20px #ffe000;
}
#pause-overlay.visible { display: flex; }
