:root {
  color-scheme: light;
  --paper: #F3EBDD;
  --paper-deep: #E8DCC6;
  --card: #FBF6EC;
  --ink: #1E2430;
  --ink-soft: #3A4150;
  --muted: #5B6170;
  --line: 2.5px;
  --drop: rgba(30, 36, 48, .2);

  --steel: #D2D9DD;
  --steel-deep: #B9C3C9;
  --floor: #E6EBEE;
  --wire: #7F8F99;
  --ceramic: #FBFAF5;
  --rim: #5F84AA;
  --glass: #CDE8F1;
  --glass-deep: #3F6F8E;
  --mug: #C25638;
  --mug-deep: #8E3B26;
  --butter: #E5BD4F;
  --butter-deep: #B48A2A;
  --accent: #0E6A98;
  --accent-deep: #083F5C;
  --plastic: #A6D8A7;
  --plastic-lid: #2F7D52;
  --wood: #C99C66;
  --wood-deep: #A77A46;
  --wood-ink: #2C1D0E;

  --ok: #2B8A57;
  --warn: #B97C08;
  --bad: #C03E2B;

  --display: "Bowlby One", "Arial Black", sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --cell: 56px;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink);
  font: 16px/1.45 var(--body);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: var(--ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 400; margin: 0; letter-spacing: .01em; }
kbd { font: 700 13px/1 var(--body); border: 2px solid var(--ink); border-radius: 5px; padding: 1px 5px; background: var(--card); box-shadow: 0 2px 0 var(--ink); }

.app { max-width: 1180px; margin: 0 auto; padding: 14px 16px 28px; display: grid; gap: 16px; }

/* ---------- header ---------- */
.top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.studio { display: block; width: 40px; height: 40px; flex: none; transition: transform .2s var(--spring); }
.studio:hover { transform: rotate(-12deg); }
.studio svg { width: 100%; height: 100%; display: block; }
.wordmark { font-size: clamp(22px, 4vw, 34px); line-height: 1; white-space: nowrap; flex: 1; min-width: 0; }
.tools { display: flex; gap: 8px; }
.tool {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px;
  border: var(--line) solid var(--ink); border-radius: 999px; background: var(--card);
  font-weight: 700; font-size: 15px; box-shadow: 0 3px 0 var(--ink); transition: transform .1s, box-shadow .1s;
}
.tool:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--ink); }
.tool:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.tool svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tool.icon { padding: 0 9px; }
#soundBtn .mute { display: none; }
#soundBtn[aria-pressed="false"] .mute { display: inline; }
#soundBtn[aria-pressed="false"] .wave { display: none; }
@media (max-width: 720px) {
  .tool span { display: none; }
  .tool { padding: 0 9px; }
  .studio { width: 34px; height: 34px; }
}
@media (max-width: 440px) {
  .top { gap: 8px; }
  .wordmark { font-size: 16px; }
  .studio { width: 28px; height: 28px; }
  .tools { gap: 4px; }
  .tool { min-height: 34px; padding: 0 6px; }
  .tool svg { width: 18px; height: 18px; }
}

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; font-size: 14px; color: var(--muted); padding: 4px 2px 0; }

/* ---------- buttons ---------- */
.btn {
  border: var(--line) solid var(--ink); background: var(--card); color: var(--ink); border-radius: 10px;
  padding: 7px 12px; font-size: 15px; font-weight: 700; min-height: 40px;
  box-shadow: 0 3px 0 var(--ink); transition: transform .1s, box-shadow .1s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 0 var(--ink); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.small { min-height: 34px; padding: 4px 10px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: default; box-shadow: 0 1px 0 var(--ink); }
.btn.hint { animation: pulse .9s ease-in-out 3; }

/* ---------- stage ---------- */
.stage { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 900px) { .stage { grid-template-columns: minmax(0, 1fr); } }

.machine {
  position: relative; background: var(--steel); border: 3px solid var(--ink); border-radius: 20px;
  box-shadow: 0 6px 0 var(--drop); padding: 16px 16px 20px; display: grid; gap: 12px; justify-items: center; overflow: hidden; min-width: 0;
  background-image: linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,0) 40%);
}
.machine-head { width: 100%; display: flex; gap: 10px 14px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.eyebrow { margin: 0 0 2px; font-weight: 700; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.machine-head h2 { font-size: 24px; line-height: 1.05; }
.machine-head p { margin: 4px 0 0; color: var(--ink-soft); max-width: 52ch; font-size: 15px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font: 700 11px/1 var(--body); letter-spacing: .08em; text-transform: uppercase; padding: 6px 9px; border-radius: 99px; border: 2px solid var(--ink); background: var(--card); }
.tag.hot { background: var(--mug); color: #fff; }

.rackwrap { display: grid; gap: 5px; justify-items: start; }
.racklabel { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-height: 22px; font: 700 12px/1 var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.racklabel em { font-style: normal; color: var(--warn); }
.racklabel .btn { font-size: 12px; min-height: 28px; padding: 3px 9px; letter-spacing: .02em; text-transform: none; box-shadow: 0 2px 0 var(--ink); }

.rack {
  position: relative; border: 3px solid var(--ink); border-radius: 12px; touch-action: none;
  background: var(--floor); box-shadow: 0 4px 0 var(--drop); transition: filter .2s;
}
.rack-art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; overflow: visible; }
.rack.pushed { cursor: pointer; }
.rack.pushed .item { cursor: pointer; filter: saturate(.5); }
.basket-label { position: absolute; font: 700 9px/1 var(--body); color: var(--ink-soft); letter-spacing: .12em; pointer-events: none; }
.rack-cover {
  position: absolute; left: -3px; right: -3px; top: -3px; z-index: 3; pointer-events: none; border-radius: 12px 12px 4px 4px;
  border: 3px solid var(--ink); border-bottom-width: 5px;
  background: repeating-linear-gradient(90deg, var(--steel-deep) 0 3px, var(--steel) 3px 16px);
  box-shadow: 0 5px 0 var(--drop); display: grid; place-items: center;
  font: 700 12px/1 var(--body); letter-spacing: .12em; color: var(--ink-soft); text-transform: uppercase;
}

/* ---------- dishes ---------- */
.item { position: absolute; padding: 3px; cursor: grab; touch-action: none; transition: left .14s ease, top .14s ease, opacity .1s; }
.item svg, .ghost svg, .card-art svg, .mini svg { width: 100%; height: 100%; display: block; overflow: visible; }
.item > svg { filter: drop-shadow(0 3px 0 var(--drop)); }
.item.lifted { opacity: .25; }
.item.sel { z-index: 2; }
.item.sel::after { content: ""; position: absolute; inset: -1px; border: 3px solid var(--accent); border-radius: 10px; pointer-events: none; }
.item.touch::after { content: ""; position: absolute; inset: 0; border: 3px dashed var(--bad); border-radius: 10px; pointer-events: none; }
.item.hint { animation: pulse .9s ease-in-out 3; }
.item.pop > svg { animation: squash .26s ease-out; transform-origin: 50% 80%; }
.item[data-shards] { cursor: pointer; }
.turns { position: absolute; z-index: 5; transform: translate(-50%, calc(-100% - 6px)); display: flex; gap: 4px; }
.turns .btn { min-height: 32px; padding: 0 10px; font-size: 17px; line-height: 1; }
.pips { position: absolute; left: 5px; bottom: 4px; display: flex; gap: 2px; pointer-events: none; }
.pips i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); border: 1.5px solid var(--ink); }
.pips i.used { background: var(--card); }
.crack { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.nestbadge { position: absolute; bottom: 2px; right: 3px; font: 700 11px/1 var(--body); background: var(--ink); color: var(--paper); padding: 2px 5px; border-radius: 5px; pointer-events: none; }
.smear { position: absolute; top: -5px; left: -5px; min-width: 22px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--butter); border: 2px solid var(--ink); color: var(--ink); font: 700 11px/16px var(--body); text-align: center; pointer-events: none; }
.sparkle { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; pointer-events: none; z-index: 6; animation: sparkle .8s ease-out forwards; }
.sparkle path { fill: #fff; stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; }

.shadow { position: absolute; border-radius: 10px; pointer-events: none; border: 3px solid; z-index: 4; }
.shadow.ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 18%, transparent); }
.shadow.soft { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 20%, transparent); border-style: dashed; }
.shadow.bad { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 16%, transparent); }
.ghost { position: fixed; pointer-events: none; z-index: 50; transform: rotate(-3deg) scale(1.04); filter: drop-shadow(3px 7px 0 var(--drop)); }

.toast {
  position: absolute; z-index: 20; pointer-events: none; font: 400 18px/1 var(--display); color: var(--accent); white-space: nowrap;
  -webkit-text-stroke: 5px var(--card); paint-order: stroke fill; animation: rise 1.1s ease-out forwards;
}
.toast.warn { color: var(--warn); }

/* ---------- door ---------- */
.door {
  position: absolute; inset: 0; z-index: 30; border-radius: 17px; transform-origin: bottom center;
  transform: perspective(900px) rotateX(-88deg); opacity: 0; pointer-events: none; visibility: hidden;
  background: linear-gradient(180deg, #E3E8EB, var(--steel) 55%, var(--steel-deep)); display: grid; place-items: center;
  transition: transform .7s cubic-bezier(.5, 0, .2, 1), opacity .15s .55s, visibility 0s .7s;
}
.door.closed { transform: perspective(900px) rotateX(0); opacity: 1; pointer-events: auto; visibility: visible; transition: transform .7s cubic-bezier(.5, 0, .2, 1), opacity .15s; }
.door-handle { position: absolute; top: 22px; left: 50%; width: 38%; height: 14px; transform: translateX(-50%); border: 3px solid var(--ink); border-radius: 8px; background: var(--wire); box-shadow: 0 3px 0 var(--drop); }
.door .panel { position: relative; z-index: 1; font: 400 15px/1.35 var(--display); color: #7EE0A8; background: var(--ink); padding: 12px 18px; border-radius: 10px; letter-spacing: .08em; text-align: center; min-width: 200px; box-shadow: 0 4px 0 var(--drop); }
.suds { position: absolute; inset: 0; overflow: hidden; border-radius: 17px; pointer-events: none; }
.suds i { position: absolute; bottom: -30px; border-radius: 50%; background: rgba(255,255,255,.85); border: 2px solid var(--ink); animation: bubble linear infinite; }
.suds i::after { content: ""; position: absolute; left: 22%; top: 20%; width: 26%; height: 26%; border-radius: 50%; background: #fff; }

/* ---------- counter ---------- */
.counter {
  position: relative; border: 3px solid var(--ink); border-radius: 20px; box-shadow: 0 6px 0 var(--drop);
  padding: 16px; display: grid; gap: 14px; min-width: 0; color: var(--wood-ink);
  background-color: var(--wood);
  background-image:
    repeating-linear-gradient(180deg, transparent 0 46px, var(--wood-deep) 46px 48px),
    repeating-linear-gradient(90deg, transparent 0 9px, rgba(255,255,255,.05) 9px 10px, transparent 10px 23px);
}
.counter.droppable { outline: 3px dashed var(--ink); outline-offset: -9px; }
.counter h3 { font: 700 12px/1 var(--body); text-transform: uppercase; letter-spacing: .14em; margin: 0 0 8px; }
.hand {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center;
  background: var(--card); color: var(--ink); border: var(--line) solid var(--ink); border-radius: 14px; padding: 12px; box-shadow: 0 4px 0 var(--drop);
}
.card-art { width: 84px; height: 84px; display: grid; grid-template: 100% / 100%; place-items: center; cursor: grab; touch-action: none; }
.card-art .fit { touch-action: none; filter: drop-shadow(0 3px 0 var(--drop)); max-width: 100%; max-height: 100%; }
.hand h4 { font-size: 19px; line-height: 1.1; }
.hand .rule { margin: 4px 0 6px; color: var(--ink-soft); font-size: 14px; }
.hand-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.hand-actions .turn { font-size: 17px; min-height: 34px; padding: 0 11px; }

.pile { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.mini { width: 44px; height: 44px; border-radius: 10px; background: rgba(251, 246, 236, .55); display: flex; align-items: center; justify-content: center; padding: 5px; }
.mini.pick { border: 2px solid transparent; cursor: grab; touch-action: none; transition: transform .15s var(--spring); }
.mini.pick:hover { transform: translateY(-2px); }
.mini.pick.picked { border-color: var(--ink); background: var(--card); box-shadow: 0 3px 0 var(--ink); }
.mini.over { outline: 2px solid var(--warn); outline-offset: -2px; transform: rotate(-6deg); }
.mini.risk { box-shadow: 0 0 0 2px var(--bad); animation: wobble 1.2s ease-in-out infinite; }
.pile .slot { width: 44px; height: 44px; border-radius: 10px; border: 2px dashed rgba(44, 29, 14, .45); }
.pile .more { font-weight: 700; font-size: 14px; }
.pile.landed { animation: landed .6s ease-out; }
.preview { margin-top: 10px; display: grid; gap: 6px; padding: 10px; border-radius: 12px; background: rgba(44, 29, 14, .12); }
.preview h4 { font: 700 12px/1.3 var(--body); letter-spacing: .06em; text-transform: uppercase; }
.preview h4.soon { color: #8E1F12; }
.preview .pile .mini { opacity: .6; filter: saturate(.6); }
.risk-note { margin: 0; font-size: 13px; color: #8E1F12; font-weight: 700; }

.status {
  min-height: 48px; background: var(--card); color: var(--ink); border: var(--line) solid var(--ink); border-radius: 12px;
  padding: 9px 12px 9px 16px; font-size: 15px; position: relative; box-shadow: 0 3px 0 var(--drop);
}
.status::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 4px; border-radius: 2px; background: var(--wire); }
.status.ok::before { background: var(--ok); }
.status.soft::before { background: var(--warn); }
.status.bad::before { background: var(--bad); }

.stats { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.stat { background: var(--card); color: var(--ink); border: 2px solid var(--ink); border-radius: 12px; padding: 7px 10px; }
.stat b { display: block; font: 400 22px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.stat span { font: 700 11px/1 var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stat b.over { color: var(--warn); }
.stat b.low { color: var(--bad); }

.meter { display: grid; gap: 5px; }
.meter-row { display: flex; justify-content: space-between; font: 700 12px/1 var(--body); letter-spacing: .08em; text-transform: uppercase; }
.meter-track { height: 14px; border-radius: 99px; background: rgba(44, 29, 14, .2); border: 2px solid var(--ink); overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: var(--accent); transition: width .3s var(--spring); }
.hands-track { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.hands-track i { height: 14px; border-radius: 99px; background: rgba(44, 29, 14, .2); border: 2px solid var(--ink); }
.hands-track i.on { background: var(--butter); }
.towel-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; margin-top: 2px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions #washBtn { flex: 1 1 100%; }
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 200px; overflow: auto; font-size: 14px; }
.log:empty { display: none; }
.log li { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; background: rgba(251, 246, 236, .8); color: var(--ink); padding: 5px 9px; border-radius: 8px; }
.log li.tempo { color: var(--ok); font-weight: 700; }
.log .stars { color: var(--butter-deep); letter-spacing: 1px; }
.log .pts { font-variant-numeric: tabular-nums; font-weight: 700; }

.side { display: grid; gap: 16px; min-width: 0; }
.tally { gap: 12px; }

/* On a phone the tray docks to the bottom of the screen, so the dish in your hand is always within a drag of both racks. */
@media (max-width: 900px) {
  .side { display: contents; }
  .tray {
    position: sticky; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 20; gap: 8px; padding: 10px;
    box-shadow: 0 -4px 0 rgba(30, 36, 48, .1), 0 6px 0 var(--drop);
  }
  .tray > div > h3:first-child:not(#pileTitle) { display: none; }
  .tray h3 { margin-bottom: 6px; }
  .tray .status { min-height: 0; font-size: 14px; line-height: 1.3; padding: 6px 10px 6px 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .tray .hand { padding: 6px 10px; gap: 10px; grid-template-columns: 48px minmax(0, 1fr); }
  .tray .hand > div:last-child { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; }
  .tray .card-art { width: 48px; height: 48px; }
  .tray .hand h4 { font-size: 16px; }
  .tray .hand .rule { font-size: 13px; margin: 0 6px 0 0; }
  .tray .hand h4 { flex: 1 1 auto; }
  .tray .hand-actions { order: -1; margin-left: auto; }
  .tray .hand h4 { order: -2; }
  .tray h3 { font-size: 11px; letter-spacing: .1em; }
  .tray .mini, .tray .pile .slot { width: 36px; height: 36px; padding: 4px; }
  .tray .pile { gap: 5px; }
  .tray .preview { margin-top: 6px; padding: 6px 8px; gap: 4px; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .tray .preview h4 { font-size: 11px; }
  .tray .preview .risk-note { grid-column: 1 / -1; font-size: 12px; }
  .tray .preview .mini { width: 26px; height: 26px; padding: 2px; }
  .log { max-height: 140px; }
}
@media (max-width: 520px) {
  .app { padding: 10px 12px 24px; gap: 12px; }
  .machine { padding: 12px 10px 14px; border-radius: 16px; }
  .machine-head h2 { font-size: 20px; }
  .machine-head p { font-size: 14px; }
  .counter { padding: 12px; border-radius: 16px; }
  .card-art { width: 64px; height: 64px; }
  .stat b { font-size: 19px; }
  .mini, .pile .slot { width: 40px; height: 40px; }
}

/* ---------- recap ---------- */
.recap { position: fixed; inset: 0; z-index: 60; background: rgba(30, 36, 48, .35); display: grid; place-items: center; padding: 16px; animation: fade .2s ease-out; }
.recap-card {
  background: var(--card); border: 3px solid var(--ink); border-radius: 20px; padding: 22px; width: min(520px, 100%); max-height: 90vh; overflow: auto;
  display: grid; gap: 14px; box-shadow: 0 8px 0 var(--ink); animation: pop-in .35s var(--spring);
}
.recap-card h2 { font-size: 32px; line-height: 1; }
.recap-card .cycle { font: 700 12px/1 var(--body); color: var(--accent); letter-spacing: .14em; text-transform: uppercase; }
.bigstars { font-size: 46px; letter-spacing: 6px; line-height: 1; color: var(--butter); -webkit-text-stroke: 2.5px var(--ink); paint-order: stroke fill; }
.bigstars .off { color: var(--paper-deep); }
.bigstars span.on { display: inline-block; animation: star-in .4s var(--spring) both; }
.recap-card table { width: 100%; border-collapse: collapse; font-size: 15px; }
.recap-card td { padding: 6px 0; border-bottom: 2px dotted var(--paper-deep); }
.recap-card td:last-child { text-align: right; font-variant-numeric: tabular-nums; padding-left: 12px; }
.recap-card .neg { color: var(--bad); }
.recap-card .actions { justify-content: flex-end; }
.recap-card .actions .btn { flex: 0 1 auto; }
.plannote { margin: 0; font-size: 13px; color: var(--muted); }
.best { margin: 0; font-weight: 700; color: var(--ok); }

/* ---------- sheets ---------- */
.sheet {
  border: 3px solid var(--ink); border-radius: 20px; padding: 0; background: var(--card); color: var(--ink);
  width: min(560px, calc(100vw - 24px)); max-height: min(86vh, 760px); box-shadow: 0 8px 0 var(--ink);
}
.sheet.wide { width: min(820px, calc(100vw - 24px)); }
.sheet[open] { animation: pop-in .3s var(--spring); }
.sheet::backdrop { background: rgba(30, 36, 48, .35); }
.sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; background: var(--card); border-bottom: 2px solid var(--paper-deep); }
.sheet-head h2 { font-size: 26px; line-height: 1; }
.x { width: 38px; height: 38px; border: var(--line) solid var(--ink); border-radius: 50%; background: var(--paper); font-size: 22px; line-height: 1; font-weight: 700; box-shadow: 0 2px 0 var(--ink); }
.sheet-note { margin: 12px 18px 0; color: var(--muted); font-size: 14px; }
.opts { display: grid; padding: 6px 18px 18px; }
.opt { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; align-items: center; padding: 12px 0; border-bottom: 2px dotted var(--paper-deep); }
.opt:last-child { border-bottom: 0; }
.opt p { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
@media (max-width: 520px) { .opt { grid-template-columns: minmax(0, 1fr); } }
.seg { display: inline-flex; border: var(--line) solid var(--ink); border-radius: 10px; overflow: hidden; background: var(--paper); box-shadow: 0 2px 0 var(--ink); justify-self: start; }
.seg button { border: 0; background: transparent; padding: 7px 12px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.seg button + button { border-left: 2px solid var(--ink); }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.range { display: flex; gap: 10px; align-items: center; }
.range input { accent-color: var(--accent); width: 150px; }
.range output { font: 400 15px/1 var(--display); min-width: 3ch; font-variant-numeric: tabular-nums; }

.levels { list-style: none; margin: 0; padding: 12px 18px 18px; display: grid; gap: 10px; }
.level {
  width: 100%; text-align: left; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  border: var(--line) solid var(--ink); border-radius: 14px; background: var(--paper); padding: 10px 12px; box-shadow: 0 3px 0 var(--ink); transition: transform .1s, box-shadow .1s;
}
.level:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--ink); }
.level[aria-current="true"] { background: #E3EEF4; }
.level .num { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font: 400 18px/1 var(--display); border: var(--line) solid var(--ink); }
.level b { font: 400 17px/1.15 var(--display); }
.level p { margin: 2px 0 0; font-size: 14px; color: var(--ink-soft); }
.level .lstars { font-size: 20px; letter-spacing: 1px; color: var(--butter); -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; white-space: nowrap; }
.level .lstars .off { color: var(--paper-deep); }

.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 6px 28px; padding: 8px 18px 20px; }
.how .span { grid-column: 1 / -1; }
.how h3 { font-size: 17px; margin: 12px 0 6px; }
.how p, .how li { font-size: 15px; color: var(--ink-soft); }
.how ul { padding-left: 18px; margin: 0; display: grid; gap: 6px; }
.legend { list-style: none; padding: 0 !important; display: grid !important; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 20px !important; }
.legend li { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; font-size: 14px; }
.legend .mini { width: 40px; height: 40px; background: var(--floor); border: 2px solid var(--ink); }

#verifyOut { white-space: pre-wrap; font: 12px/1.4 ui-monospace, Menlo, monospace; background: var(--card); border: 2px solid var(--ink); border-radius: 12px; padding: 12px; margin: 0 16px 16px; }

/* ---------- motion ---------- */
@keyframes squash { 0% { transform: scale(1.1, .86); } 55% { transform: scale(.97, 1.05); } 100% { transform: none; } }
@keyframes pulse { 50% { transform: scale(1.1); } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }
@keyframes rise { from { transform: translate(-50%, 0); opacity: 1; } to { transform: translate(-50%, -46px); opacity: 0; } }
@keyframes landed { 0% { transform: translateY(-8px); opacity: .3; } 100% { transform: none; opacity: 1; } }
@keyframes bubble { 0% { transform: translateY(0) scale(.6); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-560px) scale(1.1); opacity: 0; } }
@keyframes sparkle { 0% { transform: scale(0) rotate(0); opacity: 0; } 40% { transform: scale(1.15) rotate(30deg); opacity: 1; } 100% { transform: scale(.4) rotate(70deg); opacity: 0; } }
@keyframes pop-in { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes star-in { from { transform: scale(0) rotate(-40deg); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .item, .door, .meter-fill, .mini.pick { transition: none; }
  .toast, .item.hint, .item.pop > svg, .suds i, .sparkle, .mini.risk, .pile.landed, .recap-card, .sheet[open], .bigstars span.on, .btn.hint { animation: none; }
}
