/* Snapbooth. Colors have one job each:
   accent (violet) = the main action · good (green) = saved/done · bad (red) = problem/delete
   warn (amber) = attention/timer · info (blue) = share/links · everything else neutral. */

:root {
  --bg: #f6f5f8;
  --surface: #ffffff;
  --surface-2: #efedf3;
  --line: #e2dfe8;
  --text: #17151c;
  --muted: #6b6577;
  --accent: #6d3bf5;
  --accent-ink: #ffffff;
  --accent-fill: #6d3bf5;
  --accent-soft: #ece5ff;
  --good: #15803d;
  --good-soft: #dcfce7;
  --bad: #dc2626;
  --bad-soft: #fee2e2;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --info: #2563eb;
  --info-soft: #dbeafe;
  --shadow: 0 1px 2px rgb(23 21 28 / 0.06), 0 8px 24px rgb(23 21 28 / 0.06);
  --r: 16px;
  --r-sm: 10px;
  --font: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0d12;
    --surface: #17161d;
    --surface-2: #221f2a;
    --line: #2d2a36;
    --text: #f3f1f7;
    --muted: #a39db0;
    --accent: #8b5cf6;
    --accent-fill: #7c3aed;
    --accent-soft: #2a1f4d;
    --good: #22c55e;
    --good-soft: #0f2e1b;
    --bad: #f87171;
    --bad-soft: #3a1416;
    --warn: #fbbf24;
    --warn-soft: #3a2a08;
    --info: #60a5fa;
    --info-soft: #11264a;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"],
.stage {
  --bg: #0e0d12;
  --surface: #17161d;
  --surface-2: #221f2a;
  --line: #2d2a36;
  --text: #f3f1f7;
  --muted: #a39db0;
  --accent: #8b5cf6;
  --accent-fill: #7c3aed;
  --accent-soft: #2a1f4d;
  --good: #22c55e;
  --good-soft: #0f2e1b;
  --bad: #f87171;
  --bad-soft: #3a1416;
  --warn: #fbbf24;
  --warn-soft: #3a2a08;
  --info: #60a5fa;
  --info-soft: #11264a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body[data-view="booth"] { background: #0e0d12; overflow: hidden; }
body.no-scroll { overflow: hidden; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: clamp(26px, 4vw, 34px); font-weight: 700; }
h2 { font-size: 18px; font-weight: 600; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.i { flex: none; display: block; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left));
}
@media (min-width: 720px) { .page { padding-left: 32px; padding-right: 32px; } }
.center-page { min-height: 100dvh; display: grid; place-items: center; }
.loading-page { min-height: 60vh; display: grid; place-items: center; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 56px; margin-bottom: 20px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #7c3aed, #ec4899);
}
.page-title { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.page-title .i { color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 16px; white-space: nowrap; user-select: none;
  transition: transform 0.12s ease, background-color 0.15s ease, opacity 0.15s;
  -webkit-user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.sm { min-height: 40px; padding: 0 14px; font-size: 15px; }
.btn.lg { min-height: 58px; padding: 0 28px; font-size: 18px; }
.btn-primary { background: var(--accent-fill); color: var(--accent-ink); box-shadow: 0 6px 20px rgb(109 59 245 / 0.28); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-good { background: var(--good); color: #fff; }
.stage .btn-good { color: #06240f; }
.btn-info { background: var(--info-soft); color: var(--info); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--line); }
.btn-bad-ghost { background: transparent; color: var(--bad); border-color: var(--line); }
.btn-bad-ghost.armed { background: var(--bad); color: #fff; border-color: var(--bad); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 999px; display: grid; place-items: center;
  background: rgb(255 255 255 / 0.08); border: 0; color: inherit;
}
.icon-btn:hover { background: rgb(255 255 255 / 0.16); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.link { display: inline-flex; align-items: center; gap: 2px; color: var(--info); font-weight: 600; }

/* ---------- tone helpers ---------- */
.tone-accent { color: var(--accent); background: var(--accent-soft); }
.tone-good { color: var(--good); background: var(--good-soft); }
.tone-bad { color: var(--bad); background: var(--bad-soft); }
.tone-warn { color: var(--warn); background: var(--warn-soft); }
.tone-info { color: var(--info); background: var(--info-soft); }

/* ---------- home ---------- */
.home-grid { display: grid; gap: 32px; align-items: center; }
@media (min-width: 900px) { .home-grid { grid-template-columns: 1.1fr 0.9fr; min-height: calc(100dvh - 140px); } }
.home-main { display: grid; gap: 14px; max-width: 560px; }
.tile {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); transition: transform 0.15s ease, border-color 0.15s;
}
.tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.tile-icon {
  width: 52px; height: 52px; flex: none; border-radius: 14px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--text);
}
.tile-text { display: grid; gap: 2px; min-width: 0; }
.tile-text b { font-size: 18px; font-weight: 600; }
.tile-text small { color: var(--muted); font-size: 14px; }
.tile-hero { padding: 26px 22px; background: var(--accent-fill); color: #fff; border-color: transparent; box-shadow: 0 14px 40px rgb(109 59 245 / 0.32); }
.tile-hero:hover { border-color: transparent; }
.tile-hero .tile-icon { width: 68px; height: 68px; border-radius: 20px; background: rgb(255 255 255 / 0.18); color: #fff; }
.tile-hero .tile-text b { font-size: 26px; font-weight: 700; }
.tile-hero .tile-text small { color: rgb(255 255 255 / 0.82); font-size: 16px; }
.tile-go { margin-left: auto; width: 44px; height: 44px; border-radius: 999px; display: grid; place-items: center; background: rgb(255 255 255 / 0.18); }
.tile-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 420px) { .tile-row { grid-template-columns: 1fr; } }
.count-badge {
  position: absolute; top: 12px; right: 12px; min-width: 24px; height: 24px; padding: 0 7px;
  border-radius: 999px; background: var(--accent-fill); color: #fff; font-size: 13px; font-weight: 700;
  display: grid; place-items: center;
}
.join {
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
}
.join-icon { color: var(--muted); }
.join input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none; height: 44px;
  font-size: 18px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
}
.join input::placeholder { letter-spacing: 0; text-transform: none; font-weight: 400; color: var(--muted); }
.join .btn { min-height: 44px; width: 44px; padding: 0; }
.how { list-style: none; margin: 10px 0 0; padding: 0; display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.how li { display: grid; justify-items: center; gap: 6px; }
.how b { font-size: 13px; font-weight: 600; color: var(--muted); }
.how-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; }
.how-arrow { color: var(--line); }
.home-art { margin: 0; position: relative; height: 520px; display: none; }
@media (min-width: 900px) { .home-art { display: block; } }
.art { position: absolute; border-radius: 6px; box-shadow: 0 24px 60px rgb(23 21 28 / 0.25); }
.art-1 { height: 470px; left: 12%; top: 10px; transform: rotate(-6deg); z-index: 2; }
.art-2 { height: 360px; right: 4%; top: 120px; transform: rotate(5deg); }

/* ---------- forms ---------- */
.split { display: grid; gap: 28px; }
@media (min-width: 860px) { .split { grid-template-columns: 1fr 340px; align-items: start; } }
.form { display: grid; gap: 22px; }
.field { display: grid; gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field > legend { font-size: 14px; font-weight: 600; color: var(--muted); padding: 0; margin-bottom: 8px; }
.field > span { margin-bottom: 0; }
.field input[type="text"], .field input:not([type]), .field input[type="date"] {
  height: 54px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); font-size: 18px; width: 100%; outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input.invalid { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.options { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option > span {
  display: grid; justify-items: center; gap: 8px; padding: 14px 8px; border-radius: 14px; cursor: pointer;
  border: 2px solid var(--line); background: var(--surface); color: var(--muted); text-align: center;
  transition: border-color 0.15s, color 0.15s;
}
.option > span b { font-size: 14px; font-weight: 600; }
.option input:checked + span { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.option input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.frame-sw { width: 22px; height: 22px; border-radius: 7px; display: inline-block; flex: none; border: 1px solid rgb(127 127 127 / 0.35); }
.frame-sw.lg { width: 40px; height: 40px; border-radius: 11px; }
.preview { position: sticky; top: 16px; display: grid; justify-items: center; gap: 10px; padding: 22px; border-radius: var(--r); background: var(--surface-2); }
.preview img { max-width: 100%; max-height: 62vh; border-radius: 4px; box-shadow: var(--shadow); }
.preview img[data-layout="strip"] { max-height: 70vh; }
.preview-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; }

/* ---------- rows (my events) ---------- */
.rows { list-style: none; margin: 0; padding: 0; max-width: 760px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.rows li + li { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 68px; }
.row:hover { background: var(--surface-2); }
.row-main { display: grid; gap: 2px; min-width: 0; flex: 1; }
.row-main b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-main small { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13px; }
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: currentColor; margin: 0 3px; }
.row-meta { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.row-go { color: var(--muted); }
.skeleton { display: inline-block; width: 40px; height: 14px; border-radius: 6px; background: var(--surface-2); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }

/* ---------- empty / messages ---------- */
.empty { display: grid; justify-items: center; gap: 14px; text-align: center; padding: 48px 16px; }
.msg-icon { width: 84px; height: 84px; border-radius: 26px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.msg-icon.bad { background: var(--bad-soft); color: var(--bad); }
.msg-icon.warn { background: var(--warn-soft); color: var(--warn); }
.msg-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 6px; }
.code-pill { font-weight: 700; letter-spacing: 0.15em; padding: 6px 14px; border-radius: 999px; background: var(--surface-2); }
.empty-inline { display: flex; align-items: center; gap: 8px; color: var(--muted); padding: 18px 4px; }
.notice { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-weight: 500; }

/* ---------- chips (static) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip-static {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 600;
}
.chip-static b { color: var(--text); font-variant-numeric: tabular-nums; }
.chip-static.tone-good, .chip-static.tone-warn { background: var(--good-soft); }
.chip-static.tone-warn { background: var(--warn-soft); color: var(--warn); }
.chip-static.tone-good { color: var(--good); }
.live .i { animation: pulse 1.6s infinite; }

/* ---------- host ---------- */
.host-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.host-title { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.host-title h1 { overflow-wrap: anywhere; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
@media (min-width: 760px) { .stats { grid-template-columns: 200px 180px 1fr; } }
.stat {
  display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 12px;
  padding: 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line);
}
.stat-icon { grid-row: span 2; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.stat-icon.soft { background: var(--surface-2); color: var(--muted); }
.stat b { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-big b { font-size: 36px; }
.stat small { color: var(--muted); font-size: 13px; }
.stat-chart { grid-column: 1 / -1; display: block; padding: 14px 16px 10px; }
@media (min-width: 760px) { .stat-chart { grid-column: auto; } }
.chart { height: 100%; min-height: 76px; display: grid; grid-template-rows: 1fr auto; gap: 6px; }
.bars { width: 100%; height: 56px; }
.bars rect { fill: var(--line); }
.bars rect.peak { fill: var(--accent); }
.chart-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.peak-label { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; }
.chart-empty { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); height: 100%; min-height: 60px; }
.host-grid { display: grid; gap: 16px; margin-bottom: 16px; }
@media (min-width: 860px) { .host-grid { grid-template-columns: 1fr 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: grid; gap: 14px; align-content: start; }
.card-head { display: flex; align-items: center; justify-content: space-between; }
.card h2 { display: flex; align-items: center; gap: 8px; }
.card h2 .i { color: var(--muted); }
.qr-big { grid-template-columns: auto 1fr; align-items: center; gap: 18px; }
@media (max-width: 480px) { .qr-big { grid-template-columns: 1fr; justify-items: center; text-align: center; } .qr-big .btn-row { justify-content: center; } }
.qr-big .qr { width: 168px; padding: 8px; background: #fff; border-radius: 14px; }
.qr svg { display: block; width: 100%; height: auto; }
.qr-side { display: grid; gap: 10px; min-width: 0; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.thumb { aspect-ratio: 4 / 5; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs .empty-inline { grid-column: 1 / -1; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--good); transition: width 0.2s; }
.settings { margin-bottom: 16px; }
.settings summary { list-style: none; display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.settings summary::-webkit-details-marker { display: none; }
.settings .chev { transition: transform 0.2s; color: var(--muted); }
.settings[open] .chev { transform: rotate(90deg); }
.settings .form { margin-top: 8px; max-width: 560px; }
.settings .form > .btn { justify-self: start; }
.settings .options { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
.key-card { grid-template-columns: auto 1fr auto; align-items: center; }
.key-text { display: grid; gap: 2px; }
.key-text small { color: var(--muted); font-size: 13px; }

/* ---------- gallery ---------- */
.gal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 18px; }
.gal-head > div:not(.gal-actions) { flex: 1; min-width: 0; }
.gal-head h1 { overflow-wrap: anywhere; }
.gallery .progress { margin-bottom: 14px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
@media (max-width: 420px) { .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; } }
.photo-grid .empty { grid-column: 1 / -1; }
.g-item { padding: 0; border: 0; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 5; background: var(--surface-2); transition: transform 0.15s; }
.g-item:hover { transform: scale(1.02); }
.g-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgb(8 7 11 / 0.96); color: #fff;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); place-items: center;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
}
.lb-top { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.lb-count { font-weight: 600; color: rgb(255 255 255 / 0.7); font-variant-numeric: tabular-nums; padding-left: 8px; }
.lb-img { max-width: 100%; max-height: calc(100dvh - 170px); object-fit: contain; border-radius: 4px; grid-row: 2; grid-column: 1; }
.lb-nav { grid-row: 2; grid-column: 1; width: 52px; height: 52px; border-radius: 999px; border: 0; display: grid; place-items: center; background: rgb(255 255 255 / 0.12); color: #fff; z-index: 2; }
.lb-nav.prev { justify-self: start; }
.lb-nav.next { justify-self: end; }
.lb-nav:disabled { opacity: 0; pointer-events: none; }
@media (max-width: 600px) { .lb-nav { display: none; } }
.lb-bar { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; padding-top: 12px; }
.lb-time { display: inline-flex; align-items: center; gap: 5px; color: rgb(255 255 255 / 0.6); font-size: 14px; margin-right: 6px; }
.lightbox .btn-info { background: #11264a; color: #93c5fd; }
.lightbox .btn-bad-ghost { border-color: rgb(255 255 255 / 0.2); color: #f87171; }
.lightbox .btn-bad-ghost.armed { color: #fff; }

/* ---------- photo page ---------- */
.photo-page { max-width: 640px; }
.photo-hero { margin: 0 0 18px; display: grid; place-items: center; }
.photo-hero img { max-width: 100%; max-height: 68dvh; border-radius: 6px; box-shadow: var(--shadow); }
.photo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }

/* ---------- booth stage (always dark) ---------- */
.stage {
  position: fixed; inset: 0; color: var(--text); background: #0e0d12;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.stage-top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 60px; }
.stage-title { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; font-size: 17px; }
.stage-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 480px) { #full { display: none; } }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px rgb(34 197 94 / 0.2); flex: none; }
.stage-tools { display: flex; gap: 8px; min-width: 44px; justify-content: flex-end; }
.stage-main { position: relative; min-height: 0; display: grid; place-items: center; padding: 0 12px; overflow: hidden; }
.viewfinder { position: relative; border-radius: 20px; overflow: hidden; background: #1b1922; box-shadow: 0 0 0 1px rgb(255 255 255 / 0.06); }
.viewfinder video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.viewfinder.fallback { background: radial-gradient(circle at 50% 40%, #2a1f4d, #17161d); }
.viewfinder.fallback::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 96px; height: 96px; opacity: 0.35;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='m21 15-3.1-3.1a2 2 0 0 0-2.8 0L6 21'/%3E%3C/svg%3E");
}
.vf-msg { position: absolute; inset: 0; z-index: 3; display: grid; place-content: center; justify-items: center; gap: 12px; text-align: center; padding: 20px; background: rgb(14 13 18 / 0.88); }
.vf-msg h2 { font-size: 22px; }
.steps { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.count { position: absolute; inset: 0; margin: auto; width: min(46%, 220px); aspect-ratio: 1; z-index: 2; display: grid; place-items: center; }
.count svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.count .track { fill: rgb(14 13 18 / 0.45); stroke: rgb(255 255 255 / 0.2); stroke-width: 6; }
.count .prog { fill: none; stroke: var(--warn); stroke-width: 6; stroke-linecap: round; }
.count b { position: relative; font-size: clamp(64px, 14vw, 120px); font-weight: 700; color: #fff; text-shadow: 0 4px 24px rgb(0 0 0 / 0.5); font-variant-numeric: tabular-nums; }
.count.tick b { animation: pop 1s ease-out; }
@keyframes pop { 0% { transform: scale(1.35); opacity: 0.2; } 25% { transform: scale(1); opacity: 1; } 100% { transform: scale(0.92); } }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 4; }
.flash.go { animation: flash 0.45s ease-out; }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }
.shot-dots { position: absolute; left: 12px; bottom: 12px; z-index: 2; display: flex; gap: 8px; margin: 0; padding: 6px; list-style: none; background: rgb(14 13 18 / 0.55); border-radius: 14px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.shot-dots li { width: 34px; height: 34px; border-radius: 9px; border: 2px dashed rgb(255 255 255 / 0.35); overflow: hidden; }
.shot-dots li.done { border: 2px solid var(--good); }
.shot-dots img { width: 100%; height: 100%; object-fit: cover; display: block; }

.stage-controls { display: grid; gap: 10px; padding: 12px 12px 14px; justify-items: center; }
.ctl { display: flex; gap: 6px; overflow-x: auto; max-width: 100%; padding: 2px; scrollbar-width: none; }
.ctl::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font-size: 14px; font-weight: 600; transition: background-color 0.15s, color 0.15s;
}
.chip:hover { color: var(--text); }
.chip.on { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }
.chip .swatch { width: 20px; height: 20px; border-radius: 50%; display: inline-block; background: conic-gradient(#f43f5e, #f59e0b, #22c55e, #3b82f6, #a855f7, #f43f5e); }
.chip .frame-sw { width: 18px; height: 18px; border-radius: 5px; }
.stage.running .ctl { opacity: 0.35; pointer-events: none; }
.ctl-label { display: none; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin: 6px 0 -4px; }
.shutter-wrap { display: grid; justify-items: center; gap: 6px; margin-top: 2px; }
.shutter {
  width: 86px; height: 86px; border-radius: 50%; border: 5px solid #fff; padding: 5px; background: transparent;
  display: grid; place-items: center; transition: transform 0.12s;
}
.shutter:active { transform: scale(0.94); }
.shutter .core { width: 100%; height: 100%; border-radius: 50%; background: var(--accent-fill); color: #fff; display: grid; place-items: center; transition: border-radius 0.2s, transform 0.2s, background-color 0.2s; }
.stage.running .shutter .core { border-radius: 12px; transform: scale(0.6); background: var(--bad); }
.stage.running .shutter .core .i { opacity: 0; }
.shutter-meta { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 600; }

/* Landscape tablets and laptops: controls in a side column. */
@media (min-aspect-ratio: 5/4) and (min-width: 700px) {
  .stage { grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: auto minmax(0, 1fr); }
  .stage-top { grid-column: 1 / -1; }
  .stage-main { padding: 0 8px 16px 16px; }
  .stage-controls { align-content: center; padding: 0 16px 16px; }
  .ctl { flex-wrap: wrap; justify-content: center; }
  .ctl-label { display: block; }
  .shutter { width: 104px; height: 104px; margin-top: 8px; }
}
/* Short phones in landscape */
@media (max-height: 520px) and (orientation: landscape) {
  .stage { grid-template-columns: minmax(0, 1fr) 290px; grid-template-rows: auto minmax(0, 1fr); }
  .stage-top { grid-column: 1 / -1; min-height: 48px; padding: 4px 12px; }
  .stage-controls { align-content: center; gap: 6px; padding: 0 8px 8px; }
  .ctl { flex-wrap: wrap; justify-content: center; }
  .chip { min-height: 32px; padding: 0 9px; font-size: 13px; }
  .ctl-label, .shutter-meta { display: none; }
  .shutter { width: 66px; height: 66px; margin-top: 0; border-width: 4px; padding: 4px; }
  .stage-controls { overflow-y: auto; align-content: safe center; }
  .ctl { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; width: 100%; }
  .stage-main { padding: 0 8px 8px; }
}

/* Review / done sheet over the booth */
.sheet { position: absolute; inset: 0; z-index: 10; background: rgb(8 7 11 / 0.94); display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); overflow: auto; }
.sheet-card { width: 100%; max-width: 980px; display: grid; gap: 20px; justify-items: center; align-items: center; }
@media (min-aspect-ratio: 5/4) and (min-width: 700px) { .sheet-card { grid-template-columns: 1fr 340px; } }
.print-wrap { display: grid; place-items: center; min-height: 0; }
.print { max-width: 100%; max-height: 60dvh; border-radius: 4px; box-shadow: 0 20px 60px rgb(0 0 0 / 0.6); animation: rise 0.4s ease-out; }
@media (min-aspect-ratio: 5/4) and (min-width: 700px) { .print { max-height: calc(100dvh - 64px); } }
@keyframes rise { from { transform: translateY(16px) scale(0.97); opacity: 0; } }
@media (max-aspect-ratio: 5/4), (max-width: 699px) {
  .sheet-card.done { gap: 14px; }
  .sheet-card.done .print { max-height: 30dvh; }
  .sheet-card.done .qr-card { max-width: 200px; padding: 10px; }
}
.sheet-side { display: grid; gap: 14px; justify-items: center; width: 100%; max-width: 340px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.sheet-actions.col { grid-template-columns: 1fr; }
.sheet-side > .btn.lg { width: 100%; }
.saving { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 18px; color: var(--muted); padding: 24px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; font-weight: 700; }
.qr-card { display: grid; justify-items: center; gap: 10px; padding: 14px; border-radius: 18px; background: #fff; color: #17151c; width: 100%; max-width: 240px; }
.qr-card .qr { width: 100%; }
.qr-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.mini-ring { width: 22px; height: 22px; transform: rotate(-90deg); }
.mini-ring .track { fill: none; stroke: rgb(255 255 255 / 0.3); stroke-width: 3; }
.mini-ring .prog { fill: none; stroke: #fff; stroke-width: 3; transition: stroke-dashoffset 1s linear; }

/* ---------- misc ---------- */
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
.spinner.sm { width: 18px; height: 18px; border-width: 2px; border-color: rgb(255 255 255 / 0.4); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 100;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 12px 20px; border-radius: 999px; font-weight: 600; box-shadow: var(--shadow);
  background: var(--text); color: var(--bg); transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.tone-good { background: var(--good); color: #fff; }
.toast.tone-bad { background: var(--bad); color: #fff; }
.toast.tone-warn { background: var(--warn); color: #1c1203; }
.toast.tone-info { background: var(--text); color: var(--bg); }
#print-sign { display: none; }

/* Tone colors win over neutral tile backgrounds. */
.tile-icon.tone-info, .how-icon.tone-info { color: var(--info); background: var(--info-soft); }
.tile-icon.tone-warn, .how-icon.tone-warn { color: var(--warn); background: var(--warn-soft); }
.tile-icon.tone-good, .how-icon.tone-good { color: var(--good); background: var(--good-soft); }
.tile-icon.tone-accent, .how-icon.tone-accent { color: var(--accent); background: var(--accent-soft); }
@media (max-width: 560px) { .host-head > .btn { width: 100%; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Printable QR sign: only the sign prints. */
@media print {
  body > *:not(#print-sign) { display: none !important; }
  #print-sign { display: block !important; }
  .sign { color: #000; text-align: center; font-family: var(--font); padding: 40px; display: grid; justify-items: center; gap: 24px; }
  .sign h1 { font-size: 44px; }
  .sign-qr { width: 360px; }
  .sign-qr svg { width: 100%; height: auto; }
  .sign-steps { display: flex; gap: 40px; font-size: 24px; font-weight: 700; }
  .sign-steps span { display: grid; justify-items: center; gap: 8px; }
  .sign p { font-size: 18px; color: #444; }
}
