:root {
  --paper: #f6f0e0;
  --cream: #efe6cf;
  --cream-2: #e3d8bb;
  /* atono brand: #393fd4 primary, #485aff, #6a82ff, #2f2baa, #291f7f, #2b3699e5 */
  --ink: #291f7f;
  --ink-2: #2f2baa;
  --blue: #393fd4;
  --blue-hi: #485aff;
  --blue-lt: #6a82ff;
  --scrim: #2b3699e5;
  --green: #485aff;
  --sage: #b2c9fe;
  --gold: #e8b84a;
  --gold-2: #b98a2a;
  --red: #c8423a;
  --px: 'Press Start 2P', ui-monospace, Menlo, monospace;
  --body: 'VT323', ui-monospace, Menlo, monospace;
  --brand: 'ES Rebond Grotesque', 'Nunito', system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* atono's brand face. Drop the licensed files into public/fonts/ to switch it on. */
@font-face { font-family: 'ES Rebond Grotesque'; src: url('fonts/ESRebondGrotesque-Bold.woff2') format('woff2'); font-weight: 700 800; font-display: swap; }
@font-face { font-family: 'ES Rebond Grotesque'; src: url('fonts/ESRebondGrotesque-Medium.woff2') format('woff2'); font-weight: 400 600; font-display: swap; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: #d8ccae;
  background-image: radial-gradient(#cbbf9f 1px, transparent 1px);
  background-size: 8px 8px;
  color: var(--ink);
  font-family: var(--body);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  display: grid;
  place-items: center;
}

/* ---------- stage: fullscreen on phones, a phone-shaped frame on wide screens ---------- */
.stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--cream);
  container-type: size;
}
@media (min-aspect-ratio: 3/4) {
  .stage {
    height: min(94dvh, 900px);
    width: calc(min(94dvh, 900px) * 0.5);
    border: 6px solid var(--ink);
    border-radius: 34px;
    box-shadow: 0 0 0 3px var(--blue), 0 30px 60px -20px rgba(41, 31, 127, 0.55);
    --safe-t: 10px;
  }
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
}

/* ---------- icons ---------- */
.icon { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.icon svg { height: 1em; width: auto; display: block; }

/* ---------- buttons ---------- */
button { font: inherit; color: inherit; cursor: pointer; }
.btn {
  pointer-events: auto;
  font-family: var(--px);
  font-size: clamp(11px, 4.6cqw, 20px);
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 8px;
  padding: 0.95em 1.4em;
  box-shadow: 0 5px 0 var(--ink), inset 0 -4px 0 var(--cream-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7em;
  white-space: nowrap;
  transition: transform 0.06s, box-shadow 0.06s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink), inset 0 -2px 0 var(--cream-2); }
.btn .icon svg { height: 0.95em; }
.btn.primary { font-size: clamp(12px, 5cqw, 22px); }
.btn.small { font-size: clamp(9px, 3.4cqw, 14px); padding: 0.9em 1.1em; }
.btn.dark { background: var(--blue); color: var(--paper); box-shadow: 0 5px 0 var(--ink), inset 0 -4px 0 var(--ink-2); }
a.btn { text-decoration: none; }
.btn.disabled { opacity: 0.6; }
.btn.wide { width: 100%; }
.btn:focus-visible, .icon-btn:focus-visible, .card:focus-visible, .tab:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.icon-btn {
  pointer-events: auto;
  width: clamp(34px, 11cqw, 46px);
  height: clamp(34px, 11cqw, 46px);
  display: grid;
  place-items: center;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: 0 3px 0 var(--ink);
  font-size: clamp(12px, 4.4cqw, 18px);
  color: var(--ink);
  padding: 0;
}
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

.coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  font-family: var(--px);
  font-size: clamp(10px, 3.6cqw, 15px);
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  padding: 0.5em 0.85em 0.5em 0.6em;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
}
.coin-pill .icon svg { height: 1.25em; }
.coin-pill.bump { animation: bump 0.25s; }

/* ---------- screens ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  padding: calc(var(--safe-t) + 3cqh) 6cqw calc(var(--safe-b) + 3cqh);
  pointer-events: none;
  touch-action: none;
  text-align: center;
}
.screen.on { display: flex; animation: fade 0.2s ease-out; }
.spacer { flex: 1; }

.topbar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5cqh;
}
.topbar .coin-pill { pointer-events: auto; }

/* Title */
.brand {
  font-family: var(--brand);
  font-weight: 800;
  font-size: clamp(18px, 7.5cqw, 32px);
  letter-spacing: -0.02em;
  color: var(--blue);
  margin-bottom: 1.2cqh;
  display: flex;
  align-items: center;
  line-height: 1;
}
.brand-logo { height: 1.1em; width: auto; display: block; }
.brand-logo + .brand-word { display: none; }
.logo {
  margin: 0;
  font-family: var(--px);
  font-weight: 400;
  color: var(--ink);
  line-height: 1.15;
  text-shadow: 0 0.12em 0 var(--sage);
}
.logo span { display: block; }
.logo .l1 { font-size: clamp(30px, 13cqw, 58px); }
.logo .l2 { font-size: clamp(16px, 7cqw, 31px); display: inline-flex; align-items: center; gap: 0.35em; margin-top: 0.25em; }
.logo .l2 .icon svg { height: 1.05em; }
.tagline {
  font-family: var(--body);
  font-size: clamp(17px, 5.6cqw, 25px);
  line-height: 1.05;
  color: var(--ink);
  max-width: 24ch;
  margin: 2cqh 0 0;
}
.best-line {
  font-family: var(--px);
  font-size: clamp(9px, 3.2cqw, 13px);
  color: var(--paper);
  background: rgba(41, 31, 127, 0.75);
  padding: 0.5em 0.8em;
  border-radius: 6px;
  margin-bottom: 0;
}
.title .btn.primary { width: 92%; }
.title .row { width: 92%; }
.best-line.rival { background: #c8423a; position: absolute; top: calc(var(--safe-t) + 3cqh + clamp(34px, 11cqw, 46px)); left: 50%; transform: translateX(-50%); white-space: nowrap; }
.hint {
  margin-top: 2cqh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6em;
  font-family: var(--px);
  font-size: clamp(9px, 3cqw, 12px);
  color: var(--paper);
  text-shadow: 0 2px 0 var(--ink);
}
.hint .icon { font-size: 2.2em; animation: tap 1.1s ease-in-out infinite; filter: drop-shadow(0 2px 0 var(--ink)); }

/* Ready */
.big-title {
  margin: 13cqh 0 0;
  font-family: var(--px);
  font-weight: 400;
  font-size: clamp(22px, 9cqw, 40px);
  color: var(--paper);
  text-shadow: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink), 0 6px 0 var(--ink);
}
.ready-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8em;
  font-family: var(--px);
  font-size: clamp(10px, 3.6cqw, 15px);
  color: var(--ink);
  margin-left: 30cqw;
  margin-top: 8cqh;
}
.ready-hint .icon { font-size: 2.6em; animation: tap 1.1s ease-in-out infinite; }
.tips {
  font-size: clamp(16px, 5cqw, 22px);
  line-height: 1.05;
  background: rgba(246, 240, 224, 0.9);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 0.5em 0.8em;
  margin: 3cqh 0 0;
}
.tips .icon svg { height: 0.9em; }
.red { color: var(--red); }

/* Paused */
.paused { background: var(--scrim); justify-content: center; gap: 3cqh; }
.paused .big-title { margin: 0 0 2cqh; }

/* Game over: score card up top, the agent's pun over the rest scene, booking ask below */
.over {
  --rest-y: 53cqh; /* the girder in drawRestScene (REST_Y in game.js) */
  padding: calc(var(--safe-t) + 2.4cqh) 0 0;
  pointer-events: auto;
  touch-action: pan-y;
  overflow-y: auto;
  gap: 0;
}
.over > * { flex-shrink: 0; }
.over-logo { height: clamp(18px, 5.6cqw, 26px); width: auto; margin-bottom: 1.6cqh; }
.over-title {
  margin: 0 0 1.8cqh;
  font-family: var(--px);
  font-weight: 400;
  font-size: clamp(14px, 5.4cqw, 24px);
  line-height: 1.2;
  color: var(--ink);
  text-shadow: 0 0.14em 0 var(--sage);
}
.scorecard {
  width: 80%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 1.6cqh 0 0;
  animation: rise 0.35s cubic-bezier(.2, 1.4, .4, 1);
}
.sc-col { display: flex; flex-direction: column; align-items: center; gap: 0.8cqh; }
.sc-col + .sc-col { border-left: 2px dashed var(--cream-2); }
.sc-num { font-family: var(--px); font-weight: 400; font-size: clamp(24px, 9cqw, 40px); line-height: 1; color: var(--ink); }
.sc-col:first-child .sc-num { color: var(--blue); }
.sc-foot {
  grid-column: 1 / -1;
  margin-top: 1.6cqh;
  padding: 0.9cqh 3cqw;
  border-top: 2px solid var(--cream-2);
  display: flex; align-items: center; gap: 2.4cqw;
  font-family: var(--px);
  font-size: clamp(7px, 2.3cqw, 10px);
  color: var(--ink-2);
}
.sc-mode { background: var(--blue); color: var(--paper); padding: 0.45em 0.6em; border-radius: 4px; }
.sc-coins { display: inline-flex; align-items: center; gap: 0.35em; }
.sc-coins .icon svg { height: 1.3em; }
.lb-status { margin-left: auto; display: inline-flex; align-items: center; gap: 0.4em; color: var(--ink); }
.lb-status b { font-weight: 400; color: var(--blue); }
.lb-status .icon svg { height: 1.2em; }
.lb-cta {
  font-family: var(--px);
  font-size: 1em;
  background: var(--gold);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 0.45em 0.6em;
  display: inline-flex; align-items: center; gap: 0.5em;
  animation: pulse 1.6s ease-in-out infinite;
}

/* The pun: a speech bubble whose tail points at the agent (60% across, just above the girder). */
.pun-bubble {
  position: absolute;
  left: 16cqw; right: 10cqw;
  bottom: calc(100cqh - var(--rest-y) + 16cqw);
  margin: 0;
  text-align: center;
  font-family: var(--body);
  font-size: clamp(16px, 5cqw, 22px);
  line-height: 1;
  color: var(--paper);
  background: var(--ink);
  border-radius: 8px;
  padding: 0.45em 0.7em 0.5em;
  animation: rise 0.35s ease-out 0.15s both;
}
.pun-bubble::after {
  content: '';
  position: absolute;
  bottom: -7px; left: calc(60cqw - 16cqw - 7px);
  border: 7px solid transparent;
  border-top-color: var(--ink);
  border-bottom: 0;
}

.over-panel {
  width: 100%;
  min-height: calc(100cqh - var(--rest-y) - 5.4cqw); /* starts right under the girder */
  background: var(--ink);
  border-top: 4px solid var(--ink-2);
  padding: 2cqh 7cqw calc(var(--safe-b) + 1.4cqh);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.1cqh;
  color: var(--paper);
}
.over-lead { margin: 0 0 0.6cqh; max-width: 30ch; font-family: var(--body); font-size: clamp(16px, 5cqw, 22px); line-height: 1; color: #9aa6e8; }
.over-q { margin: 0 0 0.6cqh; font-family: var(--px); font-size: clamp(10px, 3.6cqw, 15px); line-height: 1.3; color: var(--paper); }
.over-q span { display: block; margin-top: 0.5em; font-family: var(--body); font-size: 1.45em; line-height: 1; color: #c9d2ff; }
.over-panel .btn { width: 100%; font-size: clamp(9px, 3.3cqw, 14px); padding: 1.05em 0.4em; gap: 0.6em; letter-spacing: 0; }
.btn.book { background: var(--paper); color: var(--ink); box-shadow: 0 5px 0 #000, inset 0 -4px 0 var(--cream-2); border-color: var(--paper); }
.btn.book .icon svg { height: 1.1em; }
.btn.ghost { background: transparent; color: var(--paper); border-color: var(--paper); box-shadow: none; }
.btn.ghost:active { transform: translateY(2px); box-shadow: none; }
.over-links { display: flex; justify-content: space-between; width: 100%; }
.over-links a, .over-links button {
  background: none; border: 0; padding: 0.6em 0.2em;
  display: inline-flex; align-items: center; gap: 0.45em;
  font-family: var(--px); font-size: clamp(7px, 2.5cqw, 10px);
  color: var(--paper); text-decoration: none;
}
.over-links .icon svg { height: 1.2em; }
.fine { margin: 0; font-family: var(--body); font-size: clamp(14px, 4cqw, 17px); color: #9aa6e8; }

/* Difficulty picker */
.diff-pick { width: 92%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2cqw; margin-bottom: 1.8cqh; pointer-events: auto; }
.diff {
  display: flex; flex-direction: column; align-items: center; gap: 0.5cqh;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: 0 3px 0 var(--ink);
  padding: 0.9cqh 0.5cqw 1cqh;
  color: var(--ink);
}
.diff.on { background: var(--blue); color: var(--paper); box-shadow: 0 0 0 3px var(--gold), 0 3px 0 var(--ink); }
.diff-level { font-family: var(--px); font-size: clamp(6px, 2.1cqw, 9px); display: flex; align-items: center; gap: 0.6em; }
.diff-name { font-family: var(--body); font-size: clamp(15px, 4.6cqw, 20px); line-height: 0.9; min-height: 1.8em; display: flex; align-items: center; text-align: center; }
.diff-pts { font-family: var(--px); font-size: clamp(6px, 2.1cqw, 9px); color: var(--gold-2); white-space: nowrap; }
.diff.on .diff-pts { color: var(--gold); }
.pips { display: flex; gap: 3px; }
.pip { width: 6px; height: 6px; border: 2px solid currentColor; display: block; }
.pip.on { background: currentColor; }
.ready-diff {
  margin-top: 2cqh;
  font-family: var(--px);
  font-size: clamp(8px, 2.8cqw, 12px);
  color: var(--paper);
  background: var(--blue);
  padding: 0.6em 0.9em;
  border-radius: 6px;
}
.diff-tag {
  position: absolute;
  top: calc(var(--safe-t) + 2cqh + clamp(34px, 11cqw, 46px) + 1.2cqh);
  right: 4cqw;
  font-family: var(--px);
  font-size: clamp(6px, 2.2cqw, 9px);
  color: var(--paper);
  background: var(--scrim);
  padding: 0.5em 0.7em;
  border-radius: 4px;
}

/* Title extras */
.title-row { margin-top: 1.6cqh; }
.title-row .btn { padding-left: 0.4em; padding-right: 0.4em; }
.post-toggle {
  pointer-events: auto;
  margin-top: 1.6cqh;
  width: 92%;
  display: flex; align-items: center; gap: 0.6em;
  text-align: left;
  font-family: var(--body);
  font-size: clamp(16px, 4.8cqw, 21px);
  line-height: 1;
  color: var(--paper);
  background: var(--scrim);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 0.5em 0.7em;
}
.post-toggle .box {
  flex-shrink: 0;
  width: 1.1em; height: 1.1em;
  border: 2px solid var(--paper);
  border-radius: 3px;
  display: grid; place-items: center;
  font-family: var(--px); font-size: 0.7em;
}
.post-toggle.on .box { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.post-toggle .edit { margin-left: auto; font-family: var(--px); font-size: 0.5em; color: var(--gold); }
.post-toggle b { font-weight: 400; color: var(--gold); }
.post-toggle small { font-size: 0.8em; opacity: 0.8; }
/* "Played before?": brings a profile's progress to this device (title screen and join sheet). */
.recover-cta {
  pointer-events: auto;
  width: 92%;
  margin-top: 1.4cqh;
  padding: 0.55em 0.8em;
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 0 0.35em;
  font-family: var(--body);
  font-size: clamp(15px, 4.4cqw, 19px);
  line-height: 1.15;
  color: var(--ink);
  background: var(--paper);
  border: 2px dashed var(--blue);
  border-radius: 8px;
  cursor: pointer;
}
.recover-cta b { font-weight: 400; color: var(--blue); text-decoration: underline; text-underline-offset: 0.15em; }
.recover-cta:active { transform: translateY(2px); }
.recover-cta:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.sheet-panel .recover-cta { width: 100%; margin: 0 0 0.4em; }
.field .label { line-height: 1.5; }
.field .opt { display: block; font-style: normal; font-size: 0.8em; color: var(--ink-2); opacity: 0.75; }
.hint-text { font-size: clamp(14px, 4cqw, 17px); line-height: 1; color: var(--ink-2); }
.sheet-copy b { font-weight: 400; color: var(--blue); }

/* Sheets (nickname, share) */
.sheet {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--scrim);
  padding: 4cqw 4cqw calc(var(--safe-b) + 4cqw);
  animation: fade 0.15s ease-out;
  touch-action: pan-y;
}
.sheet-panel {
  width: 100%;
  max-height: 100%;
  overflow-y: auto;
  padding: 2.4cqh 5cqw 2.6cqh;
  display: flex;
  flex-direction: column;
  gap: 1.6cqh;
  text-align: left;
  animation: rise 0.25s cubic-bezier(.2, 1.3, .4, 1);
  -webkit-user-select: text; user-select: text;
}
.sheet h2 { margin: 0; font-family: var(--px); font-weight: 400; font-size: clamp(11px, 4cqw, 16px); line-height: 1.4; color: var(--ink); }
.sheet-copy { margin: 0; font-size: clamp(16px, 4.8cqw, 21px); line-height: 1.05; color: var(--ink-2); }
.field { display: flex; flex-direction: column; gap: 0.6em; }
.field input {
  font-family: var(--px);
  font-size: 16px; /* 16px stops iOS zooming in */
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 8px;
  padding: 0.8em 0.7em;
  width: 100%;
  outline: none;
}
.field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-lt); }
.field-error { color: var(--red); font-size: clamp(16px, 4.6cqw, 20px); line-height: 1; min-height: 1em; }
.field-error:empty { display: none; }
.check { display: flex; align-items: center; gap: 0.5em; font-size: clamp(16px, 4.8cqw, 21px); line-height: 1; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); }
.sheet .row { width: 100%; }
.share-card { width: 100%; height: auto; border: 3px solid var(--ink); border-radius: 8px; background: var(--blue); aspect-ratio: 1200 / 630; }
.share-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2cqw; }
.share-btn {
  display: flex; align-items: center; justify-content: center; gap: 0.4em;
  font-family: var(--px);
  font-size: clamp(7px, 2.5cqw, 10px);
  color: var(--paper);
  background: var(--blue);
  border: 2px solid var(--ink);
  border-radius: 6px;
  box-shadow: 0 3px 0 var(--ink);
  padding: 1.1em 0.3em;
  text-decoration: none;
  text-align: center;
}
.share-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.share-btn[data-share="copy"] { background: var(--paper); color: var(--ink); }
.link { background: none; border: 0; padding: 0; color: var(--blue); text-decoration: underline; font: inherit; }

.panel {
  pointer-events: auto;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 0 6px 0 var(--ink), inset 0 -5px 0 var(--cream-2);
}
.label { font-family: var(--px); font-size: clamp(8px, 2.8cqw, 12px); color: var(--green); }
.new {
  background: var(--red); color: var(--paper);
  font-size: 0.9em; padding: 0.3em 0.4em; border-radius: 3px;
  animation: blink 0.6s steps(2) infinite;
}
.row { display: flex; gap: 3cqw; width: 92%; }
.row .btn { flex: 1; }

/* ---------- HUD ---------- */
.hud { position: absolute; inset: 0; pointer-events: none; display: none; }
.hud.on { display: block; }
.score {
  position: absolute;
  top: calc(var(--safe-t) + 6cqh);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--px);
  font-size: clamp(30px, 12cqw, 56px);
  color: var(--paper);
  text-shadow: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink), 0 6px 0 var(--ink);
}
.score.bump { animation: bump 0.2s; }
#hud-coins { position: absolute; top: calc(var(--safe-t) + 2cqh); right: 4cqw; }
#btn-pause { position: absolute; top: calc(var(--safe-t) + 2cqh); left: 4cqw; visibility: hidden; }
#btn-pause.on { visibility: visible; }

/* ---------- store ---------- */
.store {
  pointer-events: auto;
  touch-action: pan-y;
  background: var(--cream);
  padding: calc(var(--safe-t) + 2cqh) 0 0;
  text-align: left;
}
.store-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 3cqw;
  padding: 0 4cqw 1.6cqh;
}
.store-head h2 { flex: 1; margin: 0; font-family: var(--px); font-weight: 400; font-size: clamp(11px, 4.4cqw, 18px); }
.preview {
  position: relative;
  width: calc(100% - 8cqw);
  display: flex;
  align-items: center;
  gap: 3cqw;
  background: linear-gradient(#e8dfc6, #dcd1b2);
  border: 3px solid var(--ink);
  border-radius: 10px;
  padding: 1.2cqh 4cqw;
  overflow: hidden;
}
#preview { width: 34cqw; max-width: 160px; height: auto; image-rendering: pixelated; flex-shrink: 0; }
.preview-info { flex: 1; min-width: 0; }
.item-name { font-family: var(--px); font-size: clamp(10px, 3.6cqw, 15px); line-height: 1.35; margin-bottom: 0.6em; }
.item-desc { font-size: clamp(16px, 4.8cqw, 21px); line-height: 1.05; color: var(--ink-2); }
.tabs {
  width: 100%;
  display: flex;
  gap: 1.4cqw;
  padding: 1.6cqh 4cqw 1.2cqh;
}
.tab {
  flex: 1;
  font-family: var(--px);
  font-size: clamp(7px, 2.6cqw, 11px);
  padding: 0.9em 0;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 6px;
  color: var(--ink);
}
.tab.on { background: var(--ink); color: var(--paper); }
.store-grid {
  flex: 1;
  width: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.6cqw;
  padding: 0.4cqh 4cqw 2cqh;
  align-content: start;
}
.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4em;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 0.8em 0.3em 0.6em;
  box-shadow: 0 3px 0 var(--ink);
}
.card canvas { width: 62%; height: auto; image-rendering: pixelated; }
.card-name { font-size: clamp(14px, 4.2cqw, 19px); line-height: 0.95; text-align: center; min-height: 1.9em; display: flex; align-items: center; }
.card-tag {
  font-family: var(--px);
  font-size: clamp(7px, 2.4cqw, 10px);
  display: inline-flex; align-items: center; gap: 0.35em;
  color: var(--ink-2);
}
.card-tag .icon svg { height: 1.2em; }
.card-tag.poor { color: #9a8f74; }
.card.worn { background: #e6edff; }
.card.sel { border-color: var(--gold-2); box-shadow: 0 0 0 3px var(--gold), 0 3px 0 var(--ink); }
.store-foot {
  width: 100%;
  padding: 1.4cqh 4cqw calc(var(--safe-b) + 2.4cqh);
  background: var(--cream);
  border-top: 2px solid var(--cream-2);
}
.store-foot .btn { font-size: clamp(11px, 4.2cqw, 18px); }
.btn.shake { animation: shake 0.3s; }

.confetti {
  position: absolute;
  top: 45%;
  width: 5px; height: 5px;
  animation: confetti 0.9s ease-out forwards;
  pointer-events: none;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-b) + 14cqh);
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--px);
  font-size: clamp(9px, 3cqw, 12px);
  padding: 0.9em 1.2em;
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  white-space: nowrap;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- motion ---------- */
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }
@keyframes bump { 50% { transform: translateX(-50%) scale(1.18); } }
.coin-pill.bump { animation-name: bumpPill; }
@keyframes bumpPill { 50% { transform: scale(1.15); } }
@keyframes tap { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }
@keyframes blink { 50% { opacity: 0.4; } }
@keyframes pulse { 50% { transform: scale(1.03); } }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes confetti { to { transform: translate(var(--dx), var(--dy)) rotate(260deg); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .hint .icon, .ready-hint .icon, .new, .lb-cta, .caret { animation: none; }
}

/* Event chip on the title screen and its sheet */
.event-chip {
  pointer-events: auto;
  margin-top: 1.2cqh;
  max-width: 92%;
  font-family: var(--body);
  font-size: clamp(15px, 4.4cqw, 19px);
  line-height: 1;
  color: var(--paper);
  background: var(--scrim);
  border: 2px dashed var(--paper);
  border-radius: 8px;
  padding: 0.45em 0.8em;
  opacity: 0.9;
}
.event-chip.live { border-style: solid; border-color: var(--event, var(--gold)); opacity: 1; }
.event-chip b { font-weight: 400; color: var(--event, var(--gold)); }
.event-chip small { font-size: 0.8em; opacity: 0.8; margin-left: 0.5em; }
#event-input { text-transform: uppercase; letter-spacing: 0.15em; font-family: var(--px); font-size: 0.8em; }
#event-leave { align-self: center; font-size: clamp(15px, 4.4cqw, 19px); }
