/* コミュステ 大会の申込と受付。スマホが先（参加者はスマホ・主催者は受付でスマホ）。
   形: 1列のカード。上に大会、下に操作。色はすべて下の変数から */
:root {
  --bg: #F3F4F7; --card: #FFFFFF; --ink: #161A23; --muted: #5E6676; --line: #D8DCE4; --soft: #EBEEF3;
  --accent: #2F45B8; --accent-ink: #FFFFFF; --accent-soft: #E6EAFA;
  --ok: #1D7A4B; --ok-soft: #E1F2E8; --warn: #8A5B00; --warn-soft: #FFF2D2; --err: #B42318; --err-soft: #FDE7E5;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, -apple-system, sans-serif;
  --num: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1218; --card: #181C25; --ink: #E8EBF1; --muted: #9BA3B3; --line: #2C3342; --soft: #222938;
    --accent: #8FA2F6; --accent-ink: #0F1218; --accent-soft: #1F2849;
    --ok: #7ED3A2; --ok-soft: #153023; --warn: #F2C572; --warn-soft: #382C11; --err: #FF9C92; --err-soft: #3B1714;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.65;
  padding-block: 0 48px;
}
header.top {
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px));
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.brand { font-weight: 700; letter-spacing: .02em; }
.brand span { font-weight: 500; color: var(--muted); margin-left: 6px; font-size: 14px; }
header nav { display: flex; gap: 14px; font-size: 14px; }
a { color: var(--accent); }
main {
  max-width: 720px; margin: 0 auto; display: grid; gap: 14px;
  padding: 16px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
}
main.wide { max-width: 1080px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; min-width: 0; }
h1 { font-size: 22px; line-height: 1.35; margin: 0 0 6px; text-wrap: balance; }
h2 { font-size: 18px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 10px 0 0; font-size: 15px; }
.facts dt { color: var(--muted); font-size: 13px; padding-top: 2px; }
.facts dd { margin: 0; min-width: 0; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--accent); }

/* フォーム */
form { display: grid; gap: 14px; }
label.f { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
label.f .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); font-size: 14px; }
.check input { width: 22px; height: 22px; flex: none; margin-top: 1px; accent-color: var(--accent); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

button, .btn {
  font: inherit; font-weight: 600; font-size: 15px; border-radius: 8px; padding: 10px 16px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; display: inline-block;
}
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.big { width: 100%; padding: 14px 16px; font-size: 17px; }
button.danger { color: var(--err); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 500; text-decoration: underline; }

/* 状態 */
.msg { padding: 12px 14px; border-radius: 8px; font-size: 14.5px; }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.msg.warn { background: var(--warn-soft); color: var(--warn); }
.msg.err { background: var(--err-soft); color: var(--err); }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 9px; border-radius: 999px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.acc { background: var(--accent-soft); color: var(--accent); }

/* 受付票 */
.ticket { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 18px; border: 2px dashed var(--line); border-radius: 14px; }
.ticket .qrbox { background: #FFFFFF; padding: 10px; border-radius: 10px; }
img.qr { display: block; image-rendering: pixelated; max-width: 100%; height: auto; }
.ticket img.qr { width: min(260px, 70vw); }
.ticket .who { font-size: 20px; font-weight: 700; }
.ticket .no { font-family: var(--num); font-size: 13px; color: var(--muted); }

/* 一覧 */
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
td button { white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tlist { display: grid; gap: 8px; }
.tlist button { text-align: left; display: flex; justify-content: space-between; gap: 10px; align-items: center; font-weight: 500; }
.tlist button.on { border-color: var(--accent); background: var(--accent-soft); }
.counts { display: flex; gap: 18px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.counts b { font-size: 24px; display: block; line-height: 1.1; }

/* 受付（カメラ） */
.scan { display: grid; gap: 10px; }
.scan video { width: 100%; max-height: 60vh; background: #000; border-radius: 10px; object-fit: cover; }
.result { padding: 16px; border-radius: 10px; font-size: 18px; font-weight: 700; text-align: center; }
.result.ok { background: var(--ok-soft); color: var(--ok); }
.result.warn { background: var(--warn-soft); color: var(--warn); }
.result.err { background: var(--err-soft); color: var(--err); }
.result .sub { display: block; font-size: 14px; font-weight: 500; margin-top: 4px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; z-index: 20;
  background: var(--ink); color: var(--bg);
}
.toast.err { background: var(--err); color: #FFFFFF; }
@media (prefers-reduced-motion: no-preference) { .result { animation: pop .18s ease-out; } }
@keyframes pop { from { transform: scale(.97); opacity: .6; } to { transform: none; opacity: 1; } }
