/* Camping Cup, Riviera: the villa pool by day (and by night in dark mode).
   Serif for display and scores, sans for everything you read. Glass is heavier on big
   surfaces, lighter on small ones. Colour means something: lagoon = now, gold = leader,
   one colour per card, one per team. */
:root {
  --bg: #F4F8F8; --bg-solid: #FFFFFF; --ink: #0D3A43; --text: #3F5F66; --muted: #7C9599; --hair: rgba(13, 58, 67, 0.08);
  --lagoon: #1C8C9E; --lagoon-soft: rgba(28, 140, 158, 0.10); --on-lagoon: #FFFFFF;
  --gold: #B97C12; --gold-soft: rgba(201, 138, 26, 0.10);
  --plus: #1C8C9E; --minus: #C4553F;
  --c-j: #C98A1A; --c-pa: #2E9C78; --c-sa: #C4553F; --c-du: #0D3A43;
  --t0: #C4553F; --t1: #1C8C9E; --t2: #C98A1A;
  --glass: rgba(255, 255, 255, 0.72); --glass-heavy: rgba(255, 255, 255, 0.82); --glass-edge: rgba(255, 255, 255, 0.9);
  --shadow: 0 1px 2px rgba(13, 58, 67, 0.04), 0 12px 36px -8px rgba(13, 58, 67, 0.12);
  --band: linear-gradient(180deg, #CBE8ED 0%, #E0F2F4 70%, #F4F8F8 100%); --rip: rgba(255, 255, 255, 0.95);
  --serif: "Instrument Serif", Georgia, serif; --sans: "Instrument Sans", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --gutter: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E2226; --bg-solid: #13292E; --ink: #E6F0EE; --text: #B5C8C9; --muted: #7F9699; --hair: rgba(230, 240, 238, 0.08);
    --lagoon: #5FC0D8; --lagoon-soft: rgba(95, 192, 216, 0.12); --on-lagoon: #06232A;
    --gold: #E6B25A; --gold-soft: rgba(230, 178, 90, 0.10); --plus: #5FC0D8; --minus: #E8866F;
    --c-j: #E6B25A; --c-pa: #5CC9A2; --c-sa: #E8866F; --c-du: #CFE3E6;
    --t0: #E8866F; --t1: #5FC0D8; --t2: #E6B25A;
    --glass: rgba(20, 44, 50, 0.62); --glass-heavy: rgba(20, 44, 50, 0.74); --glass-edge: rgba(255, 255, 255, 0.06);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 12px 36px -8px rgba(0, 0, 0, 0.4);
    --band: linear-gradient(180deg, #0F3A42 0%, #0F2C31 70%, #0E2226 100%); --rip: rgba(160, 230, 240, 0.14);
    color-scheme: dark;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; overscroll-behavior-y: none; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; min-height: 100svh; position: relative; overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; text-align: inherit; }
:focus-visible { outline: 2px solid var(--lagoon); outline-offset: 2px; border-radius: 8px; }
.num { font-variant-numeric: lining-nums tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
i[class*="ph"] { line-height: 1; }

/* Water band with slow ripples, behind the top of every page */
.band { position: absolute; inset: 0 0 auto; height: 520px; pointer-events: none; background: var(--band); overflow: hidden; z-index: 0; }
.band::after { content: ""; position: absolute; inset: -40px; opacity: 0.55;
  background: repeating-radial-gradient(ellipse 70px 24px at 25% 35%, transparent 0 15px, var(--rip) 16px, transparent 18.5px 32px),
              repeating-radial-gradient(ellipse 80px 28px at 72% 60%, transparent 0 17px, var(--rip) 18px, transparent 20.5px 36px);
  filter: blur(0.6px); animation: ripple 24s ease-in-out infinite alternate;
  mask-image: linear-gradient(#000 35%, transparent); -webkit-mask-image: linear-gradient(#000 35%, transparent); }
@keyframes ripple { to { transform: translate(26px, 12px) scale(1.05); } }

.wrap { position: relative; z-index: 1; max-width: 640px; margin: 0 auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-left)) calc(110px + env(safe-area-inset-bottom)); }

/* Top bar */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: max(14px, env(safe-area-inset-top)); min-height: 56px; font-size: 14px; font-weight: 500; color: var(--text); }
.bar a, .bar button { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--ink); font-weight: 500; }
.bar i { font-size: 17px; color: var(--lagoon); }
.live { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px 0 9px; border-radius: 99px; font-size: 13px; color: var(--text);
  background: var(--glass); border: 1px solid var(--glass-edge); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.live i { width: 6px; height: 6px; border-radius: 50%; background: #2BB3A3; box-shadow: 0 0 0 3px rgba(43, 179, 163, 0.22); }
.live.off i { background: var(--muted); box-shadow: none; }

/* Type */
h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(76px, 22vw, 96px); line-height: 0.86; letter-spacing: -0.025em; }
h1 i { color: var(--lagoon); font-style: italic; padding-right: 0.04em; }
h2 { font-family: var(--serif); font-weight: 400; font-style: italic; font-size: 34px; line-height: 1; letter-spacing: -0.01em; margin: 40px 0 14px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
h2 small { font-family: var(--sans); font-style: normal; font-size: 13px; color: var(--muted); letter-spacing: 0.01em; text-align: right; }
h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.005em; margin: 22px 0 8px; color: var(--text); }
.lede { font-family: var(--serif); font-size: 24px; line-height: 1.2; letter-spacing: -0.005em; margin-top: 16px; max-width: 22em; }
.lede em { color: var(--text); }
.meta { margin-top: 10px; font-size: 14px; color: var(--muted); }
.muted { color: var(--muted); }
p.note { font-size: 14px; color: var(--muted); margin-top: 10px; }
b, strong { font-weight: 600; }

/* Materials */
.surf { background: var(--glass-heavy); border: 1px solid var(--glass-edge); border-radius: 20px; box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(28px) saturate(1.5); backdrop-filter: blur(28px) saturate(1.5); }
.tile { background: var(--glass); border: 1px solid var(--glass-edge); border-radius: 16px; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.rows > * + * { box-shadow: 0 -1px 0 var(--hair); }
.pad { padding: 4px 16px; }
@media (prefers-reduced-transparency: reduce) { .surf, .tile, .live, .dock { background: var(--bg-solid); -webkit-backdrop-filter: none; backdrop-filter: none; } }

/* Icon badge */
.badge { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--lagoon-soft); color: var(--lagoon); font-size: 23px; }
.badge.solid { background: var(--lagoon); color: var(--on-lagoon); }
.badge.gold { background: var(--gold-soft); color: var(--gold); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 22px; border-radius: 99px;
  background: var(--ink); color: var(--bg); font-weight: 600; font-size: 16px; letter-spacing: -0.005em;
  transition: transform 140ms var(--ease-out), opacity 140ms ease; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.3; cursor: default; }
.btn:disabled:active { transform: none; }
.btn i { font-size: 18px; }
.btn.block { width: 100%; }
.btn.big { min-height: 58px; font-size: 17px; }
.btn.lagoon { background: var(--lagoon); color: var(--on-lagoon); }
.btn.ghost { background: var(--glass-heavy); color: var(--ink); box-shadow: inset 0 0 0 1px var(--hair); }
.btn.quiet { background: transparent; color: var(--muted); padding: 0 10px; min-height: 44px; font-weight: 500; }
.btn.danger { background: transparent; color: var(--minus); padding: 0 10px; }
@media (hover: hover) and (pointer: fine) { .btn:not(:disabled):hover { opacity: 0.9; } }

/* Card chips: one colour per card, faded outline once used */
.cc { --cc: var(--c-du); display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px 0 8px; border-radius: 99px;
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.005em; color: var(--ink); white-space: nowrap;
  background: color-mix(in srgb, var(--cc) 11%, transparent); }
.cc i { font-size: 15px; color: var(--cc); }
.cc .t { color: var(--muted); font-weight: 500; }
.c-J { --cc: var(--c-j); } .c-PA { --cc: var(--c-pa); } .c-SA { --cc: var(--c-sa); } .c-DU { --cc: var(--c-du); }
.cc.u { background: transparent; box-shadow: inset 0 0 0 1px var(--hair); color: var(--muted); opacity: 0.55; }
.cc.u i { color: var(--muted); }
.hand { display: flex; flex-wrap: wrap; gap: 5px; }
.pass { color: var(--muted); font-size: 14px; }

/* Team marks */
.tm { --tc: var(--muted); display: inline-grid; place-items: center; flex: none; width: var(--s, 30px); height: var(--s, 30px); border-radius: 50%;
  background: var(--tc); color: #fff; font-family: var(--serif); font-size: calc(var(--s, 30px) * 0.62); line-height: 1; }
.tm.t0 { --tc: var(--t0); } .tm.t1 { --tc: var(--t1); } .tm.t2 { --tc: var(--t2); }
.tm.sm { --s: 22px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 50; transform: translate(-50%, 0); max-width: calc(100% - 40px);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-size: 15px; font-weight: 500; box-shadow: var(--shadow);
  transition: transform 240ms var(--ease-out), opacity 240ms var(--ease-out); }
.toast[hidden] { display: block; opacity: 0; transform: translate(-50%, 12px); pointer-events: none; visibility: hidden; transition: transform 200ms var(--ease-out), opacity 200ms ease, visibility 0s linear 200ms; }

/* PIN sheet */
.sheet-back { position: fixed; inset: 0; z-index: 40; background: rgba(6, 30, 36, 0.35); transition: opacity 220ms ease; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; margin: 0 auto; max-width: 480px; background: var(--bg-solid); border-radius: 26px 26px 0 0;
  padding: 26px var(--gutter) calc(20px + env(safe-area-inset-bottom)); transition: transform 320ms cubic-bezier(0.32, 0.72, 0, 1); }
.sheet-back[hidden], .sheet[hidden] { display: block; pointer-events: none; visibility: hidden; }
.sheet-back[hidden] { opacity: 0; transition: opacity 220ms ease, visibility 0s linear 220ms; }
.sheet[hidden] { transform: translateY(105%); transition: transform 240ms var(--ease-out), visibility 0s linear 240ms; }
.sheet h3 { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 32px; color: var(--ink); margin: 0; }
.sheet p { color: var(--muted); font-size: 15px; margin-top: 4px; }
.pin-input { width: 100%; margin: 20px 0 12px; height: 62px; border-radius: 16px; border: 1px solid var(--hair); background: var(--bg);
  text-align: center; font-size: 28px; letter-spacing: 0.4em; font-weight: 600; color: var(--ink); }
.pin-input:focus { outline: 2px solid var(--lagoon); outline-offset: 0; }
.pin-err { color: var(--minus) !important; min-height: 1.4em; margin: 0 0 8px !important; }

/* Admin dock */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 10px max(var(--gutter), env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 70%, transparent); -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5);
  border-top: 1px solid var(--hair); }
.dock-in { max-width: 640px; margin: 0 auto; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.dock .btn { min-height: 44px; font-size: 15px; }

/* Entrances: rows and tiles rise in once */
.rise { animation: rise 460ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) {
  .band::after, .rise { animation: none; }
  .btn:active { transform: none; }
}

/* Phones: chips in dense lists show only the icon; names come back on wide screens */
@media (max-width: 959px) {
  .cc.short { width: 28px; padding: 0; justify-content: center; border-radius: 9px; }
  .cc.short .l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .cc.short i { font-size: 16px; }
}

/* ---------- The draw show (full screen) ---------- */
.draw { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; overflow: hidden auto; overscroll-behavior: contain;
  background: radial-gradient(120% 90% at 50% 0%, #125461 0%, #0B3440 45%, #06212A 100%); color: #EAF6F5;
  padding: max(24px, env(safe-area-inset-top)) var(--gutter) max(24px, env(safe-area-inset-bottom));
  clip-path: circle(0% at 50% 50%); transition: clip-path 700ms cubic-bezier(0.77, 0, 0.175, 1), opacity 320ms ease; }
.draw.on { clip-path: circle(150% at 50% 50%); }
.draw.off { opacity: 0; }
body.drawing { overflow: hidden; }
.draw-water { position: absolute; inset: 0; pointer-events: none; opacity: 0.2;
  background: repeating-radial-gradient(ellipse 80px 28px at 30% 30%, transparent 0 17px, rgba(160, 230, 240, 0.35) 18px, transparent 20.5px 36px),
              repeating-radial-gradient(ellipse 90px 30px at 70% 70%, transparent 0 19px, rgba(160, 230, 240, 0.3) 20px, transparent 22.5px 40px);
  animation: ripple 14s ease-in-out infinite alternate; }
.draw-beams { position: absolute; inset: -50%; pointer-events: none; opacity: 0.5; mix-blend-mode: screen; }
.draw-beams i { position: absolute; inset: 0; background: conic-gradient(from 0deg at 50% 50%, transparent 0 20deg, rgba(95, 192, 216, 0.14) 30deg, transparent 44deg 160deg, rgba(230, 178, 90, 0.10) 172deg, transparent 186deg 360deg);
  animation: beams 22s linear infinite; }
.draw-beams i + i { animation-duration: 34s; animation-direction: reverse; opacity: 0.7; }
@keyframes beams { to { transform: rotate(360deg); } }

/* Countdown */
.draw-count { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 2; }
.draw-count b { grid-area: 1 / 1; font-family: var(--serif); font-weight: 400; font-size: clamp(160px, 48vw, 340px); line-height: 1; color: #fff;
  animation: countIn 600ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.draw-count i { grid-area: 1 / 1; width: 120px; height: 120px; border-radius: 50%; border: 1.5px solid rgba(160, 230, 240, 0.55); background: none; animation: shock 600ms cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes countIn { 0% { opacity: 0; transform: scale(1.6); } 35% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(0.85); } }
@keyframes shock { from { transform: scale(0.4); opacity: 1; } to { transform: scale(4.5); opacity: 0; } }

.draw-in { position: relative; z-index: 1; width: min(100%, 980px); display: grid; justify-items: center; gap: clamp(12px, 2.6vh, 28px); text-align: center;
  opacity: 0; transition: opacity 400ms ease; }
.draw.staged .draw-in { opacity: 1; }
.draw-top { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; letter-spacing: 0.08em; color: rgba(234, 246, 245, 0.7); }
.draw-badge { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #1C8C9E; color: #fff; font-size: 21px; box-shadow: 0 0 0 0 rgba(95, 192, 216, 0.6); animation: badgePulse 2s ease-out infinite; }
@keyframes badgePulse { 0% { box-shadow: 0 0 0 0 rgba(95, 192, 216, 0.55); } 70%, 100% { box-shadow: 0 0 0 14px transparent; } }
.draw-title { margin: 0 0 10px; display: block; font-family: var(--serif); font-style: italic; font-weight: 400; font-size: clamp(52px, min(14vw, 13vh), 128px); line-height: 0.9; letter-spacing: -0.02em; color: #fff; }
.draw-title span { display: inline-block; opacity: 0; transform: translateY(0.5em) rotate(6deg); filter: blur(8px); }
.draw.titled .draw-title span { opacity: 1; transform: none; filter: none; transition: opacity 500ms var(--ease-out) var(--d), transform 700ms cubic-bezier(0.34, 1.56, 0.64, 1) var(--d), filter 500ms ease var(--d); }

/* The wheel */
.draw-wheel { position: relative; width: min(100%, 640px); height: clamp(120px, 20vh, 190px);
  transition: height 600ms cubic-bezier(0.77, 0, 0.175, 1), opacity 300ms ease, margin 600ms cubic-bezier(0.77, 0, 0.175, 1); }
/* The empty wheel folds away smoothly, so the groups glide up instead of jumping */
.draw.end .draw-wheel { height: 0; opacity: 0; margin: -14px 0; }
.draw-ring { position: absolute; inset: 0; }
.draw-ring::before { content: ""; position: absolute; left: 70px; right: 70px; top: 30px; bottom: 30px; border-radius: 50%; border: 1px dashed rgba(160, 230, 240, 0.22); }
.draw-chip { display: inline-flex; align-items: center; height: 48px; padding: 0 18px; border-radius: 99px; font-family: var(--serif); font-size: 26px; line-height: 1; white-space: nowrap;
  background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); color: #fff; will-change: transform; }
.draw-ring .draw-chip { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); transition: background 300ms ease, box-shadow 300ms ease, scale 300ms cubic-bezier(0.34, 1.56, 0.64, 1); }
.draw-ring .draw-chip.lift { scale: 1.28; z-index: 20 !important; opacity: 1 !important; background: rgba(255, 255, 255, 0.95); color: #06212A;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.15), 0 0 44px 8px rgba(160, 230, 240, 0.75); animation: liftPulse 700ms ease-in-out infinite alternate; }
@keyframes liftPulse { to { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.08), 0 0 70px 16px rgba(160, 230, 240, 0.9); } }

/* Groups and slots */
.draw-groups { width: 100%; display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 14px; }
.draw-group { --tc: #5FC0D8; min-width: 0; padding: 16px; border-radius: 22px; text-align: left;
  background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  opacity: 0; transform: translateY(24px); transition: opacity 500ms var(--ease-out), transform 600ms cubic-bezier(0.34, 1.56, 0.64, 1); transition-delay: calc(var(--i) * 90ms + 200ms); }
.draw.titled .draw-group { opacity: 1; transform: none; }
.draw.end .draw-group { animation: groupHop 700ms cubic-bezier(0.34, 1.56, 0.64, 1) both; animation-delay: calc(var(--i) * 110ms); }
@keyframes groupHop { 40% { transform: translateY(-10px) scale(1.03); } }
.draw-group.t0 { --tc: #E8866F; } .draw-group.t1 { --tc: #5FC0D8; } .draw-group.t2 { --tc: #E6B25A; } .draw-group.tg { --tc: #E6B25A; }
.draw-gh { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: rgba(234, 246, 245, 0.85); margin-bottom: 12px; }
.draw-mark { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--tc); color: #06212A; font-family: var(--serif); font-size: 19px; }
.draw-mark i { font-size: 16px; }
.draw-slots { display: grid; gap: 8px; }
.draw-group:has(.draw-slot:nth-child(4)) .draw-slots { grid-template-columns: 1fr 1fr; }
.draw-slot { position: relative; min-height: 54px; border-radius: 16px; display: flex; align-items: center; padding: 2px; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.14); background: rgba(0, 0, 0, 0.12); }
.draw-slot > i { position: absolute; left: 12px; font-style: normal; font-family: var(--serif); font-size: 18px; color: rgba(234, 246, 245, 0.45); }
.draw-slot.filled { box-shadow: inset 0 0 0 1.5px var(--tc); background: color-mix(in srgb, var(--tc) 18%, transparent); }
.draw-slot .draw-chip { width: 100%; justify-content: center; background: transparent; box-shadow: none; height: 50px; }
.draw-slot:has(> i) .draw-chip { padding-left: 34px; justify-content: flex-start; }
.draw-spark { position: absolute; z-index: 5; width: 7px; height: 7px; border-radius: 50%; pointer-events: none; }
.draw-confetti { position: absolute; top: 0; z-index: 4; border-radius: 2px; pointer-events: none; }

.draw-finale { min-height: 1.6em; font-size: 19px; color: rgba(234, 246, 245, 0.85); opacity: 0; transform: translateY(10px) scale(0.96); transition: opacity 500ms var(--ease-out) 450ms, transform 600ms cubic-bezier(0.34, 1.56, 0.64, 1) 450ms; }
.draw-finale b { color: #fff; font-weight: 600; }
.draw.end .draw-finale { opacity: 1; transform: none; }
.draw-actions { display: flex; gap: 10px; }
.draw-actions [hidden] { display: none; }
.draw-actions .btn.ghost { background: rgba(255, 255, 255, 0.1); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }

/* Phones: every group side by side, so the whole draw fits one screen */
@media (max-width: 640px) {
  .draw-in { gap: 22px; }
  .draw-title { font-size: 60px; }
  .draw-wheel { height: clamp(130px, 22vh, 190px); }
  .draw-groups { gap: 8px; }
  .draw-group { padding: 10px 8px; border-radius: 16px; }
  .draw-gh { flex-direction: column; gap: 6px; font-size: 12px; margin-bottom: 8px; text-align: center; }
  .draw-slots { gap: 6px; }
  .draw-slot { min-height: 44px; border-radius: 12px; }
  .draw-slot .draw-chip, .draw-chip { height: 40px; font-size: 20px; padding: 0 12px; }
  .draw-slot .draw-chip { padding: 0 4px; }
  .draw-slot:has(> i) .draw-chip { padding-left: 26px; }
  .draw-slot > i { left: 9px; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .draw { clip-path: none; transition: opacity 200ms ease; }
  .draw-water, .draw-beams i, .draw-badge { animation: none; }
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .band::after { opacity: 0.3; } }

/* Short laptop screens: tighter slots so the whole stage fits */
@media (max-height: 820px) and (min-width: 641px) {
  .draw-slot { min-height: 46px; } .draw-slot .draw-chip, .draw-chip { height: 42px; font-size: 22px; }
  .draw-group { padding: 12px 14px; } .draw-gh { margin-bottom: 8px; } .draw-slots { gap: 6px; }
}

/* Wide screens: one notch smaller type all round */
@media (min-width: 960px) {
  h2 { font-size: 30px; margin: 34px 0 12px; }
  .pts b { font-size: 40px !important; }
  .nm { font-size: 17px !important; }
}

/* Page scale, shared by every page: a bit smaller on laptops, bigger on a TV */
@media (min-width: 960px) { html { zoom: 0.85; } }
@media (min-width: 2400px) { html { zoom: 1.2; } }

/* Performance: big panels over the moving water were re-blurred on every scroll frame, and
   on first load Chrome showed them as blank white boxes until it caught up. Large surfaces
   are now near-solid with no backdrop blur; only small fixed chrome keeps the blur. */
.surf, .tile { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
.surf { background: color-mix(in srgb, var(--bg-solid) 92%, transparent); }
.tile { background: color-mix(in srgb, var(--bg-solid) 84%, transparent); }
.band { contain: strict; }
.band::after { will-change: transform; }

/* ---------- Shared top navigation (nav.js): a floating bar as wide as the content ---------- */
.topnav { position: sticky; top: 0; z-index: 35; padding: calc(10px + env(safe-area-inset-top)) 0 0; pointer-events: none; }
.topnav-in { pointer-events: auto; margin: 0 auto; max-width: calc(100% - 2 * var(--gutter)); height: 52px; padding: 0 8px 0 16px; border-radius: 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: color-mix(in srgb, var(--bg-solid) 80%, transparent); -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: inset 0 0 0 1px var(--glass-edge), 0 8px 24px -10px rgba(13, 58, 67, 0.25); }
.topnav-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; color: var(--ink); white-space: nowrap; }
.topnav-brand i { font-size: 20px; color: var(--lagoon); }
.topnav-tabs { display: flex; gap: 2px; }
.topnav-tabs a { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 12px;
  font-size: 14.5px; font-weight: 600; color: var(--text); transition: background 160ms ease, color 160ms ease, transform 140ms var(--ease-out); }
.topnav-tabs a i { font-size: 18px; }
.topnav-tabs a:active { transform: scale(0.96); }
.topnav-tabs a[aria-current="page"] { background: var(--ink); color: var(--bg); }
@media (hover: hover) and (pointer: fine) { .topnav-tabs a:not([aria-current]):hover { background: var(--hair); color: var(--ink); } }
@media (max-width: 520px) {
  .topnav-brand span { display: none; }
  .topnav-in { padding: 0 6px 0 12px; }
  .topnav-tabs a { padding: 0 11px; font-size: 13.5px; gap: 5px; }
}
/* With the nav in place, page bars only carry live status and actions */
.has-nav .bar { padding-top: 10px; min-height: 44px; }
.has-nav .bar:empty { display: none; }
.has-nav .s-head { padding-top: 22px; }

/* ---------- One wide layout for every page: same width, two equal columns ---------- */
:root { --wide-pad: clamp(32px, 4vw, 72px); --col-gap: clamp(40px, 5vw, 96px); }
@media (min-width: 960px) {
  .wrap { max-width: 1480px; padding-left: var(--wide-pad); padding-right: var(--wide-pad); padding-bottom: 110px; }
  .dock-in { max-width: calc(1480px - 2 * var(--wide-pad)); }
  .cols2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--col-gap); align-items: start; }
  .cols2 > * { min-width: 0; }
}

/* Nav width in CSS (no script), so it is right from the first frame: same as the page content */
.topnav-in { width: min(calc(100% - 2 * var(--gutter)), calc(var(--wrap-max, 640px) - 2 * var(--gutter))); max-width: none; }
@media (min-width: 960px) { .topnav-in { width: min(calc(100% - 2 * var(--wide-pad)), calc(1480px - 2 * var(--wide-pad))); } }
