/* ClaimYourTab — design system ("the receipt and the highlighter")
   The app behaves like the thing it splits: a paper receipt you mark up.
   Warm paper ground, ink-black type, and one loud color: highlighter
   yellow, which only ever means "this is yours". Everyone else at the
   table gets their own highlighter pastel. Money is set in a receipt
   mono (DM Mono); everything else in Schibsted Grotesk. Primary actions
   are solid ink and live at the bottom (thumb zone). Sentence case
   everywhere, no shouting labels. */

@font-face {
  font-family: "Schibsted Grotesk";
  src: url("fonts/schibsted-grotesk.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Mono";
  src: url("fonts/dm-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f4f1e9;      /* page ground */
  --sheet: #fffdf7;      /* receipt paper */
  --ink: #16140f;
  --ink-2: #5d594f;      /* secondary text */
  --ink-3: #8a8578;      /* tertiary / placeholders */
  --line: #e4dfd3;
  --line-2: #cfc8b7;
  --hi: #ffe14d;         /* highlighter: "yours" */
  --hi-soft: #fff3b0;
  --go: #0b7a45;         /* money sent */
  --go-soft: #dcf2e4;
  --danger: #b3261e;
  --danger-soft: #fbe7e4;
  /* the rest of the table, each a different highlighter */
  --p0: #ffb8d4;
  --p1: #a6e9c8;
  --p2: #b3dbff;
  --p3: #ffcfa3;
  --p4: #dacbff;
  --venmo: #008cff;
  --cashapp: #00d632;
  --paypal: #0070e0;
  --zelle: #6d1ed4;
  /* legacy names still used by inline styles in the scripts */
  --hairline: var(--line);
  --muted: var(--ink-2);
  --accent: var(--ink);
  --accent-tint: var(--hi-soft);
  --surface: var(--paper);
  --sans: "Schibsted Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  /* torn-paper teeth: bottom edge and top edge */
  --zig-b: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg);
  --zig-t: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg);
}

* { box-sizing: border-box; }

/* The hidden attribute must always win — component classes set their
   own display (.btn is display:flex), which silently overrides the
   browser's hidden styling and leaves "hidden" elements visible and
   dead (this is what broke the home page's Continue-without-a-photo
   button: it showed from page load but did nothing when tapped). */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; background: var(--paper); }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

main {
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 18px 128px;
}

::selection { background: var(--hi); color: var(--ink); }

h1.hero {
  font-size: clamp(34px, 9.4vw, 44px);
  line-height: 1.02;
  font-weight: 850;
  margin: 12px 0 10px;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
h1.hero .mark {
  background: linear-gradient(100deg, #0000 1%, var(--hi) 2.5%, var(--hi) 97%, #0000 99%);
  padding: 0 0.08em;
  margin: 0 -0.04em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.lede { font-size: 17px; color: var(--ink-2); margin: 0 0 4px; max-width: 34ch; }

.meta { font-size: 14px; color: var(--ink-2); }
.money { font-family: var(--mono); font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* --- brand bar --- */
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
  padding: 6px 0 14px;
  color: var(--ink);
  text-decoration: none;
}
.brand svg { width: 26px; height: 26px; flex: none; display: block; }

section { margin: 32px 0; }
section > h2 {
  font-size: 19px;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 12px;
  font-weight: 800;
}

/* --- receipt paper with a torn (zigzag) bottom edge --- */
.sheet, #cards {
  background: var(--sheet);
  border-radius: 18px 18px 0 0;
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - 8px) no-repeat, var(--zig-b) bottom / 12px 8px repeat-x;
  mask: linear-gradient(#000 0 0) top / 100% calc(100% - 8px) no-repeat, var(--zig-b) bottom / 12px 8px repeat-x;
}
.sheet { padding: 18px 18px 26px; }

/* --- claim wall header -------------------------------------------------
   Host keeps the small section label. Guests (who scanned in) get the
   big sticky version: "Pick what's yours" is the one job of their
   screen, so it stays pinned while the cards scroll. */
.claim-head { padding: 10px 0 10px; margin-bottom: 4px; }
.claim-head h2 {
  font-size: 19px;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-weight: 800;
  margin: 0;
}
.claim-head.guest {
  position: sticky;
  top: 0;
  z-index: 6;
  background: rgba(244, 241, 233, 0.92);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  margin: 0 -18px 6px;
  padding: 12px 18px 10px;
}
.claim-head.guest h2 {
  font-size: 30px;
  font-weight: 850;
  letter-spacing: -0.035em;
  line-height: 1.05;
}
.claim-head .meta { margin: 4px 0 0; }

/* --- the claim wall: one receipt, each item a line on it --- */
#cards { padding: 6px 0 16px; }
#cards:empty { display: none; }

.card {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  width: 100%;
  min-height: 68px;
  padding: 12px 18px;
  margin: 0;
  background: none;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  isolation: isolate;
  transition: transform 140ms var(--ease);
  user-select: none;
  -webkit-user-select: none;
}
.card + .card::before {
  content: "";
  position: absolute;
  top: 0; left: 18px; right: 18px;
  border-top: 1.5px dashed var(--line);
}
/* the highlighter stroke behind a line that's yours */
.card::after {
  content: "";
  position: absolute;
  inset: 6px 8px;
  z-index: -1;
  border-radius: 6px 10px 8px 12px / 10px 6px 12px 8px;
  background: var(--hi);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 320ms var(--ease);
}
.card.mine::after { transform: scaleX(1); animation: cyt-swipe 360ms var(--ease); }
.card.mine.seen::after, .card.mine.seen .check { animation: none; }
.card.mine + .card::before { border-color: transparent; }
.card:active { transform: scale(0.985); }
.card .grow { flex: 1; min-width: 0; }
.card .item-name { font-size: 17px; font-weight: 650; display: block; letter-spacing: -0.01em; }
.card .item-price { font-size: 16px; }
.card.claimed-other .item-name, .card.claimed-other .item-price { color: var(--ink-2); }
.card .check {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--ink); color: var(--hi); flex: none;
  display: none; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
}
.card.mine .check { display: inline-flex; animation: cyt-pop 240ms var(--ease); }
.card .meta { font-size: 13px; }
.card:focus-visible { outline: 2.5px solid var(--ink); outline-offset: -4px; border-radius: 12px; }

/* --- per-item share button + chooser (on cards you've claimed) --- */
.share-btn {
  flex: none;
  font: inherit; font-family: var(--mono); font-size: 13px; font-weight: 500;
  padding: 5px 10px; border-radius: 999px; cursor: pointer;
  background: var(--ink); color: var(--sheet);
  border: 0;
}
.share-btn.auto { background: rgba(22, 20, 15, 0.1); color: var(--ink); }
.share-chooser {
  flex: 0 0 100%;
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  padding-top: 8px;
}
.share-chooser .meta { color: var(--ink); font-weight: 650; margin-right: 2px; }
.share-chooser .chip { padding: 6px 12px; font-size: 14px; background: var(--sheet); }
.share-chooser .chip.on { background: var(--ink); }

.avatars { display: inline-flex; vertical-align: middle; }
.avatars .avatar + .avatar { margin-left: -5px; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--p2); color: var(--ink);
  font-size: 10.5px; font-weight: 800; letter-spacing: -0.02em;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--sheet);
  flex: none;
}
.avatar.c0 { background: var(--p0); }
.avatar.c1 { background: var(--p1); }
.avatar.c2 { background: var(--p2); }
.avatar.c3 { background: var(--p3); }
.avatar.c4 { background: var(--p4); }
.avatar.me { background: var(--ink); color: var(--hi); }
.row > .avatar { width: 36px; height: 36px; font-size: 13px; box-shadow: none; }

/* --- icons (inline SVG, drawn with the text color) --- */
.ico { width: 22px; height: 22px; flex: none; display: block; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* --- buttons --- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 56px;
  padding: 12px 18px;
  border-radius: 16px; border: 1.5px solid transparent;
  font: inherit; font-weight: 700; font-size: 17px; letter-spacing: -0.01em;
  cursor: pointer; text-decoration: none;
  transition: transform 140ms var(--ease), background 140ms ease-out;
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 2px; }
.btn-primary {
  background: var(--ink); color: var(--sheet);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 8px 18px -10px rgba(22, 20, 15, 0.6);
}
.btn-primary:active { background: #000; }
.btn-quiet {
  background: transparent; border-color: var(--line-2); color: var(--ink);
  min-height: 50px; font-size: 16px; font-weight: 650;
}
.btn-quiet:active { background: rgba(22, 20, 15, 0.05); }
.btn-small {
  width: auto; min-height: 40px; padding: 6px 14px;
  font-size: 14px; border-radius: 12px;
}
.btn[disabled] { opacity: 0.45; cursor: default; transform: none; }

.btn-venmo { background: var(--venmo); color: #fff; }
.btn-cashapp { background: var(--cashapp); color: #0a1f0f; }
.btn-paypal { background: var(--paypal); color: #fff; }
.btn-zelle { background: var(--zelle); color: #fff; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.24);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; flex: none;
}
.btn-cashapp .brand-mark { background: rgba(10, 31, 15, 0.12); }

/* --- forms --- */
label.field { display: block; margin: 0 0 16px; }
label.field span { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 650; color: var(--ink); margin-bottom: 7px; }

/* --- payment brand logos: the companies' actual logos, loaded live
   from the Simple Icons CDN (which tracks the official brand marks),
   so a logo updates here when the brand updates it. The letter under
   each logo is the fallback if the CDN is ever unreachable. --- */
.brand-chip {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--line);
  font-weight: 800; font-size: 15px; font-style: normal;
  position: relative; overflow: hidden;
}
.brand-chip.venmo { color: var(--venmo); }
.brand-chip.cashapp { color: var(--cashapp); }
.brand-chip.paypal { color: #003087; }
.brand-chip.zelle { color: var(--zelle); }
.brand-chip.applepay { color: #000; }
.brand-chip img {
  position: absolute; inset: 0; margin: auto;
  width: 16px; height: 16px; background: #fff; display: block;
}
.brand-chip svg { width: 15px; height: 15px; fill: #000; display: block; }
input[type="text"], input[type="number"], input[type="tel"], input[type="email"] {
  width: 100%; min-height: 52px;
  padding: 12px 14px;
  font: inherit; font-size: 17px;
  border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--sheet); color: var(--ink);
  transition: border-color 140ms ease-out, box-shadow 140ms ease-out;
  -webkit-appearance: none; appearance: none;
}
input::placeholder { color: var(--ink-3); }
/* on paper-white surfaces, fields sit in the darker paper instead */
.start-card input[type="text"], .popup-card input[type="text"] { background: var(--paper); border-color: transparent; }
input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px var(--hi-soft); }

details.more { margin: 2px 0 16px; }
details.more summary {
  font-size: 15px; font-weight: 650; color: var(--ink); cursor: pointer;
  padding: 8px 0; list-style: none; display: flex; align-items: center; gap: 10px;
}
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before {
  content: "+";
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  border: 1.5px solid var(--line-2);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 16px; line-height: 1;
  transition: transform 200ms var(--ease);
}
details.more[open] summary::before { transform: rotate(45deg); }
details.more[open] > :not(summary) { animation: cyt-rise 220ms var(--ease); }

.error {
  background: var(--danger-soft); color: var(--danger);
  border-radius: 12px; padding: 11px 14px; font-size: 14px; font-weight: 600; margin: 0 0 14px;
  display: none;
}
.error.show { display: block; animation: cyt-shake 300ms var(--ease); }

/* --- rows / totals --- */
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 0; border-bottom: 1.5px dashed var(--line);
}
.row:last-child { border-bottom: none; }
.row .grow { flex: 1; min-width: 0; }
.row strong { font-weight: 700; letter-spacing: -0.01em; }
.row .total { font-size: 17px; }
#totals-section > #totals-list { background: var(--sheet); border-radius: 18px; padding: 2px 16px; }
#bill-lines { margin-top: 10px; padding: 0 2px; }
#bill-lines .row { padding: 7px 0; border-bottom: 0; }
#bill-lines .row:has(strong) { border-top: 1.5px solid var(--ink); margin-top: 6px; padding-top: 12px; }
#bill-lines .row:has(strong) .total { font-size: 20px; }

.sent-badge {
  color: var(--go); background: var(--go-soft);
  font-weight: 700; font-size: 12.5px; white-space: nowrap;
  padding: 3px 9px; border-radius: 999px;
}

/* --- sticky bottom bar --- */
.stickybar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: rgba(244, 241, 233, 0.88);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid rgba(22, 20, 15, 0.08);
  padding: 10px 18px calc(10px + env(safe-area-inset-bottom));
  display: none;
}
.stickybar.show { display: block; animation: cyt-up 260ms var(--ease); }
.stickybar .inner {
  max-width: 520px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
}
.stickybar .grow { flex: 1; min-width: 0; }
.stickybar .amount { font-size: 18px; font-weight: 500; font-family: var(--mono); letter-spacing: -0.03em; }
.stickybar .btn { width: auto; flex: none; min-width: 112px; min-height: 52px; }

/* --- round-up row --- */
.roundup {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 56px;
  padding: 12px 16px; margin: 0 0 12px;
  border: 1.5px solid var(--line); border-radius: 14px;
  cursor: pointer; font-size: 15px;
  background: var(--sheet);
}
.roundup input { width: 22px; height: 22px; accent-color: var(--ink); flex: none; }

/* --- share / QR: a ticket you hold up to the table --- */
#share-section { background: var(--sheet); border-radius: 22px; padding: 18px; overflow: hidden; }
#share-section > h2 { margin-bottom: 14px; }
.share-link { display: flex; gap: 8px; }
.share-link input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 14px; min-height: 48px; background: var(--paper); border-color: transparent; color: var(--ink-2); }
.share-link .btn { min-height: 48px; background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.qr {
  text-align: center; padding: 20px 0 4px; margin: 18px -18px 0;
  border-top: 2px dashed var(--line);
  position: relative;
}
.qr::before, .qr::after {
  content: ""; position: absolute; top: -12px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--paper);
}
.qr::before { left: -11px; }
.qr::after { right: -11px; }
.qr img { width: 184px; height: 184px; display: inline-block; mix-blend-mode: multiply; }
.share-note { font-size: 13px; margin-top: 4px; }

/* --- editor --- */
.editor-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.editor-row .name { flex: 1; min-width: 0; }
.editor-row .price { width: 92px; font-family: var(--mono); }
.editor-row input { min-height: 46px; font-size: 16px; }
.icon-btn {
  width: 42px; height: 42px; flex: none;
  border: 1.5px solid var(--line); background: transparent; border-radius: 12px;
  font-size: 15px; cursor: pointer; color: var(--ink-2);
}
.icon-btn:active { background: var(--danger-soft); color: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.chip {
  border: 1.5px solid var(--line-2); background: transparent; border-radius: 999px;
  padding: 9px 15px; font: inherit; font-size: 15px; font-weight: 650; cursor: pointer; color: var(--ink);
  transition: transform 120ms var(--ease);
}
.chip:active { transform: scale(0.95); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--hi); }

.success { text-align: center; padding: 22px 0 18px; }
.success .big-check, .popup-card .big-check {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--hi); color: var(--ink); font-size: 30px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px;
  box-shadow: 0 0 0 8px var(--hi-soft);
  animation: cyt-pop 360ms var(--ease);
}
.success strong { font-size: 22px; letter-spacing: -0.03em; font-weight: 850; }

/* --- summary: a printed receipt, torn at both ends --- */
.summary-card {
  background: var(--sheet);
  padding: 30px 22px 32px;
  -webkit-mask: var(--zig-t) top / 12px 8px repeat-x, linear-gradient(#000 0 0) center / 100% calc(100% - 16px) no-repeat, var(--zig-b) bottom / 12px 8px repeat-x;
  mask: var(--zig-t) top / 12px 8px repeat-x, linear-gradient(#000 0 0) center / 100% calc(100% - 16px) no-repeat, var(--zig-b) bottom / 12px 8px repeat-x;
}
.summary-card h1.hero { text-align: center; font-size: 30px; margin-top: 6px; }
.summary-card #subtitle { text-align: center; margin: 0 0 16px; }
.summary-card #people { border-top: 1.5px dashed var(--line-2); }
.summary-card .row .meta { font-size: 13px; }
.summary-card #bill-lines { border-top: 1.5px dashed var(--line-2); padding-top: 6px; }

a { color: var(--ink); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.center { text-align: center; }
.mt { margin-top: 12px; }
.quiet-link { color: var(--ink-2); font-weight: 650; font-size: 15px; }

/* --- loading overlay (scan upload): a receipt being read line by line --- */
.loading-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(244, 241, 233, 0.97);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.loading-overlay[hidden] { display: none; }
.loading-card { text-align: center; max-width: 320px; }
.loading-spinner {
  width: 92px; height: 118px; margin: 0 auto 26px;
  position: relative; overflow: hidden;
  background:
    linear-gradient(var(--line-2) 0 0) 16px 22px / 46px 5px no-repeat,
    linear-gradient(var(--line-2) 0 0) 16px 38px / 60px 5px no-repeat,
    linear-gradient(var(--line-2) 0 0) 16px 54px / 38px 5px no-repeat,
    linear-gradient(var(--line-2) 0 0) 16px 70px / 54px 5px no-repeat,
    linear-gradient(var(--ink) 0 0) 16px 90px / 60px 6px no-repeat,
    var(--sheet);
  border-radius: 8px 8px 0 0;
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - 8px) no-repeat, var(--zig-b) bottom / 11.5px 8px repeat-x;
  mask: linear-gradient(#000 0 0) top / 100% calc(100% - 8px) no-repeat, var(--zig-b) bottom / 11.5px 8px repeat-x;
}
.loading-spinner::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 14px;
  background: var(--hi); mix-blend-mode: multiply;
  animation: cyt-scan 1.6s var(--ease) infinite alternate;
}
.loading-msg { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; min-height: 30px; }
.loading-sub { font-size: 15px; color: var(--ink-2); margin-top: 6px; }
.loading-bar {
  width: 180px; height: 4px; margin: 20px auto 0;
  background: var(--line); border-radius: 999px; overflow: hidden;
}
.loading-bar-fill {
  width: 40%; height: 100%; border-radius: 999px; background: var(--ink);
  animation: cyt-slide 1.3s ease-in-out infinite;
}
.loading-dots { display: none; }
@keyframes cyt-scan {
  from { transform: translateY(4px); }
  to { transform: translateY(96px); }
}
@keyframes cyt-slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(560%); }
}
@keyframes cyt-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@keyframes cyt-rise {
  from { transform: translateY(6px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes cyt-up {
  from { transform: translateY(100%); }
  to { transform: none; }
}
@keyframes cyt-shake {
  0%, 100% { transform: none; }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
@keyframes cyt-swipe { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* --- host big number (still unclaimed) --- */
.owed-wrap { text-align: left; padding: 22px 0 4px; }
.owed-label { font-size: 15px; font-weight: 650; color: var(--ink-2); }
.owed-amount {
  font-family: var(--sans);
  font-size: clamp(52px, 15vw, 68px); font-weight: 850; letter-spacing: -0.05em; line-height: 1;
  margin: 6px 0 14px;
  font-variant-numeric: tabular-nums;
}
.meter {
  height: 10px; border-radius: 999px; background: var(--sheet);
  box-shadow: inset 0 0 0 1.5px var(--line);
  overflow: hidden; margin: 0 0 10px;
}
.meter span {
  display: block; height: 100%; width: 0; background: var(--hi);
  border-radius: 999px; box-shadow: inset 0 0 0 1.5px rgba(22, 20, 15, 0.12);
  transition: width 600ms var(--ease);
}

/* --- host toolbar --- */
/* Host toolbar: an app-style icon bar — five equal columns, a big
   icon over a tiny one-line label, so it always fits the phone's
   width (the old content-sized pills wrapped and overflowed). */
.host-tools {
  display: flex; gap: 2px; align-items: stretch;
  margin: 4px 0 4px; background: var(--sheet);
  border-radius: 18px;
  padding: 6px;
}
.tool-btn {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  font: inherit; text-align: center;
  padding: 9px 2px 8px; border-radius: 13px;
  background: none; color: var(--ink);
  border: none; cursor: pointer;
  transition: background 120ms ease-out, transform 120ms var(--ease);
}
.tool-btn:active { background: var(--paper); transform: scale(0.95); }
.tool-icon { line-height: 1; display: flex; }
.tool-icon .ico { width: 24px; height: 24px; }
.tool-label { font-size: 11.5px; font-weight: 650; color: var(--ink-2); white-space: nowrap; }

/* --- pop-ups: bottom sheets on phones, cards on wider screens --- */
.popup-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(22, 20, 15, 0.42);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: cyt-fade 180ms ease-out;
}
.popup-overlay[hidden] { display: none; }
.popup-card {
  background: var(--sheet); border-radius: 24px; padding: 28px 22px 22px;
  max-width: 380px; width: 100%; text-align: center;
  max-height: 88vh; overflow-y: auto;
  animation: cyt-pop 220ms var(--ease);
  box-shadow: 0 30px 60px -20px rgba(22, 20, 15, 0.45);
  position: relative;
}
@media (max-width: 600px) {
  .popup-overlay { align-items: flex-end; padding: 0; }
  .popup-card {
    max-width: none; border-radius: 26px 26px 0 0;
    padding: 30px 20px calc(20px + env(safe-area-inset-bottom));
    max-height: 92vh;
    animation: cyt-up 300ms var(--ease);
  }
  .popup-card::before {
    content: ""; position: absolute; top: 9px; left: 50%; transform: translateX(-50%);
    width: 40px; height: 5px; border-radius: 999px; background: var(--line-2);
  }
}
.editor-card { text-align: left; max-width: 440px; }
.editor-card h2 { text-align: center; margin-top: 0; }
.editor-card > .meta.center { margin: -2px 0 18px; }
.editor-card #editor-done { margin-top: 14px; }
.editor-card > .meta:not(.center) { display: block; font-weight: 650; color: var(--ink); }
#scan-popup-items { margin: 0 0 16px; text-align: left; }
.popup-item {
  position: relative; isolation: isolate;
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 54px;
  padding: 10px 12px; margin: 0;
  background: none; border: 0; border-top: 1.5px dashed var(--line);
  font: inherit; font-size: 16px; font-weight: 650; text-align: left; cursor: pointer; color: var(--ink);
}
.popup-item:first-child { border-top: 0; }
.popup-item::after {
  content: ""; position: absolute; inset: 5px 2px; z-index: -1;
  border-radius: 6px 10px 8px 12px / 10px 6px 12px 8px;
  background: var(--hi); transform: scaleX(0); transform-origin: left;
  transition: transform 300ms var(--ease);
}
.popup-item.mine::after { transform: scaleX(1); }
.popup-item .grow { flex: 1; min-width: 0; }
.popup-item .price { font-weight: 500; }
.popup-item .who { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.popup-item .check {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  background: var(--ink); color: var(--hi); font-size: 13px; font-weight: 800;
  display: none; align-items: center; justify-content: center;
}
.popup-item.mine .check { display: inline-flex; }
.popup-card h2 { margin: 6px 0 6px; font-size: 24px; font-weight: 850; letter-spacing: -0.03em; }
.popup-card p { margin: 0 0 18px; color: var(--ink-2); font-size: 15px; }
@keyframes cyt-pop {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes cyt-fade { from { opacity: 0; } to { opacity: 1; } }

/* --- landing page --- */
.hero-art {
  position: relative;
  margin: 26px 0 8px;
  padding: 0 14px 30px;
}
.hero-art .tilt { transform: rotate(-1.5deg); filter: drop-shadow(0 18px 20px rgba(22, 20, 15, 0.16)); }
.hero-art .sheet { padding: 14px 14px 24px; }
.r-head { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; color: var(--ink-3); padding: 0 6px 9px; border-bottom: 1.5px dashed var(--line); margin-bottom: 4px; }
.r-line {
  position: relative; isolation: isolate;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 6px; font-size: 15px; font-weight: 650;
}
.r-line .grow { flex: 1; }
.r-line .money { font-size: 14px; }
.r-line.hl::after {
  content: ""; position: absolute; inset: 3px 0; z-index: -1;
  border-radius: 5px 9px 7px 10px / 9px 5px 10px 7px;
  background: var(--c, var(--hi));
  transform-origin: left; animation: cyt-swipe 600ms var(--ease) both;
}
.r-line.d1::after { animation-delay: 250ms; }
.r-line.d2::after { animation-delay: 500ms; }
.r-line.d3::after { animation-delay: 750ms; }
.r-total { display: flex; justify-content: space-between; padding: 10px 6px 0; margin-top: 4px; border-top: 1.5px solid var(--ink); font-weight: 800; }
.paid-chip {
  position: absolute; right: 0; bottom: 0;
  display: flex; align-items: center; gap: 8px;
  background: var(--ink); color: var(--sheet);
  padding: 8px 14px 8px 8px; border-radius: 999px;
  font-size: 14px; font-weight: 700;
  rotate: 2deg;
  box-shadow: 0 14px 24px -12px rgba(22, 20, 15, 0.6);
  animation: cyt-rise 500ms 1.2s var(--ease) both;
}
.paid-chip .avatar { box-shadow: none; }
.paid-chip .money { color: var(--hi); }

.start-card { background: var(--sheet); border-radius: 22px; padding: 22px 18px 18px; }
.start-card > h2 { font-size: 24px; letter-spacing: -0.03em; font-weight: 850; margin: 0 0 16px; }
.btn .ico { width: 20px; height: 20px; }
.steps { display: grid; gap: 14px; }
.step { display: flex; gap: 14px; align-items: flex-start; }
.step .ico-wrap {
  width: 46px; height: 46px; border-radius: 15px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--sheet);
}
.step:nth-child(2) .ico-wrap { background: var(--hi); }
.step strong { display: block; font-size: 17px; letter-spacing: -0.01em; }
.step .meta { font-size: 15px; }
.foot { text-align: center; color: var(--ink-3); font-size: 13px; padding-top: 4px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  /* A loading indicator that never moves looks broken/stuck, so the
     scan loader keeps a gentle fade pulse even with Reduce Motion on
     (no spinning or sliding, just "still working"). */
  .loading-spinner, .loading-bar-fill, .loading-dots span {
    animation: cyt-pulse 1.6s ease-in-out infinite !important;
  }
}
