/* Layout: one card table. The plum table fills the screen; every view is a single centered column on it. */
:root{
  --table:#2B0A3C; --table-deep:#190724;   /* plum, sampled from assets/home.webp */
  --cream:#F5EDE3; --ink:#1B241D;
  --chalk:#EEF4EA; --muted:rgba(238,244,234,.64); --line:rgba(238,244,234,.16);
  --good:#3FD98B; --bad:#FF5F5F;           /* found a set, and did not */
  --red:#E63946; --blue:#1D6FDC; --yellow:#F5B700;
  --card-a:1.75;        /* card width over height; shape sizes are quoted against the height */
  --f-display:"Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --f-body:"Figtree", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  color-scheme:dark;
}
html,body{height:100%}
[hidden]{display:none!important}
body{
  margin:0; background:var(--table);
  color:var(--chalk); font-family:var(--f-body); font-size:15px; overflow-x:hidden;
}
body::after{content:"";position:fixed;inset:0;pointer-events:none;z-index:1;
  background:radial-gradient(120% 90% at 50% 40%, transparent 35%, var(--table-deep) 100%)}

/* The four corner shapes, drawn from the game's own masks so they scale to any window
   instead of cropping. The same table sits under every view. */
.deco{position:fixed;inset:0;overflow:hidden;pointer-events:none;z-index:0}
.deco i{position:absolute;display:block;aspect-ratio:1;
  -webkit-mask-image:var(--m);mask-image:var(--m);-webkit-mask-size:contain;mask-size:contain;
  -webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center}
.d1{--m:url(assets/circle.png);  background:var(--red);    width:30vmax;top:-16vmax;left:-11vmax}
.d2{--m:url(assets/square.png);  background:var(--blue);   width:26vmax;top:-13vmax;right:-10vmax;rotate:14deg}
.d3{--m:url(assets/triangle.png);background:var(--blue);   width:28vmax;bottom:-15vmax;left:-12vmax;rotate:28deg}
.d4{--m:url(assets/triangle.png);background:var(--yellow); width:32vmax;bottom:-16vmax;right:-11vmax;rotate:-12deg}
.app{position:relative;z-index:2;min-height:100%;box-sizing:border-box;overflow-x:clip;display:flex;flex-direction:column;
  padding-left:max(16px, env(safe-area-inset-left,0px));padding-right:max(16px, env(safe-area-inset-right,0px));
  padding-block:16px 24px}
.view{flex:1;display:flex;flex-direction:column;align-items:center;width:100%;max-width:980px;margin-inline:auto}
.view[hidden]{display:none}   /* a class beats the UA rule for [hidden], so say it here */
button{font:inherit;color:inherit;cursor:pointer}
:focus-visible{outline:2px solid var(--chalk);outline-offset:3px}

/* ---------- glyphs & cards ---------- */
.g-circle{--m:url(assets/circle.png)}
.g-square{--m:url(assets/square.png)}
.g-triangle{--m:url(assets/triangle.png)}
/* Shapes are vector solids drawn in game.js. Every tone comes from --c by the same formula, so no
   colour gets different treatment. A face stroked in its own colour gets soft corners. */
.glyph{display:block;width:100%;height:100%;overflow:visible}
.base,.lit,.shade{stroke-width:1.6;stroke-linejoin:round}
.base{fill:var(--c);stroke:var(--c)}
.lit{--t:color-mix(in srgb,var(--c) 68%,#fff);fill:var(--t);stroke:var(--t)}
.shade{--t:color-mix(in srgb,var(--c) 76%,#5a2408);fill:var(--t);stroke:var(--t)}
.rim,.wire{fill:none;stroke:var(--c);stroke-linejoin:round;stroke-linecap:round}
.rim{stroke-width:3.5}
.wire{stroke-width:6}
.glyph-wrap{width:calc(var(--h) / var(--card-a));aspect-ratio:1;transition:opacity .3s ease;
  filter:drop-shadow(0 0 .6px rgba(40,26,12,.55)) drop-shadow(0 5px 5px rgba(30,20,10,.2))}

/* Wider than tall, and the shapes are sized off the card's height, so the width is free to
   change without touching them. One, two or three of them sit in a row across the middle. */
.card{position:relative;aspect-ratio:var(--card-a);border-radius:9% / 13.5%;border:1px solid rgba(60,45,30,.22);
  background:var(--cream) url(assets/card.jpg) center/cover;display:flex;align-items:center;justify-content:center;gap:3%;
  box-shadow:0 1px 0 rgba(255,255,255,.5) inset, 0 6px 14px -6px rgba(0,0,0,.55), 0 1px 2px rgba(0,0,0,.35);
  padding:0;transition:transform .14s ease, box-shadow .14s ease}
/* A dimmed card stays a card. Only the shape recedes, so the board keeps its cream
   grid instead of turning to mud where the felt shows through. */
.card.dim{box-shadow:0 1px 3px rgba(0,0,0,.28)}
.card.dim .glyph-wrap{opacity:.17}
button.card:hover{transform:translateY(-2px)}
/* A lit card glows rather than wearing a line: soft light outside the edge, and a little inside
   it so the colour still reads on the cream. --g is the colour, as r,g,b so it can take an alpha.
   Lit cards sit above their neighbours, or the next card along would cover the glow. */
.card.hint,.card.sel,.card.got,.card.miss{z-index:1;
  box-shadow:0 0 9px 1px rgba(var(--g),.95), 0 0 26px 6px rgba(var(--g),.5),
             inset 0 0 16px rgba(var(--g),.38), 0 10px 18px -8px rgba(0,0,0,.5)}
.card.hint{--g:238,244,234}
.card.sel,.card.got,.card.miss{transform:translateY(-5px) scale(1.02)}   /* same place, so only the colour changes */
.card.sel{--g:245,183,0}
.card.got{--g:63,217,139}
.card.miss{--g:255,95,95;animation:shake .38s}
.card.deal{animation:deal .32s cubic-bezier(.2,.9,.3,1.2)}
.card.out{animation:out .22s ease-in forwards;pointer-events:none}
@keyframes out{to{transform:translateY(-16px) scale(.82) rotate(-4deg);opacity:0}}
button.card:disabled{cursor:default}
@keyframes shake{20%,60%{translate:-5px 0}40%,80%{translate:5px 0}}
@keyframes deal{from{transform:scale(.86) rotate(-3deg);opacity:.2}to{transform:none;opacity:1}}


/* ---------- home ---------- */
/* Home is one picture with its title and buttons drawn in, so the stage keeps the picture's
   shape and the spots are percentages of it. The width fills the window where it can, and stops
   at 155vw on a tall window and 2.2 heights on a very wide one, so the title and buttons are never
   cropped. Past that the sides fade into the table, which is the same plum. */
.stage{position:fixed;left:50%;top:50%;translate:-50% -50%;aspect-ratio:1779/884;
  width:min(max(100vw,min(100dvh * 2.0125,155vw)),100dvh * 2.2);background:url(assets/home.webp) center/100% 100% no-repeat}
@media (min-aspect-ratio:11/5){.stage{-webkit-mask-image:linear-gradient(90deg,transparent,#000 9%,#000 91%,transparent);
  mask-image:linear-gradient(90deg,transparent,#000 9%,#000 91%,transparent)}}
.spot{position:absolute;padding:0;border:0;border-radius:999px;background:transparent;color:transparent;
  transition:box-shadow .12s ease}
.spot:hover{box-shadow:0 0 0 3px rgba(255,255,255,.6)}
.s1{left:28.56%;top:46.6%;width:42.72%;height:16.29%}
.s2{left:28.61%;top:65.84%;width:42.72%;height:15.38%}
body[data-view=home] .deco,body[data-view=home]::after{display:none}
@media (max-aspect-ratio:13/10){body[data-view=home] .deco{display:block}}
.sr-only{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip-path:inset(50%)}
.play{background:var(--cream);color:var(--ink);border:0;border-radius:999px;padding:15px 34px;
  font:700 17px/1 var(--f-body);box-shadow:0 8px 20px -8px rgba(0,0,0,.6);transition:transform .12s}
.play:hover{transform:translateY(-2px)} .play:active{transform:translateY(1px)}
.ghost{background:transparent;border:1px solid var(--line);border-radius:999px;padding:12px 22px;color:var(--chalk);font-weight:600}
.ghost:hover{border-color:var(--muted)}
/* Campaign: seven tiles on one path. The path, the locks and the highlighted level all come from
   saved progress, so this is built rather than pictured. */
.levels{gap:clamp(12px,3vh,30px);max-width:none}
.sheet.levels h2{margin-bottom:clamp(6px,2.4vh,24px);font-size:min(clamp(42px,5.6vw,76px),13vh);color:var(--cream)}
.ladder{--gap:clamp(10px,3vw,38px);display:grid;grid-template-columns:repeat(5,1fr);gap:var(--gap);
  width:min(100%,950px,calc((100dvh - 390px) * 4.25));margin:clamp(12px,3vh,30px) 0 0;padding:0;list-style:none}
.rung{display:grid;justify-items:center;gap:clamp(6px,1.2vh,12px);width:100%;padding:0;border:0;background:none;color:var(--chalk)}
.tile{position:relative;display:grid;place-items:center;width:100%;aspect-ratio:1/.9;border-radius:22%;
  background:#654769;box-shadow:inset 0 -5px 0 rgba(0,0,0,.16);transition:transform .12s ease}
li:not(:last-child) .tile::after{content:"";position:absolute;left:100%;top:50%;width:var(--gap);height:clamp(3px,.6vw,7px);
  translate:0 -50%;background:#654769}
.tile .glyph{width:88%;height:auto;aspect-ratio:1;filter:drop-shadow(0 3px 3px rgba(20,8,30,.35))}
.tile .wire{stroke-width:10}
.tile .rim{stroke-width:6}
.lock{position:absolute;top:-13%;right:-11%;display:grid;place-items:center;width:34%;aspect-ratio:1;border-radius:50%;
  background:#533a5c;box-shadow:0 0 0 2px rgba(255,255,255,.2)}
.lock svg{width:58%;height:58%}
.rung .n{min-width:2.3em;padding:.22em .5em;border-radius:999px;background:#533a5c;
  font:800 clamp(12px,1.7vw,20px)/1.2 var(--f-body);font-variant-numeric:tabular-nums}
.rung.locked{cursor:not-allowed}
/* Its line is always there, so the Start button stays put when a locked level is clicked */
.sheet .locknote{min-height:1.4em;margin:0;font:600 clamp(14px,1.6vw,18px)/1.4 var(--f-body);color:var(--cream)}
/* Medals: bronze, silver, gold. One tone each for the face, the shine and the shade. */
.m1{--mc:#C98A4B;--mh:#EBC49A;--md:#8E5A2B}
.m2{--mc:#BFC7D1;--mh:#F0F3F6;--md:#7E8894}
.m3{--mc:#F5C542;--mh:#FFF0B0;--md:#B98A12}
.tmedal{position:absolute;right:-4%;bottom:-12%;width:40%;aspect-ratio:1}
.tmedal svg{display:block;width:100%;height:100%;filter:drop-shadow(0 2px 3px rgba(0,0,0,.45))}
.rung:not(.locked):hover .tile{transform:translateY(-3px)}
.rung.next .tile{background:var(--cream) url(assets/card.jpg) center/cover;transform:scale(1.14);
  box-shadow:0 0 0 clamp(3px,.5vw,6px) var(--yellow), 0 0 26px 6px rgba(245,183,0,.5)}
.rung.next:hover .tile{transform:scale(1.14) translateY(-3px)}
.rung.next .n{margin-top:.5em;background:var(--yellow);color:var(--table)}
.rung.done .n{background:var(--good);color:var(--table)}
.go{display:inline-flex;align-items:center;gap:.7em;padding:clamp(13px,2.2vh,24px) clamp(34px,6vw,76px);border:0;border-radius:999px;
  background:var(--yellow);color:var(--table);font:800 clamp(19px,2.4vw,30px)/1 var(--f-body);
  box-shadow:0 5px 0 #C98E00, 0 14px 24px -10px rgba(0,0,0,.7);transition:transform .12s ease}
.go:hover{transform:translateY(-2px)}
/* A lift carries the button off a mouse resting on its bottom edge, which ends the hover and drops
   it back, over and over. This strip stays under the mouse so the hover holds. */
.play,.go{position:relative}
button.card:hover::after,.play:hover::after,.go:hover::after{content:"";position:absolute;inset:0 0 -4px}
.go svg{width:.8em;height:.8em}
.go:disabled{opacity:.42;cursor:default;transform:none}

/* ---------- custom game ---------- */
.sheet.custom{gap:clamp(10px,2.2vh,22px)}
.sheet.custom h2{font-size:min(clamp(42px,5.6vw,76px),13vh);color:var(--cream)}
.opts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:clamp(10px,2vh,18px) clamp(14px,3vw,32px);width:min(100%,720px)}
.opt{display:grid;gap:6px;justify-items:start;text-align:left;min-width:0}
.opt>span,.field>span{font:600 13px/1 var(--f-body);color:var(--muted)}
.seg{display:flex;width:100%;padding:3px;box-sizing:border-box;border:1px solid var(--line);border-radius:999px;background:rgba(25,7,36,.6)}
.seg button{flex:1;min-width:0;padding:clamp(7px,1.3vh,11px) 4px;border:0;border-radius:999px;background:none;color:var(--chalk);
  font:600 clamp(13px,1.4vw,15px)/1 var(--f-body);white-space:nowrap}
.seg button[aria-pressed=true]{background:var(--cream);color:var(--table)}
.seg button:disabled{cursor:default}
.seg button:disabled:not([aria-pressed=true]){color:var(--muted)}
.field{display:grid;gap:6px;width:min(100%,280px);text-align:left}
.custom input{box-sizing:border-box;width:100%;padding:10px 16px;border:1px solid var(--line);border-radius:999px;background:rgba(25,7,36,.6);
  color:var(--chalk);font:600 16px/1.2 var(--f-body)}
.custom input:focus{outline:2px solid var(--yellow);outline-offset:1px}
.join{display:flex;gap:8px;width:min(100%,260px)}
.join input{flex:1;min-width:0;text-transform:uppercase}
.join input::placeholder{text-transform:none;color:var(--muted)}
.custom .actions{align-items:center}
.players{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin:0;padding:0;list-style:none;max-width:720px}
.players li{padding:7px 14px;border-radius:999px;background:#533a5c;font-weight:600}
.players .me,.rank .me,.scores .me{color:var(--yellow)}

/* ---------- intro & result ---------- */
.sheet{justify-content:center;gap:22px;text-align:center;padding-block:24px}
/* The tutorial is the board. The level name rides in the eyebrow and the teaching line carries the type. */
.intro{gap:clamp(10px,1.8vh,18px);padding-block:12px}
#introBoard{transition:opacity .45s ease,visibility .45s}
#intro.splash #introBoard{opacity:0;visibility:hidden;transition:none}
.sheet p.lead{transition:transform .6s cubic-bezier(.2,.8,.2,1);
  display:grid;align-content:end;min-height:2.7em;max-width:42ch;color:var(--chalk);font:600 clamp(18px,2.4vw,24px)/1.35 var(--f-body);text-wrap:balance}
.eyebrow{font:600 11px/1 var(--f-body);letter-spacing:.16em;text-transform:uppercase;color:var(--muted)}
.sheet h2{margin:0;font:800 clamp(34px,8vw,56px)/1 var(--f-display);letter-spacing:-.02em;text-wrap:balance}
.sheet p{margin:0 auto;max-width:42ch;line-height:1.55;color:var(--muted);font-size:16px}
.sheet p strong{color:var(--chalk);font-weight:600}
#introActions .play{min-width:112px}
/* Back and Next sit under the board's left and right edges */
#introActions{width:min(100%,920px,calc((100dvh - 232px) * 5 / 3));justify-content:space-between}
.actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:center}
#result{gap:clamp(8px,2.4vh,26px);padding-block:12px}
#result h2{font-size:min(clamp(42px,8.5vw,112px),14vh);color:var(--cream)}
#resBody:empty{display:none}
.emblem{position:relative;width:clamp(76px,19vh,190px);aspect-ratio:1.4}
.emblem.medal{width:clamp(72px,20vh,180px);aspect-ratio:1}
.emblem svg{display:block;width:100%;height:100%;filter:drop-shadow(0 6px 10px rgba(0,0,0,.35))}
.emblem i{position:absolute;display:block;aspect-ratio:1;background:var(--c);
  -webkit-mask-image:var(--m);mask-image:var(--m);-webkit-mask-size:contain;mask-size:contain;
  -webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center}
.emblem .g-circle{--c:var(--red);width:52%;left:0;top:10%}
.emblem .g-square{--c:var(--blue);width:47%;right:0;top:0;rotate:14deg}
.emblem .g-triangle{--c:var(--yellow);width:53%;left:25%;bottom:0}
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:clamp(8px,1.6vw,24px);width:min(100%,740px)}
.stat{border:1px solid var(--line);border-radius:18px;padding:clamp(8px,2vh,20px) 8px;background:rgba(255,255,255,.06)}
.stat b{display:block;font:800 clamp(24px,min(4vw,7vh),48px)/1.1 var(--f-display);font-variant-numeric:tabular-nums}
.stat span{font-size:clamp(13px,1.6vw,18px);color:var(--muted)}
.steps{--gap:clamp(12px,2.6vw,38px);display:flex;align-items:center;gap:var(--gap);margin:0;padding:0;list-style:none}
.steps li{position:relative;display:grid;place-items:center;width:clamp(26px,min(3.6vw,6.5vh),42px);aspect-ratio:1;box-sizing:border-box;
  border:2px solid rgba(238,244,234,.3);border-radius:50%;color:var(--muted);font:700 clamp(12px,1.5vw,18px)/1 var(--f-body)}
.steps li+li::before{content:"";position:absolute;right:100%;top:50%;width:calc(var(--gap) + 2px);height:3px;translate:0 -50%;
  background:rgba(238,244,234,.22)}
.steps .done+li::before{background:var(--cream)}
.steps .done,.steps .now{border-color:var(--cream);background:var(--cream);color:var(--table)}
.steps .now{scale:1.18}
.steps svg{width:62%;height:62%}
/* The finished level's moment, in order: the tick draws and twinkles, the bar grows to the next
   step, that step lights, and game.js unlocks Next Level. Each animation starts from its own
   "before" look and ends on the plain resting style, so reduced motion just shows the result.
   The timings add up to UNLOCK in game.js. */
.steps .fresh{animation:stepIn .4s cubic-bezier(.2,1.5,.4,1) .2s backwards}
.steps .fresh svg path{stroke-dasharray:1;animation:tick .34s ease-out .3s backwards}
.steps .fresh+li::before{background:rgba(238,244,234,.22)}
.steps .fresh+li::after{content:"";position:absolute;right:100%;top:50%;width:calc(var(--gap) + 2px);height:3px;translate:0 -50%;
  background:var(--cream);transform-origin:left center;animation:grow .5s ease-in-out .95s backwards}
.steps .fresh+.now{animation:stepOn .38s cubic-bezier(.2,1.5,.4,1) 1.42s backwards}
.spark{position:absolute;width:42%;aspect-ratio:1;opacity:0;background:var(--yellow);pointer-events:none;
  clip-path:polygon(50% 0,60% 40%,100% 50%,60% 60%,50% 100%,40% 60%,0 50%,40% 40%);animation:twinkle .62s ease-out .42s}
.spark.p1{left:-26%;top:-30%}
.spark.p2{right:-28%;top:-22%;width:32%;animation-delay:.52s}
.spark.p3{right:-20%;bottom:-30%;animation-delay:.6s}
.spark.p4{left:-22%;bottom:-20%;width:28%;animation-delay:.48s}
.play:disabled{opacity:.42;cursor:default}
.play.ready{animation:ready .34s cubic-bezier(.2,1.5,.4,1)}
@keyframes stepIn{from{scale:.5;background:transparent;border-color:rgba(238,244,234,.3)}}
@keyframes tick{from{stroke-dashoffset:1}to{stroke-dashoffset:0}}
@keyframes grow{from{scale:0 1}to{scale:1 1}}
@keyframes stepOn{from{scale:1;background:transparent;border-color:rgba(238,244,234,.3);color:var(--muted)}}
@keyframes twinkle{0%{opacity:0;scale:.2;rotate:0deg}45%{opacity:1;scale:1.1;rotate:35deg}100%{opacity:0;scale:.3;rotate:70deg}}
@keyframes ready{from{scale:.94}60%{scale:1.05}to{scale:1}}
#resActions .play{padding:clamp(13px,2.5vh,26px) clamp(34px,5vw,84px);font-size:clamp(17px,1.9vw,24px)}
#resActions .ghost{padding:clamp(11px,2vh,20px) clamp(20px,2.6vw,40px);font-size:clamp(15px,1.5vw,19px)}
.newbest{color:var(--yellow);font-weight:600}
.rank{display:grid;gap:6px;width:min(100%,360px);margin:0;padding:0;list-style:none}
.rank li{display:flex;justify-content:space-between;gap:16px;padding:clamp(5px,1vh,10px) 16px;border-radius:12px;background:rgba(255,255,255,.06);font-weight:600}
.rank b{font-variant-numeric:tabular-nums}

/* ---------- game ---------- */
.game{gap:14px}
.hud{width:100%;display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:12px}
.hud .lv{font-weight:600;line-height:1.25;min-width:0}
.hud .clock{justify-self:end;font:800 30px/1 var(--f-display);font-variant-numeric:tabular-nums}
.hud .clock.low{color:var(--bad)}
.score{display:flex;align-items:center;justify-content:center;gap:clamp(5px,1vw,10px)}
.score b{margin-right:4px;font:800 30px/1 var(--f-display);font-variant-numeric:tabular-nums}
.hm{display:grid;place-items:center;width:30px;aspect-ratio:1;box-sizing:border-box;border:2px solid var(--mc);border-radius:50%;
  color:var(--mc);font:700 12px/1 var(--f-body);font-variant-numeric:tabular-nums;transition:background .2s ease,color .2s ease}
.hm.on{background:var(--mc);color:var(--table)}
.pips{display:flex;gap:5px;flex-wrap:wrap;justify-content:center;max-width:180px}
.pip{width:10px;height:10px;border-radius:50%;border:1.5px solid var(--muted)}
.pip.on{background:var(--chalk);border-color:var(--chalk)}
.count{font:800 30px/1 var(--f-display);font-variant-numeric:tabular-nums;text-align:center}
.count small{display:block;font:500 11px/1.4 var(--f-body);letter-spacing:.12em;text-transform:uppercase;color:var(--muted)}
.bar{width:100%;height:4px;border-radius:4px;background:var(--line);overflow:hidden}
.bar i{display:block;height:100%;background:var(--chalk);transform-origin:left;transition:transform .1s linear}
.board{display:grid;grid-template-columns:repeat(3,1fr);gap:clamp(8px,1.6vw,18px);
  width:min(100%, 920px, calc((100dvh - 212px - var(--hist,0px)) * 5 / var(--rows,4)))}
.board.demo{width:min(100%, 920px, calc((100dvh - 232px) * 5 / var(--rows,3)))}
/* Sets found: a column beside the board where the window is wide enough, a strip under it where not */
.history h3{margin:0 0 8px;font:600 11px/1 var(--f-body);letter-spacing:.14em;text-transform:uppercase;color:var(--muted)}
.history ol{margin:0;padding:0;list-style:none}
.history li{display:grid;grid-template-columns:repeat(3,1fr);gap:3px;animation:deal .32s ease-out}
.history .scores li{display:flex;justify-content:space-between;gap:8px;animation:none;font-weight:600}
.scores span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.scores b{font-variant-numeric:tabular-nums}
.history .card{border-radius:14% / 22%;box-shadow:0 1px 2px rgba(0,0,0,.35)}
.history .glyph-wrap{filter:none}
@media (min-aspect-ratio:5/4){
  .game .board{max-width:calc(100vw - 372px)}
  /* Twelve cards sit 4 across where there's room, and stay 3 across on a phone so they stay readable */
  .board.wide{grid-template-columns:repeat(4,1fr);width:min(100%,1228px,calc((100dvh - 212px) * 6.7 / 3))}
  .board.demo.wide,#introBoard.wide~#introActions{width:min(100%,1228px,calc((100dvh - 232px) * 6.7 / 3))}
  .game:has(.board.wide){max-width:max(980px,min(1228px,calc(100vw - 372px)))}
  .intro:has(.board.wide){max-width:1228px}
  .history{position:fixed;top:78px;bottom:12px;right:16px;width:164px;box-sizing:border-box;display:flex;flex-direction:column;
    padding:10px;border-radius:14px;background:rgba(25,7,36,.6)}
  .history ol{display:grid;align-content:start;gap:8px;min-height:0;overflow-y:auto}
}
@media not all and (min-aspect-ratio:5/4){
  .game{--hist:54px}
  .history{width:100%}
  .history h3{display:none}
  .history ol{display:flex;gap:8px;min-height:40px;overflow-x:auto}
  .history li{flex:0 0 116px}
}
.tools{display:flex;gap:10px;justify-content:center;flex-wrap:wrap}
.tools .ghost{padding:9px 18px;font-size:14px}
.toast{min-height:20px;font-size:14px;color:var(--muted);text-align:center}
.toast.sr{position:absolute;width:1px;height:1px;min-height:0;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%)}

@media (max-width:480px){
  .hud .clock,.count{font-size:24px}
  .home{gap:22px}
}
@media (prefers-reduced-motion:reduce){
  *{animation:none!important;transition:none!important}
}
