:root {
  --bg: #0b0f18; --panel: #121826; --panel2: #18203a; --text: #e7eaf0; --muted: #a3acbe; --border: #263049;
  --accent: #4f8cff; --warn: #f2b33d; --ok: #3ecf8e; --blue: #8cc2ff; --red: #ffb0b0; --blue-bg: #12294a; --red-bg: #4a1620;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: "BIZ UDPGothic", "Yu Gothic UI", "Meiryo", system-ui, sans-serif; font-size: 14px; }
button { font: inherit; cursor: pointer; background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: bold; min-width: 64px; }
button.ghost { background: transparent; }
.small-btn { padding: 4px 10px; font-size: 12px; }
input, select { background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 7px 9px; font: inherit; }
.muted { color: var(--muted); } .small { font-size: 12px; } .grow { flex: 1 1 auto; }

/* 一覧・同意 */
.page { max-width: 1200px; margin: 0 auto; padding: 24px 16px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px 22px; margin-bottom: 16px; }
.card.narrow { max-width: 720px; margin: 40px auto; }
.card h1 { font-size: 18px; margin: 0 0 10px; }
.row { display: flex; gap: 8px; }
.plain { padding-left: 1.2em; line-height: 1.8; }
.note { background: #3a2f10; color: #ffd27a; border-radius: 6px; padding: 6px 10px; font-size: 13px; margin-bottom: 8px; }
.check { display: flex; gap: 8px; align-items: center; margin: 10px 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 18px; margin: 12px 0; }
.grid2 label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.game { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; cursor: pointer; display: flex; gap: 12px; align-items: center; }
.game:hover { border-color: var(--accent); }
.game img { width: 48px; height: 48px; border-radius: 8px; }
.game .t { font-weight: bold; }
.bar { height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar > div { height: 100%; background: var(--ok); }

/* 再生画面: 1 画面に収める */
.play { height: 100vh; min-height: 760px; display: flex; flex-direction: column; overflow: hidden; }
.sb { flex: 0 0 auto; background: #0f1522; border-bottom: 1px solid var(--border); padding: 6px 20px; display: flex; flex-direction: column; gap: 6px; }
.sb-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 150px; gap: 10px; align-items: center; }
.sb-side { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.sb-side.right { align-items: flex-end; }
.score { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.team { display: flex; align-items: center; gap: 18px; padding: 6px 16px; }
.team.blue { background: var(--blue-bg); justify-content: flex-end; }
.team.red { background: var(--red-bg); }
.stat { display: flex; flex-direction: column; line-height: 1.2; }
.team.blue .stat { align-items: flex-end; }
.stat span { font-size: 11px; color: #c4cde0; }
.stat b { font-size: 18px; }
.stat.big b { font-size: 30px; font-weight: 900; }
.team.blue .stat.big { color: var(--blue); } .team.red .stat.big { color: var(--red); }
.drakes { display: flex; gap: 4px; }
.drake { width: 22px; height: 22px; }
.obj img { width: 30px; height: 30px; }
.obj.none img { opacity: .45; }
.fe img.mon { border-radius: 0; }
.clockbox { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px 20px; min-width: 140px; background: var(--bg); }
.clock { font-size: 28px; font-weight: 900; font-variant-numeric: tabular-nums; }
.gdiff { font-size: 12px; font-weight: bold; padding: 1px 8px; border-radius: 4px; }
.objs { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.obj { display: flex; align-items: center; gap: 8px; padding: 3px 10px; border-radius: 8px; background: var(--panel); border: 1px solid var(--border); }
.obj.hot { background: #2a2410; border-color: #6b5620; }
.obj .nm { font-size: 12px; font-weight: bold; } .obj .sub { font-size: 11px; color: var(--muted); }
.obj .tm { font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--muted); }
.obj.hot .tm { color: #ffd27a; }
.objnote { font-size: 11px; color: var(--muted); max-width: 230px; line-height: 1.4; }

.body { flex: 1 1 auto; min-height: 0; display: flex; gap: 14px; padding: 8px 20px; }
.stage-wrap { flex: 0 0 auto; height: 100%; display: flex; }
.stage { position: relative; height: 100%; aspect-ratio: 830 / 810; background: #000; border-radius: 10px; overflow: hidden; }
.stage video, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
/* マップの拡大 (11-16): zoomer に transform を掛ける。位置の計算は canvas の見た目の四角 (getBoundingClientRect) から取るので拡大中もずれない */
.zoomer { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.stage.zoomed canvas { cursor: grab; touch-action: none; }
.stage.zoomed.asking canvas { cursor: crosshair; }
.stage.panning canvas, .stage.zoomed.asking.panning canvas { cursor: grabbing; }
.zoomctl { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 4px; z-index: 2; opacity: .8; }
.zoomctl:hover { opacity: 1; }
.zoomctl button { min-width: 34px; height: 30px; padding: 0 8px; font-size: 14px; line-height: 1; background: rgba(11,15,24,.85); color: var(--text); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.zoomctl button:disabled { opacity: .4; cursor: default; }
.stage video { filter: brightness(var(--map-bright, 1.5)); } /* fog の映像は暗いので既定で明るくする (user 11-10) */
.bright { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-left: 8px; } .bright input { width: 90px; }
.loading { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); background: rgba(11,15,24,.85); color: #ffd27a; border: 1px solid #6b5620; border-radius: 8px; padding: 4px 12px; font-size: 13px; pointer-events: none; }
.stage.asking { outline: 3px solid var(--warn); }
.stage.asking canvas { cursor: crosshair; }
/* 11-12: できごと欄がつぶれたので、ミニマップの列を 44vh → 40vh に細くし、ミニマップの説明は title に移した (高さ 900 px で できごと欄 51 → 約 130 px) */
.mmcol { flex: 0 0 auto; width: min(40vh, 28vw); min-width: 260px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.side { flex: 1 1 auto; min-width: 300px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.mmcol .feedbox { flex: 1 1 0; min-height: 0; overflow-y: auto; scrollbar-width: thin; } /* 残りの高さだけを使う (auto だと行が増えた時にミニマップが縮んで帯と重なる) */
.trailopt { margin: 0; color: var(--muted); }
.qcard { flex: 0 0 auto; min-width: 0; background: #2a2208; border: 2px solid var(--warn); border-radius: 14px; padding: 14px 16px; box-shadow: 0 0 0 3px rgba(242,179,61,.25), 0 0 24px rgba(242,179,61,.25); }
.qcard.idle { background: #1e1a0e; border-color: rgba(242,179,61,.7); box-shadow: 0 0 14px rgba(242,179,61,.12); }
.qhead { display: flex; gap: 10px; align-items: center; }
.qhead img { width: 52px; height: 52px; border-radius: 8px; border: 2px solid var(--warn); }
.qnum { color: var(--warn); font-size: 14px; font-weight: bold; }
.qtitle { font-size: 20px; font-weight: bold; line-height: 1.4; }
.qprompt { margin: 10px 0 12px; font-size: 15px; line-height: 1.55; color: #f0f2f6; }
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.step { border-radius: 8px; padding: 7px 4px; text-align: center; background: var(--panel); border: 1px solid var(--border); color: var(--muted); }
button.step:not(:disabled):hover { outline: 2px solid #fff3; }
button.step:disabled { opacity: 1; cursor: default; }
.step b { display: block; font-size: 18px; } .step span { font-size: 12px; }
.step.done { background: #1f3a2c; border-color: #2f6b4a; color: #8fe3b4; }
.step.now { background: var(--warn); border-color: var(--warn); color: #1a1406; }
.submit { width: 100%; min-height: 50px; font-size: 15px; background: #3a3220; border: 0; color: #bfb08a; font-weight: bold; }
.submit.ready { background: var(--warn); color: #1a1406; }
.mm { flex: 0 0 auto; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.mmwrap { position: relative; }
.mmwrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.mm video { width: 100%; aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--border); background: #000; display: block; }
.mm figcaption { font-size: 10px; color: var(--muted); line-height: 1.35; }
.teams { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.tbox { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 3px 6px; min-width: 0; }
.tbox.own { border-color: #24406b; } .tbox.ene { border-color: #5a2630; }
.prow { display: grid; grid-template-columns: 30px 13px minmax(0, 1fr) 54px; gap: 4px; align-items: center; }
.phead { display: grid; grid-template-columns: minmax(0, 1fr) auto 54px; gap: 4px; align-items: center; }
.pnum { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; font-variant-numeric: tabular-nums; }
.pnum span:first-child { font-size: 12px; } .pnum span:last-child { font-size: 11px; color: #ffd27a; }
.phead { font-size: 10px; color: var(--muted); padding: 0 2px 2px; }
.phead .r, .prow .r { text-align: right; font-variant-numeric: tabular-nums; }
.prow { padding: 1px 2px; border-radius: 5px; font-size: 12px; }
.prow.target { background: #2a2410; }
.prow.dead { opacity: .55; }
.prow.dead .pic img { filter: grayscale(1); }
.pic { position: relative; width: 28px; height: 28px; }
.pic img { width: 28px; height: 28px; border-radius: 5px; border: 2px solid; }
.pic .lv { position: absolute; right: -4px; bottom: -3px; min-width: 15px; height: 14px; border-radius: 7px; background: var(--bg); border: 1px solid; font-size: 9px; font-weight: bold; text-align: center; line-height: 12px; }
.spells { display: flex; flex-direction: column; gap: 1px; } .spells img { width: 13px; height: 13px; border-radius: 2px; }
.pname { min-width: 0; display: flex; gap: 5px; align-items: baseline; white-space: nowrap; overflow: hidden; } .pname b { font-size: 12px; overflow: hidden; text-overflow: ellipsis; } .pname span { font-size: 10px; color: var(--muted); }
.prow.target .pname span { color: var(--warn); font-weight: bold; }
.status { font-size: 10px; text-align: right; white-space: nowrap; }
.feedbox { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 4px 8px; }
.feedbox h3 { margin: 0 0 2px; font-size: 12px; color: var(--muted); font-weight: normal; position: sticky; top: -4px; background: var(--panel); }
.fe { display: grid; grid-template-columns: 38px 22px 14px 22px minmax(0, 1fr); gap: 6px; align-items: center; font-size: 13px; padding: 1px 0; }
.fe img { width: 22px; height: 22px; border-radius: 4px; }
.fe .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.fe .ene { color: var(--red); } .fe .own { color: #c9d6ee; }

.foot { flex: 0 0 auto; border-top: 1px solid var(--border); background: #0f1522; padding: 6px 20px 8px; display: flex; flex-direction: column; gap: 4px; }
.ctl { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ctl > button { min-height: 40px; }
.speeds { display: flex; gap: 4px; margin-left: 6px; } .speeds button { min-width: 46px; min-height: 40px; }
.speeds button.on { background: var(--accent); border-color: var(--accent); font-weight: bold; }
.jumps { display: flex; gap: 4px; } .jumps button { min-height: 40px; padding: 0 12px; font-size: 13px; }
.jumps button:disabled { border-style: dashed; }
.barlabel { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.zoombar { position: relative; height: 46px; border-radius: 8px; background: var(--panel2); overflow: hidden; cursor: pointer; }
.zoombar .played { position: absolute; left: 0; top: 0; bottom: 0; background: #22304a; }
.zoombar .locked { position: absolute; top: 0; bottom: 0; right: 0; background: repeating-linear-gradient(135deg, #18203a 0 8px, #222b40 8px 16px); }
.zoombar .tick { position: absolute; top: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; transform: translateX(-50%); pointer-events: none; }
.zoombar .tick i { width: 3px; height: 24px; }
.zoombar .tick span { font-size: 12px; font-weight: bold; white-space: nowrap; margin-top: 2px; }
.head { position: absolute; top: 0; bottom: 0; width: 3px; background: #fff; transform: translateX(-1px); pointer-events: none; }
.fullbar { position: relative; height: 20px; border-radius: 6px; background: var(--panel2); cursor: pointer; }
.fullbar .played { position: absolute; left: 0; top: 0; bottom: 0; background: #2a3b5c; border-radius: 6px 0 0 6px; }
.fullbar .locked { position: absolute; top: 0; bottom: 0; right: 0; background: repeating-linear-gradient(135deg, #18203a 0 6px, #222b40 6px 12px); border-radius: 0 6px 6px 0; }
.fullbar .bm { position: absolute; top: 3px; bottom: 3px; width: 7px; border-radius: 3px; transform: translateX(-3px); pointer-events: none; }
.fullbar .head { top: -3px; bottom: -3px; width: 4px; }

/* 答え合わせ */
.revealbtn { margin-top: 8px; width: 100%; background: var(--warn); border-color: var(--warn); color: #1a1406; font-weight: bold; }
.rv-head { flex: 0 0 auto; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 10px 20px; background: #0f1522; border-bottom: 1px solid var(--border); }
.rv-title { font-size: 20px; font-weight: bold; }
.rv-score { display: flex; gap: 10px; align-items: center; }
/* 選手欄の .side (min-width 300・縦の flex) と同じ名前なので打ち消す (11-17: PC の幅 1024 で見出しが縦に潰れていた) */
.rv-score .side { display: block; flex: 0 0 auto; min-width: 0; overflow: visible; text-align: center; padding: 4px 14px; border-radius: 10px; }
.rv-score .side b { display: block; font-size: 30px; font-weight: 900; line-height: 1.1; }
.rv-score .you { background: #2a2208; color: #ffd27a; border: 1px solid var(--warn); }
.rv-score .ai { background: #0e2a35; color: #9fe3ff; border: 1px solid #2a7ea0; }
.rv-score .vs { color: var(--muted); font-size: 12px; text-align: center; }
.rv-score .result { font-size: 18px; font-weight: 900; padding: 0 6px; }
.rv-side { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.rv-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.rv-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.rv-legend i.heat { border-radius: 2px; background: linear-gradient(90deg, rgba(90,209,255,.1), rgba(90,209,255,.8)); }
.rv-ctl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rv-ctl .check { margin: 0; }
.rv-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.rv-big { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 6px 8px; }
.rv-big.sel { border-color: var(--warn); }
.rv-big h4 { margin: 0 0 4px; font-size: 13px; display: flex; justify-content: space-between; }
.rv-sub { display: grid; grid-template-columns: 44px 1fr 1fr 64px; gap: 6px; align-items: center; width: 100%; padding: 4px 6px; font-size: 13px; text-align: left; background: transparent; border-color: transparent; }
.rv-sub.sel { background: #22304a; border-color: #3a4a6a; }
.rv-sub .d { font-variant-numeric: tabular-nums; }
.rv-sub .you { color: #ffd27a; } .rv-sub .ai { color: #9fe3ff; }
.rv-sub .w { text-align: center; font-weight: bold; border-radius: 6px; padding: 1px 0; }
.w.win { background: #3a3008; color: #ffd27a; } .w.lose { background: #0e2a35; color: #9fe3ff; } .w.draw { background: var(--panel2); color: var(--muted); }
.teemo { font-size: .85em; opacity: .75; white-space: nowrap; }
.rv-note { line-height: 1.6; padding: 4px 2px 8px; } .rv-note b { color: var(--text); }
.tb { width: 100%; border-collapse: collapse; font-size: 14px; }
.tb th, .tb td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: right; font-variant-numeric: tabular-nums; }
.tb th:first-child, .tb td:first-child { text-align: left; }
.tb tr.total td { font-weight: bold; border-top: 2px solid var(--border); }

.rc-code { font-size: 34px; font-weight: 900; letter-spacing: 4px; text-align: center; padding: 14px; margin: 14px 0; border: 2px dashed var(--warn); border-radius: 12px; color: #ffd27a; font-variant-numeric: tabular-nums; }
.game.locked { opacity: .5; cursor: default; }
.game .lockmsg { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* 持ち物 (11-12) */
.prow .items { grid-column: 1 / -1; display: flex; gap: 2px; padding-left: 47px; margin-bottom: 2px; }
.items .it { position: relative; width: 18px; height: 18px; border-radius: 3px; background: #1b2232; overflow: hidden; }
.items .it img { width: 100%; height: 100%; display: block; }
.items .it b { position: absolute; right: 0; bottom: -2px; font-size: 9px; color: #fff; text-shadow: 0 0 2px #000; }
.items .it.tr { margin-left: 4px; border-radius: 50%; }
.items .it.empty { opacity: .5; }

/* 味方の Teamfight 帯 (11-12) */
.band { margin: 0; flex: 0 0 auto; }
.band video { width: 100%; display: block; border-radius: 6px; background: #000; filter: brightness(var(--map-bright, 1.5)); }
.band figcaption { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ===== 高さの低い PC の画面 (11-16、1366x768 など) =====
   右の列 (問題 + 選手 10 人) が枠に収まらず、選手の欄が 3 人ぶんで切れていた。上のスコア・問題の札・下の操作欄を詰めて 5 人とも見えるようにする */
@media (min-width: 901px) and (min-height: 561px) and (max-height: 820px) {
  .sb { padding: 4px 20px; gap: 4px; }
  .team { padding: 3px 16px; }
  .stat b { font-size: 16px; } .stat.big b { font-size: 24px; }
  .clockbox { padding: 2px 20px; } .clock { font-size: 22px; }
  .obj { padding: 2px 10px; } .obj img { width: 26px; height: 26px; }
  .objnote { max-width: 420px; }
  .body { padding: 6px 20px; }
  .side, .mmcol { gap: 6px; }
  .qcard { padding: 8px 12px; border-radius: 12px; }
  .qhead img { width: 40px; height: 40px; }
  .qnum { font-size: 12px; } .qtitle { font-size: 17px; line-height: 1.3; }
  .qprompt { margin: 6px 0 8px; font-size: 13px; line-height: 1.45; }
  .steps { margin-bottom: 6px; }
  .step { padding: 5px 4px; display: flex; gap: 6px; justify-content: center; align-items: baseline; }
  .step b { display: inline; font-size: 15px; }
  .submit { min-height: 40px; }
  .foot { padding: 4px 20px 6px; gap: 3px; }
  .ctl > button, .speeds button, .jumps button { min-height: 34px; padding-top: 4px; padding-bottom: 4px; }
  .zoombar { height: 38px; } .zoombar .tick i { height: 18px; } .zoombar .tick span { font-size: 11px; margin-top: 1px; }
  .fullbar { height: 14px; }
}

/* ===== スマートフォン・狭い画面 (11-13) =====
   幅 900 px 以下か高さ 560 px 以下で縦に積む。app.js の COMPACT と同じ条件 (決定ボタンを下の操作欄へ、エピックの欄をマップの下へ移す)。
   縦持ち: スコア → マップ → 問題 → ミニマップ・帯・できごと → 選手 → エピック。下に操作欄 (決定・再生・シークバー) を貼り付ける
   横持ち: 左にマップを貼り付け、右の列を縦に送る */
button, .zoombar, .fullbar, .game, .stage canvas { touch-action: manipulation; } /* ダブルタップの拡大を止める */
@media (max-width: 900px), (max-height: 560px) {
  html { -webkit-text-size-adjust: 100%; }
  input, select { font-size: 16px; } /* 16 px 未満だと iOS が入力時に画面を拡大する */
  .page { padding: 12px 10px; }
  .card { padding: 14px; }
  .card.narrow { margin: 8px auto; }
  .row { flex-wrap: wrap; }
  .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
  .grid2 input, .grid2 select { width: 100%; min-width: 0; }
  form .check { align-items: flex-start; }
  form button[type=submit], #rc-ok { min-height: 46px; width: 100%; }
  #f-resume input { flex: 1 1 160px; min-width: 0; }
  #f-resume button { width: auto; }
  .games { grid-template-columns: 1fr; }
  .rc-code { font-size: 26px; letter-spacing: 2px; }
  #tb-body { overflow-x: auto; }
  .tb { min-width: 640px; font-size: 13px; }

  .play { height: auto; min-height: 100dvh; overflow: visible; }
  .sb { padding: 6px 8px; gap: 4px; }
  .sb-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; }
  .sb-side { flex-direction: row; align-items: center; gap: 8px; }
  .score { grid-column: 1 / -1; grid-row: 2; }
  /* チームの欄: 上の段 = キル数 (時計の側に数字)、下の段 = タワーとゴールド、ドラゴンはその下 */
  .team { display: grid; grid-template-columns: auto auto; gap: 0 8px; padding: 3px 6px; align-items: baseline; align-content: center; }
  .team.blue { justify-content: end; justify-items: end; }
  .team.red { justify-content: start; justify-items: start; }
  .team > .stat.big { grid-area: 1 / 1 / 2 / 3; flex-direction: row; align-items: baseline; gap: 6px; }
  .team.red > .stat.big { flex-direction: row-reverse; }
  .team > .stat:not(.big) { grid-row: 2; flex-direction: row; align-items: baseline; gap: 4px; }
  .team > .drakes { grid-area: 3 / 1 / 4 / 3; }
  .drake { width: 16px; height: 16px; }
  .stat span { font-size: 10px; white-space: nowrap; }
  .stat b { font-size: 14px; }
  .stat.big b { font-size: 22px; }
  .clockbox { min-width: 0; padding: 2px 8px; }
  .clock { font-size: 20px; }
  .gdiff { font-size: 10px; padding: 1px 4px; white-space: nowrap; }

  .body { flex-direction: column; gap: 8px; padding: 8px; }
  .stage-wrap { order: 1; height: auto; justify-content: center; }
  .stage { height: auto; width: min(100%, calc(100dvh - 190px)); min-width: 240px; scroll-margin: 8px 0 180px; } /* 下の余白 = 貼り付けた操作欄の分 (問題のコマでマップへ戻す時に隠れない) */
  .side { display: contents; }
  .qcard { order: 2; padding: 10px 12px; border-radius: 12px; box-shadow: 0 0 0 2px rgba(242,179,61,.2); }
  .qcard.idle { box-shadow: none; }
  .qhead img { width: 40px; height: 40px; }
  .qnum { font-size: 12px; }
  .qtitle { font-size: 16px; }
  .qprompt { margin: 6px 0 8px; font-size: 13px; }
  .steps { margin-bottom: 0; }
  .step { padding: 6px 2px; min-height: 44px; }
  .step b { font-size: 16px; } .step span { font-size: 11px; }
  .mmcol { order: 3; width: auto; min-width: 0; }
  .mm, .band { width: 100%; max-width: 520px; margin: 0 auto; }
  .mmcol .feedbox { flex: 0 0 auto; overflow: visible; }
  .teams { order: 4; }
  .prow .items { padding-left: 0; flex-wrap: wrap; }
  .objs { order: 5; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .obj { padding: 3px 6px; gap: 6px; min-width: 0; }
  .obj > div { flex: 1 1 auto; min-width: 0; }
  .obj img { width: 24px; height: 24px; }
  .obj .tm { font-size: 13px; }
  .objnote { grid-column: 1 / -1; max-width: none; }
  .trailopt { order: 6; align-items: flex-start; }

  /* 下に貼り付ける操作欄: 決定 (app.js が移す) → 再生 → 大問のシークバー → 試合全体 */
  .foot { position: sticky; bottom: 0; z-index: 5; padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); gap: 5px; box-shadow: 0 -6px 16px rgba(0,0,0,.5); }
  .foot .submit { min-height: 46px; }
  .foot .barlabel, .foot .bright, .foot .jumps, .foot .grow, .ctl > .muted { display: none; }
  .ctl { flex-wrap: nowrap; gap: 5px; }
  .ctl > button { flex: 1 1 0; padding: 8px 4px; white-space: nowrap; }
  .speeds { margin-left: 0; gap: 3px; } .speeds button { min-width: 36px; padding: 8px 4px; }
  .zoombar { height: 38px; }
  .zoombar .tick i { height: 18px; }
  .zoombar .tick span { font-size: 11px; margin-top: 1px; }
  .fullbar { height: 14px; }

  /* 答え合わせ: マップを上に貼り付け、小問の一覧を下で送る */
  .rv-head { display: flex; flex-wrap: wrap; gap: 6px 8px; padding: 8px; }
  .rv-head > div:not(.rv-score) { order: 3; flex: 1 1 100%; }
  #rv-table-btn { order: 2; margin-left: auto; padding: 4px 10px; font-size: 12px; }
  .rv-score { order: 4; flex: 1 1 100%; justify-content: center; }
  .rv-score .side { display: block; flex: 0 0 auto; min-width: 0; overflow: visible; padding: 2px 12px; } /* 選手欄の .side (min-width 300) と同じ名前なので打ち消す */
  .rv-score .side b { font-size: 24px; }
  .rv-title { font-size: 16px; }
  #v-reveal .stage-wrap { position: sticky; top: 0; z-index: 3; background: var(--bg); padding-bottom: 4px; }
  #v-reveal .stage { width: min(100%, calc(100dvh - 260px)); }
  .rv-side { order: 2; min-height: auto; }
  .rv-list { overflow: visible; }
  .rv-sub { min-height: 40px; }
  .rv-ctl button { min-height: 40px; }
}
@media (orientation: landscape) and (max-height: 560px) {
  .play { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 8px; align-items: start; padding: 0 8px 0 4px; }
  .body { display: contents; }
  .play > header, .play > footer, .body > *, .side > *, .body > .objs { grid-column: 2; }
  .body > .stage-wrap, #v-reveal .stage-wrap { grid-column: 1; grid-row: 1 / span 20; position: sticky; top: 0; height: 100dvh; padding: 4px 0; }
  .stage, #v-reveal .stage { height: 100%; width: auto; min-width: 0; }
  .sb { border: 0; padding: 6px 0 0; background: transparent; }
  .rv-head { border: 0; padding: 6px 0 0; background: transparent; }
  /* 操作欄は右の列の下に固定 (グリッドの中では sticky が効かない)。左端 = マップの幅 (高さ × 830/810) の右 */
  #v-play { padding-bottom: 170px; }
  .foot { position: fixed; right: 0; bottom: 0; left: calc((100dvh - 8px) * 1.025 + 12px); border-left: 1px solid var(--border); border-radius: 10px 0 0 0; }
  .foot .fullbar { display: none; }
  .foot .submit { min-height: 40px; }
  .mm { max-width: max(200px, calc(100dvh - 150px)); } /* 操作欄の上に全体が見える大きさ */
}

/* ===== メインメニュー (11-16) ===== */
.menu { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; overflow-x: hidden; background: #0c0e12; }
.menu-in { display: grid; grid-template-columns: minmax(260px, 540px) minmax(300px, 500px); gap: 40px; align-items: center; justify-content: center; width: 100%; max-width: 1080px; }
.hero { position: relative; margin: 0 -18px; } /* 枠なし。立体のマップが背景に浮いて見えるようにする */
.hero canvas { width: 100%; aspect-ratio: 1; display: block; }
.hero-steps { list-style: none; display: flex; justify-content: center; gap: 6px; margin: -6% 0 0; padding: 0; font-size: 12px; color: #6f7b94; }
.hero-steps li { display: flex; align-items: center; gap: 5px; padding: 4px 10px 4px 5px; border: 1px solid transparent; border-radius: 99px; white-space: nowrap; transition: color .3s, border-color .3s, background .3s; }
.hero-steps i { font-style: normal; font-weight: bold; width: 18px; height: 18px; line-height: 18px; text-align: center; border-radius: 50%; background: #1b2438; color: #8a96b0; transition: background .3s, color .3s; }
.hero-steps li.on { color: #ffe2a6; border-color: rgba(242,179,61,.55); background: rgba(242,179,61,.1); }
.hero-steps li.on i { background: var(--warn); color: #1a1406; }
.pre-lead { margin: 0 0 12px; line-height: 1.7; }
.pre { display: grid; gap: 8px; margin-bottom: 10px; }
.pre-item { background: var(--panel2); border-radius: 10px; padding: 10px 14px; }
.pre-item > b { color: #ffd27a; font-size: 13px; }
.pre-item p { margin: 3px 0 0; line-height: 1.7; }
.pre-item details { margin-top: 4px; font-size: 12px; color: var(--muted); }
.pre-item summary { cursor: pointer; color: var(--blue); }
.pre-item details ul { margin: 4px 0 0; }
.study { margin: 4px 0 0; display: grid; gap: 3px; font-size: 13px; line-height: 1.6; }
.study > div { display: grid; grid-template-columns: 11em 1fr; gap: 8px; }
.study > div[hidden] { display: none; }
.study dt { color: var(--muted); }
.study dd { margin: 0; }
.contact { color: var(--blue); overflow-wrap: anywhere; }
.linklike { background: none; border: 0; padding: 0; color: var(--blue); text-decoration: underline; cursor: pointer; font: inherit; }
.menu-foot .linklike { color: #c9a96a; margin-top: 6px; }
@media (max-width: 520px) { .study > div { grid-template-columns: 1fr; gap: 0; } }
.pre-ask {margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.menu-kicker { color: var(--warn); font-size: 13px; font-weight: bold; letter-spacing: .08em; }
/* 見出しまわり (11-16 user が案 b を選択): 英字はセリフ体、日本語は明朝、背景は青みを抜いた黒、ボタンは角ばった真鍮色。目立つ役はマップの絵に任せる */
.menu-title { white-space: nowrap; font-family: Georgia, "Times New Roman", serif; font-size: min(4.4vw, 56px); /* 1 行に収まる大きさ (幅はおよそ文字の大きさの 8.2 倍) */ font-weight: 400; line-height: 1.02; letter-spacing: -.01em; margin: 0 0 14px; color: #efe7d6; }
.menu-lead { font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif; font-size: 16px; line-height: 2; color: #c9c2b2; margin: 0 0 22px; max-width: 30em; }
.menu .menu-btn { border-radius: 3px; background: none; border-color: #3a3a3a; }
.menu .menu-btn.main { background: #c9a96a; border-color: #c9a96a; }
.menu .menu-btn:hover { border-color: #c9a96a; }
.menu .hero-steps li.on { color: #e9d9b4; border-color: rgba(201,169,106,.6); background: none; }
.menu .hero-steps li.on i { background: #c9a96a; }
/* 見出しの ? は LoL の「敵が消えた」ピン風 (黄色)。自前の文字と CSS だけで、ゲームの画像は使わない。開いた時に 1 回だけ弾んで輪が広がる */
.mia { position: relative; display: inline-block; margin-left: .12em; font-family: "Segoe UI", "Helvetica Neue", system-ui, sans-serif; font-weight: 900; color: #ffe14a; -webkit-text-stroke: .045em #2b1f00; paint-order: stroke fill; text-shadow: 0 0 .28em rgba(255,207,46,.55); animation: miapop .5s .5s cubic-bezier(.3,1.6,.5,1) backwards; }
.mia::after { content: ""; position: absolute; left: 50%; top: 52%; width: 1.5em; height: 1.5em; margin: -.75em 0 0 -.75em; border: .05em solid #ffe14a; border-radius: 50%; opacity: 0; pointer-events: none; animation: miaring .9s .75s ease-out; }
.nobr { white-space: nowrap; } /* JG と ? を必ず同じ行に並べる */
/* 遊び: ? の上をマウスが通る (スマートフォンでは触る) たびに、もう一度弾んで輪が広がる */
.mia:hover { animation: miabounce .45s cubic-bezier(.3,1.6,.5,1); cursor: default; }
.mia:hover::after { animation: miaring2 .8s ease-out; }
@keyframes miabounce { from { transform: scale(.55); } }
@keyframes miaring2 { from { transform: scale(.3); opacity: .9; } to { transform: scale(1.25); opacity: 0; } }
@keyframes miapop { from { transform: scale(0); } }
@keyframes miaring { from { transform: scale(.3); opacity: .9; } to { transform: scale(1.25); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .mia, .mia::after, .mia:hover, .mia:hover::after { animation: none; } }
.menu-done { color: #8fe3b4; font-size: 13px; margin-bottom: 8px; }
.menu-btns { display: flex; flex-direction: column; gap: 10px; }
.menu-btn { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 14px 18px; border-radius: 12px; }
.menu-btn b { font-size: 18px; } .menu-btn span { font-size: 12px; color: var(--muted); line-height: 1.5; }
.menu-btn:hover { border-color: var(--warn); }
.menu-btn.main { background: var(--warn); border-color: var(--warn); color: #1a1406; } .menu-btn.main span { color: #4a3a10; }
.menu-link { background: none; border: 0; color: var(--blue); text-decoration: underline; padding: 6px 0; text-align: left; font-size: 13px; }
.menu-foot { font-size: 12px; color: var(--muted); margin: 16px 0 0; line-height: 1.6; }
.to-menu { margin-bottom: 10px; }

/* ===== チュートリアル (11-16): 案内の帯・説明の吹き出し ===== */
.tut-bar { flex: 0 0 auto; display: flex; gap: 12px; align-items: center; min-height: 44px; padding: 6px 20px; background: #3a2f10; border-bottom: 2px solid var(--warn); color: #ffe9b8; font-size: 15px; }
.tut-bar > b { flex: 0 0 auto; background: var(--warn); color: #1a1406; border-radius: 6px; padding: 2px 8px; font-size: 12px; }
.tut-bar > span { flex: 1 1 auto; line-height: 1.5; }
.tut-bar > button { flex: 0 0 auto; white-space: nowrap; }
.tut-pulse { outline: 3px solid var(--warn) !important; outline-offset: 3px; animation: tutpulse 1s ease-in-out infinite; }
@keyframes tutpulse { 50% { outline-color: rgba(242,179,61,.15); } }
.coach { position: fixed; inset: 0; z-index: 50; }
.coach-hole { position: fixed; border-radius: 10px; border: 3px solid var(--warn); box-shadow: 0 0 0 200vmax rgba(4,7,14,.72); pointer-events: none; transition: left .2s, top .2s, width .2s, height .2s; }
.coach-card { position: fixed; width: min(380px, calc(100vw - 16px)); background: var(--panel); border: 2px solid var(--warn); border-radius: 12px; padding: 12px 16px 14px; box-shadow: 0 12px 40px rgba(0,0,0,.6); }
.coach-n { font-size: 12px; color: var(--muted); }
.coach-card h3 { margin: 2px 0 6px; font-size: 17px; color: #ffd27a; }
.coach-card p { margin: 0 0 12px; font-size: 14px; line-height: 1.75; }
.coach-btns { align-items: center; flex-wrap: nowrap; }
@media (max-width: 900px), (max-height: 560px) {
  .menu { align-items: flex-start; padding: 16px 12px 28px; }
  .menu-in { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .hero { width: min(100%, 340px, 44dvh); margin: -8px auto 0; }
  .hero-steps { font-size: 10.5px; gap: 2px; } .hero-steps li { padding: 3px 6px 3px 3px; gap: 3px; } .hero-steps i { width: 15px; height: 15px; line-height: 15px; }
  .menu-title { font-size: min(10.5vw, 56px); }
  .menu-lead { font-size: 14px; margin-bottom: 14px; }
  .menu-btn { min-height: 56px; }
  .tut-bar { padding: 6px 8px; gap: 8px; font-size: 13px; }
  #v-play > .tut-bar { position: sticky; top: 0; z-index: 6; }
}
@media (orientation: landscape) and (max-height: 560px) {
  .play > .tut-bar { grid-column: 2; }
  .menu-in { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .hero { width: min(40vw, 80dvh); }
}
@media (prefers-reduced-motion: reduce) { .tut-pulse { animation: none; } .coach-hole { transition: none; } }
/* 言語の切り替え (11-18 user): メニューの右上 */
.menu { position: relative; }
.lang-sw { position: absolute; top: 16px; right: 16px; display: flex; border: 1px solid #3a3a3a; border-radius: 3px; overflow: hidden; z-index: 2; }
.lang-sw button { background: none; border: 0; border-radius: 0; padding: 6px 14px; font-size: 13px; color: #9a9384; cursor: pointer; }
.lang-sw button + button { border-left: 1px solid #3a3a3a; }
.lang-sw button:hover { color: #efe7d6; }
.lang-sw button.on { background: #c9a96a; color: #14110a; font-weight: bold; cursor: default; }
