/* NIGHTWATCH — 暗いサバイバル調。全画面を 960x540 の #stage に収めて scale で拡縮する（スクロールなし） */
:root {
  --font: "Yu Gothic UI", "Meiryo", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }
body {
  background: #02080b;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.45;
  user-select: none;
}

#viewport { --nw-core-ready: 1; position: fixed; inset: 0; overflow: hidden; }
#stage {
  position: absolute; left: 50%; top: 50%;
  width: 960px; height: 540px; margin: -270px 0 0 -480px;
  transform-origin: 50% 50%;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% -10%, #12333f 0%, var(--bg2) 45%, var(--bg) 100%);
}
#stage canvas#game { position: absolute; left: 0; top: 0; width: 960px; height: 540px; display: block; }
/* 2026-11-04: "#stage canvas#game" (two ids) outranked these, so the field canvas stayed in every mode; on phones its 960x540 box
   gave the viewport-sized stage hidden scroll. Same selector here so the per-mode rule wins. */
body[data-mode="select"] #stage canvas#game,
body[data-mode="brief"] #stage canvas#game,
body[data-mode="result"] #stage canvas#game { display: none; }
body[data-mode="night"] #game { cursor: none; }
body[data-mode="night"].wh-open #game,
body[data-mode="night"].is-paused #game { cursor: default; }

.screen { position: absolute; inset: 0; padding: 12px 20px; }
.screen-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.logo { margin: 0; font-size: 20px; letter-spacing: 0.14em; color: var(--amber); font-family: var(--mono); }
.logo-sub { font-size: 13px; color: var(--muted); letter-spacing: 0.1em; margin-left: 6px; }
.screen-title { margin: 4px 0 2px; font-size: 20px; color: var(--amber); letter-spacing: 0.06em; }
.lead { margin: 0 0 8px; color: var(--muted); }
.note { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }
kbd { font-family: var(--mono); font-size: 11px; font-weight: 700; color: #1b1203; background: var(--amber); border-radius: 3px; padding: 0 5px; }

/* ボタン */
.btn {
  appearance: none; font: inherit; color: var(--text); cursor: pointer;
  background: linear-gradient(#1b3f50, #122e3b);
  border: 1px solid var(--line); border-radius: 5px; padding: 6px 14px;
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.btn:hover:not(:disabled) { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber) inset; }
.btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: .5; }
.btn-primary { background: linear-gradient(#c7821f, #8f5a12); border-color: #e7a747; color: #fff7e6; font-weight: 700; }
.btn-primary:hover:not(:disabled) { background: linear-gradient(#e29a2e, #a56a17); }
.btn-accent { border-color: var(--amber); color: var(--amber); }
.btn-big { padding: 10px 26px; font-size: 16px; }
.btn-small { padding: 2px 9px; font-size: 12px; }
.btn-sound[aria-pressed="true"] { border-color: var(--amber); color: var(--amber); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

/* 区分タグ */
.tag { display: inline-block; font-size: 10.5px; line-height: 1.45; padding: 0 5px; border-radius: 3px; border: 1px solid; vertical-align: middle; white-space: nowrap; }
.tag-unique { color: #86e0da; border-color: #3b8f8a; background: #0f3a3b; }
/* Unique weapons cannot be stored: lock mark on the tag + a dashed teal frame on the card/row, distinct from the equipped gold edge (CK 10-22). */
.tag-unique::before { content: "\1F512"; margin-right: 3px; font-size: .9em; }
.is-unique { outline: 2px dashed #7fd3c8; outline-offset: -4px; }
.tag-repairable { color: #f7cf7a; border-color: #b8842c; background: #3a2c10; }
.tag-disposable { color: #f7a091; border-color: #b04d3f; background: #3a1a15; }

/* ---------- キャラ選択（5枚横一列） ---------- */
.card-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
.card {
  appearance: none; font: inherit; color: inherit; text-align: left; cursor: pointer;
  background: linear-gradient(#112c37, #0b1c24); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px; display: flex; flex-direction: column; gap: 5px; min-width: 0; height: 392px;
  transition: transform .14s, border-color .14s, box-shadow .14s;
}
.card:hover, .card:focus-visible { border-color: var(--amber); transform: translateY(-3px); box-shadow: 0 6px 18px rgba(0,0,0,.5), 0 0 0 1px var(--amber) inset; outline: none; }
.card canvas { width: 100%; height: 150px; border-radius: 5px; display: block; background: #0a1b22; flex: none; }
.card-name { font-size: 16px; font-weight: 700; color: var(--amber); }
.card-desc { font-size: 12px; color: var(--text); overflow-wrap: anywhere; line-height: 1.4; }
.card-uniq { list-style: none; margin: 0; padding: 5px 0 0; border-top: 1px dashed var(--line); font-size: 11.5px; color: var(--muted); }
.card-uniq li { margin: 2px 0; overflow-wrap: anywhere; }
.card-uniq b { color: var(--text); font-weight: 600; }

/* ---------- 装備確認 ---------- */
.brief-grid { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; margin-top: 4px; }
.brief-who canvas { width: 200px; height: 250px; border-radius: 8px; border: 1px solid var(--line); display: block; background: #0a1b22; }
.brief-name { font-size: 19px; font-weight: 700; color: var(--amber); margin-top: 6px; }
.brief-desc { font-size: 12px; color: var(--muted); }
.brief-extra { margin-top: 6px; font-size: 13px; color: var(--text); }
.legend { list-style: none; margin: 0; padding: 0; font-size: 12px; color: var(--muted); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.legend .tag { margin-right: 6px; }
.controls { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr); gap: 3px 14px; margin: 0; font-size: 12.5px; }
.controls dt { color: var(--amber); font-family: var(--mono); }
.controls dd { margin: 0; color: var(--text); }

/* ---------- 武器スロット行（確認・倉庫・昼で共通） ---------- */
.slot-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 1px 8px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; min-width: 0; min-height: 38px;
}
.slot-row.empty { grid-template-columns: auto 1fr; color: var(--muted); border-style: dashed; background: rgba(15,38,48,.45); }
.slot-row.equipped { border-color: var(--amber); background: linear-gradient(#2b2a1c, #1a2128); box-shadow: 0 0 8px rgba(242,169,59,.3); }
.slot-row.unusable .slot-name { opacity: .7; }
.slot-row.selected { border-color: #7fe0d4; box-shadow: 0 0 0 1px #7fe0d4 inset; }
.slot-key { font-family: var(--mono); font-weight: 700; color: var(--amber); background: #000a; border-radius: 4px; padding: 0 6px; min-width: 20px; text-align: center; }
.slot-body { min-width: 0; }
.slot-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.slot-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-flag { color: var(--amber); font-size: 11px; font-weight: 700; white-space: nowrap; }
.slot-stats { color: var(--muted); font-family: var(--mono); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-reason { color: var(--danger); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-btns { display: flex; gap: 5px; align-items: center; }
.slot-note { color: var(--muted); font-size: 11px; white-space: nowrap; }

/* ---------- 夜 HUD ---------- */
.screen-night { padding: 0; pointer-events: none; }
.screen-night > * { pointer-events: auto; }
.hud-top {
  position: absolute; left: 0; right: 0; top: 0; height: 34px;
  display: flex; align-items: center; gap: 4px 16px; padding: 0 10px;
  background: linear-gradient(rgba(5,14,19,.82), rgba(5,14,19,.6)); border-bottom: 1px solid rgba(42,90,105,.7);
}
.hud-wave { font-family: var(--mono); font-size: 16px; color: var(--amber); font-weight: 700; letter-spacing: .08em; white-space: nowrap; }
.hud-cell { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hud-cell[hidden] { display: none; }
.hud-lookout-lane { margin-right: 8px; white-space: nowrap; }
.hud-lookout-lane > span { margin-right: 3px; }
#hud-lookout { margin-right: 14px; }
.hud-bar-cell { flex: 1 1 200px; }
.hud-label { color: var(--muted); font-size: 12px; white-space: nowrap; }
.hud-num { font-family: var(--mono); font-weight: 700; min-width: 2ch; }
.hud-buttons { margin-left: auto; gap: 6px; }
.bar { flex: 1 1 auto; height: 12px; background: #04090c; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; min-width: 60px; }
.bar-fill { display: block; height: 100%; width: 100%; background: linear-gradient(#e9b24d, #b97a1e); transition: width .15s; }
.bar-fill.low { background: linear-gradient(#ef6b5c, #a8362b); }


.hud-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; height: 38px; padding: 0 8px 2px;
  display: flex; align-items: stretch; justify-content: space-between; gap: 10px;
  background: linear-gradient(rgba(5,14,19,0), var(--band) 30%);
  pointer-events: none;
}
.hud-slots { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; pointer-events: auto; }
.slot {
  position: relative; width: 172px; height: 36px; padding: 2px 7px 3px; overflow: hidden; cursor: pointer; line-height: 1.2;
  background: var(--band); border: 1px solid rgba(42,90,105,.9); border-radius: 5px;
  display: flex; flex-direction: column; justify-content: center; gap: 0; min-width: 0;
}
.slot:hover { border-color: var(--amber); }
.slot.equipped { border-color: var(--amber); background: rgba(52,42,18,.82); box-shadow: 0 0 8px rgba(242,169,59,.4); }
.slot.unusable .slot-name { opacity: .65; }
.slot.empty { flex-direction: row; align-items: center; gap: 8px; cursor: default; color: var(--muted); border-style: dashed; background: rgba(5,14,19,.5); }
.slot-top { display: flex; align-items: center; gap: 5px; min-width: 0; flex: none; }
.slot .tag { line-height: 1.2; }
.slot .slot-stats, .slot .slot-reason { flex: none; line-height: 1.2; }
.slot-top .slot-name { flex: 1 1 auto; min-width: 0; font-size: 12.5px; }
.slot-top .slot-key { font-size: 11px; padding: 0 4px; min-width: 16px; }
.slot-empty { font-size: 12px; }
.slot-reload { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: transparent; }
.slot-reload b { display: block; height: 100%; width: 0; background: #fff; }
.slot.reloading { border-color: #ffffff; }

.hud-right { display: flex; align-items: center; gap: 14px; pointer-events: none; padding-right: 2px; }
.hud-grenade { font-family: var(--mono); font-weight: 700; color: var(--amber); font-size: 14px; white-space: nowrap; text-shadow: 0 1px 3px #000; }
.hud-grenade.none { color: var(--muted); }
.hud-ammo { display: flex; align-items: baseline; gap: 8px; text-shadow: 0 1px 4px #000; }
.ammo-side { display: flex; flex-direction: column; line-height: 1.2; }
.ammo-sub { font-family: var(--mono); font-size: 12px; color: var(--text); white-space: nowrap; }
.ammo-name { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* 倉庫パネル（左寄り。右側の戦況が見える幅） */
.wh-panel {
  position: absolute; left: 8px; top: 40px; width: 480px; max-height: 456px; padding: 6px 10px 8px;
  background: rgba(7, 18, 24, 0.9); border: 1px solid var(--amber); border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,.6);
  display: flex; flex-direction: column; gap: 4px;
}
.wh-head { display: flex; align-items: center; gap: 10px; }
.wh-title { margin: 0; font-size: 17px; color: var(--amber); letter-spacing: .2em; }
.wh-note { flex: 1 1 auto; min-width: 0; white-space: nowrap; color: #ffd9a0; font-weight: 700; font-size: 12px; background: rgba(168,105,26,.28); border: 1px solid var(--amber-dark); border-radius: 3px; padding: 0 8px; }
.wh-close { font-size: 16px; line-height: 1; padding: 2px 9px; }
.wh-hint { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.wh-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }

/* 手持ち／倉庫ウィジェット */
.hs { display: grid; gap: 6px 14px; }
.hs-col { display: grid; gap: 4px; align-content: start; min-width: 0; }
.wh-panel .slot-row { padding: 2px 6px; min-height: 0; line-height: 1.25; gap: 0 6px; }
.wh-panel .hs-col, .wh-panel .hs-list { gap: 3px; }
.hs-title { margin: 2px 0 0; font-size: 12px; color: var(--muted); letter-spacing: .06em; border-left: 3px solid var(--amber-dark); padding-left: 7px; font-weight: 600; }
.hs-list { display: grid; gap: 4px; align-content: start; }
.hs-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.hs-box { min-height: 0; }
/* 行を1行に圧縮（名前・区分・数値を横並び）。多数でもスクロールを避ける */
.hs .slot-row { padding: 2px 8px; min-height: 0; line-height: 1.25; }
.hs .slot-body { display: flex; align-items: center; gap: 0 8px; min-width: 0; }
.hs .slot-head { flex: none; }
.hs .slot-name { max-width: 110px; }
.hs .slot-stats, .hs .slot-reason { flex: 1 1 0; min-width: 0; }
.hs .slot-body:has(.slot-reason) .slot-stats { display: none; }
.hs .slot-row.empty { min-height: 29px; }
.btn-dim { opacity: .55; }

/* ---------- ポーズ・トースト ---------- */
.pause-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(2,8,12,.7); z-index: 30; }
.pause-box { text-align: center; padding: 20px 30px; background: var(--panel); border: 1px solid var(--amber); border-radius: 8px; }
.pause-title { font-size: 26px; color: var(--amber); letter-spacing: .2em; font-weight: 700; }
.pause-sub { color: var(--muted); margin: 4px 0 14px; }
.toast {
  position: absolute; left: 50%; bottom: 46px; transform: translateX(-50%); z-index: 40;
  background: rgba(10,20,26,.94); border: 1px solid var(--amber); color: var(--text);
  padding: 4px 14px; border-radius: 4px; font-size: 13px; max-width: 80%; text-align: center; pointer-events: none;
}

/* Version stamp remains available before daytime styles load. */
.version-label{position:absolute;z-index:40;top:1px;left:50%;transform:translateX(-50%);padding:1px 7px;border-radius:0 0 5px 5px;background:#f9eddfcc;color:#826b96;font-size:9px;pointer-events:none;white-space:nowrap}
body[data-mode="night"] .version-label{top:46px}
@media(max-width:700px),(pointer:coarse){
  body[data-mode="day"] .version-label{position:fixed;top:0;left:auto;right:0;transform:none;font-size:8px}
}
#day-panel.base-css-pending{visibility:hidden}

/* ---------- 昼 ---------- */
#day-panel.screen-day {
  display: flex; flex-direction: column; width: 100%; height: 100%;
  min-width: 0; min-height: 0; padding: 0; overflow: clip; font-size: 13px;
}
#day-panel .day-head {
  position: relative; z-index: 20; flex: 0 0 44px; height: 44px; min-height: 0;
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  align-items: center; gap: 8px; padding: 0 8px;
  background: #152d38; border-bottom: 1px solid #53736a;
}
/* Two lines fit the 44px head; one ellipsised line cut "Wakaba neighbourhood · Defence 1 / 2 · Town 1/3" to "Wakaba neighbourhood · Defe…" (clipping scan 10-24) */
#day-panel .day-title {
  min-width: 0; max-width: 180px; margin: 0;
  font-size: 12px; line-height: 1.2; color: #f0e7d1; white-space: normal; text-wrap: balance;
}
#day-panel .hours {
  display: flex; flex-direction: column; flex-wrap: nowrap; align-items: flex-start;
  min-width: 0; gap: 2px;
}
#day-panel .meter { display: flex; gap: 2px; }
#day-panel .meter i {
  display: block; width: 6px; height: 4px; border-radius: 1px;
  background: #a2ccb2; border: 1px solid #d2dfbc;
}
#day-panel .meter i.used { background: #263f48; border-color: #4b6764; }
#day-panel .hours-text {
  font-family: var(--mono); font-size: 10px; line-height: 1.2;
  font-weight: 700; color: #f0e7d1; white-space: nowrap;
}
#day-panel .day-status {
  display: grid; grid-template-columns: repeat(2, max-content); justify-content: end;
  gap: 1px 8px; min-width: 0; margin: 0; color: #b7c9c9;
  font-size: 9px; line-height: 1.2; white-space: nowrap;
}
#day-panel .day-status b { color: #f0e7d1; font-family: var(--mono); }

#day-panel .day-content {
  position: relative; inset: auto; flex: 1 1 0; height: auto;
  min-width: 0; min-height: 0; margin: 0; padding: 8px;
  background: none; border: 0; border-radius: 0; overflow: clip;
}
.broken-label { color: var(--danger); font-weight: 700; font-size: 11.5px; }
.empty-msg { padding: 24px; text-align: center; color: var(--muted); }

/* 仲間タブ */
.ally-list { display: grid; gap: 6px; }
.ally-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.ally-name { font-size: 14px; color: #ffc766; min-width: 54px; }
.chip { display: inline-block; font-size: 11.5px; line-height: 1.5; padding: 0 7px; border-radius: 9px; border: 1px solid; white-space: nowrap; }
.chip-good { color: #9fe6b6; border-color: #3d8f5d; background: #11301f; }
.chip-bad { color: #ffab9f; border-color: #a8483b; background: #38171a; }
.chip-normal { color: var(--text); border-color: #5b6f75; background: #1b2a30; }
.chip-bonus { color: #ffd9a0; border-color: var(--amber-dark); background: #32230d; }
/* rules.uniqueAllies: gold (the L rarity tokens) marks a unique ally; a dark plate keeps the chip readable on both themes. */
.chip.chip-unique { color: var(--rarity-l-text); background: var(--rarity-l-deep); border-color: var(--rarity-l-edge); }
.ally-unique .ally-name { color: var(--rarity-l-edge); }
.ally-top .ally-hold { margin-left: auto; }
.ally-hold, .ally-cands { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 7px; font-size: 12.5px; }
.ally-hold-label { color: var(--muted); font-size: 11.5px; min-width: 28px; }
.cand { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; }
.cand-dur { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.cand-rate { font-size: 11px; font-weight: 700; }
.cand-good { border-color: #3d8f5d; } .cand-good .cand-rate { color: #9fe6b6; }
.cand-bad { border-color: #a8483b; } .cand-bad .cand-rate { color: #ffab9f; }
.cand-normal .cand-rate { color: var(--text); }
.cand-broken .cand-name { text-decoration: line-through; text-decoration-color: var(--danger); }

#day-panel .day-foot {
  position: static; display: flex; flex-direction: column; align-items: stretch;
  flex: none; width: 100%; height: auto; min-width: 0; min-height: 0;
  margin: auto 0 0; gap: 3px; overflow: clip;
}
.log-list {
  list-style: none; margin: 0; padding: 6px 10px; flex: 1 1 auto; min-width: 0;
  background: rgba(18, 12, 7, 0.9); border: 1px solid #5a4325; border-radius: 6px; font-size: 12.5px; overflow: hidden;
}
.log-list li { padding: 1px 0; border-bottom: 1px dotted #4a3822; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.log-list li:first-child { color: #ffd9a0; font-weight: 700; }
.log-list li.fail { color: var(--danger); }
#day-panel .day-foot .log-list {
  flex: none; height: auto; max-height: none; padding: 3px 5px;
  font-size: 9px; line-height: 1.2; border-radius: 4px;
}
#day-panel .day-next {
  order: -1; flex: none; width: auto; display: flex; flex-direction: column;
  align-items: stretch; min-width: 0; gap: 3px;
}
#day-panel .day-next .btn-big {
  min-width: 0; min-height: 32px; padding: 4px 6px;
  font-size: 11px; line-height: 1.2;
}
#day-panel .day-next .note {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  max-width: none; gap: 3px; font-size: 9px; line-height: 1.2; text-align: center;
}

/* ---------- 結果 ---------- */
.result { text-align: center; padding-top: 100px; }
.result-title { font-size: 48px; margin: 0 0 6px; letter-spacing: .3em; }
.result.win .result-title { color: var(--ok); }
.result.lose .result-title { color: var(--danger); }
.result-stats { display: inline-grid; grid-template-columns: max-content max-content; gap: 6px 22px; margin: 14px 0 6px; text-align: left; font-size: 18px; }
.result-stats dt { color: var(--muted); }
.result-stats dd { margin: 0; font-family: var(--mono); color: var(--amber); font-weight: 700; }
.result .btn-row { justify-content: center; margin-top: 24px; }

/* ステージ内のレイアウトは拡縮前提の固定値。親要素のスクロールバーが出ないよう念のため */
#viewport, #stage { scrollbar-width: none; }

/* Pop cel pass: lavender ink, mint/coral accents and soft collectible cards. */
:root {
  --bg: #eee6fa; --bg2: #e2dbf7; --panel: #f7f2ff; --panel2: #e5dcf6;
  --line: #aca0cc; --amber: #795ba9; --amber-dark: #a87caf;
  --text: #483c66; --muted: #74698d; --danger: #b84a69; --ok: #378369;
  --band: rgba(246, 240, 255, .95);
}
body { background: #b8abd5; }
#stage { background: #eee6fa; }
#screen-select, #screen-brief, .result {
  background: radial-gradient(circle at 9% 2%, #ffffffb3 0 12%, transparent 12.3%),
    radial-gradient(circle at 95% 97%, #d0ece59e 0 20%, transparent 20.3%),
    linear-gradient(145deg, #f5eefe, #e1daf6 62%, #dedfee);
}
.screen-head { min-height: 34px; }
.screen-head .logo { margin-right: auto; }
.logo { color: #5b4c83; font-family: var(--font); font-size: 23px; letter-spacing: .06em; font-weight: 900; }
.logo-sub { color: #9383af; font-size: 12px; }
.screen-title { color: #6f5d96; font-size: 19px; margin: 4px 0 1px; }
#select-title::before { content: '★ '; color: #b48761; }
.lead { font-size: 11.5px; }
.btn {
  border: 2px solid #b0a3ce; border-radius: 11px;
  background: #fbf6ff; color: #5a4a78; box-shadow: 0 3px 0 #c4b9da;
  font-weight: 700; transition: transform .13s, box-shadow .13s, background .13s;
}
.btn:hover:not(:disabled) { border-color: #8b77b6; background: #e7dcff; box-shadow: 0 3px 0 #ad9bce; }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #b2a3cd; }
.btn:focus-visible { outline: 3px solid #7960b0; outline-offset: 3px; }
.btn-primary { background: #a9e4ca; border-color: #69a995; color: #345d55; box-shadow: 0 4px 0 #85b8a8; }
.btn-primary:hover:not(:disabled) { background: #baf0d7; border-color: #518e7b; box-shadow: 0 4px 0 #77a897; }
.btn-small { border-width: 1.5px; padding: 2px 8px; font-size: 11px; border-radius: 8px; }
.btn-sound[aria-pressed="true"], .js-motion[aria-pressed="true"] { background: #e0f5e9; border-color: #70a990; color: #3f7561; }
.card-list { gap: 10px; margin-top: 9px; }
.card {
  position: relative; padding: 5px; gap: 4px; height: 410px;
  border: 2px solid #a698c7; border-radius: 17px;
  background: #faf6ff; box-shadow: 0 5px 0 #c3b8dc;
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.card:hover, .card:focus-visible { transform: translateY(-4px); border-color: #8770b4; box-shadow: 0 9px 0 #c3b8dc, 0 0 0 3px #fff7; }
.card::after { content: '出撃 →'; margin-top: auto; align-self: stretch; text-align: center; padding: 3px 0; background: #e7def6; color: #786399; border-radius: 7px; font-size: 10.5px; font-weight: 800; letter-spacing: .15em; }
.card canvas { height: 207px; border-radius: 11px; background: #8c7bc4; }
.card-text { padding: 1px 4px; }
.card-name { font-size: 15px; color: #665086; margin-bottom: 2px; }
.card-desc { font-size: 10.8px; line-height: 1.4; }
.card-desc, .card-uniq, .card-uniq li { color: #55486c; font-weight: 600; }
.hud-bottom .slot-stats, .hud-bottom .slot-empty, .ammo-sub, .ammo-name { color: #55456f; font-weight: 700; }
.card-uniq { font-size: 10.5px; border-top: 1px solid #d5c9e7; margin-top: 4px; padding-top: 4px; }
.card-uniq li { margin: 1px 0; }
.brief-who canvas { border: 3px solid #b4a2cf; border-radius: 18px; box-shadow: 0 5px 0 #c3b7d9; }
.brief-name { color: #6a5391; }
.tag-unique { color: #3c7a6b; border-color: #8ac4b1; background: #e0f5ec; }
.tag-repairable { color: #876532; border-color: #d6b37d; background: #fff0d5; }
.tag-disposable { color: #9a5970; border-color: #daa1b6; background: #ffe3ee; }
kbd { color: #64517e; background: #e7dbfb; border: 1px solid #c0abd6; }
.slot-row { border-radius: 10px; background: #f9f4ff; border-color: #bfb0d7; }
.slot-row.empty { background: #ece5f4; color: #8b7ca4; }
.slot-row.equipped { background: #fff1d2; border-color: #cda976; box-shadow: 0 0 0 1px #f5d19e inset; }
.slot-key { color: #715b99; background: #e5d8f5; }
.hud-top { background: #f4edffed; border-bottom: 2px solid #b5a6cd; }
.hud-wave { color: #765b9e; }
.bar { background: #dfd4ed; border-color: #b0a2c6; }
.bar-fill { background: #92cbb1; }
.bar-fill.low { background: #ed96ad; }
.hud-bottom { background: #f4edffed; border-top-color: #b5a6cd; }
.hud-slots li, .hud-slot { color: var(--text); background: #f9f3ff; border-color: #b6a4ce; }
.hud-slots li.equipped, .hud-slot.equipped { background: #fff1d2; border-color: #d6ad71; box-shadow: none; }
.hud-grenade { color: #7b5d9b; }
.hud-grenade, .hud-ammo { text-shadow: none; }
.slot.empty { background: #ebe3f4; color: #8a7aa4; }
.wh-panel { background: #f6eefffa; border: 2px solid #ad9cc9; border-radius: 15px; box-shadow: 0 7px 0 #7d709b66; }
.wh-head { background: #e9def9; border-color: #b3a0cd; }
.wh-title { color: #775b9e; }
.wh-note, .wh-hint { color: #78688f; }
.wh-note { background: #fff0d8; border-color: #d8b799; }
.pause-overlay { background: #5d4b7c55; }
.pause-box { background: #f6efff; border: 3px solid #ac98c8; border-radius: 24px; box-shadow: 0 6px 0 #84729e; }
.pause-title { color: #725397; }
.pause-sub { color: #8d7ba4; }
.toast { background: #fff0ce; color: #73578b; border: 2px solid #bea1cb; border-radius: 12px; }

.day-head .btn-small { flex-shrink: 0; white-space: nowrap; }
.cand-good .cand-rate { color: #467c66; }
.cand-bad .cand-rate { color: #a45b74; }
.log-list { background: #faf5ff; border-color: #c1aed6; border-radius: 12px; }
.ally-name, .log-list li:first-child { color: #77589d; }
.log-list li { border-bottom-color: #d8cce7; }
.chip-good { color: #477b67; background: #dcf0e5; border-color: #9dbfaa; }
.chip-bad { color: #a35b75; background: #ffe2ec; border-color: #dba4b8; }
.chip-normal { color: #796090; background: #eadff6; border-color: #b6a1ce; }
.chip-bonus { color: #92704c; background: #fff0d7; border-color: #d4b991; }
.result { padding-top: 76px; }
.result::before { content: '★  ✦  ★'; display: block; color: #b99367; font-size: 31px; letter-spacing: 24px; padding-left: 24px; margin-bottom: 5px; }
.result-title { font-size: 44px; letter-spacing: .12em; }
.result-stats { border: 2px solid #c7b6de; border-radius: 17px; background: #fffbffb3; padding: 18px 25px; font-size: 16px; }
.result-stats dd { color: #8663a3; }
.result-portrait { position: absolute; left: 60px; top: 151px; width: 174px; height: 248px; border: 4px solid #fff; border-radius: 23px; transform: rotate(-5deg); box-shadow: 0 5px 0 #c6b7da; }
body[data-mode="brief"] .screen:not([hidden]), body[data-mode="day"] .screen:not([hidden]), body[data-mode="result"] .screen:not([hidden]) { animation: pop-enter .22s ease-out; }
@keyframes pop-enter { from { opacity: .5; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
body.reduced-motion *, body.reduced-motion *::before, body.reduced-motion *::after { animation: none !important; transition: none !important; }
body.reduced-motion .card:hover, body.reduced-motion .card:focus-visible { transform: none; }
@media (prefers-reduced-motion: reduce) { body:not([data-motion="standard"]) *, body:not([data-motion="standard"]) *::before, body:not([data-motion="standard"]) *::after { animation: none !important; transition: none !important; } }

/* Rarity is always spelled out; hue is a supplementary cue. */
.weapon-rarity{display:inline-block;vertical-align:middle;margin:2px 0 2px 6px;padding:2px 5px;border:1px solid currentColor;border-radius:4px;font:600 10px/1.35 system-ui,sans-serif;letter-spacing:.02em;white-space:nowrap;color:var(--rarity-c-text);border-color:var(--rarity-c-edge);background:var(--rarity-pill-bg);max-width:100%;box-sizing:border-box}
.weapon-rarity[data-rarity="U"]{color:var(--rarity-u-text);border-color:var(--rarity-u)}
.weapon-rarity[data-rarity="R"]{color:var(--rarity-r-text);border-color:var(--rarity-r)}
.weapon-rarity[data-rarity="E"]{color:var(--rarity-e-text);border-color:var(--rarity-e)}
.weapon-rarity[data-rarity="L"]{color:var(--rarity-l-text);border-color:var(--rarity-l)}
.weapon-reference{display:block;color:#bac6c4;font:400 10px/1.45 system-ui,sans-serif;letter-spacing:.01em;overflow-wrap:anywhere;white-space:normal}
.loadout-card>.weapon-rarity{margin:3px 0;justify-self:start}
.loadout-card strong .weapon-rarity{font-size:8px;margin:1px 0 0 3px;padding:0 3px}
/* Model references remain visible in inspection/comparison; compact slots
   retain a title without forcing extra rows into the mobile HUD. */
.slot-name:has(.weapon-rarity){white-space:normal;overflow-wrap:anywhere}
body.mobile-ui #day-panel .base-tab-equip .base-storage-chip .weapon-reference,
body.mobile-ui .slot-top .weapon-reference{display:none}
body.mobile-ui #day-panel .base-tab-equip .base-storage-chip .weapon-rarity{font-size:8px;line-height:1.2;padding:0 2px;margin:0 0 0 2px}
body.mobile-ui #day-panel .base-tab-equip .base-storage-chip .slot-name:has(.weapon-rarity){white-space:normal;line-height:11px}
/* T-002: the wordmark and a painted night silhouette must exist before JS/art.
   All four loading controllers share this static scene; no animation loop or new asset. */
:is(.arrival-screen,.prep-transition,.coop-presentation-loading){
 position:fixed;inset:0;z-index:10000;display:grid;place-items:center;
 padding:max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));
 overflow:clip;isolation:isolate;background-color:#0a1721;
 background-image:radial-gradient(ellipse at 76% 16%,#3b4947 0,transparent 40%),linear-gradient(#0c1724,#142a35 65%,#0a1721);
 color:#e4eaf0;font:400 16px/1.5 var(--font,system-ui,sans-serif);text-align:center;touch-action:none;user-select:none
}
/* Author-level shared layout must not override the native closed-dialog state. */
.prep-transition:not([open]){display:none}
:is(.arrival-screen,.prep-transition,.coop-presentation-loading)::before{
 content:"";position:absolute;inset:auto 0 0;height:clamp(100px,24vh,220px);pointer-events:none;
 background:#07121b;clip-path:polygon(0 44%,9% 44%,9% 20%,13% 8%,17% 20%,17% 65%,25% 65%,25% 36%,34% 36%,34% 58%,45% 58%,45% 30%,51% 16%,57% 30%,57% 63%,68% 63%,68% 44%,76% 44%,76% 13%,78% 13%,78% 0,83% 0,83% 13%,85% 13%,85% 62%,94% 62%,94% 34%,100% 34%,100% 100%,0 100%)
}
:is(.arrival-screen,.prep-transition,.coop-presentation-loading)::after{
 content:"";position:absolute;top:12%;right:17%;width:42px;height:42px;border-radius:50%;background:#d3c5a1;opacity:.35;box-shadow:0 0 70px 12px #e4b87033;pointer-events:none
}
.nw-loading-panel{
 position:relative;z-index:1;display:grid;justify-items:center;gap:20px;width:min(620px,100%);min-width:0;
 padding:32px;background:#0e1e29;border:1px solid #768e9055;border-top:2px solid #e4b870;box-shadow:0 24px 80px #0006;color:#e4eaf0
}
.nw-loading-brand{margin:0;color:#f1c477;font:700 clamp(28px,4.5vw,52px)/1.15 var(--mono,monospace);letter-spacing:.14em;white-space:nowrap}
.nw-loading-brand::before{content:"";display:block;width:32px;height:3px;margin:0 auto 18px;background:#f1c477;box-shadow:0 0 16px #e4b87055}
.arrival-text,.nw-loading-status{margin:0;color:#e4eaf0;font:500 16px/1.5 var(--font,system-ui,sans-serif);letter-spacing:.02em;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.arrival-bar{width:100%;height:8px;appearance:none;background:#253e4b;border:0;border-radius:2px;overflow:hidden}
.arrival-bar::-webkit-progress-bar{background:#253e4b}
.arrival-bar::-webkit-progress-value{background:#f1c477}
.arrival-bar::-moz-progress-bar{background:#f1c477}
.nw-loading-actions{display:flex;justify-content:center;align-items:center;flex-wrap:wrap;gap:12px;width:100%}
.nw-loading-panel :is(a,button),#prep-transition .nw-loading-panel :is(a,button){display:inline-flex;align-items:center;justify-content:center;min-width:100px;min-height:44px;padding:8px 16px;border:1px solid #a0b7c488;border-radius:3px;background:#192f3d;color:#e4eaf0;font:500 14px/1.5 var(--font,system-ui,sans-serif);text-decoration:none;white-space:nowrap;box-sizing:border-box;transition:none}
.nw-loading-panel :is(a,button):focus-visible{outline:3px solid #f1c477;outline-offset:3px}
/* Co-op owns a scaled field shell. Compensate only its loader's type, spacing
   and targets so phone recovery stays readable without changing the game stage. */
.coop-presentation-loading{position:absolute;z-index:100;--nw-loading-scale:var(--inv-scale,1)}
/* mobile-layout.css removes the field transform outside combat, while keeping
   its logical --inv-scale. That presentation is already in physical pixels. */
body.mobile-ui:not([data-mode="night"]) .coop-presentation-loading{--nw-loading-scale:1}
.coop-presentation-loading .nw-loading-panel{width:min(calc(560px * var(--nw-loading-scale,1)),100%);padding:calc(12px * var(--nw-loading-scale,1));gap:calc(8px * var(--nw-loading-scale,1))}
.coop-presentation-loading .nw-loading-brand{font-size:calc(clamp(26px,4vmin + 8px,44px) * var(--nw-loading-scale,1))}
.coop-presentation-loading .nw-loading-brand::before{width:calc(24px * var(--nw-loading-scale,1));height:calc(2px * var(--nw-loading-scale,1));margin-bottom:calc(6px * var(--nw-loading-scale,1))}
.coop-presentation-loading .nw-loading-status{font-size:calc(15px * var(--nw-loading-scale,1))}
.coop-presentation-loading .nw-loading-actions{gap:calc(8px * var(--nw-loading-scale,1))}
#coop-shell .coop-presentation-loading .nw-loading-panel :is(a,button){min-width:calc(100px * var(--nw-loading-scale,1));min-height:calc(44px * var(--nw-loading-scale,1));padding:calc(8px * var(--nw-loading-scale,1));font-size:calc(15px * var(--nw-loading-scale,1))}
@media(max-height:440px),(max-width:380px){
 .nw-loading-panel{padding:20px 16px;gap:14px}
 .nw-loading-brand{font-size:28px}
 .nw-loading-brand::before{margin-bottom:10px}
}
/* Recovery is static and reachable even when JS or CSS animations never run.
   The old screens retain controller nodes, but have no presentation route. */
body.booting #stage,body.booting #stage *{visibility:hidden!important}
#screen-select,#screen-brief{display:none!important}
#boot-screen{animation:none}
.boot-slow{margin:0;color:#c3d0d6;font-size:14px;font-weight:400;text-align:center}
.boot-slow a{color:inherit;display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;padding:0 12px;white-space:nowrap;box-sizing:border-box}
