:root{
  font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:#eef8ed;
  background:#153e36;
  font-synthesis:none;
  color-scheme:dark
}
*{
  box-sizing:border-box
}
html,body,#app{
  width:100%;
  height:100%;
  margin:0;
  overflow:hidden
}
button{
  font:inherit;
  cursor:pointer;
  -webkit-tap-highlight-color:transparent
}
button:focus-visible{
  outline:3px solid #ffdf87;
  outline-offset:3px
}
/* Headings receive focus from code so screen readers start there; a focus box on them only looks broken. */
[tabindex="-1"]:focus{
  outline:none
}
button:disabled{
  opacity:.35;
  cursor:default
}
#app{
  position:relative;
  display:flex;
  flex-direction:column;
  background:radial-gradient(ellipse at 50% 42%,#316858 0,#194b40 55%,#103d35 100%)
}
#app:before{
  content:"";
  position:absolute;
  inset:12px;
  border:1px solid #b9d5ad19;
  border-radius:18px;
  pointer-events:none
}
header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 20px 8px;
  z-index:1
}
.header-actions{
  display:flex;
  gap:6px
}
.icon-button{
  display:grid;
  place-items:center;
  padding:0;
  width:38px;
  height:38px;
  border:1px solid #c9dfc52b;
  border-radius:50%;
  background:#14392c55;
  color:#e6efda;
  font-size:18px
}
.control-icon{width:1em;height:1em;flex:none;display:block;pointer-events:none}
.icon-button .control-icon{width:22px;height:22px}
.stats{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:28px;
  font-variant-numeric:tabular-nums;
  font-size:14px;
  color:#e0e9d8;
  padding:0 20px 7px
}
.stats strong{
  font-size:20px;
  color:#fff8df;
  margin-left:5px;
  font-weight:600
}
.stats .time{
  min-width:40px;
  display:inline-block
}
#score{display:inline-block;min-width:4.6ch;text-align:left;transform-origin:left center}
.time-label{
  display:none
}
.board-area{
  position:relative;
  flex:1;
  min-height:0;
  overflow:clip;
  overscroll-behavior:contain;
  scrollbar-width:thin;
  scrollbar-color:#75947b #194b40;
  touch-action:pan-x pan-y
}
.board-area.enlarged{
  overflow:auto;
  scrollbar-gutter:stable;
}
.board-wrap{
  overflow:hidden;
  position:relative;
  margin:auto;
  contain:layout paint
}
.board{
  position:absolute;
  transform-origin:top left;
  will-change:transform
}
.tile{
  /* An ivory body over a green back plate; every interaction keeps the same physical tile. */
  --tile-body:1px 5px 0 #cdd4c9,2px 8px 0 #239f59,2px 10px 0 #157745;
  --tile-shadow:2px 12px 2px #07281e38;
  position:absolute;
  width:60px;
  height:80px;
  padding:3px;
  border:1px solid #dbd8c3;
  border-radius:7px;
  background:linear-gradient(135deg,#fffef3,#eee9d4);
  box-shadow:var(--tile-body),var(--tile-shadow),inset 0 1px 0 white;
  /* Gradient-to-solid background transitions expose the dark board mid-fade, and shadow transitions repaint the board. */
  transition:filter .16s,translate .14s ease-out;
  touch-action:manipulation;
  color:#244c46
}
.tile svg{
  display:block;
  width:100%;
  height:100%;
  pointer-events:none
}
/* A short contact shadow marks the upper layer without darkening the whole row below. */
.tile.upper{
  --tile-shadow:2px 13px 3px #07281e52
}
.tile.blocked{
  /* Only the face tint changes: thickness, edge highlight and layer shadows stay shared. */
  background:linear-gradient(135deg,#f1f2e7,#e3e5d7);
  background-color:#e8eadf;
  filter:none
}
/* Free tiles are the ones that lift and slide, so each is its own layer before it moves. Safari otherwise rebuilt the
   board's layers at the tap, and on an iPad the lift of a picked tile and the slide of a match showed one or two
   frames (docs/qa/arrow-grove-2026-10-15). */
.tile.free{will-change:transform}
.tile.free:hover{
  background:linear-gradient(135deg,#fffef7,#f6f0dc);
  box-shadow:var(--tile-body),2px 15px 4px #07281e45,inset 0 1px 0 white;
  translate:0 -2px
}
.tile.free.hinted{
  background:#ffe59a;
  box-shadow:var(--tile-body),var(--tile-shadow),inset 0 0 0 3px #704000,0 0 0 3px #ffda75;
  z-index:900!important
}
/* The picked tile lifts off the board. */
.tile.free.selected{
  background:#dcefff;
  box-shadow:var(--tile-body),2px 18px 6px #061f2450,inset 0 0 0 3px #174f79,0 0 0 3px #eff8ff;
  translate:0 -7px;
  z-index:950!important
}
.tile.free.partner:not(.hinted){
  background:#edf6ff;
  box-shadow:var(--tile-body),var(--tile-shadow),inset 0 0 0 3px #174f79;
  z-index:850!important
}
/* Glows stay still. An animated glow becomes its own layer, and every tile stacked above it must then be composited
   too, which doubled the drawing work per match on a slow two-core machine. */
.tile.free.hinted:not(.lock-source)::before,.tile.unlocked:not(.lock-source):not(.lock-target)::before{
  content:'';
  position:absolute;
  inset:-4px;
  border-radius:10px;
  pointer-events:none
}
.tile.free.hinted:not(.lock-source)::before{box-shadow:0 0 0 3px #ffda75,0 0 18px 7px #ffe8a8cc}
.coaching .tile.free.hinted:not(.lock-source)::before{box-shadow:0 0 0 5px #ffda75,0 0 24px 10px #ffe8a8dd}
.tile.unlocked:not(.lock-source):not(.lock-target)::before{box-shadow:0 0 0 3px #fff3c4,0 0 20px 6px #fff3c4b0}
.tile.restored{animation:restore .35s ease-out}
.board.shuffling{animation:reshuffle .55s ease-in-out}
.tile[data-marker]::after{
  content:attr(data-marker);
  position:absolute;
  top:-7px;
  right:-5px;
  width:24px;
  height:24px;
  display:grid;
  place-items:center;
  border:2px solid #fff9e6;
  border-radius:50%;
  background:#704000;
  color:#fff;
  font-size:20px;
  font-weight:800;
  line-height:1;
  pointer-events:none;
}
.tile.selected::after{
  background:#174f79
}
.tile.partner:not(.hinted)::after{background:#174f79}
.tile.lock-target::before,.tile.lock-source::before{
  content:"";
  position:absolute;
  inset:0;
  border:3px dashed #a13b0c;
  border-radius:6px;
  pointer-events:none
}
.tile.lock-target::before{border:4px solid #a13b0c}
/* Gold tiles: a gold frame around the usual ivory face, with gold edges that show under the stacks above. */
.tile.gold{
  --tile-body:1px 5px 0 #f0cc68,2px 8px 0 #d39a22,2px 10px 0 #9c6a10;
  padding:6px;
  border:1px solid #b8841f;
  background:linear-gradient(135deg,#fff4c7 0%,#f2cf6b 36%,#d9a23a 50%,#f6dc8c 66%,#e2b04a 100%);
  background-color:#fffdf2
}
.tile.gold.free:hover{background:linear-gradient(135deg,#fff8d8 0%,#f6d97f 36%,#e2ad48 50%,#f9e4a0 66%,#e9bb57 100%)}
.tile.gold.blocked{background:linear-gradient(135deg,#f3e6b8 0%,#dcc077 36%,#c9a250 50%,#e4cf92 66%,#d2b064 100%);background-color:#f4f3e8}
.tile.gold svg{border-radius:4px;background:#fffdf2;box-shadow:0 0 0 1.5px #b8841f}
.tile.gold.blocked svg{background:#f4f3e8}
/* Gold light leaks out from under a stack: a still glow, painted below every tile above it. */
.tile.gold.covered:not(.lock-target)::before{content:"";position:absolute;inset:-2px;border-radius:9px;box-shadow:0 0 0 2px #ffb03acc,0 0 9px 3px #ff9f2e99;pointer-events:none}
.tile .glint{position:absolute;left:-7px;bottom:-5px;width:19px;height:19px;background:#fffdf0;clip-path:polygon(50% 0,61% 39%,100% 50%,61% 61%,50% 100%,39% 61%,0 50%,39% 39%);pointer-events:none}
/* A bonus tag sits on the tile's top edge like a price label: red and gold, as on a lucky envelope. */
.tile .ribbon{
  position:absolute;
  top:-8px;
  right:1px;
  padding:2px 5px 3px;
  border:1.5px solid #ffe08a;
  border-radius:6px;
  background:#d8344a;
  color:#ffe9a0;
  font-size:13px;
  font-weight:900;
  line-height:1;
  box-shadow:0 2px 0 #7a1022;
  pointer-events:none
}
.tile.blocked .ribbon{background:#b8566a;color:#fff1c8}
.tile[data-marker] .ribbon{visibility:hidden}
.blocked-guide{position:fixed;inset:0;z-index:1050;pointer-events:none}
.blocked-guide[hidden]{display:none}
/* A see-through note like the praise labels: it reads over the tiles without hiding them, and fades after a moment. */
.blocked-label{
  position:absolute;
  padding:6px 12px 7px;
  border-radius:12px;
  background:#4a1a04c2;
  box-shadow:0 0 14px 5px #4a1a04c2;
  color:#fff4df;
  font-size:15px;
  line-height:1.35;
  text-align:center;
  text-shadow:0 1px 0 #2a0e02
}
.blocked-label strong,.blocked-label span{display:block}
.blocked-label strong{font-size:17px;margin-bottom:1px;color:#ffe2bd}
.blocked-arrow{
  position:absolute;
  transform:translate(-50%,-50%);
  display:grid;
  place-items:center;
  width:30px;
  height:30px;
  border:2px solid #fff4df;
  border-radius:6px;
  background:#a13b0c;
  color:white;
  font-size:26px;
  font-weight:800;
  line-height:1
}
.blocked-guide[data-reason="sides"] .above,
.blocked-guide[data-reason="covered"] .left,
.blocked-guide[data-reason="covered"] .right{display:none}
.side-rule{margin:20px 0;padding:12px 8px;background:#e7ebdf;border-radius:10px}
.rule-row{display:flex;justify-content:center}
.rule-tile{position:relative;flex:1;max-width:65px}
.rule-tile svg{display:block;width:100%;border:1px solid #81907a;border-radius:5px;background:#fffef3}
.rule-tile.locked svg{background:#cbd2c6}
.rule-tile>span{position:absolute;left:50%;bottom:-10px;transform:translateX(-50%);background:#a13b0c;color:white;border-radius:5px;padding:0 4px;font-size:22px;line-height:1.2}
.side-rule p{margin:22px 0 0}
.practice-dialog{width:min(460px,calc(100% - 28px));padding:18px}
.practice-dialog h2{font-size:25px;margin:0 0 8px}
.practice-progress{font-size:14px;margin:8px 0;color:#45624d}
.practice h3{font-size:24px;margin:8px 0;color:#254b3c}
.practice{--practice-width:clamp(60px,18vw,88px);display:grid;grid-template-columns:1fr 1fr}
.practice>p,.practice>h3,.practice-board{grid-column:1 / -1}
.practice #practice-next{grid-column:2;grid-row:6}
.practice #practice-skip{grid-column:1;grid-row:6}
.practice:has(#practice-next[hidden]) #practice-skip{grid-column:1 / -1}
.practice .tool{white-space:normal;line-height:1.25;padding:10px 8px}
.practice-complete{display:block}
.practice-copy{min-height:48px;margin:8px 0;font-size:clamp(16px,2vw,18px)}
.practice-board{height:calc(var(--practice-width) * 4 / 3 + 42px);position:relative;margin:16px auto}
.practice-status{min-height:48px;margin:10px 0;font-size:clamp(16px,2vw,18px);font-weight:600;color:#254b3c}
.practice button[hidden]{display:none}
.practice .tile{width:var(--practice-width);height:calc(var(--practice-width) * 4 / 3);transition:none}
@media (min-width:520px) and (min-aspect-ratio:4/3){
  .practice-dialog{width:min(760px,calc(100% - 24px))}
  .practice:not(.practice-complete){--practice-width:clamp(60px,calc((100vw - 96px) / 8),88px);grid-template-columns:minmax(0,1fr) calc(var(--practice-width) * 4 + 6px);gap:8px 16px}
  .practice .practice-progress{grid-column:1;grid-row:1}
  .practice h3{grid-column:1;grid-row:2}
  .practice .practice-copy{grid-column:1;grid-row:3;min-height:0}
  .practice .practice-board{grid-column:2;grid-row:1 / 4;align-self:center;margin:8px auto}
  .practice-status{grid-row:4;min-height:0;margin:6px 0}
  .practice #practice-next,.practice #practice-skip{grid-row:5;margin-top:0}
}
@media (max-height:380px) and (min-width:520px){
  .practice-dialog{padding:12px}
  .practice-dialog h2{display:none}
  .practice:not(.practice-complete){gap:6px 16px}
  .practice h3{font-size:22px;margin:0}
  .practice-progress,.practice-copy,.practice-status{margin:0;line-height:1.3}
  .practice-copy,.practice-status{font-size:16px}
  .practice-board{height:calc(var(--practice-width) * 4 / 3 + 26px);margin:0 auto}
}
.tile.removing{
  pointer-events:none;
  transition:translate .12s cubic-bezier(.55,0,.9,.45);
  z-index:1000!important
}
.feedback{
  height:42px;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:0 12px;
  font-size:14px;
  line-height:1.4;
  color:#eef5e8;
  flex-shrink:0
}
.feedback.positive{
  color:#ffe6a3
}
.feedback.warning{
  color:#ffd7ac
}
.toolbar{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:3px 20px 19px;
  z-index:1
}
.tool{
  height:44px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  padding:0 17px;
  border:1px solid #bdd6b933;
  background:#12392f77;
  border-radius:12px;
  color:#f0f3df;
  font-size:14px;
  font-weight:600;
  white-space:nowrap
}
.tool:disabled{
  opacity:1;
  background:#244e45;
  color:#b6c7ba;
  border-color:#607b6d
}
.tool:hover{
  background:#386853
}
.tool.primary{
  background:#eee5bd;
  color:#27483a;
  border-color:#eee5bd
}
.tool .symbol{
  display:inline-flex;
  flex:none;
  font-size:18px;
  font-weight:400
}
.fx{position:fixed;inset:0;pointer-events:none;z-index:1150;overflow:hidden;contain:strict}
.fx>div{position:absolute;width:0;height:0}
.fx i{position:absolute;display:block}
.fx .chips i{margin:-3px 0 0 -5px;border-radius:2px;background:#fffaea;box-shadow:0 2px 0 #7d8a6c}
.fx .petals i{width:12px;height:7px;margin:-3px 0 0 -6px;border-radius:50%}
.fx .sparkles i{width:18px;height:18px;margin:-9px 0 0 -9px;clip-path:polygon(50% 0,61% 39%,100% 50%,61% 61%,50% 100%,39% 61%,0 50%,39% 39%)}
.fx .stars i{width:24px;height:24px;margin:-12px 0 0 -12px;clip-path:polygon(50% 0,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%)}
.fx .sparks i{width:6px;height:20px;margin:-10px 0 0 -3px;border-radius:3px}
.fx .confetti i{width:12px;height:18px;margin:-9px 0 0 -6px;border-radius:2px}
.fx .coins i{width:26px;height:26px;margin:-13px 0 0 -13px;border-radius:50%;box-shadow:inset 0 0 0 3px #c98a1b,inset 0 0 0 5px #ffe9a8,inset 0 0 0 9px #ffd76a,inset 0 0 0 12px #0d3b31,0 2px 0 #7a4b00}
.fx .coins.small i{width:13px;height:13px;margin:-6px 0 0 -6px;box-shadow:inset 0 0 0 2px #c98a1b,inset 0 0 0 4px #ffe9a8,0 1px 0 #7a4b00}
.fx .flash{border-radius:50%}
/* Turning rays behind the biggest moments, fading out towards their edge. */
.fx .rays{border-radius:50%;-webkit-mask:radial-gradient(circle,#000 18%,transparent 70%);mask:radial-gradient(circle,#000 18%,transparent 70%)}
.fx .rays.flame{background:repeating-conic-gradient(#ffb347bb 0 9deg,transparent 9deg 30deg)}
.fx .rays.royal{background:repeating-conic-gradient(#c9b6ffbb 0 8deg,#ffe08a88 8deg 12deg,transparent 12deg 30deg)}
.fx .rays.gold{background:repeating-conic-gradient(#ffe08acc 0 10deg,transparent 10deg 24deg)}
.fx .twinkle i{width:24px;height:24px;margin:-12px 0 0 -12px;background:radial-gradient(circle,#fff 0 25%,#ffe08a 60%);clip-path:polygon(50% 0,58% 42%,100% 50%,58% 58%,50% 100%,42% 58%,0 50%,42% 42%)}
.fx>.stamp{width:auto;height:auto;padding:3px 10px 4px;border:2.5px solid #d8344a;border-radius:8px;background:#fff6e0;color:#b3182f;font-size:18px;font-weight:900;letter-spacing:.02em;white-space:nowrap;box-shadow:inset 0 0 0 2px #fff6e0,inset 0 0 0 3.5px #d8344a99,0 4px 12px #00140f80;opacity:0}
/* Points fly from the pair to the score. */
.fx>.score-fly{width:auto;height:auto;display:flex;align-items:center;gap:4px;padding:2px 11px 3px;border:2px solid #c4f2d6;border-radius:999px;background:#0d2f28e6;box-shadow:0 4px 12px #00140f80;font-weight:900;font-size:24px;line-height:1.1;color:#fff2b7;white-space:nowrap;opacity:0}
.score-fly.hot{border-color:#ffb347;background:#3a1a0ae6;color:#fff;font-size:26px}
.score-fly.bonus{border-color:#ffe08a;background:#8a1830e6;color:#ffe9a0;font-size:26px}
.score-fly.gold{padding-left:5px;border-color:#f3cf6a;background:linear-gradient(#4a3407,#2a1d04);color:#ffe7a0;font-size:30px;box-shadow:0 0 0 3px #f3cf6a40,0 4px 16px #ffd76a66}
.score-fly .sticker{width:30px;height:30px;display:block}
/* Praise appears where a pair met. Combo tiers, gold and bonus each have their own colour, sticker and size;
   quick matches only ever add points, nothing counts down. No frame: outlined words on a soft, see-through glow
   of the tier's colour, so the tiles underneath stay visible. */
.combo{
  --tint:#0d2f2899;
  --ink:#1e6045;
  position:fixed;
  z-index:1160;
  pointer-events:none;
  display:grid;
  grid-template-columns:auto auto;
  align-items:center;
  justify-items:start;
  column-gap:8px;
  opacity:0;
  padding:7px 20px 8px 10px;
  border-radius:999px;
  background:var(--tint);
  box-shadow:0 0 18px 8px var(--tint);
  font-weight:800;
  line-height:1.1;
  white-space:nowrap
}
.combo>svg{grid-row:span 2;width:42px;height:42px;display:block}
.combo strong{font-size:23px;color:#fff;text-shadow:0 2px 0 var(--ink),2px 0 0 var(--ink),-2px 0 0 var(--ink),0 -2px 0 var(--ink),0 4px 8px #00140f99}
.combo span{font-size:14px;color:#e4fff0;text-shadow:0 1.5px 0 var(--ink),1.5px 0 0 var(--ink),-1.5px 0 0 var(--ink),0 -1.5px 0 var(--ink),1px 1px 0 var(--ink),-1px 1px 0 var(--ink),1px -1px 0 var(--ink),-1px -1px 0 var(--ink)}
.combo.tier-nice{background:none;box-shadow:none}
.combo.tier-great{--tint:#1d5fa899;--ink:#174f79}
.combo.tier-great strong{font-size:26px}
.combo.tier-great span{color:#dff0ff}
.combo.tier-amazing{--tint:#c2410ca6;--ink:#7a2406;padding:8px 22px 9px 10px}
.combo.tier-amazing strong{font-size:30px}
.combo.tier-amazing span{color:#fff1df}
.combo.tier-incredible{--tint:#6a2bb0a6;--ink:#3a1478;padding:9px 26px 10px 11px}
.combo.tier-incredible strong{font-size:38px;text-shadow:0 2px 0 var(--ink),2px 0 0 var(--ink),-2px 0 0 var(--ink),0 -2px 0 var(--ink),0 0 16px #b79cff}
.combo.tier-incredible span{font-size:16px;color:#ece6ff}
.combo.tier-incredible>svg,.combo.tier-amazing>svg{width:52px;height:52px}
.combo.tier-gold>svg{width:48px;height:48px}
.combo.tier-gold{--tint:#8a5a00b3;--ink:#7a4b00;padding:8px 24px 9px 8px}
.combo.tier-gold strong{font-size:32px;color:#ffe9a8;text-shadow:0 2px 0 var(--ink),2px 0 0 var(--ink),-2px 0 0 var(--ink),0 -2px 0 var(--ink),0 0 14px #ffd76a}
.combo.tier-gold span{color:#ffe7b0}
.combo.tier-bonus{--tint:#a3213aa6;--ink:#5a0c1b}
.combo.tier-bonus strong{color:#ffe9a0}
.combo.tier-bonus span{color:#ffe2b8}
.combo.tier-record{--tint:#0f6b4ab3;--ink:#7a4b00;padding:8px 24px 9px 8px}
.combo.tier-record strong{font-size:30px;color:#ffe9a8;text-shadow:0 2px 0 var(--ink),2px 0 0 var(--ink),-2px 0 0 var(--ink),0 -2px 0 var(--ink),0 0 12px #ffd76a}
.combo.tier-record span{color:#fff1bf}
.combo.tier-mipo{--tint:#2a1d9eb3;--ink:#2a1d9e;padding:8px 24px 9px 8px}
.combo.tier-mipo strong{font-size:30px;color:#ffd23f}
.combo.tier-mipo span{color:#fff6cf}
.combo .mipo{width:48px;height:48px;margin:-8px 0 -6px -4px}
/* Score plaque: a coin, a label and the running total; points land on it with a flash. */
.score-box{
  position:relative;
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:3px 14px 3px 4px;
  border:2px solid #e2bd62;
  border-radius:999px;
  background:linear-gradient(#1b5a4a,#0c3a30 55%,#0a2f27);
  box-shadow:inset 0 0 0 2px #0a2b24,inset 0 0 0 3px #d4ad5788,inset 0 2px 0 #ffffff26,0 0 0 1px #7a4b0099,0 3px 10px #00140f66
}
.score-shine{position:absolute;inset:0;border-radius:inherit;overflow:hidden;pointer-events:none}
.score-shine i{position:absolute;top:-20%;bottom:-20%;left:0;width:34%;background:linear-gradient(100deg,transparent,#fff6d466 45%,#ffffffaa 50%,#fff6d466 55%,transparent);translate:-120% 0}
.score-coin{display:block;width:28px;height:28px;flex:none}
.score-coin .sticker{display:block;width:100%;height:100%}
.score-label{font-size:11px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;color:#e8cf8a}
.stats .score-box strong{margin:0;font-size:22px;font-weight:800;color:#fff1bf;text-shadow:0 1px 0 #5a3d06}
.score-flash{position:absolute;inset:-5px;border-radius:inherit;pointer-events:none;opacity:0;box-shadow:0 0 0 3px #f3dc95,0 0 20px 7px #f3cf6a88}
.score-flash[data-kind=hot]{box-shadow:0 0 0 3px #ffc58f,0 0 20px 7px #ff8a3d88}
.score-flash[data-kind=bonus]{box-shadow:0 0 0 3px #d4c4ff,0 0 20px 7px #9f86ff88}
.score-flash[data-kind=gold]{box-shadow:0 0 0 4px #ffe08a,0 0 28px 12px #ffd76aaa}
.gold-left{display:inline-flex;align-items:center;gap:5px;padding:3px 10px 3px 6px;border:1.5px solid #d4ad5799;border-radius:999px;background:#0a2b24aa;color:#ffe9a8}
.stats .gold-left strong{margin:0;font-size:16px;font-weight:800;color:#ffe9a8}
.gold-icon{width:15px;height:20px;border-radius:3px;background:#fffdf2;box-shadow:inset 0 0 0 3.5px #e2b04a,0 2px 0 #9c6a10}
.gold-label{font-size:11px;font-weight:800;letter-spacing:.1em;text-transform:uppercase;color:#e8cf8a}
.gold-left.found{border-color:#f3cf6a;background:#4a3407cc}
/* Beating the best score for this board shape crowns the plaque for the rest of the level. */
.score-box.record{border-color:#fff1bf;box-shadow:inset 0 0 0 2px #0a2b24,inset 0 0 0 3.5px #f3cf6a,0 0 0 1.5px #b8841f,0 0 14px #ffd76a77,0 3px 10px #00140f66}
.score-box.record .score-label{color:#ffe9a8}
.stats .score-box.record strong{color:#ffe08a;background:linear-gradient(#fff6d0 20%,#f3cf6a 55%,#d99a26);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;text-shadow:none;filter:drop-shadow(0 1px 0 #5a3d06)}
.score-box.record::after{content:"Best";position:absolute;top:-10px;right:-8px;padding:2px 6px;border-radius:7px;background:#d8344a;color:#fff1bf;font-size:10px;font-weight:900;letter-spacing:.06em;text-transform:uppercase;box-shadow:0 2px 0 #7a4b00}
#hint.nudge{animation:nudge 1.6s ease-in-out infinite}
.feedback.coach{gap:10px;color:#fff8df;font-weight:600;font-size:15px}
.feedback .mipo{width:38px;height:38px;flex:none;animation:hop .5s ease-out}
.level{font-size:16px;font-weight:600;color:#cfe3cc;letter-spacing:.01em;min-width:0}
.loading{
  margin:auto;
  color:#fff3cb
}
dialog{
  border:1px solid #d9cdac;
  border-radius:22px;
  background:#faf7e9;
  color:#254b3c;
  padding:24px;
  width:min(420px,calc(100% - 28px));
  max-height:calc(100% - 24px);
  overflow:auto;
  box-shadow:0 24px 80px #001e1aaa;
  text-align:center
}
dialog::backdrop{
  background:#052e29b5;
  backdrop-filter:blur(5px)
}
dialog h2{
  font-family:Georgia,serif;
  font-size:31px;
  font-weight:400;
  margin:8px 0 12px
}
dialog p{
  font-size:16px;
  line-height:1.6;
  color:#3d5846
}
dialog .tool{
  background:#255846;
  color:#fff;
  width:100%;
  margin-top:12px;
  border-color:#255846;
  min-height:48px;
  font-size:16px
}
dialog .secondary{
  background:transparent;
  color:#45624d;
  border-color:#cbd3bc
}
dialog .secondary:hover{background:#e7ead9;color:#254b3c;border-color:#68795e}
dialog button:focus-visible{outline-color:#174f79}
.result-stats{
  display:flex;
  justify-content:center;
  gap:28px;
  margin:22px 0
}
.result-stats strong{
  display:block;
  font-size:25px
}
.result-stats span{
  font-size:13px;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:#49634b
}
.result-dialog{padding-top:16px}
.result-dialog[open]{display:flex;flex-direction:column}
.result-dialog .result-mipo{order:-1}
.result-dialog h2{margin:0 0 4px}
.result-mipo .mipo{display:block;width:80px;height:80px;margin:0 auto;animation:hop .6s ease-out}
dialog p.result-sub{margin:0}
.result-dialog .result-stats{margin:14px 0}
.badges{display:flex;justify-content:center;flex-wrap:wrap;gap:8px;list-style:none;padding:0;margin:0 0 12px}
.badges li{display:flex;align-items:center;gap:5px;padding:6px 11px;border-radius:999px;border:1px dashed #a9b39d;color:#5d6d59;font-size:14px;font-weight:600}
.badges li span{font-size:16px;line-height:1}
.badges li.earned{border:1px solid #255846;background:#e2efe1;color:#1f4a3a}
.badges li.earned span{color:#b8325c}
.badges li.waiting{opacity:.25}
.badges li.pop{animation:badge .45s cubic-bezier(.3,1.6,.5,1)}
dialog p.new-best{font-weight:700;color:#7a4b00;margin:0}
dialog .tool.play{background:#ffd23f;border:2px solid #2a1d9e;color:#2a1d9e;font-weight:800;box-shadow:0 4px 0 #f6b42c}
dialog .tool.play:hover{background:#ffdc66}
dialog .tool.play:focus-visible{outline-color:#2a1d9e}
.rule-sample{
  display:flex;
  justify-content:center;
  gap:10px;
  margin:18px
}
.rule-sample svg{
  height:72px;
  background:#fffef2;
  border:1px solid #d4d3bc;
  border-radius:7px;
  box-shadow:0 3px #aab19a
}
.confetti{
  position:absolute;
  inset:0;
  pointer-events:none;
  overflow:hidden;
  z-index:1200
}
.confetti i{
  position:absolute;
  width:7px;
  height:12px;
  top:-20px;
  background:#e3c576;
  animation:confetti 2.4s ease-out forwards
}
.paused .board{
  visibility:hidden
}
@keyframes restore{from{opacity:0;translate:0 -18px}}
@keyframes reshuffle{50%{opacity:.35}}
@keyframes nudge{50%{box-shadow:0 0 0 4px #ffe59a99;background:#386853}}
@keyframes hop{0%{translate:0 8px;scale:.85}60%{translate:0 -3px}100%{translate:0 0}}
@keyframes badge{0%{scale:.4;opacity:0}100%{scale:1;opacity:1}}
@keyframes confetti{
  to{
    transform:translateY(100vh) rotate(640deg);
    opacity:0
  }
}
@media(max-width:550px){
  header{
    padding:17px 17px 12px
  }
  .stats{
    gap:18px;
    padding-bottom:12px
  }
  .stats strong{
    font-size:18px
  }
  .toolbar{
    gap:4px;
    padding:4px 8px max(16px,env(safe-area-inset-bottom))
  }
  .tool{
    flex:1;
    flex-direction:column;
    gap:2px;
    padding:4px 2px;
    height:54px;
    font-size:14px;
    border-radius:11px
  }
  .tool .symbol{
    font-size:20px
  }
  .feedback{
    height:44px;
    font-size:14px;
    padding:0 18px
  }
  dialog .tool{
    display:flex;
    flex-direction:row;
    min-height:44px
  }
  .header-actions{
    gap:5px
  }
  .icon-button{
    width:34px;
    height:34px
  }
}
@media(max-height:450px){
  header{
    padding:8px 18px 4px
  }
  .stats{
    position:absolute;
    top:14px;
    left:50%;
    transform:translateX(-50%);
    gap:16px;
    white-space:nowrap
  }
  .stats strong{
    font-size:16px
  }
  .toolbar{
    padding:0 12px 8px
  }
  .tool{
    height:35px;
    flex-direction:row;
    flex:initial;
    padding:0 13px;
    font-size:14px
  }
  .feedback{
    height:34px;
    font-size:14px
  }
}
@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{
    animation-duration:.01ms!important;
    animation-iteration-count:1!important;
    transition:none!important
  }
  dialog::backdrop{
    backdrop-filter:none
  }
}
@media(max-width:550px) and (max-height:450px){
  header{
    padding:8px 12px 4px
  }
  .header-actions{
    gap:4px
  }
  .icon-button{
    width:30px;
    height:30px;
    font-size:15px
  }
  .stats{
    position:static;
    transform:none;
    padding:0 12px 6px;
    gap:18px
  }
  .toolbar{
    gap:4px;
    padding:2px 8px 8px
  }
  .toolbar .tool{
    flex:1;
    flex-direction:column;
    height:44px;
    padding:4px 2px;
    font-size:14px;
    gap:1px
  }
  .toolbar .symbol{
    font-size:17px
  }
  .feedback{
    height:36px;
    font-size:14px
  }
}

@media (max-height:450px) and (min-width:551px) and (max-width:759px){
  .stats{position:static;transform:none;gap:16px;padding:0 10px 4px}
}

/* On phones and short screens the plaque is only as tall as a line of text, so the board keeps its room. */
@media (max-width:550px),(max-height:450px){
  .score-box{padding:0 10px 0 1px;gap:4px;border-width:1.5px}
  .score-coin{width:22px;height:22px}
  .stats .score-box strong{font-size:18px;line-height:22px}
  .score-label{font-size:10px}
  .gold-left{padding:0 8px 0 4px;line-height:22px}
  .gold-icon{width:12px;height:16px}
  .stats .gold-left strong{font-size:15px}
}
@media (max-width:550px){.stats{padding-bottom:7px}}
@media (max-height:450px){
  .score-coin{width:20px;height:20px}
  .stats .score-box strong,.gold-left{line-height:20px}
}
@media (pointer:coarse){
  .icon-button{min-width:44px;min-height:44px}
  .tool{min-width:44px;min-height:44px}
  .keyboard-help{display:none}
}
@media (pointer:coarse) and (max-width:550px){
  .header-actions{gap:2px}
}

/* Use the empty sides of a wide player, so the board gets its full height.
   Narrow/very short players retain the compact top and bottom controls. */
@media (min-width:760px) and (min-height:380px){
  #app{
    display:grid;
    grid-template-columns:80px minmax(0,1fr) 108px;
    grid-template-rows:32px auto minmax(0,1fr);
    gap:8px;
    padding:12px
  }
  header{display:contents}
  .stats{
    grid-column:1;
    grid-row:2;
    position:static;
    transform:none;
    display:flex;
    flex-direction:column;
    align-items:stretch;
    gap:14px;
    padding:0;
    font-size:14px;
    white-space:normal
  }
  .stats strong{display:block;margin:3px 0 0;font-size:25px;line-height:1.1}
  .stats .time{display:block}
  .score-box{display:grid;justify-items:center;gap:1px;padding:8px 2px 9px;border-radius:14px}
  .score-coin{width:30px;height:30px}
  .stats .score-box strong{font-size:21px;letter-spacing:-.02em}
  #score{min-width:0;text-align:center;transform-origin:center}
  .time-label{display:inline}
  .feedback{
    grid-column:1;
    grid-row:3;
    height:auto;
    min-height:0;
    display:block;
    overflow:auto;
    padding:6px 0 0;
    text-align:left;
    font-size:15px;
    line-height:1.45
  }
  header > .level{grid-column:1;grid-row:1;align-self:center;line-height:1.25;font-size:14px}
  .board-area{grid-column:2;grid-row:1 / -1;min-width:0}
  .feedback.coach .mipo{display:block;margin-bottom:6px}
  .header-actions{
    grid-column:3;
    grid-row:1;
    display:grid;
    grid-template-columns:repeat(2,44px);
    gap:6px;
    justify-content:center;
    align-self:start
  }
  .icon-button{width:44px;height:44px;font-size:20px}
  #pause{grid-column:1 / -1;width:100%;border-radius:12px}
  .toolbar{
    grid-column:3;
    grid-row:2 / -1;
    margin-top:66px;
    flex-direction:column;
    align-items:stretch;
    justify-content:flex-start;
    gap:8px;
    padding:0
  }
  .toolbar .tool{height:44px;min-height:44px;flex:none;padding:0 6px;gap:5px;font-size:14px}
  .toolbar .symbol{font-size:19px}
}
@media (min-width:1100px) and (min-height:450px){
  #app{grid-template-columns:96px minmax(0,1fr) 128px;padding:16px;gap:12px}
  .stats strong{font-size:30px}
  .stats .score-box strong{font-size:25px}
  .feedback{font-size:15px}
  .toolbar .tool{height:50px;font-size:16px}
}

@media (max-width:480px){
  .combo.tier-great strong{font-size:25px}
  .combo.tier-amazing strong,.combo.tier-gold strong,.combo.tier-record strong,.combo.tier-mipo strong{font-size:27px}
  .combo.tier-incredible strong{font-size:28px}
  .combo>svg,.combo.tier-incredible>svg,.combo.tier-amazing>svg,.combo.tier-gold>svg{width:38px;height:38px}
  .combo .mipo{width:42px;height:42px}
  .combo.tier-incredible span{font-size:14px}
}
/* Keep readable controls and practice steps on narrow or short screens. */
@media (max-width:360px){
  .gold-label{display:none}
  .stats{gap:18px}
  .practice h3{font-size:21px}
  /* Keep the four controls readable on 320 px phones. */
  .toolbar{gap:3px;padding-left:6px;padding-right:6px}
  .toolbar .tool{font-weight:500}
}
/* A short phone (320 × 568) fits each practice step, even when the hint or step title wraps onto another line. */
@media (max-width:550px) and (max-height:620px){
  .practice-dialog{padding:14px}
  .practice-dialog h2{font-size:22px;margin-bottom:4px}
  .practice-progress,.practice h3,.practice-copy{margin:4px 0}
  .practice-board{margin:8px auto}
  .practice-status{margin:6px 0}
}
@media (max-height:450px){
  .level{margin:0;font-size:16px;color:#fff8df;white-space:nowrap}
}
