/* Half Full. Layout: one glass, center stage under a bar spotlight; controls at thumb height.
   A deliberate single look: saturated cobalt with glowing liquid. */
:root {
  --bg: #2034e6;
  --bg-deep: #121f9e;
  --glow: #4a5cff;
  --ink: #ffffff;
  --soft: rgba(255, 255, 255, 0.74);
  --faint: rgba(255, 255, 255, 0.16);
  --panel: rgba(10, 16, 90, 0.45);
  --sun: #ffe14d;
  --sun-ink: #1a2280;
  --font-display: "Dela Gothic One", "Arial Black", Impact, sans-serif;
  --font-body: "Outfit", "Segoe UI", system-ui, sans-serif;
  --font-mono: "DM Mono", ui-monospace, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.4;
  background: radial-gradient(120% 70% at 50% 38%, var(--glow) 0%, var(--bg) 45%, var(--bg-deep) 100%) no-repeat, var(--bg);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-top: max(12px, env(safe-area-inset-top, 0px)); padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.app { max-width: 460px; height: 100%; margin: 0 auto; display: grid; grid-template-rows: auto auto 1fr auto auto; gap: 8px; }
.app.results { grid-template-rows: auto auto auto; align-content: start; height: auto; min-height: 100%; }
.legal { display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 14px; color: var(--soft); }
.legal a { color: var(--ink); text-decoration: underline; padding: 4px 2px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.brand { display: flex; align-items: baseline; gap: 8px; }
.logo { font-family: var(--font-display); font-size: 22px; letter-spacing: 0.01em; line-height: 1; }
.logo span { color: var(--sun); }
.num { font-family: var(--font-mono); font-size: 13px; color: var(--soft); }
.right { display: flex; align-items: center; gap: 8px; }
.streak { font-family: var(--font-mono); font-size: 13px; background: var(--faint); padding: 6px 10px; border-radius: 999px; }
.icon { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--faint); color: var(--ink); font-size: 16px; cursor: pointer; display: grid; place-items: center; font-family: var(--font-body); font-weight: 700; }
.task { text-align: center; display: grid; gap: 4px; align-content: center; }
.task .glassname { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--soft); }
.task h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(22px, 7vw, 30px); line-height: 1.05; margin: 0; text-wrap: balance; }
.dots { display: flex; gap: 6px; justify-content: center; margin-top: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); transition: background 300ms, transform 300ms; }
.dot.on { background: var(--ink); transform: scale(1.2); }
.dot.done { background: var(--sun); }
.banner { text-align: center; font-size: 14px; font-weight: 700; background: var(--sun); color: var(--sun-ink); padding: 6px 12px; border-radius: 999px; justify-self: center; }
.stage { position: relative; min-height: 220px; overflow: hidden; border-radius: 18px; touch-action: none; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
.viewtoggle { position: absolute; top: 10px; right: 10px; display: flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--panel); }
.viewtoggle button { border: 0; border-radius: 999px; padding: 6px 12px; background: transparent; color: var(--soft); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: background 200ms, color 200ms; }
.viewtoggle button.on { background: #fff; color: var(--sun-ink); }
.tools { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 6px; align-items: center; pointer-events: none; }
.tools .tip { font-size: 12px; color: var(--soft); background: var(--panel); padding: 5px 10px; border-radius: 999px; }
.tools button { pointer-events: auto; border: 0; border-radius: 999px; padding: 7px 12px; background: rgba(255, 255, 255, 0.92); color: var(--sun-ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.tag { position: absolute; transform: translate(0, -50%); font-weight: 700; font-size: 14px; padding: 3px 9px; border-radius: 999px; pointer-events: none; white-space: nowrap; }
.tag.half { background: var(--sun); color: var(--sun-ink); }
.tag.you { background: #fff; color: var(--sun-ink); transform: translate(-100%, -50%); }
.fallback { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--soft); }
.controls { display: grid; gap: 10px; }
.hint { text-align: center; font-size: 14px; color: var(--soft); margin: 0; min-height: 1.4em; }
.pourrow { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.hold {
  border: 0; border-radius: 999px; padding: 20px; width: 100%; cursor: pointer; touch-action: none;
  font-family: var(--font-display); font-size: clamp(15px, 4.6vw, 20px); white-space: nowrap; letter-spacing: 0.02em; color: var(--sun-ink); background: var(--sun);
  box-shadow: 0 8px 0 #c9a920, 0 14px 30px rgba(0, 0, 0, 0.25); transition: transform 80ms, box-shadow 80ms;
}
.hold.down { transform: translateY(6px); box-shadow: 0 2px 0 #c9a920, 0 6px 16px rgba(0, 0, 0, 0.25); }
.drain {
  border: 3px solid rgba(255, 255, 255, 0.85); border-radius: 999px; padding: 17px 10px; background: var(--panel); cursor: pointer; touch-action: none;
  font-family: var(--font-display); font-size: 17px; letter-spacing: 0.02em; color: var(--ink); transition: transform 80ms, background 80ms;
}
.drain.down { transform: translateY(4px); background: rgba(10, 16, 90, 0.7); }
.drain:disabled { opacity: 0.35; cursor: default; }
.btn { border: 2px solid var(--faint); border-radius: 999px; padding: 14px; background: transparent; color: var(--ink); font: inherit; font-weight: 700; font-size: 16px; cursor: pointer; text-align: center; text-decoration: none; }
.btn.solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.sun { background: var(--sun); color: var(--sun-ink); border-color: var(--sun); }
.btn:disabled { opacity: 0.35; cursor: default; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.reveal { text-align: center; display: grid; gap: 6px; }
.score { font-family: var(--font-display); font-size: 58px; line-height: 0.9; font-variant-numeric: tabular-nums; }
.score small { font-size: 22px; color: var(--soft); }
.verdict { font-weight: 700; font-size: 18px; }
.fact { font-size: 15px; color: var(--soft); margin: 0 auto; max-width: 34ch; }

/* Results */
.final { display: grid; gap: 14px; text-align: center; padding-bottom: 12px; }
.final .total { font-family: var(--font-display); font-size: 84px; line-height: 0.9; font-variant-numeric: tabular-nums; }
.final .total small { font-size: 28px; color: var(--soft); }
.rank { font-size: 18px; font-weight: 700; min-height: 1.4em; }
.rank b { color: var(--sun); }
.rounds { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.rounds div { background: var(--faint); border-radius: 12px; padding: 10px 2px; display: grid; gap: 2px; }
.rounds b { font-family: var(--font-display); font-weight: 400; font-size: 20px; }
.rounds span { font-size: 12px; color: var(--soft); }
.panel { background: var(--panel); border-radius: 16px; padding: 14px; display: grid; gap: 10px; text-align: left; }
.label { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--soft); }
.hist { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; align-items: end; height: 90px; }
.hist div { background: rgba(255, 255, 255, 0.35); border-radius: 4px 4px 0 0; min-height: 3px; }
.hist div.me { background: var(--sun); }
.histaxis { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 11px; color: var(--soft); }
.versus { font-size: 17px; font-weight: 700; text-align: center; }
.next { font-family: var(--font-mono); font-size: 14px; color: var(--soft); }
.next b { color: var(--ink); font-variant-numeric: tabular-nums; }
.tip { display: grid; gap: 6px; justify-items: center; }
.tip .btn { padding: 10px 18px; font-size: 15px; }
.tip p { margin: 0; font-size: 13px; color: var(--soft); max-width: 32ch; }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-size: 14px; }
.links a, .links button { color: var(--soft); background: none; border: 0; font: inherit; text-decoration: underline; cursor: pointer; padding: 4px; white-space: nowrap; }
.app.results .legal { display: none; } /* the results screen already links to both */

/* Overlays */
.overlay { position: fixed; inset: 0; background: rgba(8, 12, 60, 0.7); display: grid; place-items: center; padding: 16px; z-index: 10; }
.sheet { width: min(420px, 100%); max-height: 90vh; overflow: auto; background: var(--bg); border-radius: 22px; padding: 22px; display: grid; gap: 14px; box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4); }
.sheet h2 { font-family: var(--font-display); font-weight: 400; font-size: 26px; margin: 0; line-height: 1.05; }
.steps { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.steps li { display: grid; grid-template-columns: 28px 1fr; gap: 8px; }
.steps .k { font-family: var(--font-display); color: var(--sun); }
.archive { display: grid; gap: 6px; }
.archive a { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--faint); color: var(--ink); text-decoration: none; font-weight: 600; }
.archive a span { font-family: var(--font-mono); color: var(--soft); font-weight: 500; }
@media (prefers-reduced-motion: reduce) { .hold, .dot, .drain, .viewtoggle button { transition: none; } }
