/* Layout: 路線図のような地図を主役に、右(スマホでは下)に問題パネル */
:root {
  --bg: #EBEFF3;
  --surface: #FFFFFF;
  --ink: #16202C;
  --muted: #586678;
  --line: #CBD3DC;
  --line-strong: #8A97A6;
  --accent: #FFC20E;      /* 駅の案内サインの黄色 */
  --accent-ink: #16202C;
  --good: #0E8A45;
  --bad: #CC3333;
  --water: #D6ECFA;       /* 湖・湾・海(薄い水色) */
  --river: #9FCDEE;       /* 川の線(水より少し濃い水色。2026-10-22) */
  --land: #F7F9FA;        /* 陸地(これまでの地図の背景と同じ色) */
  --title-red: #C0392B; --title-purple: #7B4FBF; --title-green: #2E8B57; --title-orange: #D9730D; --title-teal: #138D90; --title-blue: #1F78B4; --title-gold: #A87A12; /* 称号のバッジの輪の色(public/title-badge.js) */
  --font-display: "Dela Gothic One", "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-body: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E141B; --surface: #17202A; --ink: #E7ECF1; --muted: #93A1B0;
    --line: #2B3846; --line-strong: #5B6C7E; --accent: #FFC20E; --accent-ink: #16202C;
    --good: #3CC27A; --bad: #FF6B6B; --water: #17324A; --land: #131B24; --river: #2C5878;
    --title-red: #FF7B6E; --title-purple: #B79BFF; --title-green: #4CD38A; --title-orange: #FFA45C; --title-teal: #4FD1D4; --title-blue: #6CB6F0; --title-gold: #F0C04A; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E141B; --surface: #17202A; --ink: #E7ECF1; --muted: #93A1B0;
  --line: #2B3846; --line-strong: #5B6C7E; --accent: #FFC20E; --accent-ink: #16202C;
  --good: #3CC27A; --bad: #FF6B6B; --water: #17324A; --land: #131B24; --river: #2C5878;
    --title-red: #FF7B6E; --title-purple: #B79BFF; --title-green: #4CD38A; --title-orange: #FFA45C; --title-teal: #4FD1D4; --title-blue: #6CB6F0; --title-gold: #F0C04A; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
/* 画面の高さに収める(2026-10-19 ユーザー指摘: ページの縦スクロールを出さない)。地図は残りの高さいっぱい、右の欄は欄の中だけスクロール。
   ゲームの画面(body.app)だけ。形の一覧(shapes.html)など同じ style.css を使うほかのページはふつうにスクロールする */
body.app { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 var(--font-body);
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
}
[hidden] { display: none !important; }
.mono { font-family: var(--font-mono); }

.top {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px;
  padding: 8px 16px;
  width: 100%; max-width: 1280px; margin: 0 auto; flex: 0 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font: 22px/1 var(--font-display); margin: 0; letter-spacing: 0.02em; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 50%;
  border: 5px solid var(--ink); background: var(--accent);
}
.brand-en { font: 600 12px var(--font-mono); color: var(--muted); letter-spacing: 0.08em; }
.sheet-en { font: 600 13px var(--font-mono); color: var(--muted); letter-spacing: 0.1em; margin: -4px 0 10px; }
.status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chip { font-size: 13px; color: var(--muted); }
/* 地図の切り替え(2026-10-27): 個人戦 / チーム戦。上の帯のプルダウン */
.map-select { border: 2px solid var(--ink); border-radius: 8px; background: var(--accent); color: var(--accent-ink); font: 700 13px/1.2 "BIZ UDPGothic", sans-serif; padding: 4px 6px; cursor: pointer; }
.chip b { font-family: var(--font-mono); color: var(--ink); letter-spacing: 0.08em; }
.timer {
  font: 600 20px/1 var(--font-mono); font-variant-numeric: tabular-nums;
  background: var(--ink); color: var(--bg); padding: 6px 10px; border-radius: 6px;
}
.timer.low { background: var(--bad); color: #fff; }
.conn { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.conn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.conn[data-state="on"]::before { background: var(--good); }

.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: minmax(0, 1fr); gap: 16px;
  width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 16px 12px; flex: 1 1 auto; min-height: 0;
}
/* 幅の狭い画面: 地図が上 6 割、欄が下 4 割(それぞれの中で完結) */
@media (max-width: 880px) { .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 58fr) minmax(0, 42fr); gap: 10px; padding: 0 10px 10px; } }

.board {
  background: var(--surface); border-radius: 12px; padding: 10px;
  min-width: 0; min-height: 0; position: relative; display: flex; flex-direction: column;
}
.board-foot { display: flex; align-items: center; gap: 10px; margin-top: 6px; flex: 0 0 auto; min-width: 0; }
.credit-short { margin: 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.map-wrap { position: relative; overflow: hidden; border-radius: 8px; background: color-mix(in srgb, var(--bg) 40%, var(--surface)); flex: 1 1 auto; min-height: 0; }
/* 重なり順(2026-10-22 案 A): 背景の地図(MapLibre)0 → 拠点を描く canvas 1(押せない。操作は下の地図が受ける)→ ボタン・切り替え・説明 2 → 選ぶときの帯 3 */
.map-base { position: absolute; inset: 0; z-index: 0; background: var(--water); }
#map { display: block; position: absolute; left: 0; top: 0; z-index: 1; pointer-events: none; user-select: none; -webkit-user-select: none; }
.zoom { position: absolute; top: 10px; right: 10px; z-index: 2; display: flex; flex-direction: column; gap: 6px; }
.zbtn {
  width: 36px; height: 36px; border-radius: 8px; border: 2px solid var(--ink);
  background: var(--surface); color: var(--ink); font: 700 18px/1 var(--font-mono); cursor: pointer;
}
.zbtn:hover { background: var(--bg); }
/* 持ち主の色を出す範囲: 小さなプルダウン(2026-10-27) */
.own-view { position: absolute; top: 10px; left: 10px; z-index: 2; border: 2px solid var(--ink); border-radius: 8px; background: var(--surface); color: var(--ink); font: 700 12px/1.2 "BIZ UDPGothic", sans-serif; padding: 5px 6px; cursor: pointer; }
.map-hint { position: absolute; left: 10px; bottom: 6px; z-index: 2; margin: 0; font-size: 12px; color: var(--muted); pointer-events: none; }
.credit { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.legend {
  list-style: none; margin: 8px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted);
}
.legend li { display: inline-flex; align-items: center; gap: 4px; }
.legend canvas { display: block; }
.lg { display: inline-block; border: 3px solid var(--line-strong); background: var(--surface); border-radius: 50%; }
.lg.own-me, .lg.own-team, .lg.own-other { width: 13px; height: 13px; }
.lg.own-me { background: radial-gradient(circle, var(--surface) 0 2px, var(--ink) 2.5px); border-color: var(--ink); }
.lg.own-team { background: var(--muted); border-color: var(--ink); }
.lg.own-other { background: var(--muted); border-color: var(--muted); }
.lg.home { width: 9px; height: 9px; border-width: 2px; }
.lg.shield { width: 14px; height: 14px; border: 1.5px dashed var(--muted); }
.lg.water { width: 16px; height: 12px; border-radius: 3px; border: 1px solid var(--line); background: var(--water); }
.ln { display: inline-block; width: 24px; height: 0; border-top: 3px dashed; }
.ln.air { border-color: #8B5CF6; }
.ln.sea { border-color: #F97316; }
.ln.sel { border-top-style: solid; border-color: var(--ink); }
/* 路線は鉄道の地図記号のように縁取りの中を白と黒の交互(新幹線は青緑と白)。色は app.js の RAIL と同じ */
.ln.rail { height: 3px; border: 1.5px solid #2B2B2B; background: repeating-linear-gradient(90deg, #2B2B2B 0 6px, #FFFFFF 6px 12px); }
.ln.rail.shinkansen { border-color: #00897B; background: repeating-linear-gradient(90deg, #00897B 0 6px, #FFFFFF 6px 12px); }

.side { display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; overflow: hidden; }
.side-main { display: flex; flex-direction: column; gap: 12px; flex: 1 1 auto; min-height: 0; overflow: hidden; }
/* 右の欄そのものはスクロールさせない(2026-10-22 ユーザー指摘: スクロールの中に通信ログのスクロールがあった)。拠点の情報と通信ログがそれぞれの中でスクロールする */
.side-main > .panel { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.side-main > .log-panel { flex: 1 1 0; min-height: 110px; display: flex; flex-direction: column; overflow: hidden; }
.log-panel .log { flex: 1 1 auto; min-height: 0; max-height: none; }
/* チャット(2026-10-21): 右の欄の下(スマホは地図の下の欄の下)にいつも出す */
.chat { flex: 0 0 42%; min-height: 200px; display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-head .label { margin: 0; }
.chat-tabs { display: flex; border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; }
.chat-tabs button { border: 0; border-left: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 700 12px/1 "BIZ UDPGothic", sans-serif; padding: 6px 10px; cursor: pointer; position: relative; }
.chat-tabs button:first-child { border-left: 0; }
.chat-tabs button[aria-selected="true"] { background: var(--ink); color: var(--surface); }
.chat-unread { display: inline-block; min-width: 8px; height: 8px; margin-left: 4px; border-radius: 50%; background: var(--bad); vertical-align: middle; }
.chat-unread[hidden] { display: none; }
.chat-dm { display: flex; gap: 6px; align-items: center; }
.chat-dm[hidden] { display: none; }
.chat-dm select { flex: 1 1 auto; min-width: 0; font-size: 13px; padding: 4px; border: 2px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); }
.chat-list { list-style: none; margin: 0; padding: 4px 6px; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.chat-list li { padding: 3px 0; overflow-wrap: anywhere; }
.chat-list .who { font-weight: 700; margin-right: 6px; }
.chat-list .who.me { color: var(--accent-ink, var(--ink)); }
.chat-list time { color: var(--muted); font-size: 12px; margin-right: 6px; }
.chat-list .report { border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 0 4px; }
.chat-note { margin: 0; font-size: 12px; color: var(--muted); }
.chat-note[hidden] { display: none; }
.chat-form { display: flex; gap: 6px; }
.chat-form input { flex: 1 1 auto; min-width: 0; font-size: 14px; padding: 6px 8px; border: 2px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); }
@media (max-width: 880px) { .chat { flex-basis: 55%; min-height: 160px; } }
.scores li.can-dm .pname { cursor: pointer; text-decoration: underline dotted; }
/* 凡例のダイアログ */
.dlg { overflow-y: auto; overscroll-behavior: contain; border: 0; border-radius: 16px; padding: 20px 22px; width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); background: var(--surface); color: var(--ink); box-shadow: 0 20px 50px rgba(10, 20, 30, 0.25); }
.dlg::backdrop { background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(2px); }
.dlg-title { font: 22px/1.2 var(--font-display); margin: 0 0 10px; }
.dlg h3 { margin: 14px 0 6px; }
.dlg .legend { margin: 0; }
.dlg .credit { font-size: 12px; }
.dlg-actions { display: flex; justify-content: flex-end; margin: 16px 0 0; }
.panel { background: var(--surface); border-radius: 12px; padding: 14px 16px; }
.label {
  margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; color: var(--muted);
}

.scores { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.scores li {
  display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  font-variant-numeric: tabular-nums;
}
.swatch { width: 14px; height: 14px; border-radius: 50%; }
.pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pname small { color: var(--muted); margin-left: 6px; }
.pscore { font: 600 15px var(--font-mono); }
.scores li.offline { opacity: 0.45; }

.qpanel { position: relative; padding-bottom: 20px; }
.idle p:last-child { margin: 0; color: var(--muted); }
.idle strong { color: var(--ink); }
.qhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mode { font-weight: 700; font-size: 13px; }
.mode .tag {
  display: inline-block; padding: 2px 8px; border-radius: 4px; margin-right: 6px;
  background: var(--accent); color: var(--accent-ink); font-size: 12px;
}
.mode .tag.def { background: var(--ink); color: var(--bg); }
.diff { font-size: 12px; color: var(--muted); letter-spacing: 0.1em; }
.qtext { font-size: 17px; font-weight: 700; margin: 10px 0 12px; word-break: auto-phrase; text-wrap: pretty; }
.qtext .ip { font-family: var(--font-mono); font-weight: 600; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.np-routes li { cursor: pointer; text-decoration: underline dotted; }
.np-routes li:hover { color: var(--accent); }
.fields { display: grid; gap: 8px; margin: 6px 0 10px; }
.field { display: grid; gap: 4px; }
.field label { font-size: 13px; font-weight: 700; }
.field input, .field textarea { font: 16px var(--font-mono); padding: 8px 10px; border-radius: 8px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); }
.field input:disabled, .field textarea:disabled { opacity: 0.7; }
.field.ok input, .field.ok textarea { border-color: var(--good); }
.field.ng input, .field.ng textarea { border-color: var(--bad); }
.fields-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.fields-foot .hint { margin: 0; }
.answers { font-family: var(--font-mono); font-size: 14px; margin: 6px 0 0; }
.defense { font-size: 13px; color: var(--muted); margin: 6px 0 0; padding-left: 10px; border-left: 3px solid var(--line); }
.qtable + .qtable { margin-top: 8px; }
.qtable caption { text-align: left; font-size: 12px; color: var(--muted); padding: 2px 0; }
.opt {
  font: 600 15px var(--font-mono); text-align: left;
  padding: 10px 12px; border-radius: 8px; border: 2px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; min-width: 0; overflow-wrap: anywhere;
}
.opt:hover:not(:disabled) { border-color: var(--ink); }
.opt:focus-visible, .btn:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.opt .k { color: var(--muted); font-size: 12px; margin-right: 6px; }
.opt.correct { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, var(--surface)); }
.opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--surface)); }
.opt:disabled { cursor: default; }
.result { margin-top: 12px; }
.verdict { font: 18px var(--font-display); margin: 0 0 4px; }
.verdict.ok { color: var(--good); }
.verdict.ng { color: var(--bad); }
.explain { margin: 0 0 6px; font-size: 14px; }
.outcome { margin: 0; font-size: 13px; color: var(--muted); }
.cool { position: absolute; left: 16px; right: 16px; bottom: 10px; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.cool-bar { height: 100%; background: var(--bad); width: 100%; transform-origin: left; }

.log { list-style: none; margin: 0; padding: 0; font-size: 13px; display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; overscroll-behavior: contain; }
.log .at { color: var(--muted); font-family: var(--font-mono); font-size: 12px; margin-right: 6px; }
.log li { color: var(--muted); }
.log li:last-child { color: var(--ink); }

/* ロビー */
.overlay {
  position: fixed; inset: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 16px; overflow-y: auto;
}
.sheet {
  background: var(--surface); border-radius: 16px; padding: 24px; width: min(460px, 100%);
  box-shadow: 0 20px 50px rgba(10, 20, 30, 0.18);
}
.sheet-title { font: 28px/1.2 var(--font-display); margin: 0 0 8px; }
.lead { margin: 0 0 18px; color: var(--muted); }
.join { display: grid; gap: 6px; }
.join label { font-size: 13px; font-weight: 700; }
.join input, .join select {
  font: 16px var(--font-body); padding: 10px 12px; border-radius: 8px;
  border: 2px solid var(--line); background: var(--bg); color: var(--ink); margin-bottom: 8px;
}
.join .row2 { display: flex; gap: 8px; align-items: stretch; }
.join .row2 input { flex: 1; min-width: 0; margin-bottom: 0; }
.join .row2 .btn { white-space: nowrap; padding: 8px 12px; font-size: 14px; }
.start-results { list-style: none; margin: 6px 0 4px; padding: 0; border: 2px solid var(--line); border-radius: 8px; max-height: 190px; overflow: auto; background: var(--surface); }
.start-results li { padding: 8px 12px; cursor: pointer; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); }
.start-results li:last-child { border-bottom: 0; }
.start-results li:hover, .start-results li:focus { background: var(--bg); outline: none; }
.start-results small { color: var(--muted); white-space: nowrap; }
/* 開始地点にできない結果(Lv1 でない駅・名所)。理由と近くの候補のボタンを出す */
.start-results li.disabled { cursor: default; flex-wrap: wrap; color: var(--muted); }
.start-results li.disabled:hover { background: none; }
.start-results li.disabled small { white-space: normal; flex-basis: 100%; }
.start-results button.near { font: inherit; font-size: 13px; padding: 4px 10px; border: 2px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink); cursor: pointer; }
.start-results button.near:hover { border-color: var(--ink); }
.rank-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rank-head select { font: 13px var(--font-body); padding: 4px 8px; border-radius: 6px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); max-width: 60%; }
.team-row { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.team-row input { flex: 1; min-width: 0; font: 14px var(--font-body); padding: 6px 10px; border-radius: 6px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); }
.team-row input[type="number"] { flex: 0 0 64px; }
.team-colors { flex-wrap: wrap; font-size: 12px; }
.team-colors label { display: inline-flex; align-items: center; gap: 4px; }
.team-colors input[type="color"] { flex: none; width: 34px; height: 26px; padding: 0; border: 2px solid var(--line); border-radius: 6px; background: var(--bg); }
.team-colors select { font: 16px var(--font-body); padding: 2px 6px; border-radius: 6px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); }
.pick-bar { position: absolute; top: 10px; left: 10px; right: 64px; z-index: 3; display: flex; gap: 10px; align-items: center; justify-content: space-between; background: var(--surface); border: 2px solid var(--ink); border-radius: 8px; padding: 8px 12px; font-size: 14px; font-weight: 700; }
.btn {
  font: 700 15px var(--font-body); padding: 10px 16px; border-radius: 8px; cursor: pointer;
  border: 2px solid var(--ink); background: var(--surface); color: var(--ink);
}
.btn.primary { background: var(--ink); color: var(--bg); }
.btn:disabled { opacity: 0.4; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.invite { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; margin: 4px 0 0; user-select: all; }
.error { color: var(--bad); font-size: 14px; margin: 10px 0 0; min-height: 1em; }
.roster, .final { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.roster li, .final li { display: flex; align-items: center; gap: 10px; }
.final li { font-size: 17px; font-variant-numeric: tabular-nums; }
.final .rank { font: 600 14px var(--font-mono); color: var(--muted); width: 1.6em; }
.final .pts { margin-left: auto; font: 600 16px var(--font-mono); }
.final li:first-child { font-weight: 700; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: 14px;
  z-index: 20; max-width: calc(100% - 32px);
}

/* 動き(2026-11-04 ユーザー依頼: アニメーション)。トーストは下から出る、称号は金色で弾む、正解は弾む、不正解は揺れる(下の 1 行で、動きを減らす設定の端末では止まる) */
.toast.fx-in { animation: toast-in 0.25s ease-out; }
.toast.toast-title { animation: toast-pop 0.6s cubic-bezier(.2, 1.6, .4, 1); font-weight: 700; background: #A87A12; color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toast-pop { 0% { opacity: 0; transform: translate(-50%, 16px) scale(0.6); } 60% { opacity: 1; transform: translate(-50%, 0) scale(1.08); } 100% { transform: translate(-50%, 0) scale(1); } }
.result .verdict { display: inline-block; }
.result.fx-ok .verdict { animation: verdict-ok 0.6s ease-out; }
.result.fx-ng .verdict { animation: verdict-ng 0.4s ease-in-out; }
@keyframes verdict-ok { 0% { transform: scale(0.6); opacity: 0; } 50% { transform: scale(1.25); opacity: 1; } 100% { transform: scale(1); } }
@keyframes verdict-ng { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
.setting [data-action=toTop] { margin: 4px 0; width: auto; align-self: flex-start; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* あなた(自分の情報と復帰コード) */
/* 上の帯の「あなた」(2026-10-19) */
.me-bar { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; justify-content: flex-end; }
.me-bar[hidden] { display: none !important; }
.me-bar .swatch { flex: 0 0 auto; }
.me-bar .pname { font-weight: 700; max-width: 12em; }
.me-bar .me-stats { margin: 0; white-space: nowrap; }
@media (max-width: 880px) { .me-bar { order: 3; flex-basis: 100%; justify-content: flex-start; } .me-bar .me-stats { display: none; } }
#meDialog .code-row { margin: 8px 0; }
#teamDialog .team-row, #teamDialog .code-row { margin: 8px 0; }
/* 問題のダイアログ: 大きさは中身で決める */
.qdlg[data-size="normal"] { width: min(640px, calc(100vw - 32px)); }
.qdlg[data-size="wide"] { width: min(960px, calc(100vw - 32px)); }
.qdlg[data-size="full"] { width: calc(100vw - 32px); height: calc(100dvh - 32px); max-width: none; }
.qdlg .qtable-wrap { overflow-x: auto; }
.qactions { gap: 8px; }
/* お手付き(不正解のあとの待ち時間)を問題ダイアログにも出す(2026-10-20)。終わるまで「続けて解く」は押せない */
.qcool { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; }
.qcool[hidden] { display: none; }
.qcool-text { flex: 0 0 auto; font-size: 13px; font-weight: 700; color: var(--bad); }
.qcool-track { flex: 1 1 auto; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.qdlg .unsupported { color: var(--bad); font-weight: 700; }
/* 説明カード(入門)とヒント(初級・中級)。2026-10-22 */
.qcard { margin: 10px 0 0; padding: 8px 12px; border-radius: 8px; border: 2px solid var(--line); border-left: 6px solid var(--accent); background: var(--bg); }
.qcard[hidden] { display: none; }
.qcard summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--muted); }
.qcard p { margin: 6px 0 2px; font-size: 15px; line-height: 1.7; white-space: pre-line; }
.qhint { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.qhint[hidden], .qhint [hidden] { display: none; }
.qhint .hint { margin: 0; }
.qhint-text { flex: 1 1 100%; padding: 8px 12px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--line)); }
.qhint-text p { margin: 0; font-size: 14px; white-space: pre-line; }
.qhint-text p + p { margin-top: 4px; }
/* 選ぶ問題の並べ方: ○× は大きな 2 つのボタン(スマホでも横に 2 つ)。2 択は横に 2 つ、3 択・4 択は縦に */
.options.n2 { grid-template-columns: 1fr 1fr; }
.options.tf .opt { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 96px; text-align: center; }
.options.tf .opt .v { font: 700 44px/1 var(--font-body); }
.options.tf .opt .k { margin: 0; }
.opt.picked { border-color: var(--ink); }
/* 入力の部品(スマホ向け): IPv4 は 4 つの欄、2 進数は 0/1 の切り替えボタン */
.field .flabel { font-size: 13px; font-weight: 700; }
.field .fhint { font-size: 12px; color: var(--muted); }
.ip4 { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
.ip4 .sep { font: 700 18px var(--font-mono); color: var(--muted); }
.field .ip4 input { width: 4.2em; min-width: 0; flex: 0 1 4.2em; text-align: center; padding: 8px 4px; }
.field .ip4 input.len { width: 3.2em; flex-basis: 3.2em; }
.bits { display: flex; flex-wrap: wrap; gap: 4px; }
.bit { font: 700 20px var(--font-mono); width: 40px; height: 48px; border-radius: 8px; border: 2px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; padding: 0; }
.bit[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.bit.gap { margin-left: 8px; }
.bit:disabled { cursor: default; opacity: 0.8; }
.bit:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.field.ok .bit { border-color: var(--good); }
.field.ng .bit { border-color: var(--bad); }
#qFieldNote { margin: 0; }
#qFieldNote:empty { display: none; }
@media (max-width: 400px) { .bit { width: 32px; height: 44px; } .bit.gap { margin-left: 4px; } }
.team-btn { max-width: 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-row { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.me-stats { margin: 4px 0 10px; }
.code-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.code {
  font: 600 13px var(--font-mono); letter-spacing: 0.04em; user-select: all;
  background: var(--bg); padding: 4px 8px; border-radius: 6px; overflow-wrap: anywhere;
}
.btn.small { font-size: 12px; padding: 4px 10px; }
.scores li { grid-template-columns: 1.4em 14px minmax(0, 1fr) auto auto; }
/* 称号(2026-10-27) */
.ptitles { font: 600 12px var(--font-body); color: var(--muted); background: none; border: 1px solid color-mix(in srgb, var(--muted) 40%, transparent); border-radius: 999px; padding: 1px 8px; cursor: pointer; white-space: nowrap; }
.ptitles:hover { color: var(--ink); }
/* 名前の横に出す称号(2026-11-04) */
.ptitle { font: 600 11px var(--font-body); color: var(--title-orange, var(--muted)); border: 1px solid currentColor; border-radius: 4px; padding: 0 5px; margin-left: 6px; white-space: nowrap; }
.me-bar .ptitle { margin-left: 0; max-width: 10em; overflow: hidden; text-overflow: ellipsis; }
.title-show { margin-top: 6px; max-width: 100%; white-space: normal; }
.title-show.on { color: var(--ink); border-color: var(--ink); }
.ptitles + .ptitles { margin-left: 4px; }
.title-dlg { width: min(760px, calc(100vw - 32px)); }
.title-dlg h3 { display: flex; align-items: baseline; gap: 8px; margin-top: 16px; }
.title-dlg h3 small { font-weight: 400; letter-spacing: 0; }
.title-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.title-cell { background: var(--bg); border-radius: 10px; padding: 8px 4px; text-align: center; }
.title-cell canvas { display: block; margin: 0 auto 4px; }
.title-cell .nm { font-size: 13px; line-height: 1.35; font-weight: 600; }
.title-cell .how { color: var(--muted); font-size: 11px; line-height: 1.3; }
.title-cell.locked canvas { filter: grayscale(1); opacity: 0.35; }
:root[data-theme="dark"] .title-cell.locked canvas { opacity: 0.5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .title-cell.locked canvas { opacity: 0.5; } }
.title-cell.locked .nm { color: var(--muted); font-weight: 400; }
.title-bar { height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--muted) 25%, transparent); margin: 4px 8px 0; overflow: hidden; }
.title-bar i { display: block; height: 100%; background: var(--muted); }
/* 設定(2026-11-02) */
.setting { border: 0; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.setting label { display: flex; align-items: center; gap: 8px; font-size: 15px; cursor: pointer; }
/* 地域制覇は都道府県ごとにたたむ(2026-11-01) */
.title-dlg details { margin: 4px 0; }
.title-dlg summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; background: var(--bg); font-size: 14px; }
.title-dlg summary::-webkit-details-marker { display: none; }
.title-dlg summary::before { content: '▶'; font-size: 10px; color: var(--muted); }
.title-dlg details[open] > summary::before { content: '▼'; }
.title-dlg summary small { margin-left: auto; color: var(--muted); }
.title-dlg details .title-grid { margin: 6px 0 8px 14px; }
/* 種類(正解の数・レベル・地域制覇 など)の欄。中の都道府県などは一段下げる(2026-11-02) */
.title-dlg details.title-cat { margin: 8px 0; }
.title-dlg details.title-cat > summary { font-size: 15px; font-weight: 700; padding: 10px 12px; }
.title-dlg details.title-cat > details { margin-left: 14px; }
.scores .rank { font: 600 12px var(--font-mono); color: var(--muted); }

/* 拠点の情報 */
.np-kana { margin: -2px 0 4px; font-size: 13px; color: var(--muted); }
.np-name { font: 700 17px/1.4 var(--font-body); margin: 0 0 2px; }
.np-meta { margin: 0 0 8px; }
.np-grid { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0 0 8px; font-size: 14px; }
.np-grid dt { color: var(--muted); }
.np-grid dd { margin: 0; font-variant-numeric: tabular-nums; }
.np-lines { list-style: none; margin: 0 0 8px; padding: 0; font-size: 13px; display: flex; flex-direction: column; gap: 2px; max-height: 120px; overflow-y: auto; }

/* 問題の表(経路表・ARP テーブル・ACL・NAT 表) */
.qtable-wrap { overflow-x: auto; margin: 0 0 12px; }
.qtable { border-collapse: collapse; font: 500 13px var(--font-mono); min-width: 100%; }
.qtable th, .qtable td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; white-space: nowrap; }
.qtable th { background: var(--bg); font-weight: 700; color: var(--muted); font-family: var(--font-body); font-size: 12px; }
.options { grid-template-columns: 1fr; }
.options .opt { font-size: 14px; }
@media (min-width: 881px) { .options.two { grid-template-columns: 1fr 1fr; } }

/* 説明書のページ(public/manual.html。tools/build-manual.js が docs/MANUAL.md から作る。2026-10-21) */
body.manual-page { background: var(--bg); color: var(--ink); max-width: 860px; margin: 0 auto; padding: 16px; line-height: 1.75; font-size: 15px; }
.manual-head h1 { font-size: 24px; margin: 8px 0; }
.manual-toc ul { list-style: none; margin: 8px 0 16px; padding: 0; columns: 2; font-size: 14px; }
@media (max-width: 600px) { .manual-toc ul { columns: 1; } }
.manual h2 { font-size: 19px; margin: 28px 0 8px; padding-bottom: 4px; border-bottom: 2px solid var(--line); }
.manual h3 { font-size: 16px; margin: 18px 0 6px; }
.manual ul, .manual ol { padding-left: 1.4em; }
.manual-table { overflow-x: auto; }
.manual table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 8px 0; }
.manual th, .manual td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.manual th { background: var(--surface); }
.manual code { font-family: var(--font-mono); font-size: 13px; }

.board-foot .btn { white-space: nowrap; flex: 0 0 auto; }
.chat-form[hidden] { display: none; }
.chat-list li.member { white-space: pre-wrap; }
#rankDialog .rank-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* 構成図(diagram.js。2026-10-25)。色は変数、線の種類と形でも区別する */
.qdiagram[hidden], .qtapbar[hidden], .qconfig[hidden], .qterm[hidden] { display: none; }
.dg { margin: 4px 0 12px; }
.dg-scroll { overflow-x: auto; overscroll-behavior-x: contain; border-radius: 12px; }
.dg-svg { display: block; width: 100%; height: auto; max-height: 60vh; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; font-family: var(--font-body); }
.dg-shape { fill: var(--surface); stroke: var(--ink); stroke-width: 2.5; }
.dg-mark { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.dg-halo { fill: none; stroke: transparent; stroke-width: 6; }
.dg-hit { fill: transparent; stroke: transparent; cursor: pointer; }
.dg-mode-view .dg-hit, .dg-disabled .dg-hit { cursor: default; }
.dg-name { font-size: 16px; font-weight: 700; fill: var(--ink); paint-order: stroke; stroke: var(--bg); stroke-width: 4; stroke-linejoin: round; }
.dg-note { font-size: 13px; fill: var(--muted); font-family: var(--font-mono); paint-order: stroke; stroke: var(--bg); stroke-width: 4; stroke-linejoin: round; }
.dg-link-line { stroke: var(--line-strong); stroke-width: 3; fill: none; }
.dg-link-dash .dg-link-line { stroke-dasharray: 10 8; }
.dg-link-bold .dg-link-line { stroke-width: 7; stroke: var(--ink); }
.dg-link .dg-hit { stroke: transparent; stroke-width: 28; }
.dg-link-label { font-size: 13px; fill: var(--muted); font-family: var(--font-mono); paint-order: stroke; stroke: var(--bg); stroke-width: 5; stroke-linejoin: round; }
.dg-group { fill: none; stroke: var(--line-strong); stroke-width: 2; stroke-dasharray: 6 6; }
.dg-group-label { font-size: 13px; font-weight: 700; fill: var(--muted); }
.dg-port-dot { fill: var(--surface); stroke: var(--line-strong); stroke-width: 2; }
.dg-port-name, .dg-port-note { font-size: 13px; fill: var(--muted); font-family: var(--font-mono); paint-order: stroke; stroke: var(--bg); stroke-width: 4; stroke-linejoin: round; }
.dg-port-name { fill: var(--ink); }
.dg-node.sel .dg-shape { stroke: var(--accent); stroke-width: 6; }
.dg-node.sel .dg-halo { stroke: var(--ink); stroke-dasharray: 4 4; }
.dg-node.mark .dg-halo { stroke: var(--good); stroke-width: 5; }
.dg-link.sel .dg-link-line { stroke: var(--accent); stroke-width: 9; }
.dg-link.mark .dg-link-line { stroke: var(--good); }
.dg-port.sel .dg-port-dot { fill: var(--accent); stroke: var(--ink); stroke-width: 3; r: 11; }
.dg-port.mark .dg-port-dot { stroke: var(--good); stroke-width: 4; }
.dg-badge circle { fill: var(--accent); stroke: var(--ink); stroke-width: 2; }
.dg-badge text { font-size: 15px; font-weight: 700; fill: var(--accent-ink); font-family: var(--font-mono); }
.dg-badge.mark circle { fill: var(--good); stroke: var(--surface); }
.dg-badge.mark text { fill: #fff; }
.dg-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 0; min-height: 22px; }
.dg-status { font-size: 13px; font-weight: 700; color: var(--muted); }
.dg-tables-bar, .dg-portpick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 0; }
.dg-tables-bar[hidden], .dg-portpick[hidden], .dg-table-box[hidden] { display: none; }
.dg-tables-label, .dg-portpick-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.dg-tables-bar .btn.on { background: var(--accent); color: var(--accent-ink); }
.dg-portpick .btn { min-height: 44px; min-width: 88px; font-family: var(--font-mono); }
.dg-table-box { margin: 8px 0 0; overflow-x: auto; }
.dg-table-title { margin: 0 0 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.dg-list { margin: 8px 0 0; font-size: 13px; }
.dg-list summary { cursor: pointer; color: var(--muted); font-weight: 700; }
.dg-list ul { margin: 4px 0 0; padding-left: 18px; }
.dg-list li { margin: 2px 0; }
.dg-list-btn { font: inherit; padding: 4px 8px; border-radius: 6px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; min-height: 32px; }
.dg-list-btn.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 30%, var(--surface)); }
.qtapbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; }
.qtapbar .hint { margin: 0; }
/* 設定を書く欄(terminal.js の configForm) */
.cfg-reqs { margin: 0 0 10px; padding: 8px 12px; border-radius: 8px; border: 2px solid var(--line); background: var(--bg); }
.cfg-reqs-title { margin: 0 0 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.cfg-reqs ol { margin: 0; padding-left: 22px; font-size: 14px; }
.cfg-reqs li.ng { color: var(--bad); font-weight: 700; }
.cfg-reqs li.ng::after { content: " ← 満たしていない"; font-size: 12px; }
.cfg-reqs li.ok { color: var(--good); }
.cfg-dev { margin: 0 0 12px; }
.cfg-dev h4 { margin: 0 0 4px; font-size: 14px; }
.cfg-view-title { margin: 0; font-size: 12px; color: var(--muted); }
.cfg-view { margin: 0 0 6px; padding: 6px 10px; font: 500 13px/1.5 var(--font-mono); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; white-space: pre-wrap; max-height: 10em; overflow: auto; color: var(--muted); }
.cfg-text { width: 100%; box-sizing: border-box; font: 500 14px/1.5 var(--font-mono); padding: 8px 10px; border-radius: 8px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); resize: vertical; min-height: 7em; }
.cfg-dev.over .cfg-text { border-color: var(--bad); }
.cfg-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin: 2px 0 0; }
.cfg-err { color: var(--bad); font-weight: 700; }
.qconfig .fields-foot { margin: 0 0 12px; }
/* 模擬ターミナル(terminal.js の terminal) */
.term { margin: 0 0 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.term-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--bg); border-bottom: 1px solid var(--line); }
.term-out { margin: 0; padding: 8px 10px; min-height: 8em; max-height: 40vh; overflow: auto; font: 500 13px/1.5 var(--font-mono); white-space: pre-wrap; word-break: break-all; color: var(--ink); background: var(--surface); }
.term-row { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-top: 1px solid var(--line); background: var(--bg); }
.term-prompt { font: 600 14px var(--font-mono); color: var(--muted); white-space: nowrap; }
.term-in { flex: 1 1 auto; min-width: 0; font: 500 15px var(--font-mono); padding: 8px 10px; border-radius: 8px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); min-height: 44px; box-sizing: border-box; }
.term-in:disabled { opacity: 0.5; }
.term-note { margin: 0; padding: 4px 10px 6px; font-size: 12px; color: var(--muted); }
.verdict.demo { color: var(--muted); }
@media (max-width: 600px) { .dg-svg { min-width: 640px; max-height: none; } .cfg-text { font-size: 16px; } .term-in { font-size: 16px; } }

/* スマホ(幅 880px 以下。2026-10-27 ユーザー指摘: 窮屈。地図を横幅いっぱいに)。
   周りの余白と角の丸みをなくし、上の帯を詰め、下の欄は「拠点の情報・通信ログ・チャット」をタブで 1 つずつ出す */
.side-tabs, .side-empty, .side-close, .settings-panel, .rank-panel { display: none; }
@media (max-width: 880px) {
  .top { padding: 4px 8px; gap: 4px 10px; }
  .brand { gap: 6px; }
  .brand h1 { font-size: 17px; }
  .brand-mark { width: 16px; height: 16px; border-width: 4px; }
  .brand-en { display: none; }
  .status { gap: 8px; }
  .me-bar { gap: 6px; }
  .me-bar .btn.small { padding: 3px 8px; font-size: 12px; }
  /* 地図を下のタブの上まで広げる。欄はタブを押したときだけ地図の上に重ねて開く(2026-11-02 ユーザー指摘) */
  .layout { grid-template-rows: minmax(0, 1fr) var(--side-tabs-h); gap: 0; padding: 0; position: relative; --side-tabs-h: 38px; }
  .board { padding: 0; border-radius: 0; }
  .map-wrap { border-radius: 0; }
  .map-hint { display: none; }
  .zoom { top: 6px; right: 6px; gap: 4px; }
  .zbtn { width: 32px; height: 32px; font-size: 16px; }
  .own-view { top: 6px; left: 6px; }
  .board-foot { margin: 0; padding: 3px 8px; gap: 6px; }
  .board-foot .btn.small { padding: 2px 8px; font-size: 12px; }
  .credit-short { font-size: 11px; }
  .side { gap: 0; background: var(--surface); border-top: 1px solid var(--line); position: absolute; left: 0; right: 0; bottom: 0; z-index: 20; }
  .side[data-open] { top: 38%; border-radius: 14px 14px 0 0; box-shadow: 0 -6px 20px rgb(0 0 0 / 0.25); }
  .side:not([data-open]) .side-main, .side:not([data-open]) .chat, .side:not([data-open]) .settings-panel { display: none !important; }
  /* 設定はスマホでは下のタブに入れる(上の帯のボタンは出さない) */
  #settingsBtn, #rankBtn { display: none; } /* 順位も下のタブ(2026-11-02) */
  .side:not([data-open]) .rank-panel { display: none !important; }
  .side[data-pane="rank"] .rank-panel { display: block; flex: 1 1 auto; overflow-y: auto; }
  .side[data-pane="rank"] .side-main { display: none; }
  .rank-panel .rank-head .dlg-title { display: none; }
  .rank-panel .rank-head { justify-content: flex-start; margin-bottom: 8px; }
  .rank-panel .rank-head select { max-width: 100%; font-size: 16px; }
  .side[data-pane="settings"] .settings-panel { display: block; flex: 1 1 auto; overflow-y: auto; }
  .side[data-pane="settings"] .side-main { display: none; }
  .side-tabs { display: flex; flex: 0 0 var(--side-tabs-h); order: 2; border-top: 1px solid var(--line); }
  .side:not([data-open]) .side-tabs { border-top: 0; }
  .side:not([data-open]) .side-tabs button[aria-selected="true"] { color: var(--muted); border-bottom-color: transparent; }
  .side[data-open] .side-close { display: block; position: absolute; top: 4px; right: 6px; z-index: 1; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--bg); color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer; }
  .side[data-open] .side-main, .side[data-open] .chat { padding-top: 6px; }
  .side[data-open] .panel, .side[data-open] .side-empty { padding-right: 48px; }
  .side-tabs button { flex: 1 1 0; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted); font: 700 13px/1 "BIZ UDPGothic", sans-serif; padding: 9px 2px 7px; cursor: pointer; white-space: nowrap; }
  .side-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
  .side .panel { border-radius: 0; padding: 8px 12px; }
  .side-main { gap: 0; }
  .side-empty { margin: 0; padding: 12px; }
  .side[data-pane="info"] .side-empty:not([hidden]) { display: block; }
  .side:not([data-pane="info"]) #nodePanel, .side:not([data-pane="log"]) .log-panel, .side:not([data-pane="chat"]) .chat { display: none; }
  .side[data-pane="info"] #nodePanel { flex: 1 1 auto; }
  .side[data-pane="chat"] .side-main { display: none; }
  .side .chat { flex: 1 1 auto; min-height: 0; }
  .side .log-panel { min-height: 0; }
  /* 欄の見出しはタブと同じ名前なので画面からは消す(読み上げには残す) */
  #npTitle, #logTitle, #chatTitle, #settingsPanelTitle { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }
  .chat-head { justify-content: flex-end; }
  .chat-form input { font-size: 16px; } /* 16px 未満だと iPhone は書くときに画面を拡大してしまう */
}
/* 問題に付ける絵(public/figure.js。2026-11-02) */
#qFigure { margin: 8px 0; }
.fg-title { margin: 0 0 4px; font-size: 14px; color: var(--muted); }
.fg-scroll { overflow-x: auto; overscroll-behavior-x: contain; border-radius: 12px; }
.fg-svg { display: block; width: 100%; height: auto; max-height: 50vh; min-width: 320px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; font-family: var(--font-body); }
.fg-label { font-size: 18px; font-weight: 700; fill: var(--ink); }
.fg-pin { font-size: 14px; fill: var(--muted); font-family: var(--font-mono); }
.fg-note, .fg-sub { font-size: 13px; fill: var(--muted); }
.fg-body { fill: var(--surface); stroke: var(--line-strong); stroke-width: 2; }
.fg-latch { fill: var(--surface); stroke: var(--line-strong); stroke-width: 2; }
.fg-contact { fill: #D4A531; stroke: #9C7A1E; stroke-width: 1; }
.fg-wire { stroke: var(--line-strong); stroke-width: 1; }
.fg-unknown { fill: var(--surface); stroke: var(--ink); stroke-width: 2; stroke-dasharray: 5 4; }
.fg-q { font-size: 28px; font-weight: 700; fill: var(--ink); }
.fg-wname { font-size: 12px; fill: var(--ink); }
.fg-cable { fill: none; stroke: var(--line-strong); stroke-width: 10; stroke-linecap: round; }
.fg-box { stroke: var(--line-strong); stroke-width: 1.5; }
.fg-boxtext { fill: var(--ink); }
.fg-tone-plain { fill: var(--surface); }
.fg-tone-l2 { fill: #DCEBFA; } .fg-tone-l3 { fill: #DDF3E4; } .fg-tone-l4 { fill: #FBEFD5; } .fg-tone-data { fill: #EEE6F7; } .fg-tone-tail { fill: #F6DCDC; }
.fg-tone-q { fill: var(--surface); stroke: var(--ink); stroke-width: 2; stroke-dasharray: 6 4; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fg-tone-l2 { fill: #1D3550; } :root:not([data-theme="light"]) .fg-tone-l3 { fill: #1D4030; } :root:not([data-theme="light"]) .fg-tone-l4 { fill: #4A3A18; } :root:not([data-theme="light"]) .fg-tone-data { fill: #3A2D4F; } :root:not([data-theme="light"]) .fg-tone-tail { fill: #4F2626; } }
:root[data-theme="dark"] .fg-tone-l2 { fill: #1D3550; } :root[data-theme="dark"] .fg-tone-l3 { fill: #1D4030; } :root[data-theme="dark"] .fg-tone-l4 { fill: #4A3A18; } :root[data-theme="dark"] .fg-tone-data { fill: #3A2D4F; } :root[data-theme="dark"] .fg-tone-tail { fill: #4F2626; }

/* はじめてガイド(public/guide.html。2026-11-04)。絵は style.css の色の名前で塗るので、暗い画面でも同じ絵になる */
.guide .g-step { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px 12px; margin: 16px 0; }
.guide .g-step h2 { margin-top: 12px; }
.g-fig { display: block; width: 100%; max-width: 520px; margin: 8px auto; }
.g-fig text, .g-map text { font-family: "BIZ UDPGothic", sans-serif; }
.g-link { stroke: var(--line-strong); stroke-width: 3; }
.g-zone { fill: var(--accent); opacity: 0.18; }
.g-me, .g-mine { fill: #2F7DE1; stroke: var(--ink); stroke-width: 1.5; }
.g-dot { fill: #fff; }
.g-free { fill: var(--surface); stroke: var(--line-strong); stroke-width: 2; }
.g-other { fill: #D64B8A; stroke: var(--ink); stroke-width: 1.5; }
.g-dim { opacity: 0.4; }
.g-glow { fill: none; stroke: var(--accent); stroke-width: 4; }
.g-ring { fill: none; stroke: #2F7DE1; stroke-width: 3; opacity: 0.6; }
.g-ring2 { fill: none; stroke: #2F7DE1; stroke-width: 2; opacity: 0.3; }
.g-rail-b { stroke: var(--ink); stroke-width: 6; }
.g-rail-w { stroke: #fff; stroke-width: 6; stroke-dasharray: 14 14; }
.g-air { fill: none; stroke: #2F7DE1; stroke-width: 2.5; stroke-dasharray: 6 6; }
.g-sea { fill: none; stroke: #138D90; stroke-width: 2.5; stroke-dasharray: 2 5; stroke-linecap: round; }
.g-card { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.5; }
.guide .g-step .g-card { fill: var(--bg); }
.g-input { fill: var(--surface); stroke: var(--line-strong); }
.g-opt { fill: var(--surface); stroke: var(--line-strong); }
.g-opt.ok { stroke: var(--good); stroke-width: 2.5; }
.g-btn { fill: var(--accent); }
.g-btntxt { font-size: 10px; font-weight: 700; fill: var(--accent-ink); }
.g-title { font-size: 15px; font-weight: 700; fill: var(--ink); }
.g-cap { font-size: 11px; fill: var(--muted); }
.g-txt { font-size: 12px; fill: var(--ink); }
.g-code { font-size: 18px; font-family: var(--font-mono); fill: var(--ink); letter-spacing: 1px; }
.g-good { font-size: 12px; font-weight: 700; fill: var(--good); }
.g-bad { font-size: 12px; font-weight: 700; fill: var(--bad); }
.g-icon { font-size: 16px; fill: #fff; }
.g-arrow { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.g-badge { fill: var(--surface); stroke-width: 7; }
.g-badge-t { font-size: 18px; font-weight: 700; fill: var(--ink); }
.g-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px 0; }
@media (max-width: 600px) { .g-cards { grid-template-columns: 1fr; } }
.g-map { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--bg); font-size: 14px; }
.g-map svg { width: 80px; height: 60px; }
.g-map span { color: var(--muted); font-size: 13px; }
.setting .track { display: flex; align-items: center; gap: 8px; } /* 音楽の曲を選ぶ(2026-11-04) */
.setting .track select { font: inherit; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }

/* 学習のまとめ(2026-11-04) */
.learn-dlg { width: min(640px, calc(100vw - 32px)); }
.learn-dlg h3 { margin: 16px 0 6px; font-size: 15px; }
.learn-total { font-size: 16px; font-weight: 600; }
.learn-weak { font-weight: 600; color: var(--bad); }
.learn-list { display: grid; gap: 4px; }
.learn-row { display: grid; grid-template-columns: minmax(0, 1.6fr) auto minmax(60px, 1fr) 3.2em; align-items: center; gap: 8px; font-size: 13px; padding: 2px 0; }
.learn-row.weak .learn-name { color: var(--bad); font-weight: 600; }
.learn-name { overflow-wrap: anywhere; }
.learn-sub { color: var(--muted); font-size: 12px; white-space: nowrap; }
.learn-bar { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.learn-bar i { display: block; height: 100%; background: var(--good); }
.learn-pct { text-align: right; font-variant-numeric: tabular-nums; }
.learn-dlg details { margin-top: 12px; }
.learn-dlg summary { cursor: pointer; font-size: 14px; }
.learn-dlg details .learn-list { margin-top: 6px; }
