:root { --cyan: #00fcfe; --navy: #010a2c; --ink: #e8fbff; --muted: #8fb3c9; color-scheme: dark; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--navy); color: var(--ink);
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

#hud { position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 0; right: 0; display: flex; justify-content: center; align-items: center; gap: 4px; padding: 0 6px; pointer-events: none; }
.hbox { background: rgba(1, 10, 44, .78); border: 1px solid rgba(0, 252, 254, .4); padding: 3px 8px; text-align: center; min-width: 64px;
  clip-path: polygon(7px 0, 100% 0, calc(100% - 7px) 100%, 0 100%); }
.hbox small { display: block; font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.hbox b { font-size: 21px; font-weight: 900; color: var(--cyan); font-variant-numeric: tabular-nums; }
.hbtn { pointer-events: auto; width: 44px; height: 44px; border: 1px solid rgba(0, 252, 254, .4); background: rgba(1, 10, 44, .78); color: var(--cyan);
  font-size: 22px; border-radius: 10px; cursor: pointer; }
.tip { position: fixed; left: 0; right: 0; bottom: calc(18px + env(safe-area-inset-bottom)); margin: 0; text-align: center; font-weight: 800; color: #ffd84a;
  text-shadow: 0 2px 6px #000; pointer-events: none; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(600px 400px at 50% 20%, rgba(0, 252, 254, .15), transparent 70%), rgba(1, 10, 44, .86); overflow-y: auto; }
.screen.soft { background: rgba(1, 10, 44, .45); }
.screen[hidden], #hud[hidden], [hidden] { display: none !important; }
.panel { width: min(420px, 100%); text-align: center; }
.panel.card { background: rgba(1, 10, 44, .92); border: 2px solid rgba(0, 252, 254, .5); padding: 18px 18px 4px;
  clip-path: polygon(18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 18px); }
h1 { margin: 6px 0 4px; font-size: 64px; line-height: .95; font-weight: 900; font-style: italic; letter-spacing: 2px;
  color: var(--cyan); text-shadow: 0 0 24px rgba(0, 252, 254, .5); }
h1 span { display: block; color: #4dff9a; text-shadow: 0 0 24px rgba(77, 255, 154, .5); }
h2 { margin: 0; font-size: 40px; font-weight: 900; font-style: italic; color: #ffd84a; }
.sub { color: var(--muted); margin: 8px 0; }
.big { font-size: 64px; font-weight: 900; margin: 6px 0 0; color: var(--cyan); font-variant-numeric: tabular-nums; }
.newbest { font-size: 22px; font-weight: 800; color: #ffd84a; margin: 0 0 8px; }
.card-table { display: grid; grid-template-columns: repeat(9, 1fr); gap: 3px; margin: 10px 0; font-variant-numeric: tabular-nums; }
.card-table div { background: rgba(0, 252, 254, .08); border: 1px solid rgba(0, 252, 254, .22); padding: 4px 0; font-size: 13px; color: var(--muted); }
.card-table b { display: block; font-size: 18px; color: var(--ink); }
.card-table .under b { color: #4dff9a; } .card-table .over b { color: #ff8aa8; } .card-table .ace b { color: #ffd84a; }
.diffs { display: flex; flex-direction: column; gap: 12px; margin: 14px 0 16px; }
.diff { font: inherit; font-size: 22px; font-weight: 900; text-transform: uppercase; letter-spacing: 1px; border: 0; padding: 12px 20px; min-height: 64px;
  color: var(--navy); cursor: pointer; clip-path: polygon(14px 0, 100% 0, calc(100% - 14px) 100%, 0 100%); transition: transform .1s, filter .1s; }
.diff small { display: block; font-size: 13px; font-weight: 700; letter-spacing: .5px; text-transform: none; opacity: .8; }
.diff:hover { filter: brightness(1.1); } .diff:active { transform: scale(.98); }
.diff.easy { background: #4dff9a; } .diff.medium { background: #ffd84a; } .diff.hard { background: #ff5c8a; }
.diff.go { background: var(--cyan); } .diff.alt { background: #2b3f7a; color: var(--ink); font-size: 18px; min-height: 52px; }
.how { font-size: 15px; color: var(--muted); border-top: 1px solid rgba(0, 252, 254, .25); padding-top: 10px; text-align: left; }
.how p { margin: 6px 0; } .how b { color: var(--ink); }
.home { display: inline-block; color: var(--muted); text-decoration: none; font-weight: 700; padding: 10px; }
.home:hover { color: var(--cyan); }
