* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

:root { --ink: #f2ecff; --gold: #ffd15c; --accent: #ff7ac8; --muted: #a294c4; }

html, body {
    height: 100%;
    overflow: hidden;
    background: #1b1030;
    color: var(--ink);
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    overscroll-behavior: none;
}
.wrap { position: relative; width: 100%; height: 100dvh; }
#stage { display: block; width: 100%; height: 100%; touch-action: none; }

.hud {
    position: absolute; top: 0; left: 0; right: 0;
    display: flex; align-items: flex-start; gap: 8px;
    padding: calc(8px + env(safe-area-inset-top)) calc(10px + env(safe-area-inset-right)) 8px calc(10px + env(safe-area-inset-left));
    pointer-events: none;
}
.hud > * { pointer-events: auto; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 40px; height: 36px; padding: 0 8px;
    border: 1px solid rgba(255, 209, 92, 0.28); border-radius: 10px;
    background: rgba(20, 10, 40, 0.5); color: var(--ink);
    font-size: 15px; font-weight: 700; text-decoration: none; cursor: pointer; flex: 0 0 auto;
    backdrop-filter: blur(6px);
}
.icon-btn-text { font-size: 13px; }
.hud-mid { flex: 1; text-align: center; pointer-events: none; }
.score {
    font-size: 27px; font-weight: 800; color: var(--gold); line-height: 1.05;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); font-variant-numeric: tabular-nums;
}
.sub { font-size: 11px; color: var(--muted); }
.sub b { color: var(--ink); }
.dot { margin: 0 5px; opacity: 0.5; }
.coins {
    display: flex; align-items: center; gap: 5px;
    height: 36px; padding: 0 11px;
    border-radius: 999px; background: rgba(20, 10, 40, 0.5);
    border: 1px solid rgba(255, 209, 92, 0.28);
    font-size: 14px; font-weight: 800; color: var(--gold);
    font-variant-numeric: tabular-nums; flex: 0 0 auto;
}
.coin-dot {
    width: 12px; height: 12px; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #ffe9a8, #e0a010);
}

.zones { position: absolute; inset: 0; display: flex; flex-direction: column; pointer-events: none; }
.zone {
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: rgba(255, 255, 255, 0.5);
    letter-spacing: 1px;
}
.zone-jump { flex: 0 0 62%; }
.zone-slide { flex: 1; border-top: 1px dashed rgba(255, 255, 255, 0.22); }

.burst {
    position: absolute; top: 26%; left: 50%;
    transform: translate(-50%, -50%) scale(0.7);
    font-size: 24px; font-weight: 900; color: var(--accent);
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.7);
    letter-spacing: 2px; opacity: 0; pointer-events: none; white-space: nowrap;
}
.burst.show { animation: pop 0.8s ease forwards; }
@keyframes pop {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
    24% { opacity: 1; transform: translate(-50%, -50%) scale(1.16); }
    70% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -85%) scale(1); }
}

.overlay {
    position: fixed; inset: 0; display: none;
    align-items: center; justify-content: center; padding: 20px;
    background: rgba(12, 6, 24, 0.9); z-index: 20;
}
.overlay.is-open { display: flex; }
.overlay-card {
    width: 100%; max-width: 330px; padding: 26px 20px;
    border-radius: 20px;
    background: linear-gradient(180deg, #33205a, #1d1136);
    border: 1px solid rgba(255, 209, 92, 0.24);
    text-align: center;
}
.title { font-size: 31px; letter-spacing: 5px; color: var(--gold); }
.subtitle { margin: 8px 0 18px; font-size: 13px; color: var(--muted); }
.over-title { font-size: 26px; color: var(--gold); letter-spacing: 3px; }
.over-sub { margin: 6px 0 14px; font-size: 13px; color: var(--muted); min-height: 18px; }
.btn {
    min-height: 48px; padding: 0 18px;
    border: 1px solid rgba(255, 209, 92, 0.3); border-radius: 13px;
    background: rgba(0, 0, 0, 0.26); color: var(--ink);
    font-size: 16px; font-weight: 700; font-family: inherit; cursor: pointer;
}
.btn-primary {
    background: linear-gradient(140deg, #ffdf85, #e2a72c);
    border-color: #ffe9a8; color: #2f2005;
}
.btn-wide { width: 100%; margin-top: 9px; }
.how { margin-top: 18px; text-align: left; }
.how-row {
    display: flex; justify-content: space-between; gap: 10px;
    padding: 5px 0; font-size: 12px; color: var(--muted);
}
.how-key { color: var(--ink); font-weight: 600; flex: 0 0 auto; }
.result-row {
    display: flex; justify-content: space-between;
    padding: 7px 4px; font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
