/* ============================================================================
   『クラン遠征帳』 — 404 Factory アトリエ・テーマ
   デザイン原本: design/juice/hub.html（Juice）。色・書体・余白・角丸・罫線は原本の値。
   404factory.dev ポータル（/home/tatsu/factory_portal）と同じトークンを共有する。
   - 地: 暖かい黒 #131111 / カード #181616 / 一段上 #1e1b1a / くぼみ #24211e
   - 文字: アイボリー #e8e6df、見出しと選択状態はくすんだ金 #cdbd78
   - 罫線は 1px のヘアライン。影は使わない（顔アイコンの台座のくぼみだけ例外）
   - 見出し: Zen Antique（中文は Noto Serif SC）／本文: Noto Sans JP・SC／数値: Doto
   新しい部品は、原本にある一番近い部品の値で組むこと。
   ============================================================================ */

:root {
  /* --- Juice 原本のトークン --- */
  --bg-page: #131111;
  --bg-nav: #191919;
  --bg-bar: rgba(25, 25, 25, 0.96);
  --bg-bar-bottom: rgba(25, 25, 25, 0.97);
  --bg-card: #181616;
  --bg-card-elevated: #1e1b1a;
  --bg-well: #24211e;
  --bg-well-warm: #362f28;
  --bg-hover: #221f1d;

  --border-card: #292525;
  --line-dossier: #353232;
  --line-article: #34302e;
  --line-badge: #3a3527;

  --ink-primary: #e8e6df;
  --ink-bright: #eee9df;
  --ink-lead: #c8c3b8;
  /* 原本は #888174。card / well の上でも余裕で 4.5:1 を超える水準に引き上げ */
  --ink-muted: #9e978a;
  --ink-dim: #7c7569;

  --gold-heading: #cdbd78;
  --gold-badge: #cbb66d;
  --gold-chip: #d2c47e;
  --gold-chip-border: #5c5437;
  --gold-seal: #d0c27d;
  --gold-seal-ring: #655a2d;
  --gold-tint: rgba(205, 189, 120, 0.1);
  --gold-tint-strong: rgba(205, 189, 120, 0.14);

  --btn-light-bg: #e6e2d5;
  --btn-light-ink: #191919;
  --btn-dark-bg: #302b28;
  --btn-dark-hover: #3a3431;
  --btn-dark-ink: #eee9df;

  --status-dot: #8fba6b;
  --status-halo: #3f5f3b;
  --accent-amber: #c78b4e;

  /* 顔アイコンの台座（暖色のくぼみ） */
  --portrait-bg: radial-gradient(circle at 50% 35%, #4a4035 0%, #2e2720 100%);
  --portrait-line: #594d3f;
  --portrait-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.55);

  --font-display: 'Zen Antique', 'Noto Sans JP', serif;
  --font-body: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Yu Gothic', system-ui, sans-serif;
  --font-num: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', system-ui, sans-serif;
  --font-ornament: 'Doto', monospace;
  --display-weight: 400;
  --num-weight: 700;

  /* --- ゲーム固有の状態色（原本の金・緑・琥珀と同じ明るさ・彩度に揃えた派生） --- */
  --crimson: #d98a7a;
  --crimson-line: #6e3f37;
  --crimson-fill: #523934;
  --crimson-soft: rgba(217, 138, 122, 0.12);
  --forest: #8fba6b;
  --forest-line: #3f5f3b;
  --forest-fill: #363f2b;
  --forest-soft: rgba(143, 186, 107, 0.1);
  --amber: #c78b4e;
  --amber-ink: #c78b4e;
  --amber-line: #6b4f33;
  --amber-soft: rgba(199, 139, 78, 0.12);
  --mark-terra: #d49a78;
  --mark-terra-bg: rgba(212, 154, 120, 0.12);
  --mark-rose: #cf8fa8;
  --mark-rose-bg: rgba(207, 143, 168, 0.12);
  --mark-teal: #86b8b4;
  --mark-teal-bg: rgba(134, 184, 180, 0.12);
  --mark-surge: #d2c47e;
  --mark-surge-bg: rgba(210, 196, 126, 0.12);
  --mark-blue: #9aa6cf;
  --mark-blue-bg: rgba(154, 166, 207, 0.12);
  --qual-standard: #c8c3b8;
  --qual-fine: #86b8b4;
  --qual-master: #cdbd78;
  --qual-mythic: #cf8fa8;
  --rose-line: #6a4756;
  --teal-line: #3f5c5a;
  --blue-line: #4a5270;

  /* --- 旧テーマの変数名（app.js のインライン style が参照する）を新トークンへ --- */
  --bg-vellum: var(--bg-page);
  --bg-paper: var(--bg-card);
  --bg-paper-alt: var(--bg-card-elevated);
  --bg-slip: var(--bg-card-elevated);
  --bg-arena: var(--bg-page);
  --bg-arena-card: var(--bg-card-elevated);
  --ink: var(--ink-primary);
  --ink-secondary: var(--ink-lead);
  --frame-ink: var(--border-card);
  --indigo: var(--gold-heading);
  --indigo-dark: var(--ink-bright);
  --brass: var(--gold-badge);
  --brass-ink: var(--gold-chip);
  --brass-bright: var(--gold-heading);
  --gold: var(--gold-heading);
  --brass-soft: var(--gold-tint);
  --focus-ring: var(--gold-heading);
  --line: var(--line-article);
  --line-strong: var(--border-card);
  --shadow-card: none;
  --shadow-slip: none;
  --shadow-btn: none;
  --shadow-modal: none;
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --font-pixel: var(--font-body);
  --font-sans: var(--font-body);
  --font-serif: var(--font-display);
}

:root:lang(zh-Hans) {
  --font-body: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --font-display: 'Noto Serif SC', 'Noto Sans SC', serif;
  --font-num: 'Noto Sans SC', 'PingFang SC', system-ui, sans-serif;
  --font-ornament: 'Doto', monospace;
  --display-weight: 700;
}

/* --- ライトモード（新ポータルと同系統のウォームアイボリー紙・1pxヘアライン） --- */
:root[data-theme="light"] {
  --bg-page: #f2ede3;
  --bg-nav: #faf7f0;
  --bg-bar: rgba(250, 247, 240, 0.96);
  --bg-bar-bottom: rgba(250, 247, 240, 0.97);
  --bg-card: #fbf8f1;
  --bg-card-elevated: #f1ebe0;
  --bg-well: #e9e1d2;
  --bg-well-warm: #dfd4bf;
  --bg-hover: #ebe3d5;

  --border-card: #dbd2c0;
  --line-dossier: #ccc1ad;
  --line-article: #ded6c6;
  --line-badge: #c8b892;

  --ink-primary: #1f1b18;
  --ink-bright: #14110f;
  --ink-lead: #3f3830;
  --ink-muted: #5c5347;
  --ink-dim: #6c6356;

  --gold-heading: #7a5914;
  --gold-badge: #7a5914;
  --gold-chip: #6d4f10;
  --gold-chip-border: #b39553;
  --gold-seal: #7a5914;
  --gold-seal-ring: #b39553;
  --gold-tint: rgba(138, 102, 22, 0.1);
  --gold-tint-strong: rgba(138, 102, 22, 0.16);

  --btn-light-bg: #241f1c;
  --btn-light-ink: #faf7f0;
  --btn-dark-bg: #ebe3d5;
  --btn-dark-hover: #e1d7c5;
  --btn-dark-ink: #1f1b18;

  --status-dot: #366a35;
  --status-halo: #a4c39e;
  --accent-amber: #965214;

  --portrait-bg: radial-gradient(circle at 50% 35%, #efe5d1 0%, #d8c9ae 100%);
  --portrait-line: #b8a686;
  --portrait-shadow: inset 0 2px 4px rgba(31, 27, 24, 0.16);

  --crimson: #a53c33;
  --crimson-line: #d4968f;
  --crimson-fill: #f3dedb;
  --crimson-soft: rgba(165, 60, 51, 0.1);
  --forest: #2e653a;
  --forest-line: #95be9e;
  --forest-fill: #e2eee5;
  --forest-soft: rgba(46, 101, 58, 0.1);
  --amber: #965214;
  --amber-ink: #884910;
  --amber-line: #cfa77a;
  --amber-soft: rgba(150, 82, 20, 0.12);
  --mark-terra: #9e451e;
  --mark-terra-bg: rgba(158, 69, 30, 0.12);
  --mark-rose: #94375f;
  --mark-rose-bg: rgba(148, 55, 95, 0.12);
  --mark-teal: #23646c;
  --mark-teal-bg: rgba(35, 100, 108, 0.12);
  --mark-surge: #7c5812;
  --mark-surge-bg: rgba(124, 88, 18, 0.13);
  --mark-blue: #3f508d;
  --mark-blue-bg: rgba(63, 80, 141, 0.12);
  --qual-standard: #544c43;
  --qual-fine: #23646c;
  --qual-master: #7a5914;
  --qual-mythic: #94375f;
  --rose-line: #c994a8;
  --teal-line: #8ab8b5;
  --blue-line: #9aa5ca;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-page);
  color: var(--ink-primary);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-size: 13px;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--gold-heading);
  outline-offset: 2px;
  box-shadow: none;
}

.meter-pill strong, .stat-strip strong, .kpi-val {
  font-variant-numeric: tabular-nums;
}

.meter-pill-btn {
  cursor: pointer;
  transition: color 150ms ease;
}

.meter-pill-btn:hover {
  background: none;
  color: var(--ink-bright);
}

.hidden {
  display: none !important;
}

/* ============================================================================
   App Shell & Header (Dark Plum-Walnut Guild Command Bar)
   ============================================================================ */
.app-shell {
  max-width: none;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 84px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px max(16px, calc((100% - 1280px) / 2 + 16px));
  background: var(--bg-bar);
  color: var(--ink-primary);
  border-bottom: 1px solid var(--line-dossier);
  box-shadow: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-crest {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--bg-well);
  border: 1px solid var(--gold-chip-border);
  box-shadow: none;
  color: var(--gold-heading);
  font-size: 15px;
  flex-shrink: 0;
}

.brand-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: var(--display-weight);
  letter-spacing: 0.02em;
  color: var(--ink-bright);
  text-shadow: none;
  white-space: nowrap;
}

.brand-sub {
  font-size: 11px;
  color: var(--gold-badge);
  letter-spacing: 0;
  border: 1px solid var(--line-badge);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}

.top-meters {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.top-currencies, .top-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.meter-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 0;
  border-radius: 0;
  background: none;
  border: 0;
  box-shadow: none;
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.meter-pill strong {
  font-family: var(--font-num);
  font-weight: var(--num-weight);
  font-size: 16px;
  letter-spacing: 0.03em;
  color: var(--ink-primary);
  font-variant-numeric: tabular-nums;
}

.meter-label {
  font-size: 12px;
  color: var(--ink-muted);
}

.meter-unit {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-muted);
  margin-left: 1px;
}

.icon-btn {
  height: 44px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  box-shadow: none;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--ink-lead);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.icon-btn:hover {
  border-color: var(--gold-chip-border);
  background: var(--btn-dark-bg);
  color: var(--ink-bright);
}

.icon-btn:active {
  transform: translateY(1px);
  box-shadow: none;
}

/* モバイル @media (max-width: 640px) ルールはカスケード保証のためファイル末尾へ統合 */
.save-alert {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 92;
  width: min(94vw, 680px);
  padding: 10px 14px;
  border-radius: 8px;
  background: #2a201e;
  border: 1px solid var(--crimson-line);
  box-shadow: none;
  color: var(--crimson);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.toast-bar {
  position: fixed;
  bottom: calc(76px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  width: min(94vw, 560px);
}

.toast-item {
  pointer-events: auto;
  background: var(--bg-nav);
  color: var(--ink-primary);
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--line-dossier);
  font-size: 12px;
  box-shadow: none;
  animation: fadeSlideIn 0.16s ease-out;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.main-view {
  padding: 18px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* ============================================================================
   Bottom Navigation (Tactical RPG Command Deck: ギルド / 編成 / 記録)
   ============================================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  transform: none;
  width: 100%;
  max-width: none;
  z-index: 35;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--bg-bar-bottom);
  border-top: 1px solid var(--line-dossier);
  box-shadow: none;
  padding: 6px max(12px, calc((100% - 640px) / 2 + 12px)) calc(6px + env(safe-area-inset-bottom));
  gap: 8px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.nav-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-muted);
  transition: color 150ms ease, background-color 150ms ease;
  min-height: 48px;
}

.nav-btn:hover:not(.active) {
  border-color: transparent;
  color: var(--ink-primary);
  background: var(--bg-well);
}

.nav-btn.active {
  background: var(--gold-tint);
  border-color: var(--gold-chip-border);
  color: var(--gold-heading);
  box-shadow: none;
  font-weight: 700;
}

.nav-icon {
  font-size: 15px;
  line-height: 1;
}

.nav-label {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: inherit;
  letter-spacing: 0;
}

.nav-badge {
  position: absolute;
  top: 3px;
  right: 16%;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  border: 0;
  background: var(--gold-heading);
  color: var(--btn-light-ink);
  font-family: var(--font-body);
  font-size: 11px;
  display: grid;
  place-items: center;
  box-shadow: none;
  font-weight: 700;
}

/* ============================================================================
   Common Cards, Buttons, Pills, Grammar Chips (Crisp Pixel-Ledger Frames)
   ============================================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: none;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: var(--display-weight);
  letter-spacing: 0;
  color: var(--gold-heading);
}

.card-sub {
  font-size: 12px;
  color: var(--ink-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 18px;
  border-radius: 6px;
  border: 1px solid var(--line-dossier);
  background: var(--btn-dark-bg);
  color: var(--btn-dark-ink);
  box-shadow: none;
  font-weight: 500;
  font-size: 13px;
  transition: background-color 150ms ease, transform 120ms ease, border-color 150ms ease;
  min-height: 44px;
  line-height: 1.3;
}

.btn:hover:not(:disabled) {
  background: var(--btn-dark-hover);
  border-color: var(--gold-chip-border);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-primary {
  background: var(--btn-light-bg);
  border-color: transparent;
  color: var(--btn-light-ink);
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0;
}

.btn-primary:hover:not(:disabled) {
  background: var(--ink-bright);
  border-color: transparent;
}

.btn-brass {
  background: rgba(205, 189, 120, 0.08);
  border-color: var(--gold-chip-border);
  color: var(--gold-chip);
  box-shadow: none;
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0;
}

.btn-brass:hover:not(:disabled) {
  background: rgba(205, 189, 120, 0.16);
  border-color: var(--gold-chip-border);
}

.btn-danger {
  background: rgba(217, 138, 122, 0.08);
  border-color: var(--crimson-line);
  color: var(--crimson);
}

.btn-sm {
  padding: 4px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  min-height: 36px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  border: 1px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.5;
}

.tag-victory {
  background: var(--forest-soft);
  color: var(--forest);
  border-color: var(--forest-line);
}
.tag-retreated {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: var(--amber-line);
}
.tag-timeout {
  background: var(--bg-well);
  color: var(--ink-lead);
  border-color: var(--line-dossier);
}
.tag-wiped {
  background: var(--crimson-soft);
  color: var(--crimson);
  border-color: var(--crimson-line);
}
.tag-running {
  background: var(--bg-well);
  color: var(--ink-lead);
  border-color: var(--line-dossier);
}
.tag-neutral {
  background: var(--bg-well);
  color: var(--ink-lead);
  border-color: var(--line-dossier);
}

.mark-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  border: 1px solid currentColor;
  gap: 4px;
}

.mark-glow {
  box-shadow: 0 0 0 1px var(--gold-heading);
}

.rule-line {
  font-size: 12px;
  color: var(--ink-lead);
  background: var(--bg-card-elevated);
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-card);
  border-left: 2px solid var(--gold-chip-border);
}

.rule-line.epithet {
  border-left-color: var(--gold-heading);
  background: var(--bg-card-elevated);
}

/* ============================================================================
   Intro Guide Strip (Parchment Hint Banner)
   ============================================================================ */
.guide-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(205, 189, 120, 0.08);
  border: 1px solid var(--gold-chip-border);
  border-left: 1px solid var(--gold-chip-border);
  box-shadow: none;
  font-size: 13px;
  color: var(--ink-primary);
  border-color: var(--gold-chip-border);
}

.guide-strip .btn {
  white-space: nowrap;
  flex-shrink: 0;
}

.guide-strip strong {
  color: var(--gold-chip);
}

@media (max-width: 560px) {
  .guide-strip {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
}

/* ============================================================================
   Hub (ギルド): Tactical Squad Sheets
   ============================================================================ */
.squad-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.squad-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-left: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: none;
  transition: border-color 0.12s ease;
}

.squad-card.frontline {
  border-color: var(--border-card);
  border-left: 1px solid var(--border-card);
  background: var(--bg-card);
  box-shadow: none;
}

.squad-card.is-running {
  border-left-color: var(--border-card);
}

.squad-card.needs-review {
  border-color: var(--gold-chip-border);
  border-left: 1px solid var(--gold-chip-border);
  background: var(--bg-card);
  box-shadow: none;
}

.squad-card.locked {
  opacity: 0.76;
  border-style: dashed;
  border-color: var(--line-dossier);
  box-shadow: none;
}

.squad-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.squad-head strong {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: 0;
  color: var(--gold-heading);
}

.squad-faces {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}

.face-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  border-radius: 10px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-card);
  box-shadow: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-bright);
  flex-direction: column;
  text-align: center;
  min-width: 0;
}

.face-pill img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: var(--portrait-bg);
  border: 1px solid var(--portrait-line);
  box-shadow: var(--portrait-shadow);
  padding: 3px;
}

.progress-bar-wrap {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--bg-well);
  border: 1px solid var(--line-dossier);
  overflow: hidden;
  margin: 8px 0 4px;
  box-shadow: none;
}

.progress-bar-fill {
  height: 100%;
  background: var(--status-dot);
  transition: width 0.3s ease;
  border-radius: 999px;
}

.hub-actions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.hub-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-card);
  box-shadow: none;
  text-align: left;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.hub-tile:hover:not(:disabled) {
  border-color: var(--gold-chip-border);
  background: var(--bg-hover);
}

.hub-tile:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: none;
}

.hub-tile:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.hub-tile-title {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0;
  color: var(--ink-bright);
}

.hub-tile-desc {
  font-size: 11px;
  color: var(--ink-muted);
}

.calm-footer-card {
  text-align: center;
  padding: 13px 16px;
  border-radius: 12px;
  background: none;
  border: 1px dashed var(--line-dossier);
  color: var(--ink-lead);
  font-size: 13px;
}

/* ============================================================================
   Squad Screen (編成): Pixel Portrait Frames & Tactical Slots
   ============================================================================ */
.squad-switcher {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.member-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.member-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: none;
}

.member-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.portrait-md, .portrait-sm {
  width: 56px;
  height: 56px;
  padding: 3px;
  border-radius: 8px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: var(--portrait-bg);
  border: 1px solid var(--portrait-line);
  box-shadow: var(--portrait-shadow);
  flex-shrink: 0;
}

.member-meta {
  flex: 1;
  min-width: 0;
}

.member-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.member-name {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--ink-bright);
}

.stat-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-muted);
}

.stat-strip strong {
  font-family: var(--font-num);
  font-weight: var(--num-weight);
  font-size: 15px;
  color: var(--ink-primary);
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}

.scar-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.scar-pill {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--bg-well);
  border: 1px solid var(--line-dossier);
  color: var(--ink-lead);
  font-family: var(--font-body);
  letter-spacing: 0;
}

.equip-3slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

@media (max-width: 640px) {
  .equip-3slots {
    grid-template-columns: 1fr;
  }
}

.slot-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-card);
  background: var(--bg-card-elevated);
  box-shadow: none;
  text-align: left;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.slot-btn:hover:not(:disabled) {
  border-color: var(--gold-chip-border);
  background: var(--bg-hover);
}

.slot-btn.shared-mark {
  border-color: var(--gold-chip-border);
  background: rgba(205, 189, 120, 0.06);
  box-shadow: none;
}

.slot-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-muted);
  letter-spacing: 0;
}

.slot-item-name {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-bright);
  letter-spacing: 0;
}

.slot-rule-mini {
  font-size: 11px;
  color: var(--ink-muted);
  line-height: 1.4;
}

/* ============================================================================
   Dispatch Plan Panel
   ============================================================================ */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-label {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--ink-muted);
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.choice-pill {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--line-dossier);
  background: var(--bg-well);
  box-shadow: none;
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-lead);
  white-space: nowrap;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
  min-height: 36px;
  line-height: 1.3;
}

.choice-pill:hover:not(:disabled):not(.active) {
  border-color: var(--gold-chip-border);
  background: var(--bg-well);
  color: var(--ink-bright);
}

.choice-pill.active {
  background: var(--gold-tint-strong);
  border-color: var(--gold-heading);
  color: var(--gold-heading);
  box-shadow: none;
}

.choice-pill:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.select-box {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--line-dossier);
  background: var(--bg-well);
  box-shadow: none;
  font-size: 13px;
  font-weight: 400;
  min-height: 44px;
  color: var(--ink-primary);
}

/* ============================================================================
   Report & Decisive 1-Frame Tactical Battle Window + 1-Tap Unwrap Ritual
   ============================================================================ */
.speaker-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-card);
  box-shadow: none;
}

.diff-banner {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.diff-banner.improved {
  background: var(--forest-soft);
  border: 1px solid var(--forest-line);
  color: var(--forest);
}

.diff-banner.neutral {
  background: var(--amber-soft);
  border: 1px solid var(--amber-line);
  color: var(--gold-badge);
}

.arena-frame {
  background: var(--bg-page);
  color: var(--ink-primary);
  border-radius: 8px;
  padding: 14px;
  border: 1px solid var(--line-article);
  box-shadow: none;
}

.arena-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-bottom: 8px;
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0;
  color: var(--ink-muted);
}

.arena-headline {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: var(--display-weight);
  letter-spacing: 0;
  color: var(--gold-heading);
  text-shadow: none;
  margin-bottom: 12px;
}

.arena-sides {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 540px) {
  .arena-sides {
    grid-template-columns: 1fr;
  }
}

.arena-unit {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 12px;
}

.arena-unit.is-actor {
  border-color: var(--gold-heading);
  box-shadow: none;
}

.arena-unit.is-target {
  border-color: var(--crimson);
}

.arena-unit.is-dead {
  opacity: 0.48;
}

.hp-bar {
  height: 7px;
  border-radius: 999px;
  background: var(--bg-well);
  border: 1px solid var(--line-dossier);
  overflow: hidden;
  margin-top: 4px;
  box-shadow: none;
}

.hp-fill {
  height: 100%;
  background: var(--status-dot);
  border-radius: 999px;
}

.hp-fill.enemy {
  background: var(--crimson);
}

/* 1-Tap Unwrap Parcel */
.unwrap-box {
  display: block;
  width: 100%;
  border: 1px dashed var(--gold-chip-border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  background: rgba(205, 189, 120, 0.06);
  box-shadow: none;
  cursor: pointer;
  transition: transform 0.1s ease;
  color: var(--ink-primary);
}

.unwrap-box:hover {
  transform: none;
  box-shadow: none;
  background: rgba(205, 189, 120, 0.12);
}

.unwrap-opened {
  border: 1px solid var(--gold-chip-border);
  border-radius: 8px;
  padding: 14px;
  background: var(--bg-card-elevated);
  box-shadow: none;
  animation: popReveal 0.22s ease-out;
}

@keyframes popReveal {
  0% {
    opacity: 0.2;
    transform: scale(0.96);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ============================================================================
   Records: Group Photo Card, Whyline Table, Modals
   ============================================================================ */
.subtab-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.photo-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: none;
}

.photo-portraits {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.photo-member {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 78px;
  text-align: center;
  font-size: 11px;
}

.photo-member img {
  width: 56px;
  height: 56px;
  padding: 3px;
  border-radius: 8px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: var(--portrait-bg);
  border: 1px solid var(--portrait-line);
  box-shadow: var(--portrait-shadow);
}

.whyline-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.whyline-table th, .whyline-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--border-card);
  text-align: left;
}

.whyline-table th {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--gold-badge);
  font-weight: 700;
  letter-spacing: 0;
}

details.fold-section {
  border: 1px solid var(--border-card);
  border-radius: 8px;
  background: var(--bg-card);
  padding: 12px 14px;
  box-shadow: none;
}

details.fold-section summary {
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  color: var(--ink-bright);
  letter-spacing: 0;
}

/* ============================================================================
   Modal Overlay (RPG Command Dialog Window)
   ============================================================================ */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 9, 9, 0.76);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.modal-panel {
  width: min(96vw, 660px);
  max-height: 88vh;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--line-dossier);
  box-shadow: none;
  padding: 18px;
}

.modal-head {
  position: sticky;
  top: -18px;
  z-index: 6;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -18px -18px 12px;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--line-article);
}

.modal-head > div {
  min-width: 0;
  flex: 1;
}

.modal-head .btn {
  white-space: nowrap;
  flex-shrink: 0;
}

.modal-head strong {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 18px;
  letter-spacing: 0;
  color: var(--gold-heading);
}

.input-text {
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--line-dossier);
  background: var(--bg-well);
  box-shadow: none;
  font-size: 13px;
  min-height: 44px;
  color: var(--ink-primary);
}

.portrait-picker {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

@media (max-width: 560px) {
  .portrait-picker {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.portrait-opt {
  padding: 2px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  display: flex;
  justify-content: center;
}

.portrait-opt.active {
  border-color: var(--gold-heading);
  background: var(--gold-tint-strong);
  box-shadow: none;
}

.portrait-opt img {
  width: 48px;
  height: 48px;
  max-width: 100%;
  border-radius: 6px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: var(--portrait-bg);
  border: 1px solid var(--portrait-line);
  display: block;
  box-shadow: var(--portrait-shadow);
}

.svg-icon {
  display: inline-block;
  vertical-align: -0.18em;
  flex-shrink: 0;
}

.icon-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ============================================================================
   Live Expedition Log (道中リアルタイム中継) & Field Skills (道中の特技)
   ============================================================================ */
.live-feed-box {
  margin-top: 10px;
  border-radius: 8px;
  background: var(--bg-page);
  color: var(--ink-lead);
  border: 1px solid var(--line-article);
  box-shadow: none;
  padding: 12px 14px;
}

.live-feed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0;
  color: var(--ink-lead);
}

.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-dot);
  border: 0;
  margin-right: 6px;
  animation: pulseLive 1.6s ease-in-out infinite;
  box-shadow: 0 0 8px var(--status-halo);
}

@keyframes pulseLive {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

.live-hp-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.live-hp-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 11px;
}

.live-hp-chip.is-dead {
  opacity: 0.72;
}

.live-hp-chip img {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: var(--portrait-bg);
  border: 1px solid var(--portrait-line);
  flex-shrink: 0;
}

.live-log-list {
  max-height: 175px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.live-log-entry {
  font-size: 12px;
  line-height: 1.5;
  padding: 0 0 0 10px;
  border-radius: 0;
  background: none;
  border-left: 2px solid var(--gold-chip-border);
  color: var(--ink-lead);
}

.live-log-entry.kind-event_ok, .live-log-entry.kind-room_clear, .live-log-entry.kind-combat_good {
  border-left-color: var(--status-dot);
  background: none;
}

.live-log-entry.kind-event_fail, .live-log-entry.kind-combat_bad {
  border-left-color: var(--crimson);
  background: none;
}

.live-log-entry.kind-chain {
  border-left-color: var(--gold-heading);
  background: none;
  color: var(--gold-chip);
}

.live-log-entry.kind-travel {
  border-left-color: var(--line-dossier);
  color: var(--ink-lead);
}

.field-skill-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  background: rgba(143, 186, 107, 0.13);
  color: var(--forest);
  border: 1px solid var(--forest-line);
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0;
}

.field-skill-pill.missing {
  background: rgba(217, 138, 122, 0.11);
  color: var(--crimson);
  border-color: var(--crimson-line);
}

.waypoint-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.waypoint-preview-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--bg-well);
  border: 1px solid var(--line-dossier);
  color: var(--ink-lead);
  font-family: var(--font-body);
  letter-spacing: 0;
}

.waypoint-preview-chip.covered {
  border-color: var(--forest-line);
  background: rgba(143, 186, 107, 0.08);
}

.ticket-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  background: none;
  color: var(--gold-badge);
  border: 1px solid var(--line-badge);
  letter-spacing: 0;
}

.waypoint-card {
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  background: var(--bg-card-elevated);
}

.waypoint-card.ok {
  border-left: 2px solid var(--status-dot);
}

.waypoint-card.fail {
  border-left: 2px solid var(--crimson);
}

.scout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.scout-card {
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 14px;
  background: var(--bg-card-elevated);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scout-card > .btn {
  margin-top: auto;
  justify-content: center;
}

.mono-box {
  width: 100%;
  min-height: 110px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line-article);
  background: var(--bg-page);
  box-shadow: none;
  color: var(--ink-lead);
}

/* ============================================================================
   Chapter Progress Banner (章区切り・フェイズ表示) & Promotion / Abyss UI
   ============================================================================ */
.chapter-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chapter-banner.is-epilogue {
  border-color: var(--border-card);
  background: var(--bg-card);
  box-shadow: none;
}

.chapter-steps {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.chapter-step {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  border: 1px solid transparent;
  background: none;
  color: var(--ink-muted);
  letter-spacing: 0;
}

.chapter-step.done {
  background: none;
  border-color: transparent;
  color: var(--ink-lead);
}

.chapter-step.current {
  background: var(--gold-tint);
  border-color: var(--gold-chip-border);
  color: var(--gold-heading);
  box-shadow: none;
}

.chapter-step.epilogue-active {
  background: var(--gold-tint);
  border-color: var(--gold-chip-border);
  color: var(--gold-heading);
  box-shadow: none;
}

.chapter-meta-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.abyss-law-box {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-card);
  font-size: 12px;
  color: var(--ink-lead);
}

.job-tier-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 9px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  background: none;
  color: var(--gold-badge);
  border: 1px solid var(--line-badge);
  letter-spacing: 0;
}

.job-section-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: var(--display-weight);
  letter-spacing: 0;
  color: var(--gold-heading);
  margin: 14px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line-article);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.slot-btn.job-locked {
  opacity: 0.62;
  border-style: dashed;
  box-shadow: none;
}

/* ============================================================================
   Playtest Polish Additions (Compact Locked Bar, Arena Dark Chips, Sticky Bar,
   Filters, Delta Preview, Custom Dialog, Roster, Mobile Refinements)
   ============================================================================ */
.locked-squad-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 20px;
  border-radius: 12px;
  background: none;
  border: 1px dashed var(--line-dossier);
  font-size: 12px;
  color: var(--ink-muted);
}

.face-pill-info {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.face-pill-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-muted);
}

.dest-line {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-lead);
  line-height: 1.5;
}

.dest-line .svg-icon {
  margin-top: 2px;
}

.role-preview-box {
  margin-top: 6px;
  padding: 7px 9px;
  border-radius: 8px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-card);
  font-size: 11px;
  color: var(--ink-lead);
  line-height: 1.45;
}

/* Arena Frame: Dark-theme mark chips & ally pixel portraits */
.arena-unit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.arena-unit-id {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.arena-unit-portrait {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: var(--portrait-bg);
  border: 1px solid var(--portrait-line);
  flex-shrink: 0;
}

.arena-mark-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0;
  background: none;
  border: 1px solid currentColor;
  color: var(--gold-chip);
}

/* Live Feed Enemy Status Row */
.live-enemy-section {
  margin-bottom: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--line-article);
}

.live-enemy-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--ink-muted);
  margin-bottom: 4px;
  letter-spacing: 0;
}

.live-enemy-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 6px;
}

.live-enemy-chip {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 4px 7px;
  font-size: 11px;
  color: var(--ink-lead);
}

.live-enemy-chip.is-dead {
  opacity: 0.42;
}

/* Compact Report Waypoint Strip */
.waypoint-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.waypoint-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-card);
}

.waypoint-chip.ok {
  border-left: 2px solid var(--status-dot);
}

.waypoint-chip.fail {
  border-left: 2px solid var(--crimson);
}

/* Squad Compact Mode & Sticky Dispatch Bar */
.member-card.is-compact {
  padding: 10px 12px;
}

.member-card.is-compact .portrait-md {
  width: 42px;
  height: 42px;
}

.member-card.is-compact .equip-3slots {
  margin-top: 8px;
}

.member-card.is-compact .slot-btn {
  padding: 6px 8px;
}

.squad-sticky-bar {
  position: sticky;
  bottom: 72px;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--bg-bar);
  color: var(--ink-primary);
  border: 1px solid var(--line-dossier);
  box-shadow: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.squad-sticky-bar .sticky-meta {
  font-size: 12px;
  color: var(--ink-lead);
  min-width: 0;
}

.squad-sticky-bar .sticky-meta strong {
  color: var(--gold-heading);
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0;
}

.squad-sticky-bar .btn {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Filters, Stat Delta, Modal Tabs, Prereq Checklist */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 10px;
}

.stat-delta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
  font-size: 11px;
}

.stat-delta-pos {
  color: var(--forest);
  font-weight: 700;
}

.stat-delta-neg {
  color: var(--crimson);
  font-weight: 700;
}

.modal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-article);
}

.prereq-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.prereq-chip {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-dossier);
  background: var(--bg-well);
  color: var(--ink-muted);
  font-family: var(--font-body);
  letter-spacing: 0;
}

.prereq-chip.met {
  background: var(--forest-soft);
  border-color: var(--forest-line);
  color: var(--forest);
  font-weight: 500;
}

/* Custom In-App Dialog Overlay */
.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(10, 9, 9, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.dialog-panel {
  width: min(92vw, 420px);
  max-height: 88vh;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--line-dossier);
  border-radius: 12px;
  box-shadow: none;
  padding: 16px;
}

.dialog-panel .modal-head {
  top: -16px;
  margin: -16px -16px 10px;
  padding: 12px 16px 8px;
}

/* Roster Management Modal */
.roster-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roster-card {
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 12px;
  background: var(--bg-card-elevated);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Album Pin & Equipment Preview */
.photo-card.is-pinned {
  border-color: var(--gold-chip-border);
  box-shadow: none;
}

.photo-equip-mini {
  font-size: 11px;
  color: var(--ink-muted);
  line-height: 1.3;
  margin-top: 2px;
  word-break: break-word;
}

/* Codex Masked Unseen Cards */
.dex-card {
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--bg-card-elevated);
}

.dex-card.unseen {
  background: none;
  border-style: dashed;
  opacity: 0.78;
}

.dex-card.unseen .svg-icon {
  opacity: 0.45;
}

/* Mobile 390px Refinements (#23) */
@media (max-width: 560px) {
  .chapter-banner {
    padding: 10px 12px;
    gap: 6px;
  }

  .chapter-meta-row {
    align-items: center;
    gap: 6px;
  }

  .chapter-step {
    padding: 2px 6px;
    font-size: 11px;
  }

  .hub-actions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .hub-tile {
    padding: 10px;
  }

  .hub-tile-title {
    font-size: 13px;
    flex-wrap: wrap;
    row-gap: 3px;
  }

  .squad-sticky-bar {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    bottom: calc(64px + env(safe-area-inset-bottom));
    padding: 7px 10px;
    z-index: 36;
  }
  .squad-sticky-bar .sticky-meta {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .squad-sticky-bar #btn-jump-plan {
    display: none;
  }

  .hub-tile.full-span-mobile {
    grid-column: 1 / -1;
  }
}

/* ============================================================================
   Cycle 1 & 2: Dopamine Engine, Overchain Diagrams, Fever, Bounties, Loot Beams
   ============================================================================ */
body.font-large {
  font-size: 16px;
}

body.font-large .card-sub, body.font-large .slot-rule-mini, body.font-large .hub-tile-desc, body.font-large .bounty-card, body.font-large .live-log-entry, body.font-large .diagnosis-banner {
  font-size: 14px;
}

body.font-large .rule-line, body.font-large .stat-strip, body.font-large .select-box, body.font-large .input-text, body.font-large .whyline-table, body.font-large .arena-unit {
  font-size: 14px;
}

body.font-large .btn, body.font-large .btn-sm, body.font-large .choice-pill {
  font-size: 14px;
}

body.font-large .hub-tile-title {
  font-size: 16px;
}

body.font-large .member-name {
  font-size: 19px;
}

body.font-large .tag, body.font-large .mark-chip, body.font-large .field-skill-pill {
  font-size: 13px;
}

body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

/* Fever & Win Streak Strip */
.fever-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 20px;
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--ink-lead);
  border: 1px solid var(--border-card);
  box-shadow: none;
  font-size: 12px;
}

.fever-strip.is-fever-ready {
  background: var(--bg-card);
  border-color: var(--gold-chip-border);
  box-shadow: none;
  animation: feverGlow 1.6s ease-in-out infinite alternate;
}

.fever-strip .tag-running, .hub-folio-wind .tag-running {
  background: var(--bg-well);
  color: var(--ink-lead);
  border-color: var(--line-dossier);
}

@keyframes feverGlow {
  from {
    box-shadow: 0 0 6px rgba(205, 189, 120, 0.28);
  }
  to {
    box-shadow: 0 0 10px rgba(205, 189, 120, 0.28);
  }
}

.fever-meter-wrap {
  flex: 1;
  min-width: 150px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.fever-bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--bg-well);
  border: 1px solid var(--line-dossier);
  overflow: hidden;
  box-shadow: none;
}

.fever-fill {
  height: 100%;
  background: var(--gold-heading);
  transition: width 0.25s ease;
  border-radius: 999px;
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border-radius: 0;
  font-family: var(--font-body);
  font-size: 12px;
  background: none;
  border: 0;
  color: var(--ink-lead);
  white-space: nowrap;
  letter-spacing: 0;
}

/* Guild Bounties (ギルド依頼書：即回収ループ) */
.bounty-strip {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: none;
}

.bounty-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 8px;
}

.bounty-card {
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 12px;
  background: var(--bg-card-elevated);
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
}

.bounty-card.is-ready {
  border-color: var(--gold-chip-border);
  background: var(--bg-card-elevated);
  box-shadow: none;
}

.bounty-progress-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-well);
  border: 1px solid var(--line-dossier);
  overflow: hidden;
  box-shadow: none;
}

.bounty-progress-fill {
  height: 100%;
  background: var(--gold-heading);
  border-radius: 999px;
}

/* Hub Tile Corner Badges & Inline Quick Steppers */
.hub-tile {
  position: relative;
}

.hub-tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  flex-wrap: wrap;
}

.hub-corner-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 9px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 11px;
  background: none;
  color: var(--gold-badge);
  border: 1px solid var(--line-badge);
  white-space: nowrap;
  letter-spacing: 0;
}

.hub-corner-badge.ready {
  background: none;
  color: var(--status-dot);
  border-color: var(--forest-line);
}

.bounty-ready-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(205, 189, 120, 0.08);
  border: 1px solid var(--gold-chip-border);
  box-shadow: none;
  color: var(--gold-chip);
  font-size: 13px;
  border-color: var(--gold-chip-border);
}

.squad-card.is-empty-squad {
  padding-top: 10px;
  padding-bottom: 10px;
  background: var(--bg-card);
  border-style: dashed;
}

.hub-quick-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 6px;
}

.inline-stepper-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

/* Report Member Combat Contribution Bar */
.member-contrib-row {
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contrib-bar {
  height: 4px;
  border-radius: 999px;
  background: var(--bg-well);
  margin-top: 2px;
  overflow: hidden;
}

.contrib-fill {
  height: 100%;
  background: var(--gold-heading);
  border-radius: 999px;
}

/* Synergy Recipe Book Modal */
.recipe-card {
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 12px;
  background: var(--bg-card-elevated);
}

.recipe-card.is-complete {
  border-color: var(--forest-line);
  background: var(--bg-card-elevated);
}

.recipe-pieces {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 7px;
}

.recipe-piece {
  border: 1px solid var(--line-dossier);
  border-radius: var(--radius-sm);
  padding: 7px 8px;
  background: var(--bg-well);
  font-size: 12px;
}

.recipe-piece.owned {
  border-color: var(--forest-line);
  background: var(--bg-well);
}

.recipe-piece.missing {
  border-style: dashed;
}

/* Workshop Auto-Dismantle & Forge Flash */
.autosell-bar {
  padding: 10px 12px;
  border: 1px solid var(--border-card);
  border-radius: 8px;
  background: var(--bg-card-elevated);
}

.forge-flash {
  animation: forgeBurst 0.55s ease-out both;
}

@keyframes forgeBurst {
  0% {
    box-shadow: none;
    transform: scale(1.012);
  }
  100% {
    box-shadow: 0 0 0 8px var(--gold-heading);
    transform: scale(1);
  }
}

/* Kinetic 3-Second Mini-Battle Highlight Playback */
.arena-replay-btn {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--gold-chip-border);
  background: rgba(205, 189, 120, 0.08);
  color: var(--gold-chip);
  font-family: var(--font-body);
  font-size: 11px;
  cursor: pointer;
  letter-spacing: 0;
  border-color: var(--gold-chip-border);
}

.arena-replay-btn:hover {
  background: rgba(205, 189, 120, 0.16);
}

.arena-beat-ribbon {
  min-height: 24px;
  margin-bottom: 8px;
  padding: 4px 10px;
  border-radius: 0 6px 6px 0;
  background: var(--bg-card-elevated);
  border-left: 2px solid var(--gold-chip-border);
  color: var(--gold-chip);
  font-family: var(--font-body);
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.18s ease;
  letter-spacing: 0;
}

.arena-beat-ribbon.is-visible {
  opacity: 1;
}

.arena-beat-ribbon.is-chain {
  background: var(--gold-tint-strong);
  border-left-color: var(--gold-heading);
  color: var(--gold-heading);
}

.arena-stage-wrap {
  position: relative;
}

.arena-fx-svg, .arena-fx-popups {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 6;
}

.arena-arc-line {
  stroke-dasharray: 280;
  stroke-dashoffset: 280;
  animation: arenaArcDraw 0.36s ease-out forwards;
  filter: none;
}

@keyframes arenaArcDraw {
  to {
    stroke-dashoffset: 0;
  }
}

.arena-unit.fx-lunge-right {
  animation: lungeRight 0.36s ease-out;
}

.arena-unit.fx-lunge-left {
  animation: lungeLeft 0.36s ease-out;
}

.arena-unit.fx-hit-shake {
  animation: hitShake 0.36s ease-out;
  box-shadow: 0 0 0 2px var(--crimson);
}

.arena-unit.fx-shield-flash {
  box-shadow: 0 0 0 2px var(--blue-line);
}

.arena-unit.fx-mark-glow {
  box-shadow: 0 0 0 2px var(--gold-heading);
}

.arena-frame.fx-chain-burst {
  box-shadow: 0 0 0 1px var(--gold-heading);
}

@keyframes lungeRight {
  0% {
    transform: translateX(0);
  }
  40% {
    transform: translateX(14px) scale(1.02);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes lungeLeft {
  0% {
    transform: translateX(0);
  }
  40% {
    transform: translateX(-14px) scale(1.02);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes hitShake {
  0%, 100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px);
  }
  45% {
    transform: translateX(6px);
  }
  70% {
    transform: translateX(-3px);
  }
}

.arena-popup {
  position: absolute;
  transform: translate(-50%, 0);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  text-shadow: none;
  animation: popupFloat 0.95s cubic-bezier(0.2, 0.9, 0.25, 1) forwards;
  letter-spacing: 0;
}

.arena-popup.is-dmg {
  color: var(--crimson);
}

.arena-popup.is-crit {
  color: var(--gold-heading);
  font-size: 16px;
}

.arena-popup.is-buff {
  color: var(--mark-teal);
}

.arena-popup.is-chain {
  background: var(--bg-nav);
  color: var(--gold-heading);
  border: 1px solid var(--gold-chip-border);
  font-size: 15px;
}

@keyframes popupFloat {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.8);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -6px) scale(1.08);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -34px) scale(0.98);
  }
}

.hub-mini-pill {
  padding: 0 12px;
  min-height: 44px;
  font-size: 12px;
  font-weight: 400;
  border-radius: 6px;
  border: 1px solid var(--line-dossier);
  background: var(--bg-well);
  color: var(--ink-lead);
  white-space: nowrap;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

@media (max-width: 640px) {
  .hub-mini-pill {
    min-height: 34px;
    padding: 5px 9px;
    font-size: 11.5px;
  }
}

.hub-mini-pill.active {
  background: var(--gold-tint-strong);
  border-color: var(--gold-heading);
  color: var(--gold-heading);
  box-shadow: none;
}

/* Live Feed Top Fade & Area Milestone Pins */
.progress-pins {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 2px;
}

.live-log-list {
  mask-image: linear-gradient(180deg, transparent 0%, #000 14%, #000 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 14%, #000 100%);
  gap: 8px;
}

.live-log-entry.kind-treasure {
  border-left-color: var(--gold-heading);
  background: none;
  color: var(--gold-chip);
  font-weight: 500;
}

/* Dopamine Scoreboard & Overchain Visual Diagram */
.dopamine-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 7px;
  margin: 10px 0;
}

.kpi-box {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kpi-box.is-hot {
  border-color: var(--gold-chip-border);
  background: var(--bg-card-elevated);
}

.kpi-box.is-extreme {
  border-color: var(--gold-heading);
  background: var(--bg-card-elevated);
}

.kpi-label {
  font-size: 11px;
  color: var(--ink-muted);
  font-family: var(--font-body);
  letter-spacing: 0;
}

.kpi-val {
  font-family: var(--font-num);
  font-size: 18px;
  color: var(--ink-bright);
  font-weight: var(--num-weight);
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: 11px;
  color: var(--ink-muted);
}

/* Kinetic Chain Flow Diagram */
.chain-diagram-card {
  border: 1px solid var(--line-article);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--bg-page);
  color: var(--ink-primary);
  box-shadow: none;
  margin-bottom: 10px;
}

.chain-diagram-card.tier-5 {
  border-color: var(--gold-chip-border);
  background: var(--bg-page);
  box-shadow: none;
}

.chain-flow-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.chain-node {
  display: inline-flex;
  flex-direction: column;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-card);
  font-size: 11px;
  line-height: 1.3;
}

.chain-node strong {
  color: var(--gold-chip);
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0;
}

.chain-arrow {
  color: var(--gold-chip-border);
  font-family: var(--font-body);
  font-size: 14px;
  letter-spacing: 0;
}

/* Treasure Beast Banner */
.treasure-beast-banner {
  border: 1px solid var(--gold-chip-border);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(205, 189, 120, 0.08);
  color: var(--gold-chip);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 10px;
  box-shadow: none;
  border-color: var(--gold-chip-border);
}

/* Highlight Carousel Nav */
.arena-carousel-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line-article);
  font-size: 11px;
  color: var(--ink-muted);
}

/* Per-Member EXP & Level-Up Cards */
.member-exp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 7px;
  margin: 8px 0;
}

.member-exp-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-card);
  font-size: 11px;
}

.member-exp-card strong {
  white-space: nowrap;
}

.member-exp-card.is-lvup {
  border-color: var(--gold-chip-border);
  background: var(--bg-card-elevated);
}

.member-exp-card img {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  image-rendering: pixelated;
  background: var(--portrait-bg);
  border: 1px solid var(--portrait-line);
  flex-shrink: 0;
}

.exp-bar {
  height: 5px;
  border-radius: 999px;
  background: var(--bg-well);
  overflow: hidden;
  margin-top: 3px;
}

.exp-fill {
  height: 100%;
  background: var(--gold-heading);
  border-radius: 999px;
}

/* Loot Cascade & Rarity Beams ("爆開け") */
.loot-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.loot-card {
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 12px;
  background: var(--bg-card-elevated);
  animation: popReveal 0.24s steps(5) both;
}

.loot-card.rarity-fine {
  border-color: var(--teal-line);
  background: var(--bg-card-elevated);
  box-shadow: none;
}

.loot-card.rarity-master {
  border-color: var(--gold-chip-border);
  background: var(--bg-card-elevated);
  box-shadow: none;
}

.loot-card.rarity-mythic {
  border-color: var(--rose-line);
  background: var(--bg-card-elevated);
  box-shadow: none;
}

.loot-card.has-epithet {
  border-style: solid;
  border-width: 1px;
}

.epithet-diff-box {
  margin-top: 5px;
  padding: 5px 8px;
  border-radius: 0;
  background: var(--bg-page);
  border-left: 2px solid var(--gold-chip-border);
  font-size: 11px;
  color: var(--ink-lead);
}

/* Mark Supply/Demand & Turn Order Timeline */
.mark-balance-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.mark-balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 11px;
  border: 1px solid var(--line-dossier);
  background: var(--bg-well);
  color: inherit;
  letter-spacing: 0;
}

.is-clickable {
  cursor: pointer;
}

.mark-chip.is-clickable:hover, .mark-balance-pill.is-clickable:hover {
  filter: brightness(0.95);
  text-decoration: underline;
}

.mark-balance-pill.ok {
  border-color: var(--forest-line);
  background: var(--forest-soft);
  color: var(--forest);
  font-weight: 700;
}

.mark-balance-pill.warn {
  border-color: var(--gold-chip-border);
  background: var(--amber-soft);
  color: var(--gold-badge);
}

.turn-order-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--ink-secondary);
}

/* Structured Combat Log */
.log-turn-header {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--gold-badge);
  background: none;
  padding: 2px 0;
  border-radius: 4px;
  margin-top: 5px;
  display: inline-block;
  letter-spacing: 0;
}

.log-line {
  font-size: 12px;
  line-height: 1.5;
  padding: 1px 0;
}

.log-line.is-chain {
  color: var(--gold-chip);
  font-weight: 500;
}

.log-line.is-crit {
  color: var(--crimson);
  font-weight: 500;
}

/* Auto-hide Sticky Bar */
.squad-sticky-bar.is-hidden-bar {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

/* Setup Live Portrait Preview */
.setup-selected-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.setup-selected-preview img {
  width: 56px;
  height: 56px;
  padding: 3px;
  border-radius: 8px;
  image-rendering: pixelated;
  background: var(--portrait-bg);
  border: 1px solid var(--portrait-line);
  box-shadow: var(--portrait-shadow);
  flex-shrink: 0;
}

/* Pity Progress Bar in Codex */
.pity-bar-wrap {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-well);
  border: 1px solid var(--line-dossier);
  overflow: hidden;
  margin-top: 4px;
  box-shadow: none;
}

.pity-bar-fill {
  height: 100%;
  background: var(--gold-heading);
  border-radius: 999px;
}

/* Enemy Scout Preview Box */
.enemy-scout-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
}

.enemy-scout-chip {
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-card);
  font-size: 11px;
}

.enemy-scout-row, .live-enemy-chip-inner {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================================================
/* ============================================================================
 * タイトル装丁カバー（革装＋真鍮隅金具の遠征帳装丁）・敵ボスビジュアル
 * ============================================================================ */
.title-ledger-cover {
  position: relative;
  text-align: left;
  padding: 24px 24px 22px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-left: 1px solid var(--border-card);
  box-shadow: none;
  color: var(--ink-primary);
  overflow: hidden;
}

.title-ledger-cover::before, .title-ledger-cover::after {
  content: none;
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--gold-chip-border);
  border-style: solid;
  pointer-events: none;
}
.title-ledger-cover::before {
  top: 7px;
  right: 7px;
  border-width: 1px 1px 0 0;
}
.title-ledger-cover::after {
  bottom: 7px;
  right: 7px;
  border-width: 0 1px 1px 0;
}

.title-ledger-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.title-ledger-crest {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--bg-well);
  border: 1px solid var(--gold-seal-ring);
  color: var(--gold-seal);
  font-size: 20px;
  box-shadow: none;
  margin-bottom: 0;
}

.title-ledger-kicker {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0;
  color: var(--gold-badge);
}

.title-ledger-main {
  margin: 2px 0 2px;
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: clamp(24px, 4.8vw, 32px);
  letter-spacing: 0;
  color: var(--gold-heading);
  text-shadow: none;
}

.title-ledger-tagline {
  margin: 0 0 12px;
  max-width: 58ch;
  font-size: 13px;
  color: var(--ink-lead);
  line-height: 1.55;
  text-wrap: balance;
}

.title-ledger-marks {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;
}

.crest-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.crest-grid .choice-pill {
  justify-content: center;
  width: 100%;
}

.title-mark-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 999px;
  background: none;
  border: 1px solid var(--gold-chip-border);
  color: var(--gold-chip);
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  transition: background-color 150ms ease;
}

.title-mark-badge.is-clickable:hover {
  background: var(--gold-tint);
  border-color: var(--gold-chip-border);
}

.title-mark-badge.is-help {
  background: none;
  border-style: solid;
  color: var(--ink-lead);
  border-color: var(--line-dossier);
}

/* Enemy Portraits & Woodcut Medallions */
.enemy-portrait-img {
  display: block;
  border-radius: var(--radius-sm);
  image-rendering: pixelated;
  object-fit: cover;
  border: 1px solid var(--line-dossier);
  background: var(--bg-page);
  flex-shrink: 0;
}

.enemy-portrait-img.is-boss {
  border-color: var(--gold-chip-border);
  box-shadow: none;
}

.enemy-medallion {
  display: block;
  flex-shrink: 0;
  border-radius: 5px;
}

.enemy-portrait-img.is-silhouette, .enemy-medallion.is-silhouette {
  filter: brightness(0.14) contrast(1.4);
  opacity: 0.72;
}

/* Boss Wanted Card in Dungeon Planner */
.boss-wanted-card {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--gold-chip-border);
  box-shadow: none;
}

.boss-wanted-portrait {
  flex-shrink: 0;
}

.boss-wanted-img {
  width: 58px;
  height: 58px;
}

/* Bestiary Grid (魔物図鑑) */
.bestiary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.bestiary-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-card);
}

.bestiary-card.is-boss {
  border-color: var(--gold-chip-border);
  background: var(--bg-card-elevated);
}

.bestiary-card.is-locked {
  opacity: 0.78;
}

.bestiary-avatar-wrap {
  flex-shrink: 0;
}

/* Overchain Golden Cut-In Banner & Confetti Burst */
.arena-confetti-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 6;
}

.arena-confetti-bit {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 1px;
  animation: confettiFly 0.88s cubic-bezier(0.16, 0.84, 0.44, 1) forwards;
}

@keyframes confettiFly {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1) rotate(0deg);
  }
  70% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 28px)) scale(0.55) rotate(var(--rot));
  }
}

.arena-cutin-banner {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  padding: 8px 14px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: var(--display-weight);
  letter-spacing: 0;
  color: var(--gold-heading);
  background: linear-gradient(90deg, transparent 0%, var(--bg-bar) 16%, var(--bg-bar) 84%, transparent 100%);
  border-top: 1px solid var(--gold-chip-border);
  border-bottom: 1px solid var(--gold-chip-border);
  text-shadow: none;
  pointer-events: none;
  opacity: 0;
  z-index: 7;
}

.arena-cutin-banner.is-active {
  animation: cutinSweep 0.95s ease-out forwards;
}

.arena-cutin-banner.is-extreme {
  font-size: 16px;
  background: linear-gradient(90deg, transparent 0%, var(--bg-bar) 14%, var(--bg-bar) 86%, transparent 100%);
  box-shadow: none;
}

@keyframes cutinSweep {
  0% {
    opacity: 0;
    transform: translateY(-50%) scaleY(0.15) scaleX(0.85);
  }
  16% {
    opacity: 1;
    transform: translateY(-50%) scaleY(1.06) scaleX(1);
  }
  76% {
    opacity: 1;
    transform: translateY(-50%) scaleY(1) scaleX(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-50%) scaleY(0.4) scaleX(1.04);
  }
}

.arena-frame.fx-stage-impact {
  animation: stageImpactShake 0.32s ease-out;
}

@keyframes stageImpactShake {
  0%, 100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-4px) translateY(1px);
  }
  45% {
    transform: translateX(4px) translateY(-1px);
  }
  70% {
    transform: translateX(-2px);
  }
}

/* ============================================================================
   v4 Additions: Bookmark Strip, Failure Diagnosis, Continue March, Puzzles,
   3/4-Choice Epithets, High-Contrast Chain Boost Badge
   ============================================================================ */
.bookmark-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 8px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-card);
  box-shadow: none;
  font-size: 12px;
}

.bookmark-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink-primary);
}

.bookmark-strip .btn {
  white-space: nowrap;
  flex-shrink: 0;
}

.diagnosis-banner {
  padding: 10px 13px;
  margin-bottom: 10px;
  border-radius: 8px;
  background: rgba(217, 138, 122, 0.08);
  border: 1px solid var(--crimson-line);
  border-left-width: 1px;
  color: var(--ink-primary);
  font-size: 13px;
  box-shadow: none;
}

.continue-march-panel {
  margin-top: 12px;
  padding: 14px;
  border-radius: 8px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--gold-chip-border);
  box-shadow: none;
}

.select-box-mini {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--line-dossier);
  background: var(--bg-well);
  font-size: 12px;
  font-weight: 500;
  max-width: 190px;
  color: var(--ink-primary);
  min-height: 36px;
}

.chain-boost-badge {
  background: var(--forest-soft);
  color: var(--forest);
  border-color: var(--forest-line);
  font-weight: 700;
}

.puzzle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
}

.puzzle-card {
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 12px;
  background: var(--bg-card-elevated);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.puzzle-card.is-solved {
  border-color: var(--forest-line);
  background: var(--bg-card-elevated);
}

.puzzle-card.is-locked {
  opacity: 0.65;
  border-style: dashed;
}

.epithet-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 9px;
}

.epithet-choice-card {
  border: 1px solid var(--gold-chip-border);
  border-radius: 8px;
  padding: 12px;
  background: var(--bg-card-elevated);
  display: flex;
  flex-direction: column;
}

.epithet-choice-card.has-trigger-warn {
  border-color: var(--crimson-line);
}

/* ============================================================================
 * v4.5 / v5.0 演出・旗印・絆・二つ名・3幕構成・精錬試算・ピークエンド開封
 * ========================================================================== */
.banner-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--gold-chip-border);
  border-radius: 8px;
  background: var(--bg-card-elevated);
}

.bond-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.bond-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--gold-chip-border);
  background: none;
  color: var(--gold-chip);
  font-size: 11px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.member-title-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: none;
  border: 1px solid var(--line-badge);
  color: var(--gold-badge);
  font-size: 11px;
  font-weight: 400;
}

.portrait-xs {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  object-fit: cover;
  image-rendering: pixelated;
  border: 1px solid var(--portrait-line);
  flex-shrink: 0;
  background: var(--portrait-bg);
}

.member-quip-bubble {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-card);
  border-left: 2px solid var(--gold-chip-border);
  background: var(--bg-card-elevated);
  font-size: 13px;
}

.member-quip-text {
  color: var(--ink);
  font-style: italic;
}

.combo-mastery-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 400;
  background: none;
  border: 1px solid var(--line-badge);
  color: var(--gold-badge);
}
.combo-mastery-badge.tier-2 {
  background: none;
  border-color: var(--gold-chip-border);
  color: var(--gold-chip);
}
.combo-mastery-badge.tier-3 {
  background: var(--gold-tint);
  border-color: var(--gold-heading);
  color: var(--gold-heading);
}
.rule-line.epithet .combo-mastery-badge {
  background: none;
  color: var(--gold-badge);
  border-color: var(--gold-chip-border);
}

.chain-diagram-card.is-mastered {
  box-shadow: none;
}

/* ピーク・エンド：最後の1個だけ自分の手で */
.unwrap-box.climax-parcel {
  border: 1px solid var(--gold-heading);
  background: var(--gold-tint);
  box-shadow: none;
  animation: climaxPulse 1.6s ease-in-out infinite;
}

.loot-card.is-climax-reveal {
  border-color: var(--gold-heading);
  box-shadow: none;
}

@keyframes climaxPulse {
  0%, 100% {
    box-shadow: 0 0 10px rgba(205, 189, 120, 0.28);
    border-color: var(--gold-chip-border);
  }
  50% {
    box-shadow: 0 0 10px rgba(205, 189, 120, 0.28);
    border-color: var(--gold-chip-border);
  }
}

/* アリーナ演出：ボス名乗りカード・ヒットストップ・白閃光シャッター */
.arena-boss-card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  background: rgba(10, 9, 9, 0.8);
  color: var(--gold-chip);
  z-index: 6;
  transition: opacity 0.22s ease;
}
.arena-boss-card.is-active {
  opacity: 1;
}
.arena-boss-card .boss-card-sub {
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--gold-heading);
  margin-bottom: 4px;
}
.arena-boss-card strong {
  font-family: var(--font-display);
  font-size: 22px;
  text-shadow: none;
  font-weight: var(--display-weight);
  letter-spacing: 0;
}

.arena-white-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: rgba(232, 230, 223, 0.4);
  opacity: 0;
  z-index: 7;
}
.arena-white-flash.is-flash {
  animation: bossShutterFlash 0.42s ease-out forwards;
}
@keyframes bossShutterFlash {
  0% {
    opacity: 0.92;
  }
  35% {
    opacity: 0.55;
  }
  100% {
    opacity: 0;
  }
}

.arena-frame.fx-hitstop {
  filter: contrast(1.16) brightness(1.08);
  transform: scale(1.008);
  transition: transform 0.08s ease;
}

/* 3幕ロードマップ・精錬試算・写真一言キャプション */
.three-act-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}
.act-pill {
  border: 1px solid var(--line-dossier);
  border-radius: var(--radius-sm);
  padding: 5px 7px;
  background: var(--bg-well);
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
}
.act-pill.is-cleared {
  border-color: var(--forest-line);
  background: var(--forest-soft);
}

.refine-delta-badge {
  margin-top: 5px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gold-chip-border);
  background: var(--bg-card-elevated);
  color: var(--ink-primary);
  font-size: 12px;
}

.photo-caption-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin: 5px 0 8px;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-card);
}
.photo-caption-text {
  font-size: 12px;
  color: var(--ink);
  font-style: italic;
  min-width: 0;
  flex: 1 1 180px;
  overflow-wrap: anywhere;
}

/* ============================================================================
 * v5.1 UI/UX Design System Additions (Hub Unified Folio, Desk Grouping,
 * Sticky Homecoming Bar, Stacked Loot, Cascade-Safe Responsive & Reduced Motion)
 * ============================================================================ */
.hub-ledger-folio {
  border-radius: 12px;
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  box-shadow: none;
  overflow: hidden;
}

.hub-ledger-folio.is-epilogue {
  border-color: var(--border-card);
}

.hub-folio-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: none;
  border-bottom: 1px solid var(--line-article);
}

.hub-folio-body {
  padding: 14px 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hub-folio-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.hub-folio-bookmark {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line-article);
  font-size: 12px;
}

.hub-folio-wind {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  padding: 4px 20px 18px;
  background: none;
  color: var(--ink-lead);
  border-top: 0;
  font-size: 12px;
}

.hub-folio-wind.is-fever-ready {
  background: none;
  border-top-color: transparent;
}

.hub-desk-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  box-shadow: none;
  padding: 18px 20px;
}

.hub-desk-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0;
  color: var(--gold-heading);
  font-weight: var(--display-weight);
}

.hub-desk-label::after {
  content: none;
  flex: 1;
  height: 1.5px;
  background: linear-gradient(90deg, var(--line-article) 0%, transparent 100%);
}

.hub-tile {
  border-left: 1px solid var(--border-card);
  background: var(--bg-card-elevated);
  box-shadow: none;
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 44px;
  gap: 3px;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.hub-tile.is-challenge {
  border-left-color: var(--border-card);
  background: var(--bg-card-elevated);
}

.hub-tile.is-challenge:hover:not(:disabled) {
  border-color: var(--gold-chip-border);
  background: var(--bg-hover);
}

.loot-stack-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--gold-tint);
  color: var(--gold-chip);
  font-family: var(--font-num);
  font-size: 12px;
  letter-spacing: 0.03em;
  font-weight: var(--num-weight);
  font-variant-numeric: tabular-nums;
}

.report-sticky-actions {
  position: sticky;
  bottom: calc(68px + env(safe-area-inset-bottom));
  z-index: 15;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-bar);
  border: 1px solid var(--line-dossier);
  box-shadow: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.squad-rule-note {
  font-size: 11.5px;
  color: var(--ink-muted);
  margin-top: 6px;
}

@media (max-width: 640px) {
  .topbar {
    position: static;
    flex-direction: column;
    align-items: stretch;
    padding: 7px 10px;
    gap: 6px;
  }
  .brand {
    justify-content: flex-start;
  }
  .brand-crest {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }
  .brand-title {
    font-size: 16px;
  }
  .brand-sub {
    font-size: 11px;
  }
  .top-meters {
    width: 100%;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 6px;
  }
  .top-currencies {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: wrap;
    gap: 4px;
  }
  .top-tools {
    flex-shrink: 0;
    gap: 4px;
  }
  .meter-pill {
    padding: 3px 6px;
    font-size: 11px;
    gap: 3px;
  }
  .meter-pill strong {
    font-size: 13px;
  }
  .meter-label {
    display: none;
  }
  .icon-btn {
    height: 32px;
    padding: 0 7px;
    font-size: 11px;
  }
  .title-ledger-cover {
    padding: 15px 14px 14px 18px;
  }
  .title-ledger-head {
    gap: 10px;
  }
  .title-ledger-crest {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }
  .main-view {
    padding: 10px 10px 92px;
    gap: 10px;
  }
  .card {
    padding: 12px;
  }
  .card-header {
    flex-wrap: wrap;
    row-gap: 6px;
    gap: 6px;
  }
  .hub-folio-top {
    padding: 6px 10px;
  }
  .hub-folio-body {
    padding: 7px 10px;
  }
  .hub-folio-wind {
    padding: 6px 10px;
    gap: 6px;
  }
  .hub-party-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .hub-party-actions .btn {
    width: 100%;
    justify-content: center;
    padding-left: 8px;
    padding-right: 8px;
    font-size: 12px;
    min-height: 38px;
  }
  .squad-card {
    padding: 11px 12px;
  }
  .member-card {
    padding: 11px 10px;
  }
  .member-top {
    gap: 9px;
  }
  .slot-btn {
    padding: 7px 9px;
  }
  .modal-panel {
    padding: 14px;
    max-height: 90vh;
    max-height: 90dvh;
  }
  .modal-head {
    top: -14px;
    margin: -14px -14px 10px;
    padding: 10px 14px 9px;
  }
  .modal-panel .btn-sm, .modal-panel .btn {
    min-height: 36px;
    max-width: 100%;
    white-space: normal;
    text-align: center;
    line-height: 1.35;
  }
  .modal-head .btn-sm {
    white-space: nowrap;
  }
  .modal-panel .choice-pill {
    white-space: normal;
    max-width: 100%;
    overflow-wrap: anywhere;
    text-align: left;
    line-height: 1.35;
    min-height: 36px;
  }
  .btn-sm, .choice-pill, .select-box-mini, .hub-mini-pill {
    min-height: 36px;
  }
  .mark-chip.is-clickable, .mark-balance-pill, .arena-replay-btn {
    min-height: 32px;
    padding-top: 4px;
    padding-bottom: 4px;
  }
  .three-act-row {
    grid-template-columns: 1fr;
  }
  .report-sticky-actions {
    bottom: calc(70px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 8px 10px;
  }
  .report-sticky-actions .btn {
    width: 100%;
    justify-content: center;
    padding: 7px 6px;
    font-size: 12px;
    min-height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .arena-frame.fx-hitstop {
    transform: none;
    filter: none;
  }
}

/* ============================================================================
   Juice 原本（design/juice/hub.html）から写した配置と、原本の部品で組んだ追加ルール。
   ファイル末尾に置き、上の @media (max-width: 640px) より後で効かせる。
   ============================================================================ */
html {
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
}

::selection {
  background: var(--gold-chip-border);
  color: var(--ink-bright);
}

input[type="checkbox"],
input[type="radio"],
input[type="range"] {
  accent-color: var(--gold-heading);
}

select,
option {
  color: var(--ink-primary);
  background-color: var(--bg-well);
}

.input-text::placeholder,
.mono-box::placeholder {
  color: var(--ink-dim);
}

hr {
  border: 0;
  border-top: 1px solid var(--line-article);
}

a {
  color: var(--gold-chip);
}

/* 数値のカウンター（原本の .num） */
.num,
.meter-pill strong,
.stat-strip strong,
.kpi-val,
#hud-gold,
#hud-shards,
#hud-fame,
#hud-seals {
  font-family: var(--font-num);
  font-weight: var(--num-weight);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

#hud-gold {
  color: var(--gold-heading);
}

/* --- コマンドバー（原本 .cmd-bar） --- */
.brand {
  min-width: 0;
}

.brand > div {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-width: 0;
}

.top-currencies {
  gap: 16px;
}

.top-tools {
  gap: 6px;
}

.meter-pill .svg-icon {
  align-self: center;
}

.meter-pill-btn {
  padding: 6px 0;
}

.status-dot,
.squad-head .tag-running::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-amber);
  box-shadow: 0 0 8px rgba(199, 139, 78, 0.45);
  flex-shrink: 0;
  margin-right: 2px;
}

/* --- 拠点（原本 .parties-grid / .roster-grid / .aux-grid） --- */
.squad-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr));
  align-items: start;
}

.squad-grid > .locked-squad-strip,
.squad-grid > .squad-card.locked {
  grid-column: 1 / -1;
}

.squad-head strong {
  font-size: 18px;
}

.squad-faces {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.face-pill-info {
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}

.face-pill-info > span {
  overflow-wrap: anywhere;
}

.hub-folio-heading {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 22px;
  line-height: 1.35;
  color: var(--ink-bright);
}

.hub-folio-body > .card-sub:first-of-type {
  font-size: 13px;
  color: var(--ink-lead);
}

.chapter-step.done .svg-icon {
  color: var(--status-dot);
}

.streak-badge .svg-icon {
  color: var(--gold-heading);
}

.fever-meter-wrap {
  color: var(--ink-lead);
}

.fever-meter-wrap .fever-bar {
  min-width: 140px;
  max-width: 260px;
}

.hub-quick-row {
  gap: 12px 18px;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--line-article);
}

.inline-stepper-group {
  gap: 6px;
}

.hub-mini-pill:hover:not(.active) {
  border-color: var(--gold-chip-border);
  color: var(--ink-bright);
}

.hub-party-actions {
  gap: 10px;
}

.hub-party-actions .btn-primary,
.hub-party-actions .btn-brass:first-child {
  flex: 1;
  min-width: 180px;
}

.hub-aux-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.hub-tile-head {
  gap: 8px;
}

.bounty-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bounty-card strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-bright);
}

.bounty-card .card-sub[style*="font-weight"] {
  font-family: var(--font-num);
  font-size: 14px;
  font-weight: var(--num-weight) !important;
  letter-spacing: 0.03em;
  color: var(--ink-lead);
}

.bounty-card.is-ready .card-sub[style*="font-weight"] {
  color: var(--status-dot);
}

/* --- 編成・遠征帳（原本のパネルと部品をそのまま使う） --- */
.member-card .member-name {
  line-height: 1.3;
}

.card > strong:first-child,
.card-header > strong {
  color: var(--ink-bright);
}

.subtab-bar,
.squad-switcher {
  gap: 6px;
}

.whyline-table td {
  color: var(--ink-lead);
}

.whyline-table td:first-child {
  color: var(--ink-bright);
}

.whyline-table tr:last-child td {
  border-bottom: none;
}

details.fold-section[open] > summary {
  margin-bottom: 10px;
}

.portrait-md,
.portrait-sm,
.portrait-xs,
.face-pill img,
.photo-member img,
.portrait-opt img,
.live-hp-chip img,
.member-exp-card img,
.arena-unit-portrait,
.setup-selected-preview img,
img[src*="point-faces48"] {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  box-sizing: border-box;
}

/* --- モーダル --- */
.modal-panel {
  scrollbar-color: var(--line-dossier) transparent;
}

.modal-panel .card {
  background: var(--bg-card-elevated);
  border-radius: 8px;
  padding: 14px 16px;
}

.modal-head .btn {
  min-height: 36px;
}

/* --- タップ領域: 主要な操作は 44px 以上（原本の min-height: 44px） --- */
@media (pointer: coarse), (max-width: 680px) {
  .btn-sm,
  .choice-pill,
  .select-box-mini,
  .hub-mini-pill,
  .modal-panel .btn,
  .modal-panel .btn-sm,
  .modal-panel .choice-pill,
  .modal-head .btn,
  .hub-party-actions .btn,
  .report-sticky-actions .btn {
    min-height: 44px;
  }

  .mark-chip.is-clickable,
  .mark-balance-pill,
  .arena-replay-btn,
  .title-mark-badge.is-clickable {
    min-height: 36px;
  }
}

/* --- 原本のレスポンシブ（1024px / 680px） --- */
@media (max-width: 1024px) {
  .hub-aux-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .topbar {
    position: sticky;
    flex-direction: row;
    align-items: center;
    padding: 8px 12px;
    gap: 8px;
  }

  .brand {
    flex: 1 1 auto;
  }

  .top-meters {
    display: contents;
  }

  .top-tools {
    order: 2;
    gap: 6px;
  }

  .top-currencies {
    order: 3;
    width: 100%;
    flex: 0 0 100%;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 8px;
    padding-top: 6px;
    border-top: 1px solid var(--line-article);
  }

  .meter-pill {
    padding: 0;
    font-size: 12px;
    gap: 5px;
  }

  .meter-pill-btn {
    padding: 6px 0;
  }

  .meter-pill strong {
    font-size: 15px;
  }

  .meter-label {
    display: inline;
    font-size: 11px;
  }

  .icon-btn {
    height: 44px;
    padding: 0 10px;
    font-size: 12px;
  }

  .icon-btn .svg-icon {
    display: none;
  }

  .brand-title {
    font-size: 16px;
  }

  .brand-sub {
    font-size: 11px;
  }

  .main-view {
    padding: 12px 12px 24px;
    gap: 14px;
  }

  .card,
  .squad-card,
  .member-card,
  .hub-desk-group,
  .bounty-strip,
  .photo-card,
  .chapter-banner {
    padding: 14px 12px;
  }

  .hub-folio-top {
    padding: 10px 12px;
  }

  .hub-folio-body {
    padding: 12px 12px 8px;
  }

  .hub-folio-wind {
    padding: 4px 12px 14px;
    gap: 8px 16px;
  }

  .hub-folio-heading {
    font-size: 18px;
  }

  .squad-grid {
    gap: 14px;
  }

  .squad-faces {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .face-pill {
    flex-direction: row;
    text-align: left;
    padding: 8px;
    gap: 10px;
  }

  .face-pill-info {
    align-items: flex-start;
  }

  .hub-aux-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .hub-actions-grid {
    grid-template-columns: 1fr;
  }

  .hub-tile.full-span-mobile {
    grid-column: auto;
  }

  .hub-party-actions {
    display: flex;
  }

  .hub-party-actions .btn {
    width: auto;
    flex: 1 1 140px;
    font-size: 13px;
  }

  .modal-panel {
    padding: 14px;
  }
}

/* --- 狭い画面での細部調整 --- */
@media (max-width: 680px) {
  .fever-meter-wrap {
    flex: 1 1 100%;
    min-width: 0;
  }

  .fever-meter-wrap .fever-bar {
    min-width: 60px;
    max-width: none;
  }
}

/* 名声ボタンは見た目を変えずに押せる範囲だけ44px以上へ広げる */
#btn-hud-fame {
  position: relative;
}

#btn-hud-fame::after {
  content: '';
  position: absolute;
  inset: -8px -6px;
}

/* --- 動きを抑える設定 --- */
@media (prefers-reduced-motion: reduce) {
  .btn:active:not(:disabled),
  .icon-btn:active,
  .hub-tile:active:not(:disabled) {
    transform: none;
  }

  .live-dot {
    animation: none;
  }
}

body.reduce-motion .live-dot {
  animation: none;
}

/* ============================================================================
   Direction A — 3層レスポンシブ司令卓ワークスペース（単一DOM・@container駆動）
   ============================================================================ */

/* --- 機能数字の可読性統一（tabular-nums / lining-nums） --- */
.meter-pill strong,
.stat-strip strong,
.kpi-val,
.cmd-num {
  font-family: var(--font-num);
  font-weight: var(--num-weight);
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: 0.01em;
}

/* --- ヘッダ刷新（404 Factory ポータル導線＋コンパクト2行モバイル対応） --- */
.app-shell {
  max-width: none;
  padding-bottom: 0;
  min-height: 100dvh;
}

.topbar {
  padding: 8px 16px;
  gap: 8px 14px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.portal-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px 8px;
  min-height: 36px;
  border-radius: 6px;
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  color: var(--ink-lead);
  text-decoration: none;
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  transition: border-color 140ms ease, color 140ms ease;
}

.portal-brand-link:hover {
  border-color: var(--gold-chip-border);
  color: var(--gold-heading);
}

.portal-brand-link .spoked-o {
  width: 13px;
  height: 13px;
  display: block;
}

.topbar-sep {
  width: 1px;
  height: 18px;
  background: var(--line-dossier);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-title {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

/* --- ワークスペース外枠（Mobileファースト → Tablet 768 → Desktop 1280） --- */
.workspace {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 10px 12px calc(76px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  align-content: start;
}

.workspace[data-view="setup"] {
  max-width: 920px;
  padding-bottom: 36px;
}

.workspace[data-view="setup"] .left-rail-shell,
.workspace[data-view="setup"] .quest-rail {
  display: none !important;
}

.workspace:not([data-view="hub"]) .quest-rail {
  display: none !important;
}

/* Mobile (<768px): left-rail-shell は透明化し、#bottom-nav だけ下部固定5枠バーに */
.left-rail-shell {
  display: contents;
}

.nav-rail {
  display: none;
}

.bottom-nav {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  gap: 2px;
}

.nav-btn {
  min-height: 48px;
  padding: 4px 2px;
}

.nav-btn-prep,
.nav-btn-challenge {
  display: flex;
}

/* --- ステージ外枠（@container 駆動） --- */
.stage-wrap {
  container-type: inline-size;
  container-name: stage;
  min-width: 0;
}

.stage-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  align-content: start;
  min-width: 0;
}

.main-view {
  container-type: inline-size;
  container-name: main;
  padding: 0;
  margin: 0;
  max-width: none;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* --- Tablet (768px – 1279px): 72px アイコンレール + フライアウト + 広大ステージ --- */
@media (min-width: 768px) {
  .workspace {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 16px;
    padding: 14px 16px 32px;
  }

  .workspace[data-view="setup"] {
    grid-template-columns: minmax(0, 1fr);
  }

  .left-rail-shell {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: sticky;
    top: 62px;
    align-self: start;
    min-width: 0;
  }

  .bottom-nav {
    position: static;
    width: 100%;
    border: 1px solid var(--border-card);
    border-radius: 10px;
    background: var(--bg-card);
    padding: 6px 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .nav-btn {
    min-height: 52px;
    padding: 6px 4px;
    border-radius: 7px;
  }

  .nav-btn-prep,
  .nav-btn-challenge {
    display: none;
  }

  .nav-rail {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .rail-tablet-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 1px solid var(--border-card);
    border-radius: 10px;
    background: var(--bg-card);
    padding: 6px 4px;
  }

  .rail-desktop-groups {
    display: none;
  }

  .rail-icon-trigger {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 52px;
    padding: 6px 4px;
    border-radius: 7px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink-lead);
    font-size: 11px;
    font-weight: 500;
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
  }

  .rail-icon-trigger:hover {
    background: var(--bg-hover);
    color: var(--ink-bright);
  }

  .rail-icon-trigger .nav-badge {
    position: absolute;
    top: 4px;
    right: 6px;
  }
}

/* --- Desktop (>= 1280px): 224px フル左レール（3ナビ＋2群ランチャー常設） --- */
@media (min-width: 1280px) {
  .topbar {
    padding: 8px 24px;
  }

  .workspace {
    grid-template-columns: 224px minmax(0, 1fr);
    gap: 16px;
    padding: 14px 24px 36px;
  }

  .bottom-nav {
    padding: 8px;
    gap: 4px;
  }

  .nav-btn {
    flex-direction: row;
    justify-content: flex-start;
    gap: 9px;
    min-height: 40px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .nav-btn .nav-badge {
    position: static;
    margin-left: auto;
  }

  .rail-tablet-group {
    display: none;
  }

  .rail-desktop-groups {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
}

/* --- @container stage: ステージ幅に応じて依頼書・司令票・陣形・ルートを最適配置 --- */
@container stage (min-width: 880px) {
  .stage-wrap.has-quest-rail > .stage-inner {
    grid-template-columns: minmax(0, 1fr) 288px;
    gap: 16px;
  }

  .stage-wrap.has-quest-rail .quest-rail {
    position: sticky;
    top: 62px;
    align-self: start;
  }

  .stage-wrap.has-quest-rail .quest-list {
    grid-template-columns: 1fr;
  }
}

/* --- 左レール：ランチャー項目（Desktop 常設） --- */
.rail-section {
  border: 1px solid var(--border-card);
  border-radius: 10px;
  background: var(--bg-card);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rail-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
  padding: 2px 6px 4px;
  letter-spacing: 0.04em;
}

.rail-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 7px 9px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-primary);
  text-align: left;
  font-size: 13px;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.rail-item:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--line-article);
}

.rail-item:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.rail-item.is-subcontext {
  border-color: var(--gold-chip-border);
  background: var(--gold-tint);
}

.rail-item-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.rail-item-label {
  overflow-wrap: anywhere;
  line-height: 1.3;
}

.rail-item-badge {
  font-family: var(--font-num);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--bg-well);
  border: 1px solid var(--line-article);
  color: var(--ink-lead);
  white-space: nowrap;
  flex-shrink: 0;
}

.rail-item-badge.is-ready {
  background: var(--gold-tint);
  border-color: var(--gold-chip-border);
  color: var(--gold-heading);
}

.rail-save-note {
  font-size: 11.5px;
  color: var(--ink-muted);
  padding: 4px 6px 0;
  line-height: 1.45;
}

/* --- 右レール / 棚：ギルド依頼書（#quest-rail） --- */
.quest-rail {
  border: 1px solid var(--border-card);
  border-radius: 12px;
  background: var(--bg-card);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.quest-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.quest-rail-title {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 16px;
  color: var(--gold-heading);
}

.quest-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 10px;
}

.quest-item-card {
  border: 1px solid var(--line-article);
  border-radius: 8px;
  background: var(--bg-card-elevated);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.quest-item-card.is-ready {
  border-color: var(--gold-chip-border);
  background: var(--gold-tint);
}

.quest-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.quest-item-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-primary);
  overflow-wrap: anywhere;
}

.quest-item-prog {
  font-family: var(--font-num);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--ink-lead);
  white-space: nowrap;
  flex-shrink: 0;
}

.quest-item-card.is-ready .quest-item-prog {
  color: var(--forest);
}

.quest-item-desc {
  font-size: 12px;
  color: var(--ink-muted);
  line-height: 1.45;
}

.quest-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.quest-item-reward {
  font-family: var(--font-num);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  color: var(--gold-heading);
}

/* --- Tablet フライアウト / Mobile ボトムシート（#drawer-root） --- */
.drawer-root {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: rgba(10, 9, 8, 0.62);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.drawer-panel {
  width: 100%;
  max-height: 82dvh;
  overflow-y: auto;
  background: var(--bg-card);
  border-top: 1px solid var(--line-dossier);
  border-radius: 14px 14px 0 0;
  padding: 14px 14px calc(18px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 768px) {
  .drawer-root {
    align-items: stretch;
    justify-content: flex-start;
  }

  .drawer-panel {
    width: 312px;
    max-height: 100dvh;
    border-top: none;
    border-right: 1px solid var(--line-dossier);
    border-radius: 0;
    padding: 16px;
  }
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-article);
}

.drawer-title {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 17px;
  color: var(--gold-heading);
}

.drawer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

@media (min-width: 768px) {
  .drawer-grid {
    grid-template-columns: 1fr;
  }
}

.drawer-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  min-height: 52px;
  border-radius: 8px;
  border: 1px solid var(--line-article);
  background: var(--bg-card-elevated);
  color: var(--ink-primary);
  text-align: left;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.drawer-tile:hover:not(:disabled) {
  border-color: var(--gold-chip-border);
  background: var(--bg-hover);
}

.drawer-tile:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.drawer-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

.drawer-tile-desc {
  font-size: 11.5px;
  color: var(--ink-muted);
  line-height: 1.38;
}

/* --- 中央司令卓：Slot H1 戦況帯（コンパクト1行〜2行） --- */
.cmd-status-strip {
  border: 1px solid var(--border-card);
  border-radius: 10px;
  background: var(--bg-card);
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
}

.cmd-status-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 260px;
  flex-wrap: wrap;
}

.cmd-chapter-pill {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 15px;
  color: var(--gold-heading);
  white-space: nowrap;
}

.cmd-goal-text {
  font-size: 12.5px;
  color: var(--ink-lead);
  line-height: 1.4;
  min-width: 0;
}

.cmd-status-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cmd-wind-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid var(--line-article);
  background: var(--bg-card-elevated);
  font-size: 12px;
  color: var(--ink-lead);
  white-space: nowrap;
}

.cmd-wind-pill.is-ready {
  border-color: var(--gold-chip-border);
  background: var(--gold-tint);
  color: var(--gold-heading);
}

.cmd-wind-mini-bar {
  width: 38px;
  height: 5px;
  border-radius: 99px;
  background: var(--bg-well);
  overflow: hidden;
}

.cmd-wind-mini-fill {
  height: 100%;
  background: var(--gold-heading);
}

.cmd-bookmark-line {
  width: 100%;
  padding-top: 6px;
  border-top: 1px solid var(--line-article);
  font-size: 12px;
  color: var(--ink-lead);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* --- 中央司令卓：Slot H3 複数部隊タブストリップ --- */
.cmd-squad-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.cmd-squad-tabs {
  display: flex;
  align-items: stretch;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1 1 auto;
}

.cmd-squad-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line-article);
  background: var(--bg-card);
  color: var(--ink-lead);
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.cmd-squad-tab:hover {
  border-color: var(--gold-chip-border);
  color: var(--ink-primary);
}

.cmd-squad-tab.is-active {
  border-color: var(--gold-chip-border);
  background: var(--gold-tint);
  color: var(--gold-heading);
}

.cmd-squad-tab.is-ghost {
  border-style: dashed;
  color: var(--ink-muted);
  font-weight: 500;
}

.cmd-squad-dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--ink-muted);
  flex-shrink: 0;
}

.cmd-squad-dot.is-running {
  background: var(--status-dot);
  box-shadow: 0 0 0 3px var(--status-halo);
}

.cmd-squad-dot.is-claim {
  background: var(--gold-heading);
}

.cmd-squad-pill {
  font-family: var(--font-num);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  color: var(--ink-muted);
  white-space: nowrap;
}

.cmd-squad-tab.is-active .cmd-squad-pill {
  color: var(--ink-primary);
}

.cmd-squad-pill.is-claim {
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--gold-heading);
  color: var(--btn-light-ink);
}

/* --- 中央司令卓：司令票（Command Ticket・5状態排他パネル） --- */
.cmd-ticket {
  border: 1px solid var(--border-card);
  border-radius: 12px;
  background: var(--bg-card);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.cmd-ticket[data-state="claim"] {
  border-color: var(--gold-chip-border);
}

.cmd-ticket[data-state="marching"] {
  border-color: var(--forest-line);
}

.cmd-ticket-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.cmd-ticket-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cmd-ticket-title {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 18px;
  color: var(--ink-bright);
  margin: 0;
}

.cmd-ticket-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

@container main (min-width: 560px) {
  .cmd-ticket-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 14px;
  }
}

.cmd-ticket-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.cmd-dest-selectors {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cmd-dest-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-bright);
}

/* --- RouteTrack（本編4章 3エリア / 深淵50F 節目ゲージ） --- */
.cmd-route-track {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.cmd-route-node {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 3px;
  min-height: 46px;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--line-article);
  background: var(--bg-card-elevated);
  color: var(--ink-lead);
  text-align: left;
  min-width: 0;
  transition: border-color 140ms ease, background-color 140ms ease;
}

button.cmd-route-node:hover {
  border-color: var(--gold-chip-border);
  color: var(--ink-bright);
}

.cmd-route-node.is-target,
.cmd-route-node.is-current {
  border-color: var(--gold-chip-border);
  background: var(--gold-tint);
  color: var(--ink-bright);
}

.cmd-route-node.is-cleared .cmd-route-state {
  color: var(--forest);
}

.cmd-route-node.is-target .cmd-route-state,
.cmd-route-node.is-current .cmd-route-state {
  color: var(--gold-heading);
}

.cmd-route-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-size: 11px;
  color: var(--ink-muted);
}

.cmd-route-state {
  font-weight: 700;
  white-space: nowrap;
}

.cmd-route-name {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

/* --- Abyss 50F RouteTrack --- */
.cmd-abyss-box {
  border: 1px solid var(--line-article);
  border-radius: 8px;
  background: var(--bg-card-elevated);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cmd-abyss-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
}

.cmd-abyss-gauge {
  position: relative;
  height: 10px;
  border-radius: 99px;
  background: var(--bg-well);
  overflow: hidden;
}

.cmd-abyss-fill {
  height: 100%;
  background: var(--gold-heading);
  border-radius: 99px;
}

.cmd-abyss-milestones {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-num);
  font-size: 11px;
  color: var(--ink-muted);
}

.cmd-abyss-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* --- 2行構成・折り返しゼロの遠征時間チップ --- */
.cmd-dur-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

@container main (min-width: 620px) {
  .cmd-dur-grid.has-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }

  .cmd-dur-grid.has-4 .cmd-dur-chip {
    padding: 6px 3px;
  }

  .cmd-dur-grid.has-4 .cmd-dur-main {
    font-size: 13px;
  }

  .cmd-dur-grid.has-4 .cmd-dur-sub {
    font-size: 10.5px;
  }
}

@container main (min-width: 520px) {
  .cmd-dur-grid.has-5 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
}

@container main (min-width: 780px) {
  .cmd-dur-grid.has-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
  }

  .cmd-dur-grid.has-5 .cmd-dur-chip {
    padding: 6px 2px;
  }
}

.cmd-dur-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 46px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line-article);
  background: var(--bg-card-elevated);
  color: var(--ink-lead);
  white-space: nowrap;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.cmd-dur-chip:hover {
  border-color: var(--gold-chip-border);
  color: var(--ink-bright);
}

.cmd-dur-chip.is-active {
  border-color: var(--gold-chip-border);
  background: var(--gold-tint);
  color: var(--gold-heading);
}

.cmd-dur-main {
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 13.5px;
  line-height: 1.2;
}

.cmd-dur-sub {
  font-family: var(--font-num);
  font-size: 11px;
  color: var(--ink-muted);
  line-height: 1.15;
}

.cmd-dur-chip.is-active .cmd-dur-sub {
  color: var(--ink-primary);
}

.cmd-cta-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-wrap: wrap;
}

.cmd-cta-primary {
  flex: 1 1 180px;
  min-height: 48px;
  font-size: 14.5px;
  font-weight: 700;
}

.cmd-cta-secondary {
  min-height: 48px;
}

.cmd-next-step {
  border: 1px solid var(--gold-chip-border);
  border-radius: 8px;
  background: var(--gold-tint);
  padding: 8px 10px;
  font-size: 12.5px;
  color: var(--ink-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.cmd-forecast-box {
  border: 1px solid var(--line-article);
  border-radius: 8px;
  background: var(--bg-card-elevated);
  padding: 10px;
  font-size: 12.5px;
  color: var(--ink-lead);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cmd-timer-big {
  font-family: var(--font-num);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 20px;
  color: var(--ink-bright);
  line-height: 1.25;
}

/* --- 中央司令卓：前後列 2×2 陣形＆5印シナジーパネル --- */
.cmd-formation {
  border: 1px solid var(--border-card);
  border-radius: 12px;
  background: var(--bg-card);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cmd-formation.is-marching {
  border-color: var(--line-article);
}

.cmd-formation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.cmd-formation-title {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 16px;
  color: var(--gold-heading);
}

.cmd-formation-rows {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

@container main (min-width: 520px) {
  .cmd-formation-rows {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

.cmd-row-col {
  border: 1px solid var(--line-article);
  border-radius: 8px;
  background: var(--bg-card-elevated);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.cmd-row-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cmd-row-members {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 1fr));
  gap: 6px;
}

.cmd-member-tile {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  min-width: 0;
}

.cmd-portrait-frame {
  width: 52px;
  height: 52px;
  padding: 2px;
  border-radius: 8px;
  background: var(--portrait-bg);
  border: 1px solid var(--portrait-line);
  box-shadow: var(--portrait-shadow);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.cmd-portrait-frame img {
  width: 48px;
  height: 48px;
  display: block;
  image-rendering: pixelated;
}

.cmd-member-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cmd-member-name-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.cmd-member-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-bright);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cmd-member-lv {
  font-family: var(--font-num);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink-lead);
  white-space: nowrap;
}

.cmd-member-job {
  font-size: 11.5px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmd-member-marks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.cmd-synergy-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--line-article);
  font-size: 12px;
}

.cmd-synergy-chips {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

/* --- モバイル375px ヘッダ2行最適化 & タップ領域44px保証 --- */
@media (max-width: 767px) {
  .topbar {
    padding: 6px 10px;
    gap: 6px 8px;
  }

  .topbar-left {
    flex: 1 1 auto;
    gap: 6px;
  }

  .portal-brand-link {
    padding: 3px 6px;
    min-height: 36px;
    font-size: 11px;
  }

  .brand-crest {
    width: 28px;
    height: 28px;
  }

  .brand-title {
    font-size: 15px;
    max-width: 140px;
  }

  .brand-sub {
    display: none;
  }

  .top-meters {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }

  .top-currencies {
    flex: 0 0 100%;
    gap: 8px;
    overflow: visible;
    justify-content: space-between;
  }

  .top-tools {
    gap: 4px;
  }

  .top-tools .icon-btn .svg-icon {
    display: inline-flex;
  }

  .top-tools .icon-btn span:not([id^="ico-"]) {
    display: none;
  }

  .top-tools .icon-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    justify-content: center;
  }

  .cmd-route-node {
    padding: 6px 7px;
  }

  .cmd-route-name {
    font-size: 11.5px;
  }

  .cmd-ticket {
    padding: 11px;
    gap: 9px;
  }

  .cmd-status-strip {
    padding: 7px 10px;
    gap: 6px;
  }
}

@media (max-width: 1279px), (any-pointer: coarse) {
  .rail-item,
  .drawer-tile,
  .cmd-squad-tab,
  .cmd-dur-chip,
  .cmd-route-node,
  .select-box-mini,
  .btn-sm {
    min-height: 44px;
  }
}
