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

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #07131f;
    font-family: Arial, sans-serif;
}

body {
    background:
        radial-gradient(circle at top, rgba(57, 189, 124, 0.15), transparent 34%),
        linear-gradient(180deg, #102035 0%, #09111d 100%);
}

#game-container {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    position: relative;
}

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

#dpad {
    position: fixed;
    width: 270px;
    height: 270px;
    display: none;
    z-index: 200;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    pointer-events: auto;
    touch-action: none;
}
@media (pointer: coarse) {
    #dpad { display: block; }
}

.dpad-btn {
    position: absolute;
    width: 90px;
    height: 90px;
    background: rgba(179, 245, 66, 0.15);
    border: 2px solid rgba(179, 245, 66, 0.6);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    color: rgba(179, 245, 66, 0.9);
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.08s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.dpad-btn:active {
    background: rgba(179, 245, 66, 0.45);
}

#dpad-up    { top: 0;     left: 90px; }
#dpad-down  { top: 180px; left: 90px; }
#dpad-left  { top: 90px;  left: 0; }
#dpad-right { top: 90px;  left: 180px; }

/* ── 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.90); 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: #b3f542;
    text-shadow: 0 0 10px #b3f542; margin-bottom: 20px;
    letter-spacing: 4px;
}
#score-list {
    background: rgba(179,245,66,0.07); border: 2px solid #b3f542;
    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(179,245,66,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: #64d2ff; text-align: right; }
.score-row.top .score-name, .score-row.top .score-val { color: #b3f542; }

#hs-new-label {
    font-size: 28px; font-weight: bold; color: #b3f542;
    text-shadow: 0 0 14px #b3f542, 0 0 28px #b3f542;
    letter-spacing: 4px; margin-bottom: 6px;
    animation: frPulse 1s ease-in-out infinite;
}
@keyframes frPulse {
    0%,100% { text-shadow: 0 0 10px #b3f542, 0 0 20px #b3f542; }
    50%      { text-shadow: 0 0 24px #b3f542, 0 0 48px #b3f542; }
}
#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;
}
#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(179,245,66,0.12); color: #b3f542;
    border: 2px solid #b3f542; 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(179,245,66,0.38); }
.spin-window {
    width: 72px; height: 180px; overflow: hidden; position: relative;
    border: 2px solid #b3f542; 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(179,245,66,0.5);
    border-bottom: 1px solid rgba(179,245,66,0.5);
    background: rgba(179,245,66,0.05);
}
.spinner-col.active-col .spin-window { box-shadow: 0 0 16px #b3f542; }
.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(179,245,66,0.25);
}
.spin-cell.curr { color: #b3f542; text-shadow: 0 0 12px #b3f542, 0 0 24px #b3f542; }

#hs-confirm-btn {
    margin-top: 10px; padding: 12px 40px; font-size: 20px; font-weight: bold;
    background: #0d2012; color: #64d2ff; border: 2px solid #64d2ff;
    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: #1a5a3a; 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; }

/* ── Title screen HS panel ───────────────────────────────────────────────── */
#fr-hs-panel {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: rgba(5,14,10,0.88); border: 2px solid #b3f542;
    border-radius: 12px; padding: 22px 36px; min-width: 320px;
    text-align: center; color: #fff; font-family: Arial, sans-serif;
    z-index: 100; pointer-events: none;
}
.fr-hs-title {
    font-size: 26px; font-weight: bold; color: #b3f542;
    letter-spacing: 4px; margin-bottom: 14px;
    text-shadow: 0 0 10px #b3f542;
}
.fr-hs-row {
    display: flex; justify-content: space-between;
    padding: 6px 0; border-bottom: 1px solid rgba(179,245,66,0.2);
    font-size: 20px; font-weight: bold; gap: 16px;
}
.fr-hs-row:last-child { border-bottom: none; }
.fr-hs-rank  { color: #888; width: 34px; }
.fr-hs-name  { color: #fff; flex: 1; text-align: center; letter-spacing: 3px; }
.fr-hs-score { color: #64d2ff; text-align: right; }
.fr-hs-row.top .fr-hs-name,
.fr-hs-row.top .fr-hs-score { color: #b3f542; }
.fr-hs-empty { color: #888; font-size: 18px; padding: 8px 0; }
