/* 学校祭 入退室管理 - スタイル
   モチーフ: 縁日(テントの縞・提灯の赤・整理券の半券)。デザイン用の値は :root にまとめています */

:root {
  --ink: #12163a;
  --ink-2: #2d3266;
  --mute: #646b93;
  --faint: #a4aac9;
  --paper: #eceff8;
  --surface: #ffffff;
  --line: #d6dbee;
  --line-2: #e7eaf6;

  --lantern: #e8344e;
  --lantern-d: #c1213a;
  --lantern-t: #fde6ea;
  --sun: #ffb020;
  --sun-t: #fff0cf;
  --ramune: #0b8f83;
  --ramune-t: #d9f3ef;
  --sky: #2f7cf6;
  --sky-t: #e1ecff;
  --grape: #6741d9;
  --grape-t: #ebe5ff;
  --ok: #168a45;
  --ok-t: #dcf4e5;
  --warn: #b76300;
  --warn-t: #ffefcc;
  --bad: #d12b2b;
  --bad-t: #fde4e4;

  --r: 20px;
  --r-sm: 12px;
  --font: "Hiragino Maru Gothic ProN", "Hiragino Sans", "BIZ UDPGothic", "Yu Gothic UI", "Noto Sans JP", "Noto Sans CJK JP", "Meiryo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --num: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Hiragino Maru Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --accent: var(--lantern);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; padding-top: 6px;
  background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.6;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  overflow-x: hidden;
}
body.modal-open { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); line-height: 1.3; text-wrap: balance; }
.c-hero p, .c-note, .lead, .hint-line, .modal-body { text-wrap: pretty; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.hidden { display: none !important; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.ic { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.22em; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; }

/* ---------- テントの縞・ヘッダー ---------- */
.tent {
  position: fixed; top: 0; left: 0; right: 0; height: 6px; z-index: 80;
  background: repeating-linear-gradient(90deg, var(--lantern) 0 26px, #fff 26px 52px);
}
.topbar {
  position: sticky; top: 6px; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 64px; padding: 8px 18px;
  background: #fff; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.brand-mark {
  width: 42px; height: 42px; flex: none; border-radius: 13px;
  display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 900; font-size: 1.35rem;
  transform: rotate(-4deg);
}
.brand-text { display: grid; line-height: 1.25; min-width: 0; }
.brand-text b { font-size: 1.15rem; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: var(--mute); font-size: .78rem; }
.top-right { display: flex; align-items: center; gap: 10px; flex: none; }
.mode-badge { padding: 4px 11px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 800; font-size: .82rem; }
.conn { display: inline-flex; align-items: center; gap: 7px; font-size: .82rem; font-weight: 700; color: var(--mute); }
.conn i { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); }
.conn[data-state="ok"] i { background: var(--ok); }
.conn[data-state="ng"] i { background: var(--bad); animation: blink 1s infinite; }
.conn[data-state="ng"] { color: var(--bad); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--paper); display: grid; place-items: center;
}
.icon-btn:active { transform: scale(.94); }
.icon-btn.is-off { color: var(--bad); }
@keyframes blink { 50% { opacity: .35; } }

.page { max-width: 1240px; margin: 0 auto; padding: 22px 20px calc(36px + var(--safe-b)); }
.page-wide { max-width: 1480px; }

/* ---------- 基本パーツ ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.panel-title { font-size: 1.1rem; font-weight: 900; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.panel-title.plain { padding: 0 4px; font-size: 1.3rem; margin-bottom: 10px; }
.sub-title { font-size: .95rem; font-weight: 800; color: var(--ink-2); margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.count { font-size: .85rem; font-weight: 800; color: var(--mute); background: var(--paper); border-radius: 999px; padding: 1px 10px; }
.count:empty { display: none; }
.hint-line { color: var(--mute); font-size: .92rem; }
.hint-line[hidden] { display: none; }
.empty { color: var(--mute); text-align: center; padding: 18px 8px; font-size: .95rem; list-style: none; }
.empty-big {
  display: grid; justify-items: center; gap: 6px; text-align: center; padding: 42px 20px;
  background: var(--surface); border: 2px dashed var(--line); border-radius: var(--r); color: var(--mute);
}
.empty-big span { font-size: 2.6rem; line-height: 1; }
.empty-big b { color: var(--ink); font-size: 1.2rem; }
.form-error { color: var(--bad); font-weight: 800; min-height: 1.6em; text-align: center; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.chip { display: inline-block; padding: 3px 12px; border-radius: 999px; font-weight: 800; font-size: .85rem; }
.chip-mode { background: var(--ink); color: #fff; }

.st { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 800; white-space: nowrap; }
.st-reg { background: var(--grape-t); color: var(--grape); }
.st-wait { background: var(--line-2); color: var(--ink-2); }
.st-call { background: var(--sun-t); color: var(--warn); }
.st-in { background: var(--sky-t); color: #1b57b8; }
.st-fin { background: var(--grape-t); color: var(--grape); }
.st-out { background: var(--line-2); color: var(--mute); }
.st-cancel { background: var(--bad-t); color: var(--bad); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pill { padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: .9rem; }
.pill b { font-family: var(--num); font-size: 1.1em; }

.banner { border-radius: var(--r-sm); padding: 12px 16px; font-size: .95rem; }
.banner b { display: block; margin-bottom: 2px; }
.banner-ok { background: var(--ok-t); color: #0d5a2c; }
.banner-warn { background: var(--warn-t); color: #6f3d00; }
.banner-bad { background: var(--bad-t); color: #8f1a1a; }

.since.is-warn { color: var(--warn); font-weight: 800; }
.since.is-bad { color: var(--bad); font-weight: 800; }

/* ---------- ボタン ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 52px; padding: 0 22px; border-radius: 14px;
  background: var(--ink); color: #fff; font-weight: 800; line-height: 1.25; text-align: center;
  -webkit-user-select: none; user-select: none;
  transition: transform .08s, filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .42; cursor: not-allowed; transform: none; filter: none; }
.btn.is-busy { pointer-events: none; opacity: .7; }
.btn-primary { background: var(--lantern); }
.btn-go { background: var(--ok); }
.btn-warn { background: var(--sun); color: #3d2500; }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn-ghost:hover { background: var(--paper); filter: none; }
.btn-danger { background: #fff; color: var(--bad); box-shadow: inset 0 0 0 2px #f0b6b6; }
.btn-danger:hover { background: var(--bad-t); filter: none; }
.btn-lg { min-height: 64px; font-size: 1.12rem; border-radius: 18px; padding: 0 28px; }
.btn-xl { min-height: 92px; font-size: clamp(1.4rem, 3vw, 1.9rem); border-radius: 24px; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: .9rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon { padding: 0; min-width: 52px; }
.btn-sm.btn-icon { min-width: 40px; }
.btn-lg.btn-icon { min-width: 64px; }
.btn-col { display: grid; gap: 10px; }
.btn-col .btn { justify-content: flex-start; }

/* ---------- レイアウト ---------- */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.two-col-wide { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); }
@media (max-width: 900px) { .two-col, .two-col-wide { grid-template-columns: 1fr; } }

/* ---------- メニュー ---------- */
.menu-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.menu-hero h1 { margin: 10px 0 6px; }
.menu-hero p { color: var(--mute); max-width: 44em; }
.menu-hero p b { color: var(--ink); }
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.role-card {
  position: relative; display: flex; align-items: center; gap: 16px; text-decoration: none;
  background: #fff; border: 2px solid var(--line); border-left: 10px solid var(--c);
  border-radius: 18px; padding: 18px 18px 18px 16px; min-height: 96px;
  transition: transform .1s, border-color .15s;
}
.role-card:hover { border-color: var(--c); }
.role-card:active { transform: scale(.98); }
.role-ic { font-size: 2.2rem; line-height: 1; width: 52px; text-align: center; flex: none; }
.role-tx { display: grid; gap: 2px; min-width: 0; }
.role-tx b { font-size: 1.2rem; font-weight: 900; }
.role-tx small { color: var(--mute); font-size: .86rem; line-height: 1.4; }
.role-lock { position: absolute; top: 10px; right: 12px; font-size: .72rem; font-weight: 800; padding: 1px 9px; border-radius: 999px; background: var(--ink); color: #fff; }
.menu-foot { margin-top: 26px; color: var(--mute); font-size: .92rem; }
.notice-page { max-width: 520px; margin: 60px auto; text-align: center; display: grid; gap: 14px; justify-items: center; }
.notice-emoji { font-size: 3.4rem; }
.notice-page p { color: var(--mute); }

/* ---------- ログイン・セットアップ ---------- */
.login-page { display: grid; place-items: center; min-height: calc(100dvh - 6px); padding-top: 12px; }
.login { width: min(400px, 100%); display: grid; gap: 14px; }
.login-brand { display: flex; align-items: center; gap: 14px; justify-content: center; margin-bottom: 4px; }
.login-brand h1 { font-size: 1.3rem; }
.login-label { text-align: center; font-weight: 800; color: var(--ink-2); }
.login-foot { text-align: center; color: var(--mute); font-size: .9rem; }
.pin-dots { display: flex; gap: 12px; justify-content: center; height: 30px; align-items: center; }
.pin-dots i { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--faint); transition: background .1s, border-color .1s, transform .1s; }
.pin-dots i.on { background: var(--ink); border-color: var(--ink); transform: scale(1.08); }

.setup-body { background: var(--paper); }
.setup { max-width: 640px; margin: 0 auto; padding: 36px 20px 60px; display: grid; gap: 18px; }
.setup-head { display: flex; align-items: center; gap: 16px; }
.setup-head p { color: var(--mute); }
.setup-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.setup-steps li { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; font-weight: 700; }
.setup-steps i { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 900; color: #fff; flex: none; }
.s-ok i { background: var(--ok); } .s-skip i { background: var(--faint); } .s-ng i { background: var(--bad); }
.pin-card { background: var(--ink); color: #fff; border-radius: var(--r); padding: 24px; display: grid; gap: 14px; }
.pin-card h2 { font-size: 1.3rem; }
.pin-card p { opacity: .82; font-size: .95rem; }
.pin-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pin-pair > div { background: rgba(255, 255, 255, .1); border-radius: 14px; padding: 14px; display: grid; gap: 2px; }
.pin-pair small { opacity: .75; font-size: .8rem; }
.pin-pair b { font-family: var(--num); font-size: 2.6rem; letter-spacing: .12em; line-height: 1.2; }
.pin-note { font-size: .85rem !important; }
.setup-actions { display: flex; }
.setup-actions .btn { flex: 1; }
.code { background: #1a1d3a; color: #e8ecff; border-radius: 10px; padding: 12px; font-size: .82rem; white-space: pre-wrap; word-break: break-all; margin: 8px 0 0; }
code { background: var(--line-2); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
@media (max-width: 480px) { .pin-pair { grid-template-columns: 1fr; } }

/* ---------- キーパッド・ステッパー ---------- */
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.key {
  appearance: none; height: 72px; border-radius: 18px; cursor: pointer;
  background: #fff; border: 2px solid var(--line); color: var(--ink);
  font-family: var(--num); font-size: 1.9rem; font-weight: 800;
  display: grid; place-items: center; -webkit-user-select: none; user-select: none;
  transition: background .08s, transform .08s;
}
.key:active { background: var(--sky-t); transform: scale(.95); }
.key-fn { background: var(--paper); color: var(--mute); font-size: 1.4rem; }
.key .ic { width: 1.5rem; height: 1.5rem; }
@media (max-height: 760px) { .key { height: 60px; } }

.stepper { display: flex; align-items: center; justify-content: center; gap: 18px; }
.step-btn {
  appearance: none; width: 76px; height: 76px; flex: none; border-radius: 22px; cursor: pointer;
  border: 0; background: var(--ink); color: #fff; display: grid; place-items: center;
  -webkit-user-select: none; user-select: none; transition: transform .08s;
}
.step-btn .ic { width: 34px; height: 34px; stroke-width: 3; }
.step-btn:active { transform: scale(.92); }
.step-btn:disabled { opacity: .25; cursor: not-allowed; transform: none; }
.step-val { display: flex; align-items: baseline; justify-content: center; gap: 6px; min-width: 150px; }
.step-val b { font-family: var(--num); font-size: 5.6rem; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.step-val span { font-size: 1.5rem; font-weight: 800; color: var(--mute); }
.stepper-lg .step-btn { width: 64px; height: 64px; }
.stepper-lg .step-val b { font-size: 4.2rem; }
.stepper-md { gap: 10px; }
.stepper-md .step-btn { width: 48px; height: 48px; border-radius: 14px; }
.stepper-md .step-btn .ic { width: 22px; height: 22px; }
.stepper-md .step-val { min-width: 96px; }
.stepper-md .step-val b { font-size: 2.2rem; }
.stepper-md .step-val span { font-size: 1rem; }
.stepper-wrap { display: flex; justify-content: center; padding: 6px 0 4px; }

/* ---------- メーター(教室の混み具合) ---------- */
.meter { display: grid; gap: 20px; }
.lv-ok { --lv: var(--ok); } .lv-warn { --lv: #e08a00; } .lv-full { --lv: var(--bad); }
.meter-head { display: flex; align-items: baseline; gap: 8px; }
.meter-head span { color: var(--mute); font-weight: 700; flex: 1; font-size: .95rem; }
.meter-head b { font-family: var(--num); font-size: 2.6rem; font-weight: 900; line-height: 1; color: var(--lv); font-variant-numeric: tabular-nums; }
.meter-head small { font-size: 1rem; font-weight: 800; color: var(--mute); }
.meter-head em { font-style: normal; font-weight: 800; font-size: .85rem; color: var(--warn); margin-left: 6px; }
.slots { display: flex; gap: 6px; margin-top: 10px; }
.slots i { flex: 1; height: 26px; border-radius: 9px; background: var(--line-2); }
.slots i.on { background: var(--lv); }
.slots i.res { background: repeating-linear-gradient(135deg, var(--lv) 0 5px, #fff 5px 10px); box-shadow: inset 0 0 0 2px var(--lv); }
.bar { display: flex; height: 26px; border-radius: 999px; background: var(--line-2); overflow: hidden; margin-top: 10px; }
.bar .fill { background: var(--lv); transition: width .4s; }
.bar .res { background: repeating-linear-gradient(135deg, var(--lv) 0 5px, #fff 5px 10px); transition: width .4s; }
.meter-free { margin-top: 8px; color: var(--mute); font-size: .9rem; }

/* ---------- 入退場カード(モード1・共通のグループ表示) ---------- */
.entry-panel { display: grid; gap: 18px; }
.quick { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.chip-btn {
  appearance: none; border: 0; cursor: pointer; padding: 9px 18px; border-radius: 999px;
  background: var(--paper); color: var(--ink-2); font-weight: 800; font-size: .95rem; min-height: 44px;
}
.chip-btn.on { background: var(--ink); color: #fff; }
.entry-next { text-align: center; color: var(--mute); font-weight: 700; }
.entry-next b { font-family: var(--num); font-size: 1.6rem; color: var(--ink); margin-left: 6px; }
.entry-warn { background: var(--warn-t); color: #6f3d00; border-radius: 12px; padding: 10px 14px; font-weight: 700; font-size: .95rem; text-align: center; }
.gchips { display: flex; flex-wrap: wrap; gap: 10px; }
.gchip {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 14px;
  background: var(--paper); font-size: .92rem; color: var(--mute);
}
.gchip b { font-family: var(--num); font-size: 1.3rem; color: var(--ink); font-weight: 900; }
.gchip span { font-weight: 700; color: var(--ink-2); }
.gchip em { font-style: normal; font-weight: 800; font-size: .8rem; color: var(--sky); }
.gchip.is-fin { background: var(--grape-t); } .gchip.is-fin em { color: var(--grape); }
.recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.recent li { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px; background: var(--paper); font-size: .92rem; color: var(--mute); }
.recent li.empty { background: none; justify-content: center; }
.recent li b { font-family: var(--num); font-size: 1.15rem; color: var(--ink); min-width: 3.2em; }
.recent li span { font-weight: 700; color: var(--ink-2); flex: 1; }
.recent-undo li .btn { margin-left: auto; }

.exit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.exit-card { background: #fff; border: 2px solid var(--line); border-radius: 20px; padding: 18px; display: grid; gap: 10px; transition: opacity .25s, transform .25s; }
.exit-card.leaving { opacity: 0; transform: scale(.94); }
.exit-no { font-family: var(--num); font-size: 3.4rem; font-weight: 900; line-height: 1; }
.exit-meta { display: flex; justify-content: space-between; color: var(--mute); font-weight: 700; font-size: .95rem; }
.exit-meta span:first-child { color: var(--ink); font-size: 1.1rem; }

/* ---------- QR表示端末 ---------- */
.recept { position: relative; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 32px; align-items: center; min-height: calc(100dvh - 150px); }
.recept-qr { display: grid; justify-items: center; gap: 14px; }
.qr-frame {
  width: min(78vmin, 640px); aspect-ratio: 1; background: #fff; border: 3px solid var(--ink);
  border-radius: 30px; padding: 22px; box-shadow: 12px 12px 0 var(--lantern);
}
.qr-box { width: 100%; height: 100%; } .qr-svg { width: 100%; height: 100%; display: block; }
.qr-url { font-family: var(--num); font-size: 1.05rem; color: var(--mute); word-break: break-all; text-align: center; }
.recept-guide { display: grid; gap: 20px; }
.recept-guide h1 { font-size: clamp(2rem, 4.4vw, 3.2rem); font-weight: 900; }
.lead { font-size: 1.15rem; color: var(--ink-2); }
.steps { list-style: none; counter-reset: st; margin: 0; padding: 0; display: grid; gap: 12px; }
.steps li { counter-increment: st; display: grid; grid-template-columns: 52px 1fr; column-gap: 16px; align-items: center; background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 14px 18px; }
.steps li::before { content: counter(st); grid-row: span 2; width: 48px; height: 48px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-family: var(--num); font-weight: 900; font-size: 1.4rem; }
.steps b { font-size: 1.25rem; } .steps span { color: var(--mute); }
.recept-stats { display: flex; gap: 14px; }
.recept-stats > div { flex: 1; background: var(--ink); color: #fff; border-radius: 18px; padding: 12px 18px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.recept-stats small { width: 100%; opacity: .75; }
.recept-stats b { font-family: var(--num); font-size: 2.8rem; line-height: 1; }
.closed-cover { position: absolute; inset: -6px; z-index: 5; background: rgba(18, 22, 58, .93); border-radius: var(--r); display: grid; place-items: center; text-align: center; color: #fff; }
.closed-cover div { display: grid; gap: 8px; justify-items: center; }
.closed-cover span { font-size: 3.4rem; } .closed-cover b { font-size: 2.2rem; } .closed-cover p { opacity: .8; }
@media (max-width: 900px) { .recept { grid-template-columns: 1fr; gap: 22px; } }

/* ---------- 入場指示端末 ---------- */
.gate { display: grid; gap: 18px; }
.gate-top { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 28px; align-items: center; }
.gate-ctl { display: grid; gap: 10px; }
.sw-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; background: var(--paper); border-radius: 16px; padding: 12px 16px; }
.sw-card b { display: block; } .sw-card small { color: var(--mute); font-size: .85rem; display: block; line-height: 1.4; }
.sw-card small.is-off { color: var(--bad); font-weight: 800; }
.sw-list { display: grid; gap: 10px; margin-top: 16px; }
.sw-card + .field, .field + .sw-card, .sw-card + .sw-card { margin-top: 14px; }
.sw {
  appearance: none; border: 0; cursor: pointer; flex: none; width: 66px; height: 38px; border-radius: 999px;
  background: var(--faint); position: relative; transition: background .18s;
}
.sw i { position: absolute; top: 4px; left: 4px; width: 30px; height: 30px; border-radius: 50%; background: #fff; transition: transform .18s; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.sw[aria-checked="true"] { background: var(--ok); }
.sw[aria-checked="true"] i { transform: translateX(28px); }
.gate-main { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.called-list { display: grid; gap: 14px; }
.call-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px;
  background: #fff; border: 4px solid var(--ok); border-radius: 26px; padding: 16px 20px;
  animation: callPulse 1.8s ease-in-out infinite;
}
@keyframes callPulse { 50% { box-shadow: 0 0 0 10px rgba(22, 138, 69, .18); } }
.call-no { display: grid; }
.call-no small { color: var(--mute); font-weight: 700; }
.call-no b { font-family: var(--num); font-size: clamp(3rem, 6.4vw, 4.6rem); font-weight: 900; line-height: 1; letter-spacing: .04em; }
.call-info { display: grid; gap: 4px; }
.call-info strong { font-size: 1.45rem; color: var(--ok); white-space: nowrap; }
.call-info span { color: var(--mute); font-weight: 700; font-size: .95rem; }
.call-actions { display: flex; gap: 10px; }
.call-actions .btn-lg { padding: 0 22px; }
.queue { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.q-row { display: grid; grid-template-columns: 34px 1fr auto auto auto; align-items: center; gap: 12px; padding: 10px 12px; background: var(--paper); border-radius: 14px; }
.q-row.is-staff { box-shadow: inset 4px 0 0 var(--sun); }
.q-pos { width: 30px; height: 30px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-weight: 900; font-size: .85rem; color: var(--mute); }
.q-no { font-family: var(--num); font-size: 1.7rem; font-weight: 900; }
.q-size { font-weight: 800; color: var(--ink-2); }
.q-wait { color: var(--mute); font-size: .88rem; font-weight: 700; }
.sheet-list { display: grid; gap: 10px; margin-top: 12px; }
.issued { display: grid; justify-items: center; gap: 2px; background: var(--paper); border-radius: 20px; padding: 18px; margin: 14px 0; }
.issued small { color: var(--mute); font-weight: 700; }
.issued b { font-family: var(--num); font-size: 5rem; line-height: 1.1; font-weight: 900; letter-spacing: .06em; }
.issued span { font-weight: 800; color: var(--ink-2); }
@media (max-width: 1000px) {
  .gate-top, .gate-main { grid-template-columns: 1fr; }
  .call-card { grid-template-columns: 1fr; text-align: center; }
  .call-actions { justify-content: center; }
  .call-actions .btn-go { flex: 1; }
}

/* ---------- コーナー端末 ---------- */
.corner { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.corner-main { border-top: 8px solid var(--cc); display: grid; gap: 14px; }
.corner-title { display: flex; align-items: center; gap: 14px; }
.corner-ic { width: 64px; height: 64px; border-radius: 20px; background: var(--cc); display: grid; place-items: center; font-size: 2.2rem; flex: none; }
.corner-title p { color: var(--mute); font-size: .95rem; }
#padNo, #padScore, #mPad { max-width: 440px; width: 100%; margin: 0 auto; }
.numdisp { display: flex; justify-content: center; gap: 12px; }
.numdisp i {
  width: 74px; height: 96px; border-radius: 18px; background: var(--paper); border: 3px solid var(--line);
  display: grid; place-items: center; font-style: normal; font-family: var(--num); font-size: 3.4rem; font-weight: 900;
}
.numdisp i.on { background: #fff; border-color: var(--ink); }
.numdisp i.cur { border-color: var(--cc, var(--accent)); }
.score-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.who { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.who-no { display: grid; }
.who-no small { color: var(--mute); font-weight: 700; font-size: .85rem; }
.who-no b { font-family: var(--num); font-size: 3.8rem; font-weight: 900; line-height: 1; letter-spacing: .05em; }
.who-meta { display: grid; gap: 4px; justify-items: start; font-weight: 800; font-size: 1.2rem; }
.score-info { display: grid; gap: 14px; }
.prog { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.prog-item { display: grid; justify-items: center; gap: 0; padding: 8px 2px; border-radius: 12px; background: var(--paper); text-align: center; min-width: 0; }
.prog-item span { font-size: 1.3rem; line-height: 1.3; }
.prog-item small { font-size: .62rem; color: var(--mute); font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.prog-item b { font-family: var(--num); font-size: .95rem; color: var(--faint); }
.prog-rows { grid-template-columns: 1fr; gap: 5px; }
.prog-rows .prog-item { grid-template-columns: 30px 1fr auto; justify-items: start; align-items: center; padding: 6px 12px; text-align: left; }
.prog-rows .prog-item small { font-size: .9rem; }
.prog-rows .prog-item b { font-size: 1.05rem; }
.prog-item.has { background: #fff; box-shadow: inset 0 0 0 2px var(--pc); }
.prog-item.has b { color: var(--ink); }
.prog-item.is-me { background: var(--pc); }
.prog-item.is-me small, .prog-item.is-me b { color: #fff; }
.scoredisp { background: var(--ink); color: #fff; border-radius: 22px; padding: 16px 22px; text-align: center; display: grid; gap: 2px; }
.scoredisp small { opacity: .8; font-weight: 700; }
.scoredisp div { display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.scoredisp b { font-family: var(--num); font-size: 5.6rem; font-weight: 900; line-height: 1.05; }
.scoredisp span { font-size: 1.6rem; font-weight: 800; opacity: .85; }
.scoredisp em { font-style: normal; font-size: .9rem; opacity: .75; }
.scoredisp.is-empty b { opacity: .3; }
.scoredisp.is-over { background: var(--bad); }
.score-input { display: grid; gap: 14px; }
.score-actions { display: grid; grid-template-columns: auto 1fr; gap: 10px; }
.score-actions .btn-ghost { white-space: nowrap; }
.corner-side { position: sticky; top: 84px; max-height: calc(100dvh - 110px); overflow: auto; }
.pick-list { display: grid; gap: 8px; }
.pick-chip {
  appearance: none; border: 2px solid var(--line); background: #fff; border-radius: 16px; cursor: pointer;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 10px 14px; text-align: left; min-height: 60px;
}
.pick-chip b { font-family: var(--num); font-size: 1.7rem; font-weight: 900; }
.pick-chip span { font-weight: 700; color: var(--ink-2); }
.pick-chip em { font-style: normal; font-weight: 800; font-size: .88rem; color: var(--warn); background: var(--sun-t); padding: 2px 10px; border-radius: 999px; }
.pick-chip:active { transform: scale(.98); }
.pick-chip.done { background: var(--paper); border-color: transparent; }
.pick-chip.done b, .pick-chip.done span { color: var(--mute); }
.pick-chip.done em { background: var(--ok-t); color: var(--ok); }
.pick-chip.is-called { border-style: dashed; }
.pick-chip.is-called em { background: var(--line-2); color: var(--mute); }
@media (max-width: 1000px) {
  .corner { grid-template-columns: 1fr; }
  .corner-side { position: static; max-height: none; }
  .score-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) { .numdisp i { width: 58px; height: 80px; font-size: 2.8rem; } .numdisp { gap: 8px; } }

/* ---------- 景品交換端末 ---------- */
.xch-scan { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 18px; align-items: stretch; min-height: calc(100dvh - 150px); }
.scan-stage { position: relative; border-radius: var(--r); overflow: hidden; background: #0c0f26; min-height: 380px; }
.scan-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-stage video.mirror { transform: scaleX(-1); }
.scan-frame { position: absolute; inset: 0; margin: auto; width: min(64%, 360px); aspect-ratio: 1; pointer-events: none; }
.scan-frame i { position: absolute; width: 46px; height: 46px; border: 6px solid #fff; }
.scan-frame i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 20px; }
.scan-frame i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 20px; }
.scan-frame i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 20px; }
.scan-frame i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 20px; }
.scan-stage.is-off .scan-frame { display: none; }
.scan-msg { position: absolute; left: 16px; right: 16px; bottom: 16px; padding: 12px 16px; border-radius: 14px; background: rgba(18, 22, 58, .85); color: #fff; font-weight: 800; text-align: center; }
.scan-msg.is-bad { background: var(--bad); }
.scan-off { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; text-align: center; padding: 28px; color: #fff; }
.scan-off span { font-size: 3rem; } .scan-off b { font-size: 1.3rem; } .scan-off p { opacity: .8; max-width: 26em; font-size: .95rem; }
.scan-side { display: grid; gap: 16px; align-content: start; }
.scan-tools { display: grid; gap: 10px; }
.scan-stat { display: flex; align-items: baseline; gap: 8px; background: var(--paper); border-radius: 16px; padding: 12px 16px; }
.scan-stat small { color: var(--mute); font-weight: 700; flex: 1; }
.scan-stat b { font-family: var(--num); font-size: 2.2rem; line-height: 1; }
@media (max-width: 900px) { .xch-scan { grid-template-columns: 1fr; min-height: 0; } .scan-stage { min-height: 320px; } }

.xch-res { display: grid; gap: 16px; }
.res-banner { border-radius: 18px; padding: 16px 22px; font-weight: 900; font-size: 1.4rem; display: flex; align-items: center; gap: 10px; }
.res-banner.is-ok { background: var(--ok-t); color: #0d5a2c; }
.res-banner.is-warn { background: var(--warn-t); color: #6f3d00; }
.res-banner.is-bad { background: var(--bad); color: #fff; }
.res-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 16px; }
.res-left { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 22px; display: grid; gap: 16px; align-content: start; }
.res-total { display: grid; }
.res-total small { color: var(--mute); font-weight: 700; }
.res-total div { display: flex; align-items: baseline; gap: 8px; }
.res-total b { font-family: var(--num); font-size: 5rem; line-height: 1; font-weight: 900; }
.res-total span { font-size: 1.6rem; font-weight: 800; color: var(--mute); }
.res-prize {
  background: var(--pc, var(--ink)); color: #fff; border-radius: var(--r); padding: 26px;
  display: grid; align-content: center; justify-items: center; text-align: center; gap: 8px; min-height: 260px;
}
.res-prize small { opacity: .85; font-weight: 800; font-size: 1.05rem; }
.res-prize b { font-size: clamp(2.6rem, 7vw, 4.6rem); line-height: 1.15; font-weight: 900; }
.res-prize p { font-size: 1.3rem; font-weight: 700; }
.res-prize em { font-style: normal; background: rgba(255, 255, 255, .22); padding: 4px 18px; border-radius: 999px; font-size: 1.6rem; font-weight: 900; }
.res-basis { font-size: .9rem; opacity: .85; }
.res-prize.is-none { background: var(--mute); }
.res-foot { display: grid; gap: 12px; }
.res-timer { display: grid; gap: 6px; text-align: center; color: var(--mute); font-weight: 700; }
.res-bar { height: 12px; background: var(--line); border-radius: 999px; overflow: hidden; }
.res-bar i { display: block; height: 100%; background: var(--ink); transform-origin: left; }
@media (max-width: 900px) { .res-body { grid-template-columns: 1fr; } }

/* ---------- モーダル・トースト ---------- */
.modal-ov { position: fixed; inset: 0; z-index: 100; background: rgba(18, 22, 58, .55); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .16s; backdrop-filter: blur(2px); }
.modal-ov.in { opacity: 1; } .modal-ov.out { opacity: 0; }
.modal { width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: #fff; border-radius: 26px; padding: 24px; display: grid; gap: 14px; transform: translateY(12px) scale(.98); transition: transform .16s; }
.modal-ov.in .modal { transform: none; }
.modal-wide { width: min(680px, 100%); }
.modal-pad { width: min(480px, 100%); }
.modal-title { font-size: 1.3rem; font-weight: 900; }
.modal-body { color: var(--ink-2); line-height: 1.7; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.modal-actions .btn { min-width: 130px; }
.modal-actions .btn-block { width: 100%; }
@media (max-width: 560px) {
  .modal-ov { align-items: end; padding: 0; }
  .modal { border-radius: 26px 26px 0 0; padding-bottom: calc(24px + var(--safe-b)); }
}
#toasts { position: fixed; left: 0; right: 0; bottom: calc(18px + var(--safe-b)); z-index: 120; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 14px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; max-width: min(560px, 100%); background: var(--ink); color: #fff; border-radius: 16px; padding: 12px 16px; font-weight: 700; box-shadow: 0 8px 26px rgba(18, 22, 58, .35); animation: toastIn .22s ease-out; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .2s; }
.toast-ok { background: #0d5a2c; } .toast-err { background: var(--bad); }
.toast button { appearance: none; border: 0; cursor: pointer; background: rgba(255, 255, 255, .2); color: #fff; font-weight: 900; border-radius: 10px; padding: 8px 14px; min-height: 38px; white-space: nowrap; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------- フォーム・表(管理) ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-weight: 800; font-size: .92rem; color: var(--ink-2); }
.field small { color: var(--mute); font-size: .82rem; line-height: 1.5; }
input[type="text"], input[type="number"], input[type="password"], input[type="url"], input[type="search"], select {
  width: 100%; min-height: 50px; padding: 8px 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-weight: 700;
}
input:focus, select:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 4px var(--sky-t); }
.field-num { display: flex; align-items: center; gap: 8px; }
.field-num input { max-width: 170px; font-family: var(--num); font-size: 1.2rem; }
.field-num em { font-style: normal; font-weight: 800; color: var(--mute); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 14px; }
.form-grid .field { margin: 0; }
.radio-row, .radio-col { display: grid; gap: 8px; }
.radio { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 14px; cursor: pointer; }
.radio input { width: 22px; height: 22px; accent-color: var(--ink); flex: none; }
.radio:has(input:checked) { border-color: var(--ink); background: var(--paper); }

.tabs { display: flex; gap: 6px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow-x: auto; margin-bottom: 18px; position: sticky; top: 76px; z-index: 40; }
.tab { appearance: none; border: 0; cursor: pointer; background: transparent; padding: 0 22px; min-height: 48px; border-radius: 13px; font-weight: 800; color: var(--mute); white-space: nowrap; }
.tab.on { background: var(--ink); color: #fff; }
.dash { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.dcol { display: grid; gap: 18px; align-content: start; min-width: 0; }
@media (max-width: 900px) { .dash { grid-template-columns: 1fr; } }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 700px) { .seg { grid-template-columns: 1fr; } }
.seg button { appearance: none; cursor: pointer; border: 2px solid var(--line); background: #fff; border-radius: 16px; padding: 12px; display: grid; gap: 2px; text-align: left; }
.seg button b { font-size: 1.15rem; } .seg button small { color: var(--mute); font-weight: 700; }
.seg button.on { background: var(--ink); border-color: var(--ink); color: #fff; } .seg button.on small { color: rgba(255, 255, 255, .75); }
.lim-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.lim-row b { display: block; } .lim-row small { color: var(--mute); }
.corner-stats { display: grid; gap: 12px; }
.cs-row { display: grid; grid-template-columns: 170px 1fr auto; align-items: center; gap: 12px; }
.cs-name { font-weight: 800; display: flex; align-items: center; gap: 8px; }
.cs-name i { font-style: normal; }
.cs-bar { height: 14px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.cs-bar i { display: block; height: 100%; background: var(--pc); border-radius: 999px; transition: width .4s; }
.cs-val { color: var(--mute); font-size: .9rem; white-space: nowrap; } .cs-val b { color: var(--ink); font-family: var(--num); }
@media (max-width: 600px) { .cs-row { grid-template-columns: 1fr; gap: 4px; } }

.list-tools { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.search { display: flex; align-items: center; gap: 8px; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 0 14px; flex: 1; min-width: 220px; }
.search input { border: 0; box-shadow: none !important; padding: 0; min-height: 46px; }
.filter { display: flex; gap: 6px; flex-wrap: wrap; }
.tbl-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--r); }
.tbl { width: 100%; border-collapse: collapse; min-width: 780px; }
.tbl th { position: sticky; top: 0; background: var(--paper); text-align: left; padding: 10px 12px; font-size: .82rem; color: var(--mute); white-space: nowrap; }
.tbl td { padding: 9px 12px; border-top: 1px solid var(--line-2); font-weight: 600; white-space: nowrap; }
.tbl td.num { font-family: var(--num); text-align: right; } .tbl td.dim { color: var(--faint); }
.td-no b { font-family: var(--num); font-size: 1.25rem; letter-spacing: .04em; }
.td-no em { font-style: normal; font-size: .68rem; font-weight: 800; background: var(--sun-t); color: var(--warn); padding: 0 6px; border-radius: 6px; margin-left: 6px; }
.tbl tr[data-status="cancelled"] td, .tbl tr[data-status="exited"] td { color: var(--mute); }
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; align-items: start; }
.savebar { position: sticky; bottom: calc(12px + var(--safe-b)); z-index: 30; margin-top: 18px; display: flex; align-items: center; gap: 10px; justify-content: flex-end; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 18px; }
.savebar span { flex: 1; font-weight: 800; }
.savebar .btn-ghost { color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35); }
.prize-row { display: grid; grid-template-columns: 150px 1.1fr 1.6fr 56px 46px; gap: 8px; align-items: center; padding: 10px 10px 10px 16px; border-radius: 16px; background: var(--paper); border-left: 8px solid var(--pc); margin-bottom: 8px; }
.pr-min { display: flex; align-items: center; gap: 6px; font-weight: 800; color: var(--mute); }
.pr-min input { max-width: 92px; font-family: var(--num); font-size: 1.1rem; }
.pr-color { width: 56px; height: 50px; padding: 4px; border-radius: 12px; border: 2px solid var(--line); background: #fff; cursor: pointer; }
.prize-actions { margin-top: 12px; }
.prize-test { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.test-out { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; }
.swatch { width: 26px; height: 26px; border-radius: 8px; display: inline-block; } .dim { color: var(--mute); font-size: .95rem; }
@media (max-width: 800px) { .prize-row { grid-template-columns: 1fr 1fr; } .pr-name, .pr-note { grid-column: 1 / -1; } }
.logs { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; display: grid; gap: 2px; }
.logs li { display: flex; gap: 12px; padding: 6px 8px; border-radius: 8px; font-size: .9rem; }
.logs li:nth-child(odd) { background: var(--paper); }
.logs time { font-family: var(--num); color: var(--mute); font-weight: 700; flex: none; }
.danger-zone { border-color: #f0b6b6; }

/* ---------- お客様のスマホ画面 ---------- */
body.cust { --cbg: #eef1fb; --chero: var(--ink); background: var(--cbg); transition: background .4s; }
body.cust .tent { position: absolute; }
body.cust[data-state="waiting"] { --cbg: #e6efff; }
body.cust[data-state="called"] { --cbg: #12a150; --chero: #fff; }
body.cust[data-state="entered"] { --cbg: #e6f4ff; }
body.cust[data-state="finished"] { --cbg: #ffe7a6; }
body.cust[data-state="exited"] { --cbg: #ede8ff; }
body.cust[data-state="cancelled"], body.cust[data-state="closed"] { --cbg: #f1f1f6; }
.cust-page { max-width: 520px; padding: 0 16px calc(40px + var(--safe-b)); }
.c-app { min-height: 100dvh; }
.c-loading { display: grid; justify-items: center; gap: 12px; padding-top: 30vh; color: var(--mute); font-weight: 700; }
.c-loading i { width: 34px; height: 34px; border: 5px solid var(--line); border-top-color: var(--lantern); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.c-wrap { display: grid; gap: 16px; padding-top: 12px; }
.c-head { display: flex; align-items: center; gap: 10px; padding: 8px 2px; color: var(--chero); }
.c-head b { font-size: 1.1rem; font-weight: 900; }
body.cust[data-state="called"] .brand-mark { background: #fff; color: var(--ok); }
.c-hero { color: var(--chero); display: grid; gap: 8px; padding: 6px 2px; }
.c-hero h1 { font-size: clamp(1.7rem, 7.2vw, 2.3rem); font-weight: 900; }
.c-hero p { opacity: .82; font-weight: 700; line-height: 1.7; }
.c-hero-call { position: relative; text-align: center; padding: 20px 0 6px; justify-items: center; }
.c-hero-call h1 { font-size: clamp(2.1rem, 9.4vw, 3rem); }
.c-pulse { width: 68px; height: 68px; border-radius: 50%; background: #fff; position: relative; margin: 6px 0 30px; display: grid; place-items: center; font-size: 2rem; }
.c-pulse::after { z-index: 0; }
.c-pulse::before, .c-pulse::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 4px solid #fff; animation: ring 1.8s ease-out infinite; }
.c-pulse::after { animation-delay: .9s; }
@keyframes ring { from { transform: scale(1); opacity: .9; } to { transform: scale(1.9); opacity: 0; } }
.c-card { background: #fff; border-radius: 24px; padding: 20px; display: grid; gap: 14px; }
.c-card h2 { font-size: 1.1rem; font-weight: 900; }
.c-reg { justify-items: center; text-align: center; }
.c-reg .btn { margin-top: 4px; }
.c-note { color: var(--mute); font-size: .92rem; line-height: 1.7; }
.c-note b { color: var(--ink); }
.c-note-center { text-align: center; color: var(--ink-2); font-weight: 700; }
.c-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); gap: 4px; }
.c-steps li { display: grid; justify-items: center; gap: 4px; position: relative; font-size: .72rem; font-weight: 800; color: var(--mute); text-align: center; }
.c-steps li::before { content: ''; position: absolute; top: 14px; left: -50%; width: 100%; height: 3px; background: rgba(18, 22, 58, .15); z-index: 0; }
.c-steps li:first-child::before { display: none; }
.c-steps i { position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-style: normal; font-family: var(--num); font-weight: 900; font-size: .85rem; color: var(--mute); border: 3px solid rgba(18, 22, 58, .12); }
.c-steps li.done i { background: var(--ink); border-color: var(--ink); color: #fff; }
.c-steps li.done::before, .c-steps li.now::before { background: var(--ink); }
.c-steps li.now i { border-color: var(--ink); color: var(--ink); background: #fff; }
.c-steps li.now, .c-steps li.done { color: var(--ink); }
.c-steps .ic { width: 14px; height: 14px; stroke-width: 4; }
body.cust[data-state="called"] .c-steps li { color: rgba(255, 255, 255, .8); }
body.cust[data-state="called"] .c-steps li::before { background: rgba(255, 255, 255, .3); }
body.cust[data-state="called"] .c-steps li.done::before, body.cust[data-state="called"] .c-steps li.now::before { background: #fff; }
body.cust[data-state="called"] .c-steps li.now, body.cust[data-state="called"] .c-steps li.done { color: #fff; }
body.cust[data-state="called"] .c-steps li.done i { background: #fff; color: var(--ok); border-color: #fff; }
body.cust[data-state="called"] .c-steps li.now i { border-color: #fff; color: var(--ok); }
.c-wait { text-align: center; justify-items: center; }
.c-wait small { color: var(--mute); font-weight: 700; }
.c-ahead { display: flex; align-items: baseline; gap: 8px; }
.c-ahead b { font-family: var(--num); font-size: 5.4rem; line-height: 1; font-weight: 900; }
.c-ahead span { font-size: 1.6rem; font-weight: 800; color: var(--mute); }
.c-scores { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.c-scores li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 14px; background: var(--paper); color: var(--mute); }
.c-scores li span { font-size: 1.3rem; } .c-scores li b { color: inherit; }
.c-scores li em { font-style: normal; font-family: var(--num); font-weight: 900; font-size: 1.15rem; }
.c-scores li.has { background: #fff; box-shadow: inset 0 0 0 2px var(--pc); color: var(--ink); }
.c-total { display: flex; align-items: baseline; justify-content: space-between; border-top: 2px dashed var(--line); padding-top: 12px; }
.c-total small { color: var(--mute); font-weight: 700; }
.c-total div { display: flex; align-items: baseline; gap: 6px; } .c-total b { font-family: var(--num); font-size: 3rem; line-height: 1; font-weight: 900; } .c-total span { font-weight: 800; color: var(--mute); }
.c-net { position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); z-index: 90; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 14px; text-align: center; font-weight: 700; font-size: .9rem; }

/* 整理券(半券) — 番号・QRを載せる、この画面の主役 */
.ticket { filter: drop-shadow(0 10px 0 rgba(18, 22, 58, .1)); }
.ticket-top, .ticket-bot { background: #fff; position: relative; }
.ticket-top {
  border-radius: 26px 26px 0 0; padding: 22px 20px 18px; text-align: center; display: grid; gap: 6px; justify-items: center;
  -webkit-mask: radial-gradient(circle 15px at 0 100%, #0000 97%, #000) left / 51% 100% no-repeat, radial-gradient(circle 15px at 100% 100%, #0000 97%, #000) right / 51% 100% no-repeat;
  mask: radial-gradient(circle 15px at 0 100%, #0000 97%, #000) left / 51% 100% no-repeat, radial-gradient(circle 15px at 100% 100%, #0000 97%, #000) right / 51% 100% no-repeat;
}
.ticket-bot {
  border-radius: 0 0 26px 26px; padding: 16px 22px 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  -webkit-mask: radial-gradient(circle 15px at 0 0, #0000 97%, #000) left / 51% 100% no-repeat, radial-gradient(circle 15px at 100% 0, #0000 97%, #000) right / 51% 100% no-repeat;
  mask: radial-gradient(circle 15px at 0 0, #0000 97%, #000) left / 51% 100% no-repeat, radial-gradient(circle 15px at 100% 0, #0000 97%, #000) right / 51% 100% no-repeat;
}
.ticket-bot::before { content: ''; position: absolute; top: 0; left: 22px; right: 22px; border-top: 3px dashed var(--line); }
.ticket small { color: var(--mute); font-weight: 700; font-size: .82rem; display: block; }
.ticket-bot b { font-size: 1.35rem; font-weight: 900; }
.ticket-bot b.num { font-size: 1.7rem; }
.ticket-bot > div:last-child { text-align: right; }
.ticket-no { display: flex; justify-content: center; gap: 4px; }
.ticket-no i { display: inline-block; width: .72em; text-align: center; font-style: normal; font-family: var(--num); font-weight: 900; font-size: clamp(4.6rem, 22vw, 6.4rem); line-height: 1.05; }
.qr-card { width: min(100%, 300px); aspect-ratio: 1; padding: 6px; }
.ticket-qr .ticket-top { padding-bottom: 20px; }

/* ---------- モード3(個人識別型) ---------- */
.ticket-no-sm i { font-size: clamp(2.7rem, 12.5vw, 3.9rem); }
.ticket-no-sm i.dash { width: .55em; color: var(--faint); }
.c3-reg { gap: 14px; }
.c3-count { display: flex; align-items: baseline; justify-content: space-between; }
.c3-count small { color: var(--mute); font-weight: 800; }
.c3-count div { display: flex; align-items: baseline; gap: 8px; }
.c3-count b { font-family: var(--num); font-size: 4rem; line-height: 1; font-weight: 900; }
.c3-count span { font-family: var(--num); font-size: 1.9rem; font-weight: 800; color: var(--mute); }
.c3-bar { height: 12px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.c3-bar i { display: block; height: 100%; background: var(--ok); border-radius: 999px; transition: width .35s; }
.c3-done { display: flex; align-items: center; gap: 8px; font-weight: 900; color: var(--ok); background: var(--ok-t); border-radius: 14px; padding: 10px 14px; }
.c3-members { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.c3-mrow { border-radius: 16px; padding: 12px 14px; background: var(--paper); }
.c3-mrow b { font-family: var(--num); font-size: 1.3rem; font-weight: 900; letter-spacing: .02em; }
.c3-mrow.ok, .c3-mrow.wait { display: flex; align-items: center; gap: 10px; }
.c3-mrow.ok { background: var(--ok-t); }
.c3-mrow em { margin-left: auto; font-style: normal; font-weight: 800; font-size: .92rem; color: var(--mute); display: inline-flex; align-items: center; gap: 4px; }
.c3-mrow.ok em { color: var(--ok); }
.c3-mrow.qr { background: #fff; border: 3px solid var(--ink); display: grid; gap: 10px; justify-items: center; text-align: center; padding: 14px; }
.c3-mhead { display: grid; gap: 2px; }
.c3-mhead b { font-size: 1.6rem; }
.c3-mhead em { margin: 0; color: var(--lantern); font-size: .95rem; }
.c3-qr { width: min(100%, 250px); aspect-ratio: 1; background: #fff; }
.c3-qrnote { font-size: .85rem; color: var(--mute); }
.c3-tag { font-size: .72rem; font-weight: 800; background: var(--ink); color: #fff; border-radius: 999px; padding: 0 9px; line-height: 1.7; white-space: nowrap; }
.c3-tag.muted { background: var(--line-2); color: var(--mute); }
.c3-wait { text-align: center; justify-items: center; }
.c3-wait small { color: var(--mute); font-weight: 800; }
.c3-wait-val { display: flex; align-items: baseline; gap: 6px; }
.c3-wait-val b { font-family: var(--num); font-size: 4.4rem; line-height: 1; font-weight: 900; }
.c3-wait-val span { font-size: 1.6rem; font-weight: 800; color: var(--mute); }
.c3-wait-val b.c3-now { font-family: var(--font); font-size: 1.5rem; color: var(--ok); line-height: 1.4; }
.c3-wait-line { font-weight: 700; color: var(--ink-2); }
.c3-scores { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.c3-srow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 16px; background: var(--paper); }
.c3-srow.mine { background: #fff; box-shadow: inset 0 0 0 3px var(--ink); }
.c3-srow b { font-family: var(--num); font-size: 1.2rem; font-weight: 900; margin-right: 6px; }
.c3-srow strong { font-family: var(--num); font-size: 1.9rem; font-weight: 900; white-space: nowrap; }
.c3-srow strong small { font-size: .9rem; color: var(--mute); margin-left: 2px; }
.c3-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.c3-chips span { background: #fff; box-shadow: inset 0 0 0 2px var(--pc); border-radius: 999px; padding: 0 10px; font-weight: 800; font-size: .85rem; line-height: 1.7; }
.c3-chips em { font-style: normal; color: var(--mute); font-size: .85rem; }

/* コーナー端末(参加者ごとの得点) */
.mrows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mrow { appearance: none; width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 8px 14px; min-height: 58px; cursor: pointer; }
.mrow b { font-family: var(--num); font-size: 1.45rem; font-weight: 900; }
.mrow .mv { margin-left: auto; font-family: var(--num); font-size: 1.8rem; font-weight: 900; white-space: nowrap; }
.mrow .mv small { font-size: .85rem; color: var(--mute); margin-left: 2px; }
.mrow .mv em { font-style: normal; color: var(--faint); }
.mrow.sel { background: var(--paper); border-color: var(--cc, var(--ink)); box-shadow: inset 8px 0 0 var(--cc, var(--ink)); }
.mrow.dirty .mv { color: var(--cc, var(--ink)); }
.mrow.over { border-color: var(--bad); background: var(--bad-t); }
.mrow.shared { border-style: dashed; }
.mrow.shared b { font-size: 1.1rem; white-space: nowrap; }
.mtotal small { white-space: nowrap; }
.mrow:active { transform: scale(.99); }
.mtotal { background: var(--ink); color: #fff; border-radius: 18px; padding: 10px 18px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 12px; }
.mtotal small { opacity: .8; font-weight: 700; }
.mtotal div { grid-row: span 2; grid-column: 2; display: flex; align-items: baseline; gap: 6px; }
.mtotal b { font-family: var(--num); font-size: 2.8rem; line-height: 1.1; font-weight: 900; }
.mtotal span { font-weight: 800; opacity: .85; }
.mtotal em { font-style: normal; font-size: .85rem; opacity: .75; grid-column: 1; }

/* 入場指示端末: 登録中のグループ */
.reg-panel { border-left: 8px solid var(--grape); }
.reg-list { display: grid; gap: 10px; margin-top: 10px; }
.reg-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 14px; background: var(--paper); border-radius: 16px; padding: 10px 14px; }
.reg-no { font-family: var(--num); font-size: 2.1rem; font-weight: 900; letter-spacing: .03em; }
.reg-prog { display: grid; gap: 4px; min-width: 0; }
.reg-count { font-weight: 800; } .reg-count strong { font-family: var(--num); font-size: 1.5rem; }
.reg-prog small { color: var(--mute); }
.q-reg { margin-left: 6px; font-size: .72rem; color: var(--warn); font-weight: 800; }
@media (max-width: 800px) { .reg-row { grid-template-columns: auto 1fr; } .reg-row .btn { grid-column: 1 / -1; } }

/* 景品交換: 参加者ごとの得点 */
.res-members { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.res-members li { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; background: var(--paper); border-radius: 12px; }
.res-members b { font-family: var(--num); font-size: 1.1rem; }
.res-members span { font-family: var(--num); font-weight: 900; font-size: 1.2rem; } .res-members small { color: var(--mute); margin-left: 2px; }

/* 管理: モード3の一覧 */
.tbl tr.sub-head td { background: var(--paper); font-size: .9rem; color: var(--ink-2); }
.tbl tr.sub-row td { background: #fafbff; }
.tbl tr.is-open td { border-top-color: var(--ink); }
.tbl td.warn { color: var(--warn); font-weight: 800; }
.modal-xl { width: min(920px, 100%); }
.tbl-edit { min-width: 660px; }
.tbl-edit input.sc { min-height: 40px; padding: 4px 8px; width: 78px; font-family: var(--num); text-align: right; }
.chk { display: flex; align-items: center; gap: 6px; font-weight: 700; white-space: nowrap; } .chk input { width: 20px; height: 20px; accent-color: var(--ok); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
@media (max-width: 560px) {
  .topbar { padding: 8px 12px; }
  .page { padding: 16px 12px calc(30px + var(--safe-b)); }
  .conn em, .mode-badge { display: none; }
  .step-val b { font-size: 4.6rem; }
  .who-no b { font-size: 3rem; }
}
