:root {
  --bg: #f4f5f8;
  --card: #ffffff;
  --line: #e3e6ee;
  --ink: #0b1220;
  --text: #111827;
  --muted: #5b6475;
  --primary: #ea580c;
  --primary-dark: #c2410c;
  --primary-light: #fff4ec;
  --amber: #f59e0b;
  --panel: #0b1220;
  --panel-2: #131d33;
  --panel-text: #c9d3ea;
  --panel-muted: #7f8db0;
  --ok: #059669;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --radius: 16px;
  --shadow: 0 1px 2px rgb(15 23 42 / 0.04), 0 8px 24px -12px rgb(15 23 42 / 0.12);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif; background: var(--bg); color: var(--text); line-height: 1.75; padding: 16px; overflow-wrap: anywhere; -webkit-font-smoothing: antialiased; }
.container { max-width: 860px; margin: 0 auto; }
a { color: var(--primary-dark); text-underline-offset: 3px; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.25; letter-spacing: -0.02em; font-weight: 800; }
h2 { font-size: 1.15rem; line-height: 1.45; margin: 0 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 1rem; margin: 18px 0 8px; }
p, ul, ol, table { margin-bottom: 10px; }
ul, ol { padding-left: 1.4em; }
.note { color: var(--muted); font-size: 0.85rem; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.kicker { display: block; font-family: var(--mono); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--primary); margin-bottom: 2px; }

/* サイトのヘッダー */
.site-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 18px; padding: 4px 0 14px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.logo { font-family: var(--mono); font-size: 1.05rem; font-weight: 800; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.logo::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--primary); margin-right: 8px; vertical-align: 1px; box-shadow: 14px 0 0 var(--amber); margin-right: 22px; }
.site-nav { display: flex; flex-wrap: wrap; gap: 2px 4px; font-size: 0.86rem; font-weight: 600; }
.site-nav a { text-decoration: none; color: var(--muted); padding: 4px 8px; border-radius: 8px; }
.site-nav a:hover { color: var(--ink); background: #e9ebf1; }
.crumbs { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; font-size: 0.78rem; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 4px; opacity: 0.5; }
.page-h1 { margin-bottom: 18px; }

/* カード・本文 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.prose h2 { display: flex; align-items: center; gap: 10px; }
.prose h2::before { content: ""; width: 6px; height: 18px; border-radius: 3px; background: var(--primary); flex: none; }
.prose li { margin-bottom: 4px; }
.fig { margin: 14px 0; }
.fig svg { width: 100%; max-width: 600px; height: auto; display: block; border-radius: 14px; }
.fig figcaption { font-size: 0.84rem; color: var(--muted); margin-top: 6px; }
.tbl { border-collapse: collapse; font-size: 0.9rem; min-width: 240px; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: 6px 14px; text-align: left; }
.tbl thead th { font-size: 0.78rem; color: var(--muted); font-weight: 700; }
.tbl.num td { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.sources { font-size: 0.88rem; }

/* ボタン（一般） */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-size: 0.9rem; font-weight: 700; cursor: pointer; text-decoration: none; touch-action: manipulation; transition: background 0.15s, border-color 0.15s, transform 0.1s; }
.btn:hover:not(:disabled) { border-color: #c5cad6; background: #fafbfc; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 6px 16px -8px rgb(234 88 12 / 0.7); }
.btn.primary:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.big { min-height: 52px; padding: 10px 24px; font-size: 1rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.msg { padding: 8px 12px; border-radius: 10px; font-size: 0.9rem; margin: 8px 0; }
.msg.error { background: var(--danger-bg); color: var(--danger); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* トップページ */
.hero { margin: 8px 0 22px; }
.hero h1 { font-family: var(--mono); letter-spacing: -0.04em; font-size: clamp(2rem, 6vw, 3rem); }
.hero-sub { font-size: 1.02rem; color: var(--muted); margin-top: 6px; }
.card.game-card { padding: 0; overflow: hidden; }
.game-card-art { display: block; background: var(--panel); padding: 14px; }
.game-card-art svg { width: 100%; height: auto; display: block; }
.game-card-body { padding: 20px 22px 22px; }
.game-card h2 { font-size: 1.6rem; letter-spacing: -0.02em; margin-bottom: 6px; }
.game-card h2 small { display: block; font-size: 0.9rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.today-status { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 0.82rem; font-weight: 700; color: var(--ink); background: #eef0f5; border-radius: 999px; padding: 4px 12px; }
.today-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgb(5 150 105 / 0.18); }
.about-list { list-style: none; padding: 0; display: grid; gap: 10px; }
.about-list li { padding-left: 22px; position: relative; }
.about-list li::before { content: ""; position: absolute; left: 2px; top: 0.7em; width: 8px; height: 8px; border-radius: 2px; background: var(--primary); }

/* ---- プレイ画面 ---- */
.game { margin-bottom: 20px; }
.game-top { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 10px 20px; margin-bottom: 12px; }
.puzzle-title { margin: 0; font-size: 1.25rem; }
.puzzle-date { font-size: 0.85rem; color: var(--muted); margin: 0; }
.score { display: grid; grid-template-columns: repeat(3, auto); gap: 6px; margin: 0; }
.score div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px 6px; text-align: center; min-width: 74px; }
.score dt { font-size: 0.68rem; font-weight: 700; color: var(--muted); letter-spacing: 0.08em; }
.score dd { font-family: var(--mono); font-size: 1.6rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--ink); }
.score div:first-child dd { color: var(--primary); }

.levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; background: #e8eaf0; padding: 4px; border-radius: 14px; margin-bottom: 12px; }
.level { border: 0; background: transparent; border-radius: 10px; padding: 6px 4px; font: inherit; font-weight: 700; font-size: 0.9rem; color: var(--muted); cursor: pointer; line-height: 1.3; }
.level small { display: block; font-family: var(--mono); font-size: 0.7rem; font-weight: 600; }
.level.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgb(15 23 42 / 0.12); }

.panel { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border-radius: 20px; padding: 12px; box-shadow: 0 20px 40px -24px rgb(11 18 32 / 0.6); color: var(--panel-text); }
.target-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 4px 6px 12px; }
.tag { font-family: var(--mono); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.14em; color: var(--amber); border: 1px solid rgb(245 158 11 / 0.5); border-radius: 6px; padding: 1px 7px; }
.target-text { font-size: 0.85rem; color: var(--panel-text); }
.target-wrap { margin-left: auto; }
.target-wrap svg { height: 34px; width: auto; display: block; }
.board-wrap { position: relative; min-height: 140px; max-width: 620px; margin: 0 auto; }
.board { width: 100%; height: auto; display: block; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.board > :not(.hit):not(.wagon) { pointer-events: none; }
.board .wagon { cursor: pointer; transition: transform 0.38s cubic-bezier(0.2, 0.8, 0.2, 1); }
.board .wagon:hover rect:first-child { filter: brightness(1.12); }
.board .hit { fill: transparent; cursor: pointer; transition: fill 0.2s; }
.board .hit:hover { fill: rgb(245 158 11 / 0.05); }
.board .hit.sel { fill: rgb(245 158 11 / 0.09); stroke: rgb(245 158 11 / 0.45); stroke-width: 1.5; stroke-dasharray: 5 4; }
.board .trk { transition: stroke 0.2s; }
.board .trk.sel { stroke: var(--amber); filter: drop-shadow(0 0 4px rgb(245 158 11 / 0.8)); }
.board .lbl.sel { fill: var(--amber); }
@media (prefers-reduced-motion: reduce) { .board .wagon, .board .trk, .board .hit { transition: none; } }
.loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0; color: var(--panel-text); font-family: var(--mono); font-size: 0.85rem; background: rgb(11 18 32 / 0.6); border-radius: 14px; }
.spinner { width: 16px; height: 16px; border: 2px solid rgb(245 158 11 / 0.3); border-top-color: var(--amber); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.status { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 0.8rem; color: var(--panel-text); padding: 10px 6px 2px; margin: 0; min-height: 2.2em; }
.status::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.status:empty::after { content: "READY"; color: var(--panel-muted); }

.console { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-top: 12px; box-shadow: var(--shadow); }
.sidings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.siding { display: flex; align-items: baseline; justify-content: center; gap: 6px; min-height: 52px; border-radius: 12px; border: 1px solid var(--line); background: #f7f8fb; color: var(--ink); font: inherit; cursor: pointer; touch-action: manipulation; transition: background 0.15s, color 0.15s, box-shadow 0.15s; }
.siding b { font-family: var(--mono); font-size: 1.35rem; font-weight: 800; }
.siding small { font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.siding:hover { background: #eef0f5; }
.siding[aria-pressed="true"] { background: var(--panel); color: #fff; border-color: var(--panel); box-shadow: inset 0 -3px 0 var(--amber); }
.siding[aria-pressed="true"] small { color: var(--panel-muted); }
.ops { display: grid; gap: 8px; margin-top: 10px; }
.op { display: grid; grid-template-columns: 6.2em repeat(3, minmax(0, 1fr)); gap: 8px; align-items: center; }
.op-label { font-size: 0.84rem; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.op-label i { font-style: normal; color: var(--primary); font-family: var(--mono); }
.key { min-height: 48px; border-radius: 12px; border: 1px solid #d6dae4; background: #fff; font-family: var(--mono); font-size: 1.15rem; font-weight: 800; color: var(--ink); cursor: pointer; touch-action: manipulation; box-shadow: 0 2px 0 #d6dae4; transition: transform 0.08s, box-shadow 0.08s, background 0.15s; }
.key::after { content: "両"; font-family: inherit; font-size: 0.7rem; font-weight: 600; margin-left: 2px; color: var(--muted); }
.key:hover:not(:disabled) { background: var(--primary-light); border-color: #fdba74; box-shadow: 0 2px 0 #fdba74; }
.key:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 0 0; }
.key:disabled { opacity: 0.3; cursor: not-allowed; box-shadow: none; background: #f3f4f7; }
.key.hinted { border-color: var(--amber); box-shadow: 0 0 0 3px rgb(245 158 11 / 0.35), 0 2px 0 var(--amber); animation: pulse 1s ease-in-out 3; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgb(245 158 11 / 0.15), 0 2px 0 var(--amber); } }
@media (prefers-reduced-motion: reduce) { .key.hinted { animation: none; } }
.console .note { margin: 10px 2px 0; min-height: 1.5em; }

.controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ctl { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 6px 12px; border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--ink); font: inherit; font-size: 0.88rem; font-weight: 700; cursor: pointer; white-space: nowrap; touch-action: manipulation; }
.ctl:hover:not(:disabled) { background: #fff; }
.ctl:disabled { opacity: 0.35; cursor: not-allowed; }
.ctl.hint-btn:not(:disabled) { border-color: rgb(245 158 11 / 0.6); background: #fffbeb; }
.ctl.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.ctl.primary:hover:not(:disabled) { background: var(--primary-dark); }

.result { margin-top: 16px; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--primary); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); animation: rise 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .result { animation: none; } }
.result h2 { font-size: 1.4rem; }
.share-text { white-space: pre-wrap; font-family: var(--mono); background: var(--panel); color: #e5e9f5; border-radius: 12px; padding: 12px 14px; font-size: 0.9rem; line-height: 1.6; margin: 8px 0; }
.stats { margin: 16px 0 8px; }
.stat-cells { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; text-align: center; margin-bottom: 12px; }
.stat-cells div { background: #f6f7fa; border-radius: 10px; padding: 6px 2px; }
.stat-cells strong { display: block; font-family: var(--mono); font-size: 1.35rem; line-height: 1.2; }
.stat-cells span { font-size: 0.7rem; color: var(--muted); }
.dist { list-style: none; padding: 0; font-size: 0.8rem; }
.dist li { display: grid; grid-template-columns: 4.5em minmax(0, 1fr) 2.5em; gap: 8px; align-items: center; margin: 3px 0; font-family: var(--mono); }
.dist .bar { height: 14px; min-width: 3px; background: linear-gradient(90deg, var(--primary), var(--amber)); border-radius: 4px; }
.countdown { font-family: var(--mono); font-weight: 700; font-size: 0.95rem; }
.result-links { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.9rem; }

/* 過去のお題 */
.archive { list-style: none; padding: 0; }
.archive li { display: grid; grid-template-columns: 4.5em 9em minmax(0, 1fr) auto; gap: 8px; padding: 10px 4px; border-bottom: 1px solid var(--line); font-size: 0.9rem; align-items: center; }
.archive li a { font-family: var(--mono); font-weight: 800; }
.archive li.empty { display: block; color: var(--muted); }
.archive .st { font-size: 0.78rem; color: var(--muted); font-family: var(--mono); }
.archive .st.done { color: var(--ok); font-weight: 700; }
.archive .st.doing { color: var(--primary-dark); }
@media (max-width: 480px) { .archive li { grid-template-columns: 3.8em minmax(0, 1fr) auto; } .archive li span:nth-child(3) { display: none; } }

/* フッター（サイト内） */
.site-footer { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 18px; }
.footer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.site-footer h2 { font-size: 0.85rem; margin-bottom: 6px; }
.site-footer ul { list-style: none; padding: 0; font-size: 0.85rem; }

@media (max-width: 560px) {
  body { padding: 12px; }
  .card { padding: 16px; }
  /* 縦長の画面: 盤面を画面の端近くまで広げる */
  .panel { padding: 6px 4px; border-radius: 14px; margin: 0 -8px; }
  .target-row { padding: 4px 4px 10px; }
  .target-wrap { margin-left: 0; }
  .score div { min-width: 62px; padding: 3px 10px 5px; }
  .score dd { font-size: 1.35rem; }
  .op { grid-template-columns: 5.2em repeat(3, minmax(0, 1fr)); }
  .ctl { font-size: 0.82rem; padding: 6px 8px; }
}

/* 効果音のオン・オフ */
.game-meta { display: flex; gap: 6px; align-items: stretch; }
.sound-toggle { width: 48px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-size: 1.2rem; cursor: pointer; touch-action: manipulation; }
.sound-toggle:hover { background: #fafbfc; border-color: #c5cad6; }
.sound-toggle[aria-pressed="false"] { background: #f1f2f6; opacity: 0.7; }
@media (max-width: 560px) { .sound-toggle { width: 42px; } }

/* 横長で背の低い画面（スマホを横にしたとき）: 盤面を左、操作を右に並べ、盤面は画面の高さに合わせる */
@media (orientation: landscape) and (max-height: 540px) and (min-width: 600px) {
  body { padding: 8px 12px; }
  .container { max-width: none; }
  .game { display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, 290px); grid-template-areas: "top top" "levels levels" "panel console" "panel controls" "result result"; column-gap: 10px; align-items: start; }
  .game-top { grid-area: top; margin-bottom: 6px; }
  .levels { grid-area: levels; margin-bottom: 6px; }
  .panel { grid-area: panel; padding: 6px; border-radius: 14px; }
  .console { grid-area: console; margin-top: 0; padding: 8px; }
  .controls { grid-area: controls; margin-top: 8px; }
  .result { grid-area: result; }
  .puzzle-title { font-size: 1.05rem; }
  .score div { min-width: 56px; padding: 2px 8px 3px; }
  .score dd { font-size: 1.2rem; }
  .target-row { padding: 2px 4px 6px; }
  .target-text { display: none; }
  .target-wrap { margin-left: 0; }
  .target-wrap svg { height: 26px; }
  .board-wrap { max-width: none; }
  /* 盤面の高さ = 画面の高さ - スコア・目標・状態の行の分 */
  .board { height: calc(100svh - 150px); max-height: 420px; width: 100%; }
  .status { padding-top: 4px; min-height: 1.6em; font-size: 0.74rem; }
  .siding { min-height: 42px; }
  .siding b { font-size: 1.15rem; }
  .ops { gap: 6px; margin-top: 6px; }
  .op { grid-template-columns: 4.6em repeat(3, minmax(0, 1fr)); gap: 6px; }
  .key { min-height: 40px; font-size: 1rem; }
  .console .note { font-size: 0.75rem; margin-top: 6px; }
  .ctl { min-height: 40px; font-size: 0.78rem; padding: 4px 6px; flex: 1 1 40%; }
}

/* ---- ストーリー: 着任のあいさつ・指令書・昇進 ---- */
.intro { background: var(--panel); color: var(--panel-text); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; box-shadow: 0 20px 40px -24px rgb(11 18 32 / 0.6); }
.intro h2 { color: #fff; font-size: 1.25rem; }
.intro p { font-size: 0.92rem; }
.intro strong { color: var(--amber); }
.order { position: relative; background: #fffdf6; border: 1px solid #eadfc4; border-radius: 12px; padding: 10px 14px 10px 18px; margin-bottom: 10px; box-shadow: var(--shadow); }
.order::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 3px 3px 0; background: var(--primary); }
.order:empty { display: none; }
.order-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.order-tag { font-size: 0.7rem; font-weight: 800; color: #fff; background: var(--ink); border-radius: 4px; padding: 1px 6px; letter-spacing: 0.1em; }
.order-head strong { font-family: var(--mono); font-size: 1rem; }
.order-meta { font-size: 0.85rem; color: var(--muted); }
.order-cargo { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 8px 0 6px; }
.order-cargo li { display: inline-flex; align-items: center; gap: 4px; font-size: 0.82rem; font-weight: 700; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px 2px 3px; }
.order-cargo b { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--c); color: #fff; font-family: var(--mono); font-size: 0.75rem; }
.order-line { margin: 0; font-size: 0.88rem; }
.order-line span { font-size: 0.7rem; font-weight: 800; color: var(--muted); margin-right: 4px; }
.result-sub { color: var(--muted); font-size: 0.9rem; margin-top: -6px; }
.career { background: #f6f7fa; border-radius: 12px; padding: 10px 14px; margin: 12px 0; }
.career-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.career-rank { font-weight: 800; font-size: 1.05rem; }
.career-pts { font-family: var(--mono); font-size: 0.82rem; color: var(--muted); }
.career-bar { height: 8px; background: #e3e6ee; border-radius: 4px; overflow: hidden; margin: 6px 0; }
.career-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--amber)); border-radius: 4px; }
.career .note { margin: 0; }
.promote { background: var(--ink); color: #fff; border-radius: 8px; padding: 6px 12px; margin-bottom: 8px; font-weight: 700; animation: rise 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); }
.promote strong { color: var(--amber); }
.top-career { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }
.top-career strong { color: var(--ink); }

/* 横長で背の低い画面: 指令書は右の列に小さく */
@media (orientation: landscape) and (max-height: 540px) and (min-width: 600px) {
  .game { grid-template-areas: "intro intro" "top top" "levels levels" "panel order" "panel console" "panel controls" "result result"; }
  .intro { grid-area: intro; }
  .order { grid-area: order; padding: 6px 10px 6px 14px; margin-bottom: 8px; }
  .order-line, .order-meta { display: none; }
  .order-cargo { margin: 4px 0 0; }
  .order-cargo li { font-size: 0.7rem; padding-right: 6px; }
  .order-cargo li > span { display: none; }
  .controls { flex-wrap: nowrap; }
  .ctl { flex: 1 1 0; font-size: 0.72rem; }
}

/* ---- サイトのメニュー（ゲーム）とゲームごとのメニュー ---- */
.site-nav a { display: inline-flex; flex-direction: column; line-height: 1.25; }
.site-nav a small { font-size: 0.66rem; font-weight: 600; color: var(--muted); }
.game-nav { display: flex; gap: 4px; overflow-x: auto; margin: 0 0 14px; padding-bottom: 2px; scrollbar-width: none; }
.game-nav a { flex: none; font-size: 0.82rem; font-weight: 700; text-decoration: none; color: var(--muted); background: #e9ebf1; border-radius: 999px; padding: 4px 12px; }
.game-nav a[aria-current="page"] { background: var(--ink); color: #fff; }

/* ---- Daily Dispatch ---- */
.plan-wrap { overflow-x: auto; margin: 6px 0; }
.plan-table { border-collapse: collapse; font-size: 0.8rem; width: 100%; min-width: 360px; margin: 0; }
.plan-table th { font-size: 0.68rem; color: var(--muted); font-weight: 700; text-align: left; padding: 2px 6px; border-bottom: 1px solid #eadfc4; }
.plan-table td { padding: 3px 6px; border-bottom: 1px dashed #efe6cf; white-space: nowrap; }
.plan-table .num { font-family: var(--mono); text-align: right; }
.plan-table .late { color: #b45309; font-weight: 800; }
.tdot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); margin-right: 6px; vertical-align: -1px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.75rem; color: var(--panel-text); }
.legend .lg, .legend-static .lg { display: inline-flex; align-items: center; gap: 4px; }
.legend-static { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.82rem; background: var(--panel); color: var(--panel-text); border-radius: 8px; padding: 6px 10px; }
.diagram-wrap { position: relative; max-width: 780px; margin: 0 auto; }
.diagram { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.fig-diagram svg { max-width: 640px; }
.diagram .wait { cursor: pointer; }
.diagram .wait:hover .wait-bar { stroke-opacity: 0.65; }
.diagram .wait.hinted .wait-bar { stroke-opacity: 0.95; animation: waitpulse 1s ease-in-out 3; }
@keyframes waitpulse { 50% { stroke-width: 18; } }
@media (prefers-reduced-motion: reduce) { .diagram .wait.hinted .wait-bar { animation: none; } }
.game.stuck .panel { box-shadow: 0 0 0 3px #f87171, 0 20px 40px -24px rgb(11 18 32 / 0.6); }
.game.stuck .status::before { background: #f87171; box-shadow: 0 0 6px #f87171; }
.console-h { font-size: 0.84rem; font-weight: 800; margin: 0 2px 8px; }
.console-h small { font-weight: 600; color: var(--muted); margin-left: 6px; }
.orders { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.orders li { display: grid; grid-template-columns: 7.6em minmax(0, 1fr); gap: 6px; align-items: center; }
.seg-name { font-size: 0.78rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.seg-name i { font-style: normal; margin: 0 2px; opacity: 0.6; }
.orders .chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0; }
.orders .arrow { color: var(--muted); font-size: 0.7rem; }
.tchip { display: inline-flex; align-items: center; gap: 3px; min-height: 36px; padding: 2px 10px 2px 8px; border-radius: 10px; border: 1px solid #d6dae4; border-left: 5px solid var(--c); background: #fff; font: inherit; font-size: 0.8rem; font-weight: 700; color: var(--ink); cursor: pointer; touch-action: manipulation; box-shadow: 0 2px 0 #d6dae4; }
.tchip i { font-style: normal; color: var(--muted); font-size: 0.72rem; }
.tchip:hover:not(:disabled) { background: var(--primary-light); }
.tchip:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.tchip:disabled { cursor: default; box-shadow: none; background: #f6f7fa; }
.tchip.hinted { border-color: var(--amber); border-left-color: var(--c); box-shadow: 0 0 0 3px rgb(245 158 11 / 0.4); animation: pulse 1s ease-in-out 3; }
@media (max-width: 560px) { .orders li { grid-template-columns: minmax(0, 1fr); gap: 2px; } }
@media (orientation: landscape) and (max-height: 540px) and (min-width: 600px) {
  .game.dispatch { grid-template-areas: "intro intro" "top top" "levels levels" "panel console" "panel controls" "plan plan" "result result"; }
  .game.dispatch .plan { grid-area: plan; margin-top: 10px; }
  .game.dispatch .plan .order-line, .game.dispatch .plan .order-meta { display: inline; }
  .game.dispatch .diagram { width: auto; max-width: 100%; max-height: calc(100svh - 120px); margin: 0 auto; }
  .game.dispatch .orders li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .game.dispatch .tchip { min-height: 30px; font-size: 0.72rem; }
}
.game.dispatch .plan { margin-top: 12px; }
