/* 団員先行予約 共通スタイル（スマホ優先） */
:root {
  color-scheme: light; /* スマホがダークモードでも、ボタンや入力欄を明るい色のままにする */
  --ink: #1d2433; --muted: #5d6576; --line: #d9dce3; --bg: #f5f4f0; --surface: #fff;
  --accent: #1f3a68; --accent-ink: #fff; --danger: #b3261e; --danger-bg: #fdecea; --ok-bg: #edf6ee;
  --ss: #c62828; --s: #e07b00; --a: #2e7d32; --b: #1e5bbf; --taken: #c9ccd2; --on: #1f3a68;
  --r: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.7 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif; }
a { color: var(--accent); }
h1 { font-size: 22px; line-height: 1.4; margin: 0 0 12px; }
h2 { font-size: 18px; margin: 24px 0 8px; }

.site-head { background: var(--accent); color: var(--accent-ink); padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
.site-title { font-weight: 700; font-size: 17px; line-height: 1.4; max-width: 960px; margin: 0 auto; }
.admin .site-title { max-width: 1200px; }
.site-title small { display: block; font-weight: 400; font-size: 12px; opacity: .85; }
.page { max-width: 960px; margin: 0 auto; padding: 16px 12px 40px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 16px; }
.card.center { text-align: center; }
.lead { font-size: 18px; }
.muted { color: var(--muted); font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.notice { background: #eef2f9; border-radius: var(--r); padding: 12px 14px; margin: 0 0 16px; font-size: 15px; }
.notice.is-error { background: var(--danger-bg); color: var(--danger); font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; text-align: left; }
.field input, .field select, .field textarea { color: var(--ink); font: inherit; font-weight: 400; min-height: 48px; padding: 8px 12px; border: 1px solid #b9bec9; border-radius: 8px; background: #fff; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 18px; border-radius: 8px; border: 1px solid #b9bec9; background: #fff; color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.wide { width: 100%; }
.btn.big { min-height: 56px; font-size: 18px; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: default; }

/* 本人選択 */
.attr-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.tab { min-width: 72px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #b9bec9; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 700; background: #fff; }
.tab.is-on { background: var(--accent); color: #fff; border-color: var(--accent); }
.names fieldset { border: 0; padding: 0; margin: 0 0 16px; }
.names legend { font-size: 13px; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.name-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.name-btn { min-height: 48px; border: 1px solid #b9bec9; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; -webkit-appearance: none; appearance: none; }
.name-btn:hover { border-color: var(--accent); }

/* 座席表 */
body.is-seats .page { padding-bottom: 180px; }
.who { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; align-items: baseline; margin-bottom: 10px; font-size: 15px; }
.who .quota { margin-left: 8px; color: var(--muted); font-size: 14px; }
.who-links { display: flex; gap: 14px; font-size: 14px; }
.map-tools { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin: 4px 0 8px; }
.map-tools .btn { white-space: nowrap; flex: none; }
.areas { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin: 0 -12px; padding-left: 12px; padding-right: 12px; -webkit-overflow-scrolling: touch; }
.chip { color: var(--ink); -webkit-appearance: none; appearance: none; flex: none; min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid #b9bec9; background: #fff; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.chip.is-on { background: var(--accent); color: #fff; border-color: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.dot { width: 12px; height: 12px; border-radius: 50%; border: 2.5px solid; background: #fff; display: inline-block; }
.dot.c-SS { border-color: var(--ss); } .dot.c-S { border-color: var(--s); } .dot.c-A { border-color: var(--a); } .dot.c-B { border-color: var(--b); }
.dot.on { background: var(--on); border-color: var(--on); }
.dot.taken { background: var(--taken); border-color: var(--taken); }
.map { position: relative; height: min(72vh, 760px); background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.map svg { width: 100%; height: 100%; display: block; }
.loading { padding: 40px 16px; text-align: center; color: var(--muted); }
.map-hint { margin: 6px 2px 0; }
.stage { fill: #eceae4; stroke: #cfccc4; stroke-width: .6; }
.stage-label { font: 700 7px sans-serif; fill: #8e8a80; text-anchor: middle; dominant-baseline: central; }
.block-label { font: 700 9px sans-serif; fill: rgba(31, 58, 104, .13); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.seat { fill: #fff; stroke-width: .9; cursor: pointer; }
.seat.c-SS { stroke: var(--ss); } .seat.c-S { stroke: var(--s); } .seat.c-A { stroke: var(--a); } .seat.c-B { stroke: var(--b); }
.seat.on { fill: var(--on); stroke-width: 1.3; }
.seat.taken { fill: var(--taken); stroke: var(--taken); cursor: default; }
.snum { font: 700 2.3px sans-serif; fill: var(--ink); text-anchor: middle; dominant-baseline: central; pointer-events: none; display: none; }
.snum.on { fill: #fff; } .snum.taken { fill: #8a8f99; }
.row-label { font: 700 2.8px sans-serif; fill: var(--muted); text-anchor: middle; dominant-baseline: central; pointer-events: none; display: none; }
svg.show-nums .snum { display: inline; }
svg.show-rows .row-label { display: inline; }

.bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; gap: 12px; align-items: center; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0, 0, 0, .06); }
.bar-info { flex: 1; min-width: 0; font-size: 15px; }
.bar-quota { display: block; font-size: 13px; color: var(--muted); }
.bar-list { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-error { font-size: 13px; color: var(--danger); font-weight: 700; }
.bottom-bar.has-error { border-top: 3px solid var(--danger); }
.bottom-bar .btn { flex: none; }
.toast { position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: rgba(29, 36, 51, .94); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: calc(100% - 32px); z-index: 20; }
.toast.show { opacity: 1; }

/* 確認・完了 */
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0 0 12px; }
.facts dt { color: var(--muted); font-size: 14px; }
.facts dd { margin: 0; font-weight: 700; }
.seat-list { list-style: none; margin: 0 0 16px; padding: 0; border-top: 1px solid var(--line); }
.seat-list li { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); font-weight: 600; }
.seat-list li em { margin-left: auto; color: var(--danger); font-style: normal; font-size: 13px; }
.seat-list li.is-taken { color: var(--muted); text-decoration: line-through; }
.seat-list.big li { font-size: 19px; padding: 12px 2px; }
.cls { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 24px; padding: 0 6px; border-radius: 6px; color: #fff; font-size: 13px; font-weight: 700; }
.cls-SS { background: var(--ss); } .cls-S { background: var(--s); } .cls-A { background: var(--a); } .cls-B { background: var(--b); }
.done { text-align: center; }
.done .seat-list { text-align: left; }
.done-mark { display: inline-block; background: var(--ok-bg); color: #1f6b2a; font-weight: 700; padding: 6px 16px; border-radius: 20px; margin: 0 0 12px; }
.res-no { font-size: 40px; font-weight: 800; letter-spacing: .06em; margin: 0; line-height: 1.2; font-variant-numeric: tabular-nums; }
.res-no small { display: block; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.done-name { font-size: 18px; font-weight: 700; margin: 12px 0; }
.inline-form { flex-direction: row; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { flex: 1; min-width: 200px; }

@media (min-width: 720px) {
  .page { padding: 24px 20px 48px; }
  .card { padding: 28px 28px; }
  .bottom-bar { padding-left: max(16px, calc((100% - 960px) / 2 + 16px)); padding-right: max(16px, calc((100% - 960px) / 2 + 16px)); }
}

/* デモの帯 */
.demo-bar { background: #fff3c4; color: #5c4400; font-size: 13px; font-weight: 700; text-align: center; padding: 6px 12px; border-bottom: 1px solid #e6cf73; }
