
  @font-face { font-family: "Anton"; font-display: swap; src: url("../fonts/anton-latin-400-normal.woff2") format("woff2"); }
  @font-face { font-family: "Open Sans"; font-weight: 400; font-display: swap; src: url("../fonts/open-sans-latin-400-normal.woff2") format("woff2"); }
  @font-face { font-family: "Open Sans"; font-weight: 600; font-display: swap; src: url("../fonts/open-sans-latin-600-normal.woff2") format("woff2"); }
  @font-face { font-family: "Open Sans"; font-weight: 800; font-display: swap; src: url("../fonts/open-sans-latin-800-normal.woff2") format("woff2"); }
  :root {
    --bg: #0c0a18; --bg2: #141127; --card: rgba(255,255,255,.045); --line: rgba(255,255,255,.1);
    --ink: #f6f3ff; --dim: #c3bedb; --muted: #8f89ad;
    --pink: #ff3d7f; --pink2: #e43a6c; --cyan: #33e1ff; --gold: #ffd86b; --violet: #8b5cff; --green: #3dff9a; --red: #ff5a5a;
    --display: "Anton", "Arial Narrow", Impact, sans-serif;
    --font: "Open Sans", "Helvetica Neue", Arial, sans-serif;
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; }
  body { background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; overflow-x: hidden;
    background-image: radial-gradient(900px 500px at 85% -10%, rgba(139,92,255,.22), transparent 60%), radial-gradient(700px 500px at -10% 30%, rgba(255,61,127,.14), transparent 60%); background-attachment: fixed; }
  a { color: var(--cyan); }
  button { font: inherit; color: inherit; }
  [hidden] { display: none !important; }
  .display { font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: .4px; line-height: .95; }
  .wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

  /* nav */
  .nav { position: sticky; top: 0; z-index: 30; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); background: rgba(12,10,24,.75); border-bottom: 1px solid var(--line); }
  .nav .wrap { display: flex; align-items: center; gap: 14px; height: 60px; }
  .brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
  .brand .tagm { font-family: var(--display); font-size: 17px; letter-spacing: 1px; color: #fff; background: var(--pink2); padding: 3px 14px 3px 10px; clip-path: polygon(0 0, 100% 0, 92% 100%, 0 100%); }
  .brand b { font-weight: 800; font-size: 14px; }
  .nav .links { margin-left: auto; display: flex; gap: 10px; align-items: center; }
  .nav .links a { color: var(--dim); text-decoration: none; font-weight: 600; font-size: 14px; }
  .nav .links a:hover { color: #fff; }
  .pill { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; }
  .pill:hover { border-color: rgba(255,255,255,.3); }
  .pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
  .pill.on .dot { background: var(--green); box-shadow: 0 0 10px var(--green); }
  @media (max-width: 560px) { .nav .links a.hide-s { display: none; } .brand b { display: none; } }

  /* buttons */
  .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px; padding: 13px 22px; font-weight: 800; font-size: 15px; cursor: pointer; text-decoration: none; background: linear-gradient(135deg, var(--pink), var(--violet)); color: #fff; box-shadow: 0 8px 30px rgba(255,61,127,.3); }
  .btn:hover { filter: brightness(1.1); }
  .btn.ghost { background: var(--card); border: 1px solid var(--line); box-shadow: none; }
  .btn[disabled] { opacity: .4; cursor: default; filter: none; }

  /* ---------- level select ---------- */
  .hero { padding: 44px 0 18px; display: grid; grid-template-columns: 1.15fr .85fr; gap: 30px; align-items: center; }
  .eyebrow { color: var(--cyan); font-weight: 800; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; }
  .hero h1 { font-size: clamp(52px, 9vw, 96px); margin: 8px 0 14px; }
  .hero h1 .g { background: linear-gradient(90deg, var(--pink), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
  .hero p { color: var(--dim); margin: 0 0 12px; max-width: 560px; }
  .how { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 20px 22px; }
  .how h3 { margin: 0 0 10px; font-size: 15px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--gold); }
  .how ol { margin: 0; padding-left: 20px; color: var(--dim); font-size: 14.5px; }
  .how li { margin: 5px 0; }
  .how li b { color: var(--ink); }
  .keys { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
  .key { font-size: 12.5px; font-weight: 700; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; color: var(--dim); }
  @media (max-width: 820px) { .hero { grid-template-columns: 1fr; padding-top: 28px; } }

  .opts { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 10px 0 18px; }
  .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
  .seg button { border: 0; background: transparent; padding: 9px 16px; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--dim); }
  .seg button.on { background: rgba(51,225,255,.16); color: #fff; }
  .opts .lbl { color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }

  .levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; padding-bottom: 50px; }
  .lvl { position: relative; text-align: left; border: 1px solid var(--line); background: linear-gradient(160deg, rgba(255,255,255,.06), rgba(255,255,255,.02)); border-radius: 20px; padding: 18px 18px 16px; cursor: pointer; transition: transform .15s, border-color .15s; display: flex; flex-direction: column; gap: 6px; min-height: 190px; }
  .lvl:hover:not(.locked) { transform: translateY(-3px); border-color: rgba(255,61,127,.6); }
  .lvl .n { font-family: var(--display); font-size: 44px; line-height: 1; color: var(--pink); }
  .lvl h4 { margin: 0; font-size: 17px; }
  .lvl p { margin: 0; color: var(--dim); font-size: 13.5px; line-height: 1.45; flex: 1; }
  .lvl .stars { font-size: 18px; letter-spacing: 2px; color: rgba(255,255,255,.18); }
  .lvl .stars .s { color: var(--gold); text-shadow: 0 0 12px rgba(255,216,107,.6); }
  .lvl .best { font-size: 12.5px; color: var(--muted); font-weight: 700; }
  .lvl.locked { cursor: default; opacity: .5; }
  .lvl.locked .n { color: var(--muted); }
  .lvl .tag { position: absolute; top: 14px; right: 14px; font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; background: rgba(51,225,255,.14); color: var(--cyan); }
  .lvl .tag.ph { background: rgba(255,216,107,.14); color: var(--gold); }

  /* ---------- game ---------- */
  .game { padding: 18px 0 40px; }
  .ghead { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
  .ghead h2 { font-size: 30px; margin: 0; }
  .ghead .sub { color: var(--muted); font-weight: 700; font-size: 14px; }
  .ghead .score { margin-left: auto; display: flex; gap: 10px; }
  .chip { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 6px 14px; text-align: center; min-width: 74px; }
  .chip small { display: block; font-size: 10.5px; color: var(--muted); font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; }
  .chip b { font-family: var(--display); font-size: 24px; font-weight: 400; line-height: 1.1; }
  .chip.turn b { color: var(--cyan); }

  .booth { background: linear-gradient(180deg, #17142c, #100d20); border: 1px solid var(--line); border-radius: 24px; padding: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
  .deckrow { display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: center; }
  .deckrow + .deckrow { margin-top: 10px; }
  .dtag { display: flex; flex-direction: column; gap: 2px; }
  .dtag .d { font-family: var(--display); font-size: 22px; }
  .dtag .t { font-size: 12px; color: var(--dim); line-height: 1.3; }
  .dtag .bpm { font-size: 11.5px; color: var(--muted); font-weight: 700; }
  .deckrow.a .d { color: var(--cyan); }
  .deckrow.b .d { color: var(--pink); }
  .wave { position: relative; height: 84px; border-radius: 14px; background: rgba(0,0,0,.35); border: 1px solid var(--line); overflow: hidden; }
  .wave canvas { width: 100%; height: 100%; display: block; }
  .wave .hide { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; background: repeating-linear-gradient(90deg, rgba(255,255,255,.02) 0 2px, transparent 2px 10px); }
  @media (max-width: 600px) { .deckrow { grid-template-columns: 1fr; gap: 6px; } .dtag { flex-direction: row; align-items: baseline; gap: 10px; } .wave { height: 64px; } }

  .stage { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; margin-top: 16px; }
  @media (max-width: 700px) { .stage { grid-template-columns: 1fr; justify-items: center; text-align: center; } }
  .count { display: flex; flex-direction: column; gap: 12px; }
  .lights { display: flex; gap: 14px; align-items: center; min-height: 66px; }
  .light { width: 46px; height: 46px; border-radius: 50%; border: 2px solid rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 20px; color: var(--muted); transition: background .06s, box-shadow .06s, transform .06s; }
  .light.one { width: 62px; height: 62px; font-size: 28px; border-color: rgba(61,255,154,.45); }
  .light.lit { background: var(--cyan); border-color: var(--cyan); color: #0c0a18; box-shadow: 0 0 26px var(--cyan); transform: scale(1.06); }
  .light.one.lit { background: var(--green); border-color: var(--green); box-shadow: 0 0 34px var(--green); }
  .bars { display: flex; gap: 6px; }
  .bar { flex: 1; max-width: 46px; height: 12px; border-radius: 4px; background: rgba(255,255,255,.08); position: relative; }
  .bar.lit { background: var(--gold); box-shadow: 0 0 12px rgba(255,216,107,.6); }
  .bar.first { background: rgba(61,255,154,.25); }
  .bar.first.lit { background: var(--green); box-shadow: 0 0 14px var(--green); }
  .barslbl { font-size: 11.5px; color: var(--muted); font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; }
  .msg { min-height: 56px; }
  .msg .big { font-family: var(--display); font-size: clamp(28px, 5vw, 42px); line-height: 1; text-transform: uppercase; }
  .msg .small { color: var(--dim); font-size: 14.5px; margin-top: 4px; }
  .msg .big.perfect { color: var(--green); text-shadow: 0 0 24px rgba(61,255,154,.5); }
  .msg .big.great { color: var(--cyan); }
  .msg .big.good { color: var(--gold); }
  .msg .big.loose { color: #ffb36b; }
  .msg .big.wreck { color: var(--red); }

  .playwrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
  .playbtn { width: 132px; height: 132px; border-radius: 50%; border: 3px solid rgba(255,61,127,.5); background: radial-gradient(circle at 50% 35%, #2a2347, #15122a); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 4px; font-family: var(--display); font-size: 26px; letter-spacing: 1px; touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; transition: transform .05s; }
  .playbtn svg { width: 34px; height: 34px; }
  .playbtn.ready { animation: ready 1s infinite; border-color: var(--green); color: var(--green); }
  .playbtn.playing { border-color: var(--green); background: radial-gradient(circle at 50% 35%, #1d5a3c, #0f2e20); color: #fff; box-shadow: 0 0 40px rgba(61,255,154,.4); }
  .playbtn:active { transform: scale(.96); }
  @keyframes ready { 50% { box-shadow: 0 0 30px rgba(61,255,154,.45); } }
  .playlbl { font-size: 12px; color: var(--muted); font-weight: 700; text-align: center; }

  .meter { margin-top: 16px; }
  .meter .trk { position: relative; height: 34px; border-radius: 10px; background: linear-gradient(90deg, rgba(255,90,90,.25), rgba(255,179,107,.2) 20%, rgba(255,216,107,.2) 35%, rgba(61,255,154,.35) 50%, rgba(255,216,107,.2) 65%, rgba(255,179,107,.2) 80%, rgba(255,90,90,.25)); border: 1px solid var(--line); }
  .meter .mid { position: absolute; left: 50%; top: -4px; bottom: -4px; width: 2px; background: var(--green); }
  .meter .mk { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px #fff; transition: left .3s; }
  .meter .mk.old { width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; background: rgba(255,255,255,.45); box-shadow: none; }
  .meter .mk.p2 { background: var(--pink); box-shadow: 0 0 10px var(--pink); }
  .meter .mk.p2.old { background: rgba(255,61,127,.5); box-shadow: none; }
  .meter .ends { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); font-weight: 800; letter-spacing: 1px; text-transform: uppercase; margin-top: 5px; }

  .gfoot { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; align-items: center; }
  .gfoot .tip { color: var(--muted); font-size: 13px; margin-left: auto; }

  /* ---------- results ---------- */
  .modal { position: fixed; inset: 0; z-index: 60; background: rgba(5,4,12,.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 16px; }
  .card { width: min(520px, 100%); max-height: 92vh; overflow: auto; background: linear-gradient(170deg, #1d1838, #120f24); border: 1px solid var(--line); border-radius: 24px; padding: 26px; box-shadow: 0 30px 90px rgba(0,0,0,.6); text-align: center; }
  .card h3 { font-size: 40px; margin: 0 0 6px; }
  .card .bigstars { font-size: 40px; letter-spacing: 6px; color: rgba(255,255,255,.15); margin: 6px 0; }
  .card .bigstars .s { color: var(--gold); text-shadow: 0 0 20px rgba(255,216,107,.7); }
  .card .tot { font-family: var(--display); font-size: 56px; line-height: 1; }
  .card .tot small { font-size: 22px; color: var(--muted); }
  .card p { color: var(--dim); margin: 10px 0; }
  .card table { width: 100%; border-collapse: collapse; margin: 12px 0 18px; font-size: 14px; }
  .card td { padding: 6px 8px; border-top: 1px solid var(--line); text-align: left; }
  .card td:last-child { text-align: right; font-weight: 800; }
  .card .acts { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
  .card .vs { display: flex; gap: 12px; justify-content: center; margin: 8px 0 4px; }
  .card .vs div { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
  .card .vs b { display: block; font-family: var(--display); font-size: 34px; font-weight: 400; }
  .card .vs .win { border-color: var(--gold); box-shadow: 0 0 20px rgba(255,216,107,.25); }
  .range { width: 100%; }
  .loading { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; background: rgba(5,4,12,.6); font-weight: 800; letter-spacing: 1px; }

  /* medals (as in the KS3 schemes: Bronze, Silver, Gold) */
  .medals { display: inline-flex; gap: 6px; align-items: center; }
  .medal { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; font-size: 11px; font-weight: 800; color: rgba(255,255,255,.25); border: 2px solid rgba(255,255,255,.14); }
  .medal.won.bronze { background: radial-gradient(circle at 35% 30%, #f0b27a, #a0522d); border-color: #f0b27a; color: #3a1d08; box-shadow: 0 0 12px rgba(205,127,50,.6); }
  .medal.won.silver { background: radial-gradient(circle at 35% 30%, #ffffff, #9aa3ad); border-color: #e8ecf0; color: #2a2f36; box-shadow: 0 0 12px rgba(220,225,230,.6); }
  .medal.won.gold { background: radial-gradient(circle at 35% 30%, #fff1a8, #d4a017); border-color: #ffe27a; color: #3d2a00; box-shadow: 0 0 14px rgba(255,216,107,.8); }
  .card .medals .medal { width: 54px; height: 54px; font-size: 13px; border-width: 3px; }
  .card .medal-line { margin: 10px 0 4px; }
  .lvl .medal-name { font-size: 12.5px; color: var(--muted); font-weight: 700; }
  .dtag .d { white-space: nowrap; }
  @media (max-width: 600px) { .ears .wave { display: none; } }

  /* "Next drop / Next round": big and flashing once a go has finished */
  .btn.next-go { align-self: flex-start; margin-top: 4px; padding: 15px 30px; font-size: 18px; background: linear-gradient(135deg, var(--green), var(--cyan)); color: #06121a; box-shadow: 0 0 0 0 rgba(61,255,154,.7); animation: next-flash 1s ease-in-out infinite; }
  .btn.next-go:hover { filter: brightness(1.08); }
  @keyframes next-flash { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(61,255,154,.65); } 50% { transform: scale(1.06); box-shadow: 0 0 0 14px rgba(61,255,154,0); } }
  @media (prefers-reduced-motion: reduce) { .btn.next-go { animation: none; } }
  @media (max-width: 700px) { .btn.next-go { align-self: center; } }
  .tm-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 10px 16px 30px; opacity: .8; }
  /* Drop on the One: saving a loose drop with the jog */
  .dnudge { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 4px; }
  .dn-row { display: flex; gap: 8px; }
  .nudge { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 13px; font-weight: 800; font-size: 13px; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; color: var(--ink); }
  .dnudge .nudge { border-color: var(--cyan); animation: nudge-flash 1s ease-in-out infinite; }
  .nudge.on { background: rgba(255,61,127,.3); border-color: var(--pink); animation: none; }
  @keyframes nudge-flash { 50% { box-shadow: 0 0 18px rgba(51,225,255,.55); } }
  .meter .mk.live { background: var(--cyan); box-shadow: 0 0 14px var(--cyan); transition: none; }
