/* Layout: one column, phone-first. Scoreboard strip on top, the board fills the width, big action buttons under it. */
:root{
  --bg:#f3f1ec; --surface:#ffffff; --fg:#1c1d1a; --muted:#6c6d66; --line:#dddad1;
  --accent:#c98a12; --accent-ink:#1c1d1a; --good:#1f7a4a; --bad:#b3362d;
  --b-dark:#1e1e1c; --b-light:#efe2bf; --b-red:#c8322b; --b-green:#1f7a4a; --b-rim:#111110;
  --display:"Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body:"Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){
  --bg:#141513; --surface:#1e1f1c; --fg:#ecebe5; --muted:#9a9b92; --line:#31322e;
  --accent:#e7a634; --accent-ink:#141513; --good:#4cb37a; --bad:#e06a5f; color-scheme:dark}}
:root[data-theme="dark"]{
  --bg:#141513; --surface:#1e1f1c; --fg:#ecebe5; --muted:#9a9b92; --line:#31322e;
  --accent:#e7a634; --accent-ink:#141513; --good:#4cb37a; --bad:#e06a5f; color-scheme:dark}

html,body{height:100%}
body{background:var(--bg);color:var(--fg);font-family:var(--body);font-size:16px;
  padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px));
  -webkit-tap-highlight-color:transparent}
.wrap{max-width:460px;margin:0 auto;padding-block:14px 28px;display:flex;flex-direction:column;gap:14px}
h1,h2,.num{font-family:var(--display)}
h1{font-size:1.9rem;margin:0;letter-spacing:.01em;text-wrap:balance}
h2{font-size:1.05rem;margin:0;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);font-weight:600}
p{margin:0;line-height:1.45}
.muted{color:var(--muted)}
button{font:inherit;color:inherit;cursor:pointer;touch-action:manipulation}
button:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
.banner{background:var(--surface);border:1px solid var(--bad);color:var(--fg);border-radius:10px;padding:10px 12px;font-size:.9rem}

/* home */
.games{display:grid;gap:10px}
.game{display:flex;flex-direction:column;gap:2px;text-align:left;background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:14px 16px}
.game > b{font-family:var(--display);font-size:1.35rem;font-weight:600}
.game span{color:var(--muted);font-size:.92rem}
.game:active{border-color:var(--accent)}
.list{display:flex;flex-direction:column;border-top:1px solid var(--line)}
.row{display:grid;grid-template-columns:1fr auto;gap:2px 12px;align-items:baseline;text-align:left;background:none;border:0;border-bottom:1px solid var(--line);padding:10px 2px}
.row .t{font-weight:600}
.row .d{color:var(--muted);font-size:.85rem}
.row .s{font-family:var(--display);font-size:1.3rem;font-weight:600;font-variant-numeric:tabular-nums;grid-row:span 2;align-self:center}
.pill{display:inline-block;font-size:.72rem;letter-spacing:.06em;text-transform:uppercase;border:1px solid var(--accent);color:var(--accent);border-radius:99px;padding:0 7px;margin-left:6px;vertical-align:2px;font-weight:600}
.empty{color:var(--muted);padding:12px 2px;font-size:.95rem}
.rates{display:grid;grid-template-columns:repeat(10,1fr);gap:4px}
.rate{display:flex;flex-direction:column;align-items:center;gap:3px;font-variant-numeric:tabular-nums}
.rate .bar{width:100%;height:46px;background:var(--line);border-radius:4px;position:relative;overflow:hidden}
.rate .bar i{position:absolute;left:0;right:0;bottom:0;background:var(--accent)}
.rate .n{font-family:var(--display);font-weight:600;font-size:.95rem}
.rate .p{font-size:.7rem;color:var(--muted)}

/* game */
.top{display:flex;justify-content:space-between;align-items:center;gap:10px}
.back{background:none;border:0;color:var(--muted);padding:6px 0;font-size:.95rem}
.board-head{display:grid;grid-template-columns:1fr auto;align-items:end;gap:10px}
.aim{font-family:var(--display);line-height:.95}
.aim small{display:block;font-size:.95rem;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);font-weight:600}
.aim strong{font-size:clamp(6.5rem,38vw,10rem);font-weight:700;color:var(--accent);display:block;line-height:.85;margin-top:4px}
.quickrow{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.quick{width:100%;min-height:84px;border-radius:14px;border:0;background:var(--accent);color:var(--accent-ink);font-family:var(--display);font-size:1.8rem;font-weight:700;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;line-height:1}
.quick span{font-family:var(--body);font-size:.95rem;font-weight:600;opacity:.75;text-transform:uppercase;letter-spacing:.06em}
.quick:active{filter:brightness(.9)}
.modebar{display:flex;justify-content:space-between;align-items:center;gap:8px;font-size:.88rem;flex-wrap:wrap}
svg.segment{width:100%;max-width:340px;height:auto;margin:0 auto;display:block;touch-action:manipulation;user-select:none;-webkit-user-select:none}
svg.segment .band{cursor:pointer}
svg.segment .band:active polygon{fill:var(--accent)}
svg.segment .band:focus-visible polygon{stroke:var(--accent);stroke-width:4}
.scorebox{text-align:right;font-family:var(--display);line-height:.95}
.scorebox small{display:block;font-size:.95rem;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);font-weight:600}
.scorebox strong{font-size:2.4rem;font-weight:700;font-variant-numeric:tabular-nums}
.scorebox em{font-style:normal;color:var(--muted);font-size:1.1rem}
.slots{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.slot{background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:8px 6px;text-align:center;min-height:56px;display:flex;flex-direction:column;justify-content:center}
.slot b{font-family:var(--display);font-size:1.6rem;font-weight:600;line-height:1}
.slot span{font-size:.78rem;color:var(--muted)}
.slot.next{border:2px dashed var(--accent)}
.slot.hit b{color:var(--good)}
.slot.miss b{color:var(--muted)}
svg.board{width:100%;max-width:100%;height:auto;display:block;touch-action:manipulation;user-select:none;-webkit-user-select:none}
svg.board.locked{opacity:.45}
.actions{display:grid;grid-template-columns:1fr;gap:8px}
.pad{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.pad.locked{opacity:.45}
.key{font-family:var(--display);font-size:1.9rem;font-weight:600;min-height:64px;border-radius:12px;border:1px solid var(--line);background:var(--surface);font-variant-numeric:tabular-nums}
.key:active{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.key.aim-key{border:2px solid var(--accent);color:var(--accent)}
.key.wide{grid-column:span 2;font-size:1.4rem}
.key.miss-key{background:var(--fg);color:var(--bg);border-color:var(--fg)}
.pad.mult{grid-template-columns:1fr}
.pick{font-size:2.4rem;font-weight:700;line-height:1;padding:4px 2px}
.pick span{font-size:1rem;font-family:var(--body);font-weight:500}
.key.big{min-height:84px;display:flex;justify-content:space-between;align-items:center;padding:0 20px;font-size:1.7rem}
.key.big span{color:var(--muted);font-size:1.3rem}
.key.ring{border-color:var(--line)}
.btn{border-radius:12px;padding:14px 10px;font-weight:600;font-size:1.05rem;border:1px solid var(--line);background:var(--surface)}
.btn.primary{background:var(--fg);color:var(--bg);border-color:var(--fg)}
.btn.ghost{background:none}
.btn[disabled]{opacity:.4;cursor:default}
.done{background:var(--surface);border:2px solid var(--accent);border-radius:12px;padding:14px 16px;display:flex;flex-direction:column;gap:4px}
.done b{font-family:var(--display);font-size:1.6rem}
.hist{display:flex;flex-direction:column;font-size:.92rem;font-variant-numeric:tabular-nums}
.hist div{display:grid;grid-template-columns:3.2em 1fr auto;gap:8px;padding:6px 2px;border-bottom:1px solid var(--line)}
.hist div span:first-child{color:var(--muted)}
.foot{display:flex;justify-content:space-between;align-items:center;gap:10px;font-size:.85rem;color:var(--muted)}
.linkbtn{background:none;border:0;color:var(--muted);text-decoration:underline;padding:6px 0;font-size:.9rem}
.confirm{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
@media (prefers-reduced-motion: no-preference){ .flash{animation:fl .35s ease-out} @keyframes fl{from{fill:var(--accent)}} }
.update-bar{position:fixed;left:0;right:0;bottom:0;z-index:20;border:0;background:var(--fg);color:var(--bg);font:600 1rem var(--body);display:flex;justify-content:center;align-items:baseline;gap:10px;
  padding:14px max(16px,env(safe-area-inset-right,0px)) calc(14px + env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px))}
.update-bar span{color:var(--accent);text-decoration:underline}
.zoomq{font-size:1rem}
.zoomq b{font-family:var(--display);font-size:1.25rem;color:var(--accent)}
@media (prefers-reduced-motion: no-preference){ svg.board .zlab{animation:zfade .35s ease-out both} @keyframes zfade{from{opacity:0}} }
/* Board carousel: one board per visit, live board last. */
:root{--dart:#e7a634}
.carousel{display:flex;gap:16px;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain}
.carousel::-webkit-scrollbar{display:none}
.carousel.lock{overflow-x:hidden}
.slide{flex:0 0 100%;min-width:0;scroll-snap-align:center;display:flex;flex-direction:column;gap:6px}
.slide-cap{display:flex;justify-content:space-between;gap:8px;font-size:.85rem;color:var(--muted);font-variant-numeric:tabular-nums;min-height:1.3em}
.slide-cap b{color:var(--fg);font-family:var(--display);font-size:1rem}
.slide.past svg.board{opacity:1}
/* the dart's fly-in is animated in app.js (animateDarts) */
.hdr-right{display:flex;align-items:baseline;gap:12px}
.slide-cap{align-items:center}
.cap-mid{flex:1;min-width:0;display:flex;justify-content:space-between;gap:8px}
.navbtn{border:1px solid var(--line);background:var(--surface);border-radius:8px;min-width:36px;height:30px;font-size:1.1rem;line-height:1;color:var(--fg)}
.navbtn.wide{padding:0 10px;font-size:.88rem}
.navbtn-gap{min-width:36px}
.board-head.past .aim strong{color:var(--muted)}
#viewhead{display:flex;flex-direction:column;gap:14px}
/* Session rows: swipe left a little to uncover Delete, all the way to delete. */
.srow{position:relative;overflow:hidden;border-bottom:1px solid var(--line)}
.del-bg{position:absolute;inset:0;background:var(--bad);display:flex;justify-content:flex-end}
.del{width:92px;height:100%;border:0;background:none;color:#fff;font-weight:600;font-size:.95rem;transition:width .15s ease}
.srow.armed .del{width:100%;text-align:right;padding-right:24px}
.srow .row{position:relative;width:100%;background:var(--bg);border-bottom:0;touch-action:pan-y;transition:transform .2s ease;user-select:none;-webkit-user-select:none}
.toast{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(20px + env(safe-area-inset-bottom,0px));z-index:30;background:var(--fg);color:var(--bg);border-radius:12px;padding:12px 16px;display:flex;gap:16px;align-items:center;font-weight:600;box-shadow:0 6px 20px rgba(0,0,0,.25)}
.toast .linkbtn{color:var(--accent);font-weight:700;font-size:1rem}
.iconbtn{background:none;border:0;padding:4px;color:var(--fg);line-height:0;border-radius:8px}
.iconbtn.off{color:var(--muted)}
.toast{max-width:calc(100% - 32px)}

/* Compact game screen: everything fits on a phone without scrolling. */
.wrap{gap:10px;padding-block:8px 14px}
.board-head{display:grid;grid-template-columns:auto 1fr;align-items:stretch;gap:14px}
.board-head .aim strong{font-size:clamp(5.5rem,30vw,7.5rem);line-height:.8;margin:0;letter-spacing:-.02em}
.board-head .aim strong.avg{font-size:clamp(3rem,15vw,4rem);line-height:1}
.board-head .side{display:flex;flex-direction:column;justify-content:space-between;gap:8px;min-width:0}
.board-head .scorebox{text-align:left;display:flex;justify-content:space-between;align-items:baseline;gap:8px;flex-wrap:wrap}
.board-head .scorebox small{font-size:.8rem}
.board-head .sc{font-family:var(--display);font-size:1rem;color:var(--muted);font-weight:600;text-transform:uppercase;letter-spacing:.06em}
.board-head .sc b{font-size:1.7rem;color:var(--fg);letter-spacing:0;margin-left:4px}
.board-head .sc em{font-style:normal;font-size:1rem;margin-left:2px}
.board-head .slots{gap:6px}
.board-head .slot{min-height:46px;padding:5px 4px}
.board-head .slot b{font-size:1.35rem}
.board-head .slot span{font-size:.7rem}
.navbtn[disabled]{opacity:.4}
.slide-cap .muted{font-size:.8rem}
.wrap{padding-block:6px 4px}
.hdr-right{align-items:center}
body{margin:0}
button.slot{font:inherit;color:inherit;cursor:pointer}
.slot.editing{border:2px solid var(--accent);background:color-mix(in srgb,var(--accent) 14%,var(--surface))}
.slot.editing b{color:var(--accent)}
.boardwrap{position:relative}
.nextboard{position:absolute;left:50%;bottom:8%;transform:translateX(-50%);border:0;border-radius:999px;background:var(--fg);color:var(--bg);font-family:var(--display);font-weight:700;font-size:1.35rem;padding:12px 26px;box-shadow:0 6px 18px rgba(0,0,0,.3)}
.slide.justdone svg.board{opacity:1}
.slide-cap{min-height:32px}
/* Multiplayer: player strip, invite sheet, guest banner. */
.chips{display:flex;gap:6px;overflow-x:auto;scrollbar-width:none;margin-top:-4px}
.chips::-webkit-scrollbar{display:none}
.chip{display:flex;align-items:baseline;gap:6px;flex:0 0 auto;border:1px solid var(--line);border-radius:999px;padding:3px 10px;font-size:.85rem;background:var(--surface)}
.chip b{font-family:var(--display);font-size:1rem;font-variant-numeric:tabular-nums}
.chip.up{border:2px solid var(--accent);padding:2px 9px}
.chip.up .nm{color:var(--accent);font-weight:600}
.chip.won{background:color-mix(in srgb,var(--accent) 18%,var(--surface))}
.sheet-bg{position:fixed;inset:0;z-index:40;background:rgba(0,0,0,.45);display:flex;align-items:flex-end;justify-content:center}
.sheet{width:100%;max-width:460px;max-height:92vh;overflow:auto;background:var(--bg);border-radius:18px 18px 0 0;display:flex;flex-direction:column;gap:10px;
  padding:18px max(16px,env(safe-area-inset-right,0px)) calc(18px + env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px))}
.sheet input{font:inherit;font-size:1.1rem;padding:10px;border-radius:10px;border:1px solid var(--line);background:var(--surface);color:var(--fg);min-width:0}
.qr{background:#fff;border-radius:12px;padding:8px;width:min(240px,70vw);align-self:center}
.qr svg{display:block;width:100%;height:auto}
.linkrow{display:flex;gap:8px}
.linkrow input{flex:1;font-size:.85rem}
.order{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:6px}
.order li{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid var(--line);padding-bottom:6px}
.order li span:last-child{display:flex;gap:6px}
.banner.guest{border-color:var(--accent);display:flex;flex-direction:column;gap:8px}
.top .muted b{color:var(--fg)}
.board-head .acc{flex-basis:100%;text-align:right;font-size:.85rem;color:var(--muted);margin-top:-4px}
/* Bigger dart boxes: the value is what you read from the oche. */
.board-head .slot{min-height:58px;padding:6px 4px;gap:2px}
.board-head .slot b{font-size:2rem;line-height:1}
.board-head .slot span{font-size:.82rem;white-space:nowrap}
/* Whose turn: big enough to read from the oche, in the row above the board. */
.turnbanner{font-family:var(--display);font-weight:700;font-size:1.5rem;letter-spacing:.02em;line-height:1;color:var(--fg)}
.turnbanner.mine{color:var(--accent)}
/* Zoomed in: a big, obvious way back out without placing a dart. */
.zoomx{position:absolute;top:8px;right:8px;width:48px;height:48px;border-radius:50%;border:0;background:rgba(17,17,16,.78);color:#f3efe4;font-size:1.4rem;line-height:1;box-shadow:0 2px 8px rgba(0,0,0,.35)}
.watchcount{align-self:center;font-size:.8rem;color:var(--muted);white-space:nowrap}
/* Invite: who the link is for. */
.seg{display:grid;grid-template-columns:1fr 1fr;border:1px solid var(--line);border-radius:10px;overflow:hidden}
.seg button{border:0;background:var(--surface);padding:10px;font-weight:600;color:var(--muted)}
.seg button.on{background:var(--fg);color:var(--bg)}
.chip.out{opacity:.5}
.order li{display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap}
.mng{display:flex;gap:6px}
.navbtn.danger{background:var(--bad);color:#fff;border-color:var(--bad)}
.sheet>*{flex-shrink:0}   /* a tall sheet scrolls; it must not squash its rows */
/* The player chips row is a button: tap it for the Players panel. */
button.chips{border:0;background:none;padding:0;text-align:left;font:inherit;color:inherit;width:100%}
.chips .chev{align-self:center;margin-left:auto;padding:0 4px;color:var(--muted);font-size:1.2rem}

/* Tablet (an iPad by the board): a big board you tap straight onto, no zoom step.
   Same query as BIG in app.js. Upright: board under the scores, as big as fits.
   Sideways: scores on the left, board full height on the right. */
@media (min-width:700px) and (min-height:600px){
  /* The board takes whatever height is left under the scores (Safari's own bars
     included), as big as that space and the width allow. */
  .wrap.gamescreen{max-width:min(1100px,100%);height:100dvh;box-sizing:border-box}
  .wrap.gamescreen .carousel{flex:1 1 0;min-height:0;width:100%;container-type:size}
  .wrap.gamescreen .slide .boardwrap{width:min(100cqw,100cqh - 40px);margin-inline:auto}
  svg#pick{touch-action:none;-webkit-touch-callout:none}
  .wrap.gamescreen .board-head .slot{min-height:60px}
  .wrap.gamescreen .board-head .slot b{font-size:1.7rem}
  .wrap.gamescreen .board-head .slot span{font-size:.85rem}
}
@media (min-width:700px) and (min-height:600px) and (orientation:landscape){
  .wrap.gamescreen{display:grid;grid-template-columns:minmax(280px,1fr) auto;grid-template-rows:repeat(9,auto) 1fr;column-gap:28px;row-gap:12px;align-content:start;max-width:none}
  .wrap.gamescreen > *{grid-column:1}
  .wrap.gamescreen > :not(.carousel){zoom:1.2}
  .wrap.gamescreen > .carousel{grid-column:2;grid-row:1 / -1;width:min(100dvh - 52px,100vw - 360px);height:auto;margin:0}
}
.loupe{position:fixed;z-index:50;width:190px;height:190px;border-radius:50%;overflow:hidden;pointer-events:none;
  border:3px solid var(--accent);box-shadow:0 8px 24px rgba(0,0,0,.45);background:var(--bg)}
.loupe svg{width:100%;height:100%;display:block}
.loupe .lcross{position:absolute;left:50%;top:50%;width:14px;height:14px;margin:-7px 0 0 -7px;border-radius:50%;border:2px solid #fff;box-shadow:0 0 0 1.5px #000}
.loupe .lread{position:absolute;left:50%;bottom:10px;transform:translateX(-50%);background:rgba(0,0,0,.72);color:#fff;font-family:var(--display);font-weight:700;font-size:1.75rem;line-height:1.15;padding:1px 14px;border-radius:999px;box-shadow:0 0 0 1.5px rgba(255,255,255,.25)}
.capbtns{display:flex;gap:6px;flex:none}
/* Tablet: read from the oche, a couple of metres away, in a bright room. Bigger and
   darker than the phone; the board flexes to whatever height is left. */
@media (min-width:700px) and (min-height:600px){
  .wrap.gamescreen .top,.wrap.gamescreen .top .back{font-size:1.2rem}
  .wrap.gamescreen .top .muted{font-size:1.2rem !important}
  .wrap.gamescreen .linkbtn{font-size:1.15rem}
  .wrap.gamescreen .board-head .scorebox small{font-size:1.2rem;color:var(--fg)}
  .wrap.gamescreen .board-head .sc{font-size:1.6rem;color:var(--fg)}
  .wrap.gamescreen .board-head .sc b{font-size:3.4rem;margin-left:8px}
  .wrap.gamescreen .board-head .sc em{font-size:1.7rem}
  .wrap.gamescreen .board-head .acc{font-size:1.35rem;color:var(--fg);margin-top:0;font-weight:600}
  .wrap.gamescreen .board-head .slot b{font-size:2.1rem}
  .wrap.gamescreen .board-head .slot span{font-size:1.05rem;color:var(--fg)}
  .wrap.gamescreen .chip{font-size:1.15rem;padding:5px 14px}
  .wrap.gamescreen .chip b{font-size:1.4rem}
  .wrap.gamescreen .turnbanner{font-size:2.1rem}
  .wrap.gamescreen .slide-cap .muted{font-size:1.05rem}
  .wrap.gamescreen .slide-cap .navbtn{font-size:1.1rem;padding:8px 14px}
}
@media (min-width:700px) and (min-height:600px) and (prefers-color-scheme: light){
  :root:not([data-theme="dark"]){--muted:#4c4d47}
}
/* On an earlier board during a game: a bold bar, so its number isn't mistaken for the target. */
.backnow{width:100%;border:0;border-radius:10px;background:var(--accent);color:var(--accent-ink,#141513);font-family:var(--display);font-weight:700;font-size:1rem;letter-spacing:.02em;padding:7px 12px;text-align:center}
/* Earlier boards stay full colour (Derek found the faded look washed out); the orange bar and the "earlier" tag say it isn't the current board. */
.slide.holding .backnow{visibility:hidden}
.slide.past.holding svg.board{opacity:1}
@media (min-width:700px) and (min-height:600px){ .wrap.gamescreen .backnow{font-size:1.5rem;padding:10px 14px} }
/* The target's far-away highlight (dimmed board, thick outline) gives way while placing a dart. */
svg.board .near{display:none}
svg.board.placing .far,svg.board.near .far{display:none}
svg.board.placing .near,svg.board.near .near{display:inline}
.loupe svg .near{display:none !important}
/* Music: what's playing (live) and what each earlier visit was thrown to. */
.slide-cap .np{order:1;flex:1 1 auto;min-width:0;display:flex;justify-content:center}
.slide-cap .navbtn{order:0}
.slide-cap .turnbanner{order:2}
.song{display:inline-flex;align-items:center;gap:8px;max-width:100%;min-width:0;padding:3px 10px 3px 3px;border-radius:999px;background:var(--surface);border:1px solid var(--line);color:var(--fg);text-decoration:none;font-size:.82rem;line-height:1.15}
.song img,.song .noart{width:26px;height:26px;border-radius:50%;object-fit:cover;flex:none;background:var(--line);display:grid;place-items:center;font-size:.8rem}
.song .songtxt{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.song .songtxt span{color:var(--muted)}
.song.live img{animation:spin 6s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion: reduce){ .song.live img{animation:none} }
@media (min-width:700px) and (min-height:600px){ .wrap.gamescreen .song{font-size:1.05rem} .wrap.gamescreen .song img,.wrap.gamescreen .song .noart{width:34px;height:34px} }
.btn.spotify{display:block;text-align:center;text-decoration:none;color:var(--fg)}
.slide-cap:has(.np .song) > .muted{display:none}
.pwshown{background:color-mix(in srgb,var(--accent) 16%,var(--surface));border:1px solid var(--accent);border-radius:10px;padding:10px 12px}
.pwshown b{font-family:var(--display);font-size:1.25rem;letter-spacing:.03em}
/* A message with two choices: text across the top, the choices underneath. */
.toast:has(.linkbtn + .linkbtn){flex-wrap:wrap;width:min(440px,calc(100% - 32px));justify-content:flex-end;column-gap:18px}
.toast:has(.linkbtn + .linkbtn) > span{flex:1 1 100%}
.songwrap{display:inline-flex;align-items:center;gap:6px;max-width:100%;min-width:0}
button.song{font:inherit;font-size:.82rem;cursor:pointer}
.song .playic{flex:none;font-family:var(--display);font-weight:700;color:var(--accent);margin-left:2px;white-space:nowrap}
.songopen{flex:none;color:var(--muted);text-decoration:none;font-size:1rem;padding:2px 4px}
@media (min-width:700px) and (min-height:600px){ .wrap.gamescreen button.song{font-size:1.05rem} }
/* Earlier board in a live game: song on the left, a shorter Back to now on the right. */
.slide-cap .backnow{order:2;width:auto;flex:1 1 auto}
.slide-cap .np:empty{display:none}
.backnow .bn-short{display:none}
.slide-cap .np:not(:empty) ~ .backnow{flex:0 0 auto}
.slide-cap .np:not(:empty) ~ .backnow .bn-long{display:none}
.slide-cap .np:not(:empty) ~ .backnow .bn-short{display:inline}
.slide-cap:has(.backnow) .np{justify-content:flex-start}
/* How this game compares: your record on this number, and the pace against earlier games. */
.form{display:grid;grid-template-columns:auto 1fr;gap:1px 10px;font-size:.82rem;line-height:1.3;font-variant-numeric:tabular-nums;margin-top:-6px}
.form .fl{color:var(--muted);text-transform:uppercase;letter-spacing:.06em;font-size:.68rem;font-weight:700;align-self:center;white-space:nowrap}
.form b{font-family:var(--display);font-size:1.02rem}
.form .up{color:var(--good)} .form .down{color:var(--bad)} .form .pb{color:var(--accent)}
.toast .tnote{font-weight:500;opacity:.75}
.done{gap:2px}
@media (min-width:700px) and (min-height:600px){
  .wrap.gamescreen .form{font-size:1.15rem;margin-top:0}
  .wrap.gamescreen .form .fl{font-size:.9rem;color:var(--fg)}
  .wrap.gamescreen .form b{font-size:1.4rem}
}
/* Finishing a game: a card, confetti and a little fanfare. */
#fanfare{position:fixed;inset:0;z-index:45;display:grid;place-items:center;background:rgba(0,0,0,.55);padding:16px}
#fanfare canvas{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.ffcard{position:relative;width:min(360px,100%);box-sizing:border-box;background:var(--bg);border:3px solid var(--accent);border-radius:22px;padding:22px 22px 18px;text-align:center;display:flex;flex-direction:column;gap:6px;box-shadow:0 20px 60px rgba(0,0,0,.45)}
.ffcard h2{font-family:var(--display);font-size:2.3rem;line-height:1;color:var(--fg);text-transform:none;letter-spacing:.01em;font-weight:700}
.fftrophy{font-size:3.2rem;line-height:1}
.ffbig{font-family:var(--display);font-weight:700;font-size:4.6rem;line-height:.95;color:var(--accent);font-variant-numeric:tabular-nums}
.ffbig small{font-size:1.5rem;color:var(--muted);font-weight:600}
.ffpb{font-family:var(--display);font-weight:700;font-size:1.5rem;color:var(--accent);letter-spacing:.04em;text-transform:uppercase}
.ffnote{color:var(--muted);font-size:.95rem}
.ffcard .btn{margin-top:8px}
@media (prefers-reduced-motion: no-preference){
  #fanfare{animation:fffade .25s ease-out}
  .ffcard{animation:ffpop .55s cubic-bezier(.2,1.5,.4,1) both}
  .ffcard .fftrophy{animation:ffbounce 1.2s ease-in-out .3s 2}
  .ffcard.party .ffpb{animation:ffglow 1.4s ease-in-out infinite}
  @keyframes fffade{from{opacity:0}}
  @keyframes ffpop{from{transform:scale(.4) rotate(-6deg);opacity:0}}
  @keyframes ffbounce{0%,100%{transform:none}30%{transform:translateY(-14px) rotate(-8deg)}60%{transform:translateY(0) rotate(6deg)}}
  @keyframes ffglow{50%{text-shadow:0 0 18px var(--accent)}}
}
@media (min-width:700px) and (min-height:600px){ .ffcard{width:min(480px,100%);zoom:1.25} }
.toast .linkbtn{white-space:nowrap}
.toast{width:max-content}
/* Hand over sheet: one big button per screen or person. */
.btn.hoto{text-align:left;font-family:var(--display);font-size:1.3rem}
/* Sign in with your phone: the code a new screen shows, and the phone's side of it. */
.pairbox{display:flex;flex-direction:column;gap:8px;align-items:center;text-align:center;background:var(--surface);border:2px solid var(--accent);border-radius:14px;padding:14px}
.pairbox b{font-family:var(--display);font-size:1.4rem}
.paircode{font-family:var(--display);font-weight:700;font-size:2.4rem;letter-spacing:.12em;margin:0}
.pairvideo{width:100%;max-height:45vh;border-radius:12px;background:#000;object-fit:cover}
#pc-code{text-transform:uppercase;letter-spacing:.2em;font-family:var(--display);font-size:1.6rem;text-align:center}
.pairbox[hidden]{display:none}
/* Board arrows, in the wood corners: ‹ earlier board, › later. */
.edgenav{position:absolute;bottom:1.5%;width:44px;height:44px;border-radius:50%;border:0;background:rgba(20,16,12,.62);color:#f3efe4;
  font-family:var(--display);font-size:1.7rem;line-height:1;display:grid;place-items:center;padding:0 0 3px;box-shadow:0 2px 6px rgba(0,0,0,.35);z-index:2}
.edgenav.prev{left:1.5%} .edgenav.next{right:1.5%}
.edgenav:active{background:var(--accent);color:var(--accent-ink)}
@media (min-width:700px) and (min-height:600px){ .edgenav{width:60px;height:60px;font-size:2.3rem} }
/* First few times: the boards slide aside to show the one before, plus a bubble. */
.carousel.peek > .slide{animation:peek 1.4s cubic-bezier(.3,.7,.3,1)}
@keyframes peek{0%{transform:none}35%{transform:translateX(72px)}55%{transform:translateX(72px)}100%{transform:none}}
.swipetip{position:absolute;left:50%;bottom:9%;transform:translateX(-50%);z-index:3;pointer-events:none;white-space:nowrap;
  background:rgba(20,16,12,.85);color:#f3efe4;font-weight:600;font-size:.95rem;padding:8px 14px;border-radius:999px;box-shadow:0 4px 14px rgba(0,0,0,.35);animation:tipfade 3.8s ease both}
.swipetip .hand{display:inline-block;animation:hand 1.1s ease-in-out 3}
@keyframes hand{0%,100%{transform:translateX(0)}50%{transform:translateX(16px) rotate(8deg)}}
@keyframes tipfade{0%{opacity:0;transform:translate(-50%,8px)}10%,85%{opacity:1;transform:translate(-50%,0)}100%{opacity:0}}
@media (min-width:700px) and (min-height:600px){ .swipetip{font-size:1.3rem;padding:12px 20px} }
.swipetip .hand{margin-right:8px}
/* One swipe = one board, however hard the flick. */
.carousel > .slide{scroll-snap-stop:always}
/* Phone: the two lines under the scoreboard never wrap, so every board's header is the
   same height and the board doesn't jump when swiping between them. (On a tablet the
   board has its own column, so wrapping there moves nothing.) */
@media not ((min-width:700px) and (min-height:600px)){
  .form > span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
}
.form > span{line-height:1.45rem}
.form b{line-height:1}
/* Dart boxes: filled (a button) and empty (a div) the same height, so a visit with only
   one or two darts doesn't make the header taller than a full one. */
.board-head .slot{box-sizing:border-box;height:64px;min-height:0;line-height:1}
.board-head .slot span{line-height:1.2}
@media (min-width:700px) and (min-height:600px){ .wrap.gamescreen .board-head .slot{height:76px} }
.board-head .slots{grid-template-columns:repeat(3,minmax(0,1fr))}
.board-head .slot{min-width:0}
.board-head .slot span{overflow:hidden;text-overflow:ellipsis}
/* Tiles button (top-left wood corner) and the all-boards overview. */
.edgenav.tiles{top:1.5%;bottom:auto;left:1.5%}
.edgenav.tiles svg{display:block}
/* The board area handles its own two-finger pinch (all boards), so the page doesn't zoom. */
.carousel{touch-action:pan-x}
#overview{position:fixed;inset:0;z-index:42;background:var(--bg);display:flex;flex-direction:column;
  padding:max(10px,env(safe-area-inset-top,0px)) max(16px,env(safe-area-inset-right,0px)) 10px max(16px,env(safe-area-inset-left,0px))}
.ovhead{display:flex;justify-content:space-between;align-items:center;padding-bottom:10px}
.ovgrid{flex:1;overflow-y:auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(104px,1fr));gap:10px;align-content:start;padding-bottom:20px}
.ovtile{border:2px solid var(--line);border-radius:12px;background:var(--surface);padding:4px;display:flex;flex-direction:column;gap:3px}
.ovtile svg.board{pointer-events:none}
.ovtile.here{border-color:var(--accent);box-shadow:0 0 0 2px var(--accent)}
.ovcap{display:flex;justify-content:space-between;align-items:baseline;gap:4px;font-size:.8rem;color:var(--muted);padding:0 3px 2px}
.ovcap b{font-family:var(--display);font-size:1rem;color:var(--fg)}
.ovnow{margin-left:4px;color:var(--accent);font-weight:700;text-transform:uppercase;font-size:.7rem;letter-spacing:.05em}
@media (min-width:700px) and (min-height:600px){ .ovgrid{grid-template-columns:repeat(auto-fill,minmax(170px,1fr))} .ovcap{font-size:1rem} .ovcap b{font-size:1.3rem} }
/* Home (2026-11-23): the three games are the page. Each shows your form; rules and
   history live elsewhere. On a tablet the games sit side by side. */
.wrap:not(.gamescreen) h1{font-size:2.2rem}
.gear{color:var(--muted)}
.games{gap:12px}
.game{position:relative;gap:12px;padding:18px;border:2px solid var(--line);border-radius:16px;justify-content:space-between}
.game > b{font-size:1.7rem;line-height:1}
.game .tag{color:var(--muted);font-size:1rem}
/* The whole tile is a button to that game's history; Play sits above it. */
.game .gopen{position:absolute;inset:0;border:0;background:none;border-radius:14px;padding:0}
.game:has(.gopen:active){border-color:var(--accent)}
.game > b,.game .tag,.game .gf,.game .play{pointer-events:none}
.gfoot{display:flex;justify-content:space-between;align-items:center;gap:10px}
.gn{position:relative;z-index:1;color:var(--muted);font-size:.95rem;background:none;border:1px solid var(--line);border-radius:999px;padding:8px 14px;margin:-8px 0 -8px -6px;font-family:inherit}
.gn:active{border-color:var(--accent)}
.play{position:relative;z-index:1;background:var(--accent);color:var(--accent-ink);border:0;border-radius:999px;padding:10px 26px;font-family:var(--display);font-weight:700;font-size:1.15rem;letter-spacing:.04em}
.play:active{filter:brightness(.9);transform:scale(.97)}
.gf{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.gf > span{display:flex;flex-direction:column;align-items:flex-start;gap:2px}
.gf small{color:var(--muted);text-transform:uppercase;letter-spacing:.08em;font-size:.72rem;font-weight:700}
.gf b{font-family:var(--display);font-size:1.7rem;line-height:1;color:var(--fg);font-weight:600;font-variant-numeric:tabular-nums}
.gf b.up,.numline b.up{color:var(--good)} .gf b.down,.numline b.down{color:var(--bad)} .gf b.gold{color:var(--accent)}
.numline{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;background:none;border:0;border-top:1px solid var(--line);border-bottom:1px solid var(--line);padding:12px 2px;text-align:left;font-size:1rem}
.numline b{font-family:var(--display);font-size:1.4rem;margin-left:6px}
.homelinks{display:grid;grid-template-columns:repeat(auto-fit,minmax(0,1fr));gap:10px}
.homelinks .btn{display:flex;justify-content:space-between;padding:14px 16px}
.list.going{border-top:0}
.list.going .row{background:var(--surface)}
.list.going .srow{border:2px solid var(--accent);border-radius:14px;margin-bottom:8px}
.top h1 + .back,.top .back + h1{margin-right:auto}
.wrap:not(.gamescreen) .top .back{font-size:1.05rem}
#menusheet .sheet .btn{text-align:left}
#menusheet .sheet p{font-size:1.05rem;padding:2px 2px 6px}
@media (min-width:700px) and (min-height:600px){
  .wrap:not(.gamescreen){max-width:min(980px,100%);gap:20px;padding-block:24px 32px}
  .wrap:not(.gamescreen) h1{font-size:2.8rem}
  .games{grid-template-columns:repeat(3,1fr);gap:16px}
  .game{min-height:200px;padding:22px}
  .game > b{font-size:2.2rem;min-height:2em}
  .gf small{font-size:.85rem} .gf b{font-size:2.1rem}
  .play{font-size:1.3rem;padding:12px 30px} .gn{font-size:1.1rem}
  .fchip{font-size:1.1rem;padding:10px 18px}
  .numline{font-size:1.2rem;padding:16px 4px}
  .numline b{font-size:1.8rem}
  .homelinks .btn{font-size:1.25rem;padding:18px 20px}
  .rate .bar{height:90px} .rate .n{font-size:1.3rem} .rate .p{font-size:.95rem;color:var(--fg)}
  .row .t{font-size:1.15rem} .row .d{font-size:1rem} .row .s{font-size:1.6rem}
}
.list.going .row{padding:12px 16px}
.list.going .srow .row{border-radius:12px}
@media (min-width:700px) and (min-height:600px){ .game{min-height:240px} .list.going .row{padding:16px 20px} }
/* History filters (2026-11-24): game + when, as chips; a game's own numbers above its list. */
.filters{display:flex;flex-direction:column;gap:8px}
.fchips{display:flex;gap:8px;overflow-x:auto;scrollbar-width:none}
.fchips::-webkit-scrollbar{display:none}
.fchip{flex:0 0 auto;border:1px solid var(--line);background:var(--surface);color:var(--fg);border-radius:999px;padding:8px 14px;font-weight:600;font-size:.95rem}
.fchip.on{background:var(--fg);color:var(--bg);border-color:var(--fg)}
.histsum{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:14px 18px}
.linkbtn.rulesbtn{text-decoration:none;color:var(--muted);font-size:.9rem}
.wrap.gamescreen .linkbtn.rulesbtn{font-size:1rem}
/* play on screen (onscreen.js) */
.osline{margin-top:14px}
.ostitle{margin:4px 0 8px}
.osintro,.osblurb{font-size:.95rem;margin:6px 0 4px}
.oscarry{width:100%;margin:10px 0 4px}
.osnames{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:10px}
.osname{font:inherit;padding:10px;border-radius:10px;border:1px solid var(--line);background:var(--surface);color:var(--fg);min-width:0}
.osstart{width:100%;margin-top:22px;padding:14px;font-size:1.1rem}
.ostage{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;margin-top:10px;cursor:crosshair}
.ostage svg{touch-action:none}
.ostage .osaim{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.osmsg{min-height:2.6em;text-align:center;padding:8px 4px 0;font-size:1.05rem}
.oschips{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}
.oschip{border:1px solid var(--line);border-radius:999px;padding:4px 10px;font-size:.9rem;color:var(--muted)}
.oschip b{color:var(--fg)}
.oschip.on{border-color:var(--accent);color:var(--fg)}
.osend{text-align:center;padding:30px 10px}
.osend .ffbig{font-size:3rem}
.osbtns{display:flex;gap:10px;justify-content:center;margin-top:22px}
.osline{width:100%}
.ossetup .fchips{flex-wrap:wrap;overflow:visible}
.osfb{display:flex;flex-direction:column;align-items:center;gap:6px;margin-top:6px;font-size:.95rem}
.osgauge{position:relative;display:block;width:min(260px,80%);height:10px;border-radius:5px;background:var(--line)}
.osgauge .ok{position:absolute;top:0;bottom:0;background:var(--good);border-radius:5px}
.osgauge .me{position:absolute;top:-4px;bottom:-4px;width:4px;margin-left:-2px;background:var(--fg);border-radius:2px}
.osgw{display:flex;align-items:center;gap:8px;width:min(320px,90%)}
.osgw small{color:var(--muted);font-size:.75rem}
.osgw .osgauge{flex:1;width:auto}

/* Streaks (home): a flame on each game's tile, one line for any game. Amber outline = play today to keep it. */
.game .streak{position:absolute;top:14px;right:14px;pointer-events:none;font-family:var(--display);font-weight:700;font-size:1.15rem;color:var(--fg);background:var(--surface);border:2px solid var(--accent);border-radius:999px;padding:1px 10px}
.game .streak.risk{border-style:dashed;opacity:.75}
.streakline{display:flex;justify-content:space-between;align-items:baseline;gap:12px;flex-wrap:wrap;font-size:1.05rem}
.streakline b{font-family:var(--display);font-size:1.5rem}
@media (min-width:700px) and (min-height:600px){ .game .streak{font-size:1.5rem;top:18px;right:18px} .streakline{font-size:1.3rem} .streakline b{font-size:2rem} }
.game:has(.streak) > b{padding-right:70px}
.game .play{color:var(--accent-ink)}
.streakline.risk{background:var(--accent);color:var(--accent-ink);border-radius:12px;padding:12px 16px;font-family:var(--display);font-weight:700;font-size:1.2rem;letter-spacing:.02em}
.streakline.risk b{font-size:1.5rem}
@media (min-width:700px) and (min-height:600px){ .streakline.risk{font-size:1.6rem;padding:16px 22px} .streakline.risk b{font-size:2rem} }
/* What your last visit came to, on a fresh board: solid and full-size so it reads from the oche. */
.pill.last{background:var(--accent);color:#fff;font-size:1.1em;letter-spacing:.04em;padding:1px 10px;vertical-align:0;font-weight:700}
/* The streak going up: once a day, on the visit message or the finish card. */
.toast .tstreak{display:inline-block;margin-top:4px;color:var(--accent);font-weight:700}
.ffstreak{font-weight:700;color:var(--accent);margin:6px 0 0;font-size:1.1rem}
/* Accuracy % is the headline figure next to the score */
.board-head .acc b{color:var(--accent);font-weight:700}
/* When each game last counted, under its name on the home tile */
.game .when{pointer-events:none;font-size:1rem;color:var(--muted);margin-top:-6px;white-space:nowrap}
.game .when.today{color:var(--good);font-weight:700}
/* ⚙ menu: Colours Auto / Light / Dark */
.themerow{display:flex;align-items:center;gap:12px}
.themerow > span{font-weight:600}
.themerow .seg{flex:1}
.seg.seg3{grid-template-columns:1fr 1fr 1fr}
