/* Shared styles. Mobile first, big tap targets, system font, no framework. */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1c1917;
  --muted: #6b635c;
  --line: #e4ded8;
  --soft: #f3eee9;
  --brand: #b45309;
  --brand-fg: #ffffff;
  --ok: #15803d;
  --err: #b91c1c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171412;
    --fg: #f5f1ed;
    --muted: #a8a09a;
    --line: #3b342f;
    --soft: #2a2420;
    --brand: #e08a1e;
    --brand-fg: #1c1206;
    --ok: #4ade80;
    --err: #f87171;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 18px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

main {
  max-width: 32rem;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

h1 { font-size: 2rem; line-height: 1.15; margin: 0.25em 0 0.6em; }
h2 { font-size: 1.25rem; margin: 1.6em 0 0.6em; }
p { margin: 0 0 1em; }
a { color: var(--brand); }

.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

/* Buttons and button-like links: at least 56 px high. */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  width: 100%;
  min-height: 56px;
  padding: 12px 20px;
  border: 0;
  border-radius: 14px;
  background: var(--soft);
  color: var(--fg);
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn.primary { background: var(--brand); color: var(--brand-fg); }
.btn.huge { min-height: 104px; font-size: 1.75rem; border-radius: 20px; }
.btn.inline { width: auto; display: inline-flex; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:focus-visible { outline: 3px solid var(--fg); outline-offset: 2px; }

.stack > * + * { margin-top: 12px; }

/* One-line status / error. */
.msg { min-height: 1.45em; margin: 16px 0; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--err); }

/* Form fields (16 px+ so iOS does not zoom). */
label { display: block; font-weight: 600; margin: 0 0 6px; }
input[type="number"] {
  width: 100%;
  min-height: 56px;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 1.25rem;
}
.field + .field { margin-top: 16px; }

/* Lists of rows (staff tables, last calls). */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.rows li .grow { flex: 1; }
.rows .btn { width: auto; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.8rem; color: var(--muted); margin-left: 0.5em; }

/* ---- Guest page ---- */
.guest {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.guest h1 { font-size: 2.6rem; text-align: center; margin: 0.5em 0 0.8em; }
.guest .msg { text-align: center; font-size: 1.1rem; }
.follow-big { margin-top: 16px; padding: 16px; border: 2px dashed var(--line); border-radius: 16px; text-align: center; }
.follow-big p { margin-bottom: 12px; }
.follow-small { margin-top: auto; padding-top: 32px; text-align: center; font-size: 0.9rem; }
.follow-small button { display: inline-flex; align-items: center; min-height: 56px; padding: 0 16px; border: 0; background: none; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; }

/* ---- Staff page ---- */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li {
  counter-increment: step;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.steps li::before {
  content: counter(step);
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--brand-fg);
  font-weight: 700;
  display: grid;
  place-items: center;
}
.steps svg { flex: none; width: 44px; height: 44px; color: var(--brand); }
.scan-box { position: relative; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 3 / 4; }
.scan-box video { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---- Print page: screen preview ---- */
.sheet { max-width: 60rem; margin: 0 auto; padding: 0 16px 32px; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.sheet .page { display: contents; }
/* The card is the size container; layout lives on .in so every cqw is a share of the card width. */
.card {
  display: block;
  container-type: inline-size;
  aspect-ratio: 70 / 42.3;
  background: #fff;
  color: #000;
  border: 1px solid #ccc;
  border-radius: 6px;
  overflow: hidden;
  text-decoration: none;
}
.card .in { height: 100%; display: flex; align-items: center; gap: 4cqw; padding: 0 6cqw; }
.card .qr { flex: none; width: 43cqw; height: 43cqw; display: block; }
.card .txt { flex: 1; min-width: 0; text-align: center; }
.card .num { font-size: 22cqw; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.card .say { font-size: 4.4cqw; font-weight: 600; line-height: 1.25; margin-top: 2.5cqw; }

/* ---- Print: A4, 3 x 7 cards of 70 x 42.3 mm per page, cut lines, no browser margins ---- */
@page { size: A4; margin: 0; }

@media print {
  :root { color-scheme: light; }
  body { background: #fff; color: #000; }
  .screen-only { display: none !important; }
  .sheet { display: block; max-width: none; margin: 0; padding: 0; }
  .sheet .page {
    display: grid;
    grid-template-columns: repeat(3, 70mm);
    grid-template-rows: repeat(7, calc(296mm / 7));
    width: 210mm;
    height: 296mm; /* 1 mm short of A4 so rounding never spills a blank page */
    overflow: hidden;
    break-after: page;
  }
  .sheet .page:last-child { break-after: auto; }
  .card {
    aspect-ratio: auto;
    width: 70mm;
    height: calc(296mm / 7);
    border: 0;
    border-radius: 0;
  }
  /* Cut lines between cards only. */
  .card:not(:nth-child(3n)) { border-right: 0.25mm dashed #999; }
  .card:nth-child(-n + 18) { border-bottom: 0.25mm dashed #999; }
}
