/* ---------- stage overlay ---------- */
#stage-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; outline: none; }
#stage-canvas:active { cursor: grabbing; }
#stage-canvas:focus-visible { box-shadow: inset 0 0 0 3px var(--focus); }

.hud {
  position: absolute; top: 16px; right: max(16px, env(safe-area-inset-right, 0px));
  left: max(16px, env(safe-area-inset-left, 0px));
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  pointer-events: none;
}
.hud-title { min-width: 0; display: grid; gap: 2px; justify-items: start; }
/* the wordmark is small: the squishy is the headline */
.wordmark { margin: 0; font-family: var(--f-name); font-weight: 400; font-size: 22px; line-height: 1.1; letter-spacing: -.01em; transform-origin: 20% 100%; will-change: transform; }
.credit {
  pointer-events: auto;
  padding-block: 4px;
  font-size: 12.5px; font-weight: 700; color: var(--muted);
  text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px;
  transition: color var(--t-press) var(--ease-out), text-decoration-color var(--t-press) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .credit:hover { color: var(--ink); text-decoration-color: currentColor; } }
.credit:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

/* "Mochi with wax coat" on the label: each part is a link to its picker */
.chip-link {
  all: unset; cursor: pointer;
  display: inline-flex; align-items: center;
  padding-block: 3px;
  color: var(--tag-ink); font-weight: 700;
  text-decoration: underline 1.5px dotted var(--sage-grey);
  text-underline-offset: 4px;
  transition: text-decoration-color var(--t-press) var(--ease-out);
}
.chip-link:focus-visible { outline: 2px solid var(--tag-ink); outline-offset: 2px; border-radius: 3px; }
@media (hover: hover) and (pointer: fine) { .chip-link:hover { text-decoration-color: var(--tag-ink); text-decoration-style: solid; } }
.chip-joiner { color: var(--tag-muted); font-weight: 500; }
/* the picker section a chip opened gets a brief highlight */
.group.flash { animation: flash 900ms var(--ease-out); border-radius: var(--r-m); }
@keyframes flash { 0% { box-shadow: 0 0 0 0 transparent; } 25% { box-shadow: 0 0 0 6px color-mix(in oklab, var(--primary) 45%, transparent); } 100% { box-shadow: 0 0 0 6px transparent; } }

/* ---------- the blister label ----------
   A printed card with a hang slot punched through it (the stage shows through the slot).
   It names who's inside, their number in the series, and the contents. */
.tag {
  position: absolute; z-index: 6; left: 50%; bottom: calc(var(--actions-bottom) + 60px);
  translate: -50% 0;
  width: min(330px, calc(100% - 32px));
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: opacity .25s var(--ease-out);
}
.tag-card {
  position: relative; width: 100%;
  padding: 22px 16px 11px;
  color: var(--tag-ink);
  filter: drop-shadow(0 1px 0 rgba(27, 40, 36, .1)) drop-shadow(0 10px 14px rgba(27, 40, 36, .14));
  transform-origin: 50% 8px;
}
.tag-card::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  border-radius: var(--r-s);
  background: var(--tag-bg);
  /* the euro slot */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 8'%3E%3Crect width='30' height='8' rx='4'/%3E%3C/svg%3E") 50% 7px / 30px 8px no-repeat, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 8'%3E%3Crect width='30' height='8' rx='4'/%3E%3C/svg%3E") 50% 7px / 30px 8px no-repeat, linear-gradient(#000 0 0);
          mask-composite: exclude;
}
.tag-top { display: flex; align-items: baseline; gap: 10px; }
.tag-name {
  all: unset; cursor: pointer; min-width: 0;
  font-family: var(--f-name); font-size: 21px; line-height: 1.15;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tag-name:focus-visible { outline: 2px solid var(--tag-ink); outline-offset: 3px; border-radius: 3px; }
@media (hover: hover) and (pointer: fine) { .tag-name:hover { text-decoration: underline 2px; text-underline-offset: 4px; } }
.tag-no { margin-left: auto; flex: none; font-size: 12.5px; font-weight: 700; color: var(--tag-muted); font-variant-numeric: tabular-nums; }
.tag-arch { margin: 1px 0 0; font-size: 13.5px; font-weight: 500; color: var(--tag-muted); }
/* the contents line sits under a perforation, like the back of a toy card */
.tag-contents {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px;
  margin: 9px 0 0; padding-top: 7px;
  border-top: 1.5px dashed var(--tag-rule);
  font-size: 14px;
}
.tag[data-kind="plain"] :is(.tag-arch, .tag-no, #chip-type) { display: none; }
.tag[data-kind="plain"] .tag-contents { margin-top: 6px; }
/* befriending: filled vs empty marks, not color alone */
.tag-dots { display: inline-flex; gap: 4px; margin-left: auto; }
.tag-dots:empty { display: none; }
.tag-dots i { width: 7px; height: 7px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--sage-grey); transition: background-color .2s var(--ease-out), box-shadow .2s var(--ease-out), transform .2s var(--ease-out); }
.tag-dots i.on { background: var(--tag-ink); box-shadow: inset 0 0 0 1.5px var(--tag-ink); transform: scale(1.1); }
/* meeting someone new: the card drops onto its hook, once */
.tag.swing .tag-card { animation: swing .7s var(--ease-swing); }
@keyframes swing { 0% { transform: translateY(-10px) rotate(-6deg); opacity: 0; } 35% { opacity: 1; } 100% { transform: none; } }
.plate-back {
  all: unset; cursor: pointer;
  padding: 7px 12px; border-radius: var(--r-m);
  font-size: 13px; font-weight: 700; color: var(--ink);
  background: color-mix(in oklab, var(--panel) 80%, transparent);
  box-shadow: inset 0 0 0 1px var(--line);
}
.plate-back:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .plate-back:hover { background: var(--panel); } }

/* first-run hint: above the label, once */
.hint {
  order: -1;
  text-align: center; font-size: 13.5px; color: var(--muted); pointer-events: none;
  transition: opacity .4s var(--ease-out), transform .4s var(--ease-out);
}
.hint strong { color: var(--ink); font-weight: 700; }
.hint.gone { opacity: 0; transform: translateY(6px); }

/* ---------- start: the squishy stays visible; the first tap anywhere is the first squish ---------- */
.start {
  all: unset;
  position: absolute; inset: 0; z-index: 5;
  cursor: pointer;
  transition: opacity .3s var(--ease-out), visibility 0s .3s;
}
.start.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.start:focus-visible .start-chip { outline: 3px solid var(--focus); outline-offset: 3px; }
.start-chip {
  position: absolute; left: 50%; bottom: calc(var(--actions-bottom) + 64px);
  translate: -50% 0;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 10px 16px 10px 13px;
  border-radius: 999px;
  background: var(--pine); color: var(--label);
  white-space: nowrap;
  animation: chip-nudge 2.4s var(--ease-out) .8s infinite;
}
.start-chip svg { width: 20px; height: 20px; color: var(--butter); flex: none; }
.start-title { font-weight: 900; font-size: 15px; }
.start-sub { font-weight: 500; font-size: 13px; opacity: .75; }
@keyframes chip-nudge { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(-5px); } 90% { transform: translateY(0); } }
/* until the first tap, the start chip stands where the label hangs */
.stage:has(.start:not(.gone)) .tag { opacity: 0; pointer-events: none; }
.hud, .actions { z-index: 6; }

/* ---------- actions ---------- */
.actions {
  position: absolute;
  left: max(16px, env(safe-area-inset-left, 0px));
  bottom: var(--actions-bottom);
  display: flex; gap: 8px;
}
.pill {
  all: unset;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 15px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 700; font-size: 14px;
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
}
.pill svg { width: 17px; height: 17px; }
.pill:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .pill:hover { background: var(--chip-hover); } }
/* the one butter button on the page */
.pill.primary { background: var(--primary); color: var(--primary-ink); box-shadow: inset 0 -2px 0 rgba(27, 40, 36, .14); }
@media (hover: hover) and (pointer: fine) { .pill.primary:hover { background: color-mix(in oklab, var(--primary) 88%, #fff); } }
#shuffle-button svg { transition: transform .35s var(--ease-out); }
#shuffle-button.rolled svg { transform: rotate(180deg); }

.toast {
  position: absolute; z-index: 6;
  top: 74px; left: 50%;
  max-width: calc(100% - 32px);
  padding: 9px 15px;
  border-radius: 999px;
  background: var(--chip-on); color: var(--chip-on-ink);
  font-size: 13.5px; font-weight: 700; text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -6px) scale(.97);
  transition: opacity .2s var(--ease-out), transform .25s var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* ---------- corner buttons ---------- */
.hud-right { display: flex; align-items: flex-start; gap: 8px; }
.panel-toggle, .shelf-button {
  all: unset; pointer-events: auto; cursor: pointer; flex: none;
  height: 40px; border-radius: var(--r-m);
  background: var(--panel); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}
.panel-toggle { display: grid; place-items: center; width: 40px; }
.panel-toggle svg { width: 20px; height: 20px; }
.sound-off { opacity: 0; }
#sound-toggle[aria-pressed="true"] .sound-off { opacity: 1; }
#sound-toggle[aria-pressed="true"] .sound-waves { opacity: 0; }
#sound-toggle[aria-pressed="true"] { color: var(--muted); }
.panel-toggle-fill { opacity: 0; transition: opacity .2s var(--ease-out); }
.app[data-panel="closed"] .panel-toggle-fill { opacity: 1; }
:is(.panel-toggle, .shelf-button):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { :is(.panel-toggle, .shelf-button):hover { background: var(--chip-hover); } }
.shelf-button { display: inline-flex; align-items: center; gap: 7px; padding: 0 12px 0 10px; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.shelf-button svg { width: 19px; height: 19px; }
.shelf-button.bump { animation: bump .5s var(--ease-out); }
@keyframes bump { 30% { transform: scale(1.12); } }

/* ---------- lot number (the visitor count, printed quietly in the corner) ---------- */
.serial {
  position: absolute;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(var(--actions-bottom) + 12px);
  font-size: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  opacity: .7;
  pointer-events: none; user-select: none;
  transition: opacity .25s var(--ease-out);
}
.stage:has(.camera-preview.open) .serial { opacity: 0; }

.camera-preview {
  position: absolute; bottom: 16px; right: max(16px, env(safe-area-inset-right, 0px));
  width: min(36%, 240px); max-width: 100%; aspect-ratio: 4 / 3;
  border-radius: var(--r-m); overflow: hidden; background: #000;
  box-shadow: 0 0 0 4px var(--label), 0 10px 26px rgba(0, 0, 0, .24); pointer-events: none;
  opacity: 0; visibility: hidden; transform: translateY(8px) scale(.96); transform-origin: 100% 100%;
  transition: opacity .2s var(--ease-out), transform .28s var(--ease-out), visibility 0s .28s;
}
.camera-preview.open { opacity: 1; visibility: visible; transform: none; transition: opacity .2s var(--ease-out), transform .28s var(--ease-out), visibility 0s; }
.camera-preview video, .camera-preview canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }

/* ---------- rail groups ---------- */
.group { display: flex; flex-direction: column; gap: 10px; }
.label { font-size: 14.5px; font-weight: 900; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.note { font-size: 13px; color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; }
.row label { font-size: 14px; font-weight: 500; flex: 1; padding-block: 8px; cursor: pointer; }
input[type=range] { flex: 1; min-width: 0; accent-color: var(--ink); }

/* every control answers the finger: a quick press-in, then back */
.press { transition: transform var(--t-press) var(--ease-out), background-color var(--t-press) var(--ease-out), box-shadow var(--t-press) var(--ease-out); }
.press:active { transform: scale(.96); }
:is(.card, .seg button, .sw, .btn, .toggle):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- picker cards ---------- */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.card {
  all: unset; box-sizing: border-box; cursor: pointer; min-width: 0;
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: var(--r-s); background: var(--chip);
  box-shadow: inset 0 0 0 1.5px transparent;
}
.card canvas { width: 38px; height: 38px; flex: none; }
.card .t { display: flex; flex-direction: column; min-width: 0; }
.card .t > span { font-weight: 700; font-size: 14px; line-height: 1.25; }
.card em { font-style: normal; font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.card[aria-pressed="true"] { background-color: var(--panel); box-shadow: inset 0 0 0 1.5px var(--ink); }
.card.fill { padding: 9px 12px; }
.card .wave { width: 30px; height: 22px; flex: none; color: var(--muted); }
.card[aria-pressed="true"] .wave { color: var(--ink); }

/* ---------- segmented control with a sliding pill ---------- */
.seg { position: relative; display: flex; background: var(--chip); border-radius: var(--r-m); padding: 3px; }
.seg .pill { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); padding: 0; border-radius: 7px; background: var(--chip-on); box-shadow: none; transition: transform var(--t-move) var(--ease-out); }
.seg[data-v="toon"] .pill { transform: translateX(100%); }
@media (hover: hover) and (pointer: fine) { .seg button[aria-pressed="false"]:hover { color: var(--ink); } }
.seg button { all: unset; position: relative; flex: 1; text-align: center; cursor: pointer; padding: 8px 6px; border-radius: 7px; font-weight: 700; font-size: 14px; color: var(--muted); transition: color .2s var(--ease-out); }
.seg button[aria-pressed="true"] { color: var(--chip-on-ink); }

/* ---------- color swatches ---------- */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sw { all: unset; cursor: pointer; width: 34px; height: 34px; transition: transform var(--t-press) var(--ease-out); border-radius: 50%; box-shadow: inset 0 -3px 6px rgba(0, 0, 0, .18), 0 0 0 1px rgba(0, 0, 0, .08); }
.sw[aria-pressed="true"] { box-shadow: inset 0 -3px 6px rgba(0, 0, 0, .18), 0 0 0 2px var(--panel), 0 0 0 4px var(--ink); }
.picker:focus-within { outline: 2px solid var(--focus); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { .sw:hover, .picker:hover { transform: scale(1.08); } }
.picker { position: relative; width: 34px; height: 34px; transition: transform var(--t-press) var(--ease-out); border-radius: 50%; overflow: hidden; background: conic-gradient(#ff7a90, #ffd36e, #8fe0b0, #7ac4ff, #c39bff, #ff7a90); box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); }
.picker input { position: absolute; inset: -6px; width: 42px; height: 42px; opacity: 0; cursor: pointer; }

/* ---------- toggle (the knob stretches while held) ---------- */
.toggle { all: unset; cursor: pointer; position: relative; flex: none; width: 46px; height: 28px; border-radius: 999px; background: var(--line); transition: background-color .2s var(--ease-out); }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 999px; background: var(--label); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transform-origin: left center; transition: transform var(--t-move) var(--ease-out); }
.toggle:active::after { transform: scaleX(1.22); }
.toggle[aria-pressed="true"] { background: var(--chip-on); }
.toggle[aria-pressed="true"]::after { transform: translateX(18px); }
.toggle[aria-pressed="true"]:active::after { transform: translateX(13px) scaleX(1.22); }
.toggle:disabled { opacity: .4; cursor: default; }

/* ---------- buttons, meters, status ---------- */
.btn { all: unset; cursor: pointer; text-align: center; padding: 8px 12px; border-radius: var(--r-m); background: var(--chip); font-weight: 700; font-size: 13.5px; }
.btn.primary { background: var(--primary); color: var(--primary-ink); padding: 11px 16px; font-size: 14.5px; box-shadow: inset 0 -2px 0 rgba(27, 40, 36, .14); }
.btn.dark { background: var(--chip-on); color: var(--chip-on-ink); padding: 11px 14px; font-size: 14.5px; }
.btn[disabled] { opacity: .5; cursor: default; }
.meter { height: 8px; border-radius: 999px; background: var(--chip); overflow: hidden; }
.meter i { display: block; width: 100%; height: 100%; border-radius: 999px; background: var(--ink); transform-origin: 0 50%; transition: transform .15s var(--ease-out); }
.status { font-size: 13.5px; font-weight: 500; padding: 9px 11px; border-radius: var(--r-s); background: var(--chip); }
.status[data-tone="bad"] { background: color-mix(in oklab, var(--primary) 30%, var(--chip)); color: var(--ink); }
.hands { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.hand { display: flex; flex-direction: column; gap: 6px; padding: 9px 11px; border-radius: var(--r-s); background: var(--chip); transition: opacity .2s var(--ease-out); }
.hand[data-seen="false"] { opacity: .5; }
.hand b { display: flex; justify-content: space-between; font-size: 13px; font-variant-numeric: tabular-nums; }
.hand b span { color: var(--muted); font-weight: 500; }

@media (hover: hover) and (pointer: fine) {
  .card:hover, .btn:hover { background-color: var(--chip-hover); }
  .card[aria-pressed="true"]:hover { background-color: var(--panel); }
  .btn.primary:hover { background: color-mix(in oklab, var(--primary) 88%, #fff); }
  .btn.dark:hover { background: var(--chip-on); }
}

@media (max-width: 820px) {
  .wordmark { font-size: 20px; }
  .camera-preview { width: min(40%, 200px); }
}

/* ---------- touch screens: 44 px targets ---------- */
@media (pointer: coarse) {
  .chip-link { padding-block: 9px; margin-block: -6px; }
  .pill, .plate-back { min-height: 44px; box-sizing: border-box; }
  .panel-toggle { width: 44px; height: 44px; }
  .shelf-button { height: 44px; }
  .tag-name { padding-block: 6px; margin-block: -6px; }
  .sw, .picker { width: 40px; height: 40px; }
  .swatches { gap: 10px; }
}

/* ---------- skip link ---------- */
.skip {
  position: absolute; z-index: 30; left: 12px; top: 12px;
  padding: 10px 14px; border-radius: var(--r-m);
  background: var(--chip-on); color: var(--chip-on-ink); font-weight: 700; text-decoration: none;
  transform: translateY(-160%);
  transition: transform .2s var(--ease-out);
}
.skip:focus-visible { transform: none; outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- record ---------- */
.rec-dot {
  width: 11px; height: 11px; flex: none;
  border-radius: 50%;
  background: var(--pine);
  transition: border-radius var(--t-move) var(--ease-out), transform var(--t-move) var(--ease-out);
}
.rec-label { font-variant-numeric: tabular-nums; min-width: 3.4em; }
.record[aria-pressed="true"] { background: var(--pine); color: var(--label); }
.record[aria-pressed="true"] .rec-dot { background: var(--butter); border-radius: 2px; transform: scale(.9); }
/* while recording, the stage gets a thin butter frame */
.stage::after {
  content: ""; position: absolute; inset: 0; z-index: 7; pointer-events: none;
  box-shadow: inset 0 0 0 3px var(--butter);
  opacity: 0; transition: opacity .2s var(--ease-out);
}
.stage[data-recording]::after { opacity: 1; }
.stage[data-recording] .hint { opacity: 0; }

/* ---------- dialogs: clip review and the collection ---------- */
:is(.clip, .shelf) {
  border: 0; margin: auto;
  background: var(--panel); color: var(--ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .3), 0 0 0 1px var(--line);
}
:is(.clip, .shelf)::backdrop { background: rgba(16, 24, 22, .55); }
:is(.clip, .shelf)[open] { animation: dialog-in .32s var(--ease-out); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }

.clip { padding: 14px; width: min(340px, calc(100vw - 32px)); border-radius: 16px; }
.clip video {
  display: block; width: 100%;
  max-height: calc(100dvh - 160px);
  aspect-ratio: 9 / 16; object-fit: contain;
  border-radius: var(--r-m); background: var(--mat);
}
.clip-actions { display: flex; gap: 8px; margin-top: 12px; }
.clip-actions .btn { flex: 1; padding: 12px 10px; font-size: 14.5px; }
.clip-actions .btn.quiet { background: transparent; color: var(--muted); flex: .8; }

@media (max-width: 359px) {
  .actions { gap: 6px; }
  .actions .pill { padding-inline: 11px; gap: 6px; }
  .rec-label { min-width: 0; }
}
@media (max-width: 520px) {
  .serial { bottom: auto; top: 74px; }
}

/* ---------- the collection: blister cards on a pegboard ---------- */
.shelf {
  padding: 0;
  width: min(560px, calc(100vw - 24px));
  max-height: min(760px, calc(100dvh - 24px));
  overflow-y: auto; overscroll-behavior: contain;
  border-radius: 16px;
  background: var(--bg);
}
.shelf-head { display: flex; align-items: baseline; gap: 10px; padding: 18px 20px 6px; position: sticky; top: 0; z-index: 2; background: var(--bg); }
.shelf-head h2 { margin: 0; font-family: var(--f-name); font-weight: 400; font-size: 22px; line-height: 1.1; }
.shelf-progress { font-size: 13.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.shelf-close { all: unset; cursor: pointer; margin-left: auto; align-self: center; display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-m); color: var(--muted); }
.shelf-close svg { width: 18px; height: 18px; }
.shelf-close:focus-visible { outline: 2px solid var(--focus); }
@media (hover: hover) and (pointer: fine) { .shelf-close:hover { background: var(--chip); color: var(--ink); } }

.shelf-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 10px 20px 4px; }
/* each spot is a little carded toy: slot, number, the squishy, its name */
.spot {
  all: unset; cursor: pointer; position: relative; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 18px 4px 9px;
  color: var(--tag-ink);
  filter: drop-shadow(0 1px 0 rgba(27, 40, 36, .1)) drop-shadow(0 6px 8px rgba(27, 40, 36, .1));
  transition: transform var(--t-move) var(--ease-out);
}
.spot::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: var(--r-s);
  background: var(--tag-bg);
  box-shadow: inset 0 0 0 1.5px transparent;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 6'%3E%3Crect width='22' height='6' rx='3'/%3E%3C/svg%3E") 50% 6px / 22px 6px no-repeat, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 6'%3E%3Crect width='22' height='6' rx='3'/%3E%3C/svg%3E") 50% 6px / 22px 6px no-repeat, linear-gradient(#000 0 0);
          mask-composite: exclude;
}
.spot[data-found="false"]::before { background: color-mix(in oklab, var(--tag-bg) 55%, var(--sage-grey)); }
.spot[aria-pressed="true"]::before { box-shadow: inset 0 0 0 2px var(--tag-ink); }
.spot-no { position: absolute; top: 4px; left: 7px; font-size: 10.5px; font-weight: 700; color: var(--tag-muted); font-variant-numeric: tabular-nums; }
.spot canvas { width: 64px; height: 64px; transition: transform .25s var(--ease-out); }
.spot-name { font-family: var(--f-name); font-size: 13px; line-height: 1.2; }
.spot[data-found="false"] .spot-name { font-family: var(--f-body); font-weight: 900; color: var(--tag-muted); }
.spot:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-s); }
@media (hover: hover) and (pointer: fine) { .spot:hover { transform: translateY(-2px); } }

/* ---------- profile: the back of the card ---------- */
.profile {
  margin: 14px 20px 20px; padding: 18px 18px 16px;
  display: grid; gap: 10px;
  border-radius: var(--r-s);
  background: var(--tag-bg); color: var(--tag-ink);
  box-shadow: 0 1px 0 rgba(27, 40, 36, .08);
}
.profile[hidden] { display: none; }
.profile-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 14px; }
.profile-head canvas { grid-row: span 2; width: 76px; height: 76px; }
.profile-name { margin: 0; font-family: var(--f-name); font-weight: 400; font-size: 24px; line-height: 1.1; align-self: end; }
.profile-no { align-self: end; font-size: 12.5px; font-weight: 700; color: var(--tag-muted); font-variant-numeric: tabular-nums; }
.profile-arch { grid-column: 2 / -1; align-self: start; font-size: 14px; font-weight: 700; color: var(--tag-muted); }
.profile[data-known="false"] .profile-name { font-family: var(--f-body); font-weight: 900; font-size: 18px; }
.profile-blurb, .profile-clue, .profile-how { margin: 0; font-size: 14.5px; line-height: 1.5; }
.profile-how { color: var(--tag-muted); }
.profile-clue { font-weight: 700; }
.profile-facts { margin: 2px 0 0; padding-top: 10px; border-top: 1.5px dashed var(--tag-rule); display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; }
.profile-facts dt { color: var(--tag-muted); font-weight: 500; }
.profile-facts dd { margin: 0; font-weight: 700; }
.profile-quirks-head { margin: 4px 0 0; font-size: 14px; font-weight: 900; display: flex; justify-content: space-between; }
.profile-quirks-head span { font-weight: 700; color: var(--tag-muted); font-variant-numeric: tabular-nums; }
.profile-quirks { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 14px; }
.profile-quirks li { display: grid; grid-template-columns: 14px 1fr; gap: 8px; align-items: start; }
.profile-quirks li::before { content: ""; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--tag-ink); }
.profile-quirks li[data-seen="false"] { color: var(--tag-muted); }
.profile-quirks li[data-seen="false"]::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--sage-grey); }
.profile-quirks small { display: block; font-size: 13px; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

@media (max-width: 520px) {
  .shelf { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .shelf-head { padding-inline: 14px; }
  .shelf-grid { padding-inline: 14px; gap: 8px; }
  .spot canvas { width: 54px; height: 54px; }
  .spot-name { font-size: 12px; }
  .profile { margin-inline: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .start-chip, .tag.swing .tag-card, :is(.clip, .shelf)[open], .shelf-button.bump, .group.flash { animation: none; }
  *, *::before, *::after { transition-duration: 0s !important; }
  .press:active { transform: none; }
}

/* ---------- controls are not text ---------- */
/* A long press on a button doesn't select its label or open the copy menu. Text that is content stays selectable.
   Last in the file, and one step more specific than a class, because many buttons here start from `all: unset`. */
button:not([data-selectable]) { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
