/* Flip 7 scorer. Built on the site's design: brand/tokens.css (colours, type,
   spacing, buttons, cards, badges), brand/components.css (header, steps) and
   shared/scorer.css (the scorer shell). Only Flip 7's own pieces are here; use
   the tokens, never hex, except for the physical things drawn (cards, the camera). */

:root { --radius: var(--radius-md); }
/* --c: a player's colour (set inline on their card and on owner buttons), with white
   text on it; without one, "on" controls use ink and the page colour, in both themes. */
.player, [style*="--c:"] { --c-text: #fff; }

/* ---- Controls: the site's buttons. Plain <button>s are the quiet kind. */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: var(--space-2) var(--space-4);
  border: var(--border-width) solid var(--color-control-edge); border-radius: var(--radius-pill);
  background: var(--color-surface); color: var(--color-ink);
  font: var(--weight-semibold) var(--text-base)/1.15 var(--font-display); cursor: pointer;
}
button.btn:not(.btn--ghost) { border-color: var(--color-line-strong); }
button.btn--ghost { border-color: transparent; }
button:disabled, .btn:disabled { opacity: 0.55; cursor: default; box-shadow: none; transform: none; }
button.danger { color: var(--color-danger); }
a.button { text-decoration: none; }
select, textarea, input[type="text"], input[type="password"] {
  font: inherit; color: var(--color-ink); background: var(--color-surface);
  border: var(--border-width) solid var(--color-control-edge); border-radius: var(--radius-sm);
}
textarea { width: 100%; padding: var(--space-2); }

.status { min-height: 1.4em; margin: 0 0 var(--space-3); color: var(--color-ink-muted); }
.status:empty { display: none; }
.status.error { color: var(--color-danger); font-weight: var(--weight-semibold); }
.muted, .legend { color: var(--color-ink-muted); font-size: var(--text-sm); }
.callout { background: var(--color-surface); border: 1px solid var(--color-line); border-left: 6px solid var(--color-accent); border-radius: var(--radius); padding: var(--space-3) var(--space-4); margin: 0 0 var(--space-3); }
.callout.warn { border-left-color: var(--color-warning); }
.callout a { color: var(--color-link); font-weight: var(--weight-semibold); }
.check { display: flex; gap: var(--space-2); align-items: flex-start; font-size: var(--text-sm); }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--color-ink); flex: none; }
.actions, .photo-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-3) 0; }
.photo-actions .btn { flex: 1 1 140px; min-height: 52px; }
.back { margin: 0 0 var(--space-3); padding-left: 0; border-color: transparent; background: transparent; color: var(--color-link); }
.tab > h2 { font-size: var(--text-2xl); }

/* ---- First visit: which deck */
.edition-pick { margin: 0 0 var(--space-4); }
.edition-pick h2 { font-size: var(--text-2xl); margin-bottom: var(--space-2); }
.edition-pick h2:focus { outline: none; }
.edition-pick p { margin: 0 0 var(--space-4); }
.edition-options { display: grid; gap: var(--space-3); }
.edition-options button {
  display: grid; justify-items: start; justify-content: stretch; gap: 2px; min-height: 72px; padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md); border-color: var(--color-line-strong); text-align: left; box-shadow: var(--shadow-pop-sm);
  font-size: var(--text-lg);
}
.edition-options button:active { transform: translate(2px, 2px); box-shadow: none; }
.edition-demo { margin: var(--space-3) 0 0; text-align: center; }
.edition-options small { font: var(--weight-regular) var(--text-sm)/1.3 var(--font-body); color: var(--color-ink-muted); }

/* ---- The round */
.round-bar { display: flex; align-items: baseline; gap: var(--space-3); margin: 0 0 var(--space-3); }
.round-bar h2 { margin: 0; font-size: var(--text-3xl); font-weight: var(--weight-bold); }
/* After a photo the camera button steps back: the round below is the work now. */
.snap.is-after { grid-template-columns: 1fr auto; align-items: center; justify-items: stretch; gap: var(--space-2) var(--space-3); }
.snap.is-after .snap-button { min-height: 48px; font-size: var(--text-base); box-shadow: var(--shadow-pop-sm); --btn-bg: var(--color-surface); --btn-ink: var(--color-ink); }
.snap.is-after .snap-tip { display: none; }
.photo-wrap { margin: 0 0 var(--space-3); }
.photo-wrap summary { cursor: pointer; color: var(--color-ink-muted); font-weight: var(--weight-semibold); padding: var(--space-1) 0; min-height: 44px; display: flex; align-items: center; gap: var(--space-2); }
.photo-canvas { width: 100%; height: auto; border-radius: var(--radius); background: #000; display: block; touch-action: manipulation; }

/* The original Flip 7 before its deck is taught: the deck's photo comes first */
.deck-first { display: grid; gap: var(--space-3); width: 100%; }
.deck-first p { margin: 0; text-align: center; color: var(--color-ink-muted); }
.deck-first strong { color: var(--color-ink); }
.calib-done { margin-top: var(--space-3); }

/* A photo with no tags found: how to take a better one */
.retake { margin: 0 0 var(--space-4); }
.retake h3 { margin: 0 0 var(--space-2); font-size: var(--text-xl); }
.retake ul { margin: 0 0 var(--space-4); padding-left: 1.2em; }
.retake li { margin: 0 0 var(--space-1); }
.retake .btn { width: 100%; }
.retake-more { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2) var(--space-4); margin: var(--space-3) 0 0; font-size: var(--text-sm); color: var(--color-ink-muted); }
.retake-more a, .retake-more .linkish { display: inline-flex; align-items: center; min-height: 44px; color: var(--color-ink-muted); font-weight: var(--weight-semibold); }

/* Entering a round by hand: how many players */
.hand-count { margin: 0 0 var(--space-4); }
.hand-count h3 { margin: 0 0 var(--space-1); }
.hand-count p { margin: 0 0 var(--space-3); }
.hand-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
.hand-counts button { min-height: 52px; padding: 0; border-radius: var(--radius-md); font-size: var(--text-xl); font-weight: var(--weight-bold); }

/* ---- Players: one card each, coloured stripe in the player's colour */
.players { display: grid; gap: var(--space-3); grid-template-columns: 1fr; margin-top: var(--space-2); }
@media (min-width: 760px) { .players { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); } }
.player { background: var(--color-surface); border: var(--border-width) solid var(--color-line-strong); border-top: 8px solid var(--c, var(--color-ink)); border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4); box-shadow: var(--shadow-pop-sm); }
.player header { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); }
.player h3 { margin: 0; font-size: var(--text-xl); display: flex; align-items: center; gap: var(--space-2); min-width: 0; overflow-wrap: anywhere; }
.player .total { font: var(--weight-bold) 2.5rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.player .total small { font-size: 1.1rem; color: var(--color-warning); margin-left: 2px; }
.player.bust .total { color: var(--color-danger); }
.breakdown { min-height: 1.4em; margin: var(--space-1) 0 var(--space-2); color: var(--color-ink-muted); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.player.bust .breakdown { color: var(--color-danger); font-weight: var(--weight-bold); }
.notes { margin: var(--space-1) 0 var(--space-2); padding-left: 18px; font-size: var(--text-sm); }
.notes li.bad { color: var(--color-danger); font-weight: var(--weight-semibold); }
.notes li.warn { color: var(--color-warning); }
.player.no-tag { border-top-style: dashed; }

/* Player icons: a character's badge, or a coloured circle with the initial. */
.avatar { width: 1.9em; height: 1.9em; flex: none; border-radius: 50%; display: inline-block; vertical-align: middle; }
.avatar-initial { display: inline-flex; align-items: center; justify-content: center; background: var(--avatar); color: #fff; font: var(--weight-bold) 0.95em/1 var(--font-display); }
.avatar.big { width: 64px; height: 64px; font-size: 1.9rem; }
.avatar-initial.big { font-size: 1.9rem; }

/* The cards found in a photo, in one row (a tap opens the card in "Edit cards") */
.found { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-2) 0 var(--space-1); }
p.found { font-size: var(--text-sm); }
.found-card {
  min-height: 44px; min-width: 44px; padding: 0 var(--space-3); border-radius: var(--radius-sm);
  border: var(--border-width) solid var(--c, var(--color-ink)); background: var(--c, var(--color-ink)); color: #fff;
  font: var(--weight-bold) var(--text-lg)/1 var(--font-display); font-variant-numeric: tabular-nums; touch-action: manipulation;
}
.found-card.low { background: var(--color-surface); color: var(--color-ink); border-style: dashed; border-color: var(--color-danger); }

/* "Edit cards": the close-up and the tiles */
.correct { margin-top: var(--space-2); border-top: 1px dashed var(--color-line); padding-top: var(--space-1); }
.correct > summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; font: var(--weight-semibold) var(--text-base) var(--font-display); color: var(--color-ink); list-style: none; text-decoration: underline; text-decoration-color: var(--color-accent); text-decoration-thickness: 3px; text-underline-offset: 6px; }
.correct > summary::-webkit-details-marker { display: none; }
.correct > summary::before { content: "✎"; display: inline-block; margin-right: var(--space-2); } /* (inline-block: not underlined) */
.correct[open] > summary::before { content: "▾"; }

/* Hand tiles: tap a value to add or remove it, hold for a second copy */
.hand { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: var(--space-2); margin: var(--space-2) 0; }
.tile {
  position: relative; min-height: 48px; padding: 0; border-radius: var(--radius-sm);
  font: var(--weight-bold) var(--text-lg)/1 var(--font-display); font-variant-numeric: tabular-nums;
  background: var(--color-bg); color: var(--color-ink-muted); border: var(--border-width) solid var(--color-line);
  -webkit-touch-callout: none; user-select: none; touch-action: manipulation;
}
.tile.mod { font-size: var(--text-base); }
.tile.special { font-size: var(--text-sm); }
.tile.on { background: var(--c, var(--color-ink)); color: var(--c-text, var(--color-bg)); border-color: var(--c, var(--color-ink)); }
.tile.low { border-style: dashed; border-color: var(--color-danger); }
.tile.on.low { box-shadow: inset 0 0 0 2px var(--color-danger); }
.tile small { position: absolute; top: -7px; right: -7px; background: var(--color-danger); color: #fff; border-radius: var(--radius-pill); font-size: 0.7rem; padding: 1px 5px; }

/* Player close-ups: tap a card in one to fix it (the fix sheet slides up from the bottom). */
.player .section { margin: var(--space-1) 0 0; padding: 0; }
.player-view { width: 100%; height: auto; border-radius: var(--radius-sm); display: block; margin: var(--space-1) auto var(--space-2); background: #000; cursor: pointer; touch-action: manipulation; }
.section-hint { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin: var(--space-1) 0 2px; font-size: var(--text-sm); color: var(--color-ink-muted); }
.section-hint .wider { flex: none; min-height: 36px; padding: 2px var(--space-3); font-size: var(--text-sm); }
.section-hint.ask { color: var(--color-warning); font-weight: var(--weight-semibold); }

/* A player from last round whose tag wasn't found in the photo (app.js missingTagHtml) */
.no-tag-box { margin: var(--space-2) 0 var(--space-3); padding: var(--space-3); border-radius: var(--radius-sm); border: 1px solid var(--color-warning); background: var(--color-accent-soft); }
.no-tag-box p { margin: 0 0 var(--space-2); overflow-wrap: anywhere; }
.no-tag-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.no-tag-actions .take { background: var(--color-accent); color: var(--color-accent-ink); border-color: var(--color-line-strong); }
.no-tag-actions .link { background: none; border: none; padding: var(--space-2) 2px; color: var(--color-ink-muted); text-decoration: underline; }
.no-tag-note { margin: var(--space-1) 0 var(--space-2); font-size: var(--text-sm); color: var(--color-warning); }

/* Brutal mode: the Flip 7 player's choice, under their cards. */
.choice { margin: var(--space-3) 0 0; padding: var(--space-3); border: var(--border-width) solid var(--color-warning); border-radius: var(--radius-md); background: var(--color-accent-soft); }
.choice.done { border-color: var(--color-line); background: transparent; }
.choice-title { margin: 0; font-size: var(--text-sm); font-weight: var(--weight-bold); color: var(--color-warning); }
.choice.done .choice-title { color: var(--color-ink-muted); }
.choice-options { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-2); }
.choice-options .bonus { font-size: var(--text-lg); }
.choice-or { color: var(--color-ink-muted); font-size: var(--text-sm); padding: 0 4px; }
.choice-options .target { padding: 6px var(--space-3) 6px var(--space-2); }
.choice-options button[aria-pressed="true"] { background: var(--color-accent); color: var(--color-accent-ink); border-color: var(--color-line-strong); }

/* Cards nobody owns, and the card chips (dataset view, calibration) */
.loose { margin-top: var(--space-4); }
.loose h3 { font-size: var(--text-lg); margin: 0 0 var(--space-1); }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 4px; width: 80px; padding: 4px; border: var(--border-width) solid var(--color-line); border-radius: var(--radius-sm); background: var(--color-bg); }
.chip.low { border-color: var(--color-danger); border-style: dashed; }
.chip.flash { outline: 3px solid var(--color-focus); }
.chip img, .chip .noimg { width: 100%; aspect-ratio: 120 / 168; object-fit: cover; border-radius: 4px; background: var(--color-line); }
.chip .noimg { display: flex; align-items: center; justify-content: center; color: var(--color-ink-muted); font-size: 0.75rem; text-align: center; }
.chip select { display: block; width: 100%; font-size: 0.75rem; font-weight: var(--weight-regular); padding: 2px; border-width: 1px; border-radius: 4px; }
.chip .remove { position: absolute; top: -10px; right: -10px; min-height: 0; width: 28px; height: 28px; padding: 0; border-radius: 50%; font-size: 0.9rem; }
.chip .place { min-height: 32px; font-size: 0.75rem; padding: 2px 4px; }
.chip .place.on { background: var(--color-accent); color: var(--color-accent-ink); border-color: var(--color-line-strong); }

/* Adding a missed player, clearing, saving */
.add-player { width: 100%; margin: var(--space-3) 0; min-height: 52px; border-style: dashed; border-color: var(--color-control-edge); border-radius: var(--radius-md); background: transparent; color: var(--color-ink); }
button.clear-round, button.remove-player { display: block; width: fit-content; min-height: 44px; margin: var(--space-1) auto 0; padding: 0 var(--space-3); color: var(--color-ink-muted); font: var(--weight-regular) var(--text-sm) var(--font-body); }
.round-actions { display: flex; gap: var(--space-3); margin: var(--space-2) 0 var(--space-5); }
.round-actions #add-round, .round-actions .demo-actions { flex: 1; }
/* "Save round" stays at the bottom of the screen while the players are scrolled past. */
#score-result:has(.player) .round-actions { position: sticky; bottom: 0; z-index: 5; margin: var(--space-2) calc(-1 * var(--gutter)) var(--space-5); padding: var(--space-3) var(--gutter) calc(var(--space-3) + env(safe-area-inset-bottom)); background: var(--color-bg); }
#score-result:has(.player) .round-actions::before { content: ""; position: absolute; left: 0; right: 0; top: -14px; height: 14px; background: linear-gradient(transparent, var(--color-bg)); pointer-events: none; }

/* "Who has these tags?" (tags reading Player 1… in a game with named players) */
#tag-question:empty { display: none; }
.tagq { background: var(--color-surface); border: var(--border-width) solid var(--color-line-strong); border-radius: var(--radius-lg); padding: var(--space-4); margin: 0 0 var(--space-3); box-shadow: var(--shadow-pop-sm); }
.tagq p { margin: 0 0 var(--space-3); }
.tagq-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin: 0 0 var(--space-2); font-weight: var(--weight-semibold); }
.tagq-row select { min-height: 44px; min-width: 50%; padding: 0 var(--space-2); }
.tagq-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }

/* ---- The scoreboard */
.scoreboard { margin-top: var(--space-5); padding: var(--space-4); }
.scoreboard h2 { margin: 0 0 var(--space-2); font-size: var(--text-2xl); }
.scoreboard.over { border: var(--border-width) solid var(--color-line-strong); box-shadow: var(--shadow-pop); }
.table-wrap { overflow-x: auto; }
.game-table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.game-table th, .game-table td { border-bottom: 1px solid var(--color-line); padding: var(--space-2); text-align: right; }
.game-table th:first-child, .game-table td:first-child { text-align: left; color: var(--color-ink-muted); }
.game-table thead th { vertical-align: bottom; font: var(--weight-semibold) var(--text-sm)/1.2 var(--font-display); }
.game-table tfoot td { font: var(--weight-bold) var(--text-xl)/1.1 var(--font-display); border-bottom: 0; }
.game-table .leader { color: var(--color-success); }
.game-table .bust { color: var(--color-danger); }
.game-table .who { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.game-table .f7 { color: var(--color-warning); margin-left: 2px; }
.game-table .hit { color: var(--color-danger); margin-left: 2px; font-size: 0.8em; }
.game-table tfoot .f7-row td { font: var(--weight-regular) var(--text-sm) var(--font-body); color: var(--color-ink-muted); padding-top: 0; }
.game-table td.absent { color: var(--color-ink-muted); }
.start-row td { color: var(--color-ink-muted); font-style: italic; }
/* Many players (app.js fitTable): smaller type, names set sideways, so all fit */
.game-table.tight { font-size: 0.85rem; }
.game-table.tight.tighter { font-size: 0.75rem; }
.game-table.tight th, .game-table.tight td { padding: 6px 3px; }
.game-table.tight.tighter th, .game-table.tight.tighter td { padding: 6px 2px; }
.game-table.tight td:first-child { white-space: nowrap; }
.game-table.tight tfoot td, .game-table.tight tfoot .f7-row td { font-size: 1em; }
.game-table.tight td.bust { font-size: 0.88em; }
.game-table.tight .who { flex-direction: column-reverse; align-items: center; }
.game-table.tight .who-name { writing-mode: vertical-rl; transform: rotate(180deg); max-height: 7em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-table.tight .f7, .game-table.tight .hit { margin-left: 0; font-size: 0.75em; }
#game-banner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font: var(--weight-semibold) var(--text-lg)/1.3 var(--font-display); border-left-color: var(--color-success); }
#game-banner > span:not(.avatar) { flex: 1 1 0; min-width: 0; } /* (an initial avatar is a span too: keep it round) */
.tie-choices { flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-1); }
.tie-choices button { flex: 1 1 auto; }
.same-players { margin: var(--space-4) 0 0; }
.scoreboard.over #game-actions { justify-content: center; gap: 4px var(--space-5); }
.scoreboard.over #game-actions button { min-height: 44px; padding: var(--space-2) 2px; border: 0; background: none; color: var(--color-ink-muted); text-decoration: underline; font: var(--weight-regular) var(--text-sm) var(--font-body); }
.joiners:empty { display: none; }
.joiner { margin: var(--space-3) 0 0; }
.joiner p { margin: 0 0 var(--space-2); font-weight: var(--weight-semibold); }
.joiner-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.joiner-actions button { flex: 1 1 auto; }

/* ---- Dataset upload (the owner's passcode) */
.dataset { margin-top: var(--space-4); padding: var(--space-3); border: 1px dashed var(--color-control-edge); border-radius: var(--radius); background: var(--color-surface); }
.dataset h3 { margin: 0 0 var(--space-1); font-size: var(--text-lg); }
.dataset-fields { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin: var(--space-2) 0; }
.dataset label { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-sm); color: var(--color-ink-muted); }
.dataset select, .dataset textarea { padding: 6px var(--space-2); }
.dataset-notes { margin-bottom: var(--space-2); }
.dataset-notes textarea { resize: vertical; }

/* ---- The fix sheet: a card tapped in a close-up */
.fix-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; max-height: 55vh; overflow-y: auto; background: var(--color-surface); color: var(--color-ink);
  border-top: var(--border-width) solid var(--color-line-strong); border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: 0 -6px 20px rgb(0 0 0 / 0.3); padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom)); }
body.fixing main { padding-bottom: 50vh; }
.fix { position: relative; max-width: 640px; margin: 0 auto; }
.fix-close { position: absolute; top: -4px; right: -4px; min-height: 0; width: 40px; height: 40px; padding: 0; border-radius: 50%; font-size: 1.1rem; }
.fix-title { margin: 0 48px var(--space-2) 0; }
.fix-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
.fix-row > span { color: var(--color-ink-muted); font-size: var(--text-sm); min-width: 3.4em; }
.fix-row button { min-height: 44px; padding: 4px var(--space-3); }
.fix-row button.on { background: var(--c, var(--color-ink)); color: var(--c-text, var(--color-bg)); border-color: var(--c, var(--color-ink)); }
.fix-row select { padding: 6px; }
.fix .hand { margin: 4px 0 0; }

/* ---- Dialogs: the passcode */
.edition-dialog { border: var(--border-width) solid var(--color-line-strong); border-radius: var(--radius-lg); background: var(--color-surface); color: var(--color-ink); max-width: min(420px, calc(100vw - 32px)); padding: var(--space-5); box-shadow: var(--shadow-pop-lg); }
.edition-dialog::backdrop { background: rgb(27 23 18 / 0.55); }
.edition-dialog h2 { margin: 0 0 var(--space-1); font-size: var(--text-xl); }
.passcode-field { display: flex; flex-direction: column; gap: 4px; margin: var(--space-2) 0 var(--space-3); }
.passcode-field input { padding: var(--space-2); min-height: 44px; }
.upload-toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: min(92vw, 420px); margin: 0; padding: var(--space-2) var(--space-4); border-radius: var(--radius-md); background: var(--color-ink); color: var(--color-bg); box-shadow: var(--shadow-md); z-index: 20; }
.upload-toast.error { background: var(--color-danger); color: #fff; }

/* ---- In-app camera: full screen viewfinder, then the photo with Use / Retake */
.camera-dialog { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000; color: #fff; }
.camera-dialog[open] { display: flex; flex-direction: column; }
.camera-dialog::backdrop { background: #000; }
.cam-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cam-stage video, .cam-stage img { width: 100%; height: 100%; object-fit: contain; }
.cam-status { min-height: 1.4em; margin: 6px 12px 0; text-align: center; font-size: var(--text-sm); color: #ddd; }
.cam-bar { display: flex; align-items: center; justify-content: space-around; gap: var(--space-3); padding: var(--space-3) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom)); }
.cam-bar button { min-height: 56px; font-size: var(--text-lg); }
.cam-bar #cam-use, .cam-bar #cam-retake { flex: 1; }
.cam-bar #cam-retake { --btn-bg: transparent; --btn-ink: #fff; border-color: #fff; box-shadow: none; }
.cam-side { min-width: 64px; background: transparent; color: #fff; border-color: rgb(255 255 255 / 0.5); }
.cam-shutter { width: 76px; height: 76px; min-height: 0; padding: 0; border-radius: 50%; background: #fff; border: 5px solid rgb(255 255 255 / 0.45); background-clip: padding-box; }
.cam-shutter:disabled { opacity: 0.4; }

/* ---- Teaching the deck, and the card library (the original Flip 7) */
.order-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; max-width: 520px; margin: var(--space-4) 0; }
.order-grid span { border: 1px solid var(--color-line); border-radius: 6px; padding: 6px 2px; text-align: center; font-size: 0.8rem; background: var(--color-surface); }
.library-grid { display: grid; gap: var(--space-2); }
.library-row { display: flex; gap: var(--space-2); align-items: center; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius); padding: 6px 10px; }
.library-row.missing { border-color: var(--color-warning); }
.library-row .name { width: 110px; flex: none; font-weight: var(--weight-semibold); }
.library-row .name small { display: block; font-weight: var(--weight-regular); color: var(--color-ink-muted); }
.library-row .thumbs { display: flex; gap: 6px; overflow-x: auto; }
.library-row .thumb { position: relative; flex: none; }
.library-row .thumb.builtin img { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.library-row .thumb img { width: 48px; aspect-ratio: 120 / 168; border-radius: 4px; display: block; }
.library-row .thumb button { position: absolute; top: -6px; right: -6px; min-height: 0; width: 22px; height: 22px; padding: 0; border-radius: 50%; font-size: 0.7rem; }

/* ---- The chips prompt (the chips experiment, arms/index.js): one per visitor */
.chips-foot { display: contents; }
.chips-slot { margin: var(--space-3) 0 0; }
.chips-line { margin: 0; padding: 0 6px; text-align: center; color: var(--color-ink-muted); font-size: var(--text-sm); }
.chips-line a { color: var(--color-link); font-weight: var(--weight-semibold); white-space: nowrap; }
.chips-card { position: relative; display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) 44px var(--space-3) var(--space-3); background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-lg); }
.chips-card img { flex: none; width: 56px; height: auto; border-radius: 50%; }
.chips-card p { margin: 0 0 6px; font-size: var(--text-sm); color: var(--color-ink-muted); }
.chips-card .chips-card-title { margin: 0 0 2px; font: var(--weight-semibold) var(--text-lg) var(--font-display); color: var(--color-ink); }
.chips-card a { color: var(--color-link); font-weight: var(--weight-semibold); }
.chips-card-hide { position: absolute; top: 6px; right: 6px; min-height: 0; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--color-ink-muted); font-size: 1.2rem; }
.share-usage { margin-top: var(--space-4); }
