/* もりあげリレー（仮）の共通の見た目。
   使う場所は暗い配信卓（照明を落とした部屋で、OBS とゲームの横に並べる）。
   だから地は暗く、色は「状態」と「押すもの」にだけ使う。状態は色＋文字＋形の3つで伝える
   （つながった＝塗りの丸／遅れ・待ち＝三角／落ちた＝四角に×／まだ＝中空きの丸）。 */

:root {
  color-scheme: dark;
  --bg: #0e1012;
  --panel: #15181b;
  --panel-2: #1b1f23;
  --well: #0b0d0f;
  --line: #262b30;
  --line-2: #343a41;
  --text: #e7eaed;
  --sub: #a7b0b8;
  --faint: #828b93;
  --accent: #7cb9e6;
  --accent-ink: #08151f;
  --accent-soft: rgb(124 185 230 / .14);
  --ok: #63d19b;
  --warn: #f0c46c;
  --bad: #ff8f87;
  --ok-soft: rgb(99 209 155 / .12);
  --warn-soft: rgb(240 196 108 / .12);
  --bad-soft: rgb(255 143 135 / .12);
  --r-ctl: 6px;
  --r-panel: 10px;
  --ease-out: cubic-bezier(.22, .9, .25, 1);
  --font: "Segoe UI", "Yu Gothic UI", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--text);
  font: 400 14px/1.6 var(--font);
  font-feature-settings: "palt" 1;
}
::selection { background: rgb(124 185 230 / .35); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 18px; font-weight: 700; letter-spacing: .01em; }
h2 { font-size: 15px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.sub { color: var(--sub); }
.faint { color: var(--faint); font-size: 13px; }
* { scrollbar-color: var(--line-2) transparent; }

/* ---------- 枠組み ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 24px; min-height: 56px;
  background: rgb(14 16 18 / .94);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; white-space: nowrap; }
.brand svg { width: 22px; height: 22px; }
.brand small { font-weight: 500; color: var(--faint); font-size: 12px; }
.top .grow { flex: 1; min-width: 0; }
.top-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--sub); }
.top-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.wrap { width: min(1240px, 100%); margin: 0 auto; padding: 24px; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-panel);
  padding: 20px;
}
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

/* ---------- 欄 ---------- */
.field { display: grid; gap: 6px; }
.field > label, .field > .label { font-size: 13px; font-weight: 600; color: var(--sub); }
.field .hint { font-size: 12.5px; color: var(--faint); }
.inline-fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

input[type=text], input[type=password], input[type=number], input[type=url], select {
  width: 100%; height: 36px; padding: 0 10px;
  background: var(--well); color: var(--text);
  border: 1px solid var(--line-2); border-radius: var(--r-ctl);
  font: inherit; font-size: 14px;
  transition: border-color 120ms var(--ease-out), box-shadow 120ms var(--ease-out);
}
input::placeholder { color: var(--faint); }
input:hover, select:hover { border-color: #46505a; }
input:focus-visible, select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[aria-invalid=true], select[aria-invalid=true] { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
input:disabled, select:disabled { opacity: .55; cursor: not-allowed; }
select { appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%23a7b0b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 12px; }
input.readonly { color: var(--sub); font-size: 13px; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--r-ctl);
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer;
  transition: background-color 120ms var(--ease-out), border-color 120ms var(--ease-out), transform 120ms var(--ease-out);
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { background: #22272c; border-color: #46505a; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.pri:hover { background: #95c8ee; border-color: #95c8ee; }
.btn.dgr { color: var(--bad); border-color: #4a3331; }
.btn.dgr:hover { background: var(--bad-soft); }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--sub); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .btn:active { transform: none; } }

/* 選ぶボタンの並び（送るもの）。今選んでいるものは枠と地の色・印で示す */
.choices { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice {
  display: grid; justify-items: start; gap: 4px; text-align: left;
  padding: 12px; min-height: 76px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  font: inherit; cursor: pointer;
  transition: border-color 120ms var(--ease-out), background-color 120ms var(--ease-out);
}
.choice svg { width: 22px; height: 22px; color: var(--sub); }
.choice b { font-size: 14px; }
.choice span { font-size: 12.5px; color: var(--faint); line-height: 1.4; }
.choice:hover { border-color: #46505a; }
.choice[aria-pressed=true] { border-color: var(--accent); background: var(--accent-soft); }
.choice[aria-pressed=true] svg { color: var(--accent); }
.choice:disabled { opacity: .45; cursor: not-allowed; }

/* スイッチ（音を送る／送らない） */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
  flex: none; position: relative; width: 38px; height: 22px; border-radius: 11px;
  background: var(--line-2); transition: background-color 140ms var(--ease-out);
}
.switch .track::after {
  content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #cfd5da; transition: transform 160ms var(--ease-out);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .45; }
.switch .text { display: grid; gap: 2px; }
.switch .text small { color: var(--faint); font-size: 12.5px; }
@media (prefers-reduced-motion: reduce) { .switch .track, .switch .track::after { transition: none; } }

/* ---------- 状態の札 ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px 0 7px; border-radius: 12px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  color: var(--sub); background: var(--panel-2); border: 1px solid var(--line-2);
}
.chip svg { width: 12px; height: 12px; flex: none; }
.chip[data-tone=ok] { color: var(--ok); background: var(--ok-soft); border-color: rgb(99 209 155 / .3); }
.chip[data-tone=warn] { color: var(--warn); background: var(--warn-soft); border-color: rgb(240 196 108 / .3); }
.chip[data-tone=bad] { color: var(--bad); background: var(--bad-soft); border-color: rgb(255 143 135 / .3); }

/* ---------- 知らせ（できないこと・直し方） ---------- */
.notice {
  display: grid; grid-template-columns: 20px 1fr; gap: 4px 10px;
  padding: 12px 14px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--line-2);
}
.notice svg { width: 20px; height: 20px; margin-top: 1px; }
.notice b { font-weight: 700; }
.notice p { grid-column: 2; color: var(--sub); font-size: 13.5px; }
.notice .row { grid-column: 2; margin-top: 6px; }
.notice[data-tone=bad] { border-color: #4a3331; background: #1d1716; }
.notice[data-tone=bad] svg { color: var(--bad); }
.notice[data-tone=warn] { border-color: #4a4130; background: #1c1a15; }
.notice[data-tone=warn] svg { color: var(--warn); }
.notice[data-tone=ok] svg { color: var(--ok); }
@media (prefers-reduced-motion: no-preference) {
  .notice.enter { animation: notice-in 200ms var(--ease-out); }
  @keyframes notice-in { from { opacity: 0; transform: translateY(-4px); } }
}

/* 線の絵（アイコン）は全部この太さ */
.ico { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* 表（受けている画面・司令室の一覧） */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; color: var(--faint); font-size: 12.5px; padding: 0 10px 8px; white-space: nowrap; }
.table td { padding: 10px; border-top: 1px solid var(--line); vertical-align: middle; font-variant-numeric: tabular-nums; }
.table td.name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 18px 4px 6px; color: var(--faint); font-size: 13.5px; }

.copyline { display: flex; gap: 8px; }
.copyline input { flex: 1; min-width: 0; }

@media (max-width: 640px) {
  .top { padding: 8px 16px; gap: 10px; }
  .top-meta .faint { display: none; }
  .wrap { padding: 16px; }
  .panel { padding: 16px; }
  .choices { grid-template-columns: 1fr; }
  .choice { min-height: 0; grid-template-columns: 22px 1fr; align-items: center; column-gap: 10px; }
  .choice span { grid-column: 2; }
  .choice svg { grid-row: span 2; }
  .table.stackable thead { display: none; }
  .table.stackable tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
  .table.stackable td { border: 0; padding: 2px 0; }
  .table.stackable td[data-k]::before { content: attr(data-k) "　"; color: var(--faint); font-size: 12px; }
  .btn.lg { width: 100%; }
}
