:root {
  --bg-dark: #070c14;
  --bg-panel: #0e1624;
  --bg-card: #131f33;
  --bg-card-hover: #1a2a44;
  --border-subtle: #1f324d;
  --border-active: #38bdf8;
  --text-main: #e2e8f0;
  --text-muted: #8ca0b8;
  --cyan: #38bdf8;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --purple: #a855f7;
  --font-mono: 'Consolas', 'Meiryo', monospace;
  --font-sans: 'Segoe UI', 'Yu Gothic UI', 'Meiryo', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.hidden {
  display: none !important;
}

body {
  background: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: auto;
  user-select: none;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1520px;
  margin: 0 auto;
  padding: 10px 14px;
  gap: 10px;
}

/* ===== 上部バー ===== */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 14px;
  flex-wrap: wrap;
}

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

.brand-badge {
  background: rgba(56, 189, 248, 0.15);
  color: var(--cyan);
  border: 1px solid var(--cyan);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 4px;
  letter-spacing: 1px;
}

.brand h1 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #f8fafc;
}

.stage-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.status-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.stat-pill {
  background: #09101c;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 4px 10px;
  display: flex;
  flex-direction: column;
  min-width: 88px;
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: #f8fafc;
}

.stat-hq .stat-value { color: var(--green); }
.stat-cost .stat-value { color: var(--cyan); }
.stat-funds .stat-value { color: var(--amber); }

.control-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ctrl-btn {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ctrl-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--cyan);
}

.ctrl-btn.primary {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--cyan);
  color: #e0f2fe;
}

.ctrl-btn.primary.paused {
  background: rgba(245, 158, 11, 0.22);
  border-color: var(--amber);
  color: #fef3c7;
}

.ctrl-btn.accent {
  background: rgba(34, 197, 94, 0.16);
  border-color: var(--green);
  color: #dcfce7;
}

.ctrl-btn.danger {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.6);
  color: #fecaca;
}

.ctrl-btn.active {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--cyan);
}

.ctrl-btn.large {
  padding: 10px 24px;
  font-size: 14px;
}

.ctrl-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ===== メインエリア ===== */
.main-area {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 10px;
  align-items: start;
}

.canvas-wrapper {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.canvas-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  padding: 4px 8px;
  background: #09101c;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.mode-indicator {
  color: var(--cyan);
  font-weight: 600;
}

.mode-indicator.air-mode {
  color: var(--amber);
}

.mode-indicator.move-mode {
  color: var(--green);
}

.tile-info {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.canvas-stage {
  position: relative;
  display: flex;
  justify-content: center;
  background: #050910;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #162338;
}

#game-canvas {
  display: block;
  width: 100%;
  max-width: 960px;
  height: auto;
  cursor: crosshair;
}

/* リザルトオーバーレイ */
.result-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 10, 18, 0.84);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.result-overlay.hidden {
  display: none;
}

.result-card {
  background: var(--bg-panel);
  border: 2px solid var(--cyan);
  border-radius: 12px;
  padding: 24px 32px;
  text-align: center;
  max-width: 480px;
  width: 92%;
  max-height: 94%;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.result-card.defeat {
  border-color: var(--red);
}

.result-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--cyan);
  margin-bottom: 8px;
}

.result-card.defeat .result-badge {
  color: var(--red);
}

.result-card h2 {
  font-size: 26px;
  margin-bottom: 8px;
}

.result-card p {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 16px;
}

.result-stats {
  background: #09101c;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: left;
  line-height: 1.8;
}

/* ===== 右サイドパネル ===== */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}

.panel-section {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  background: #0b1320;
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--cyan);
}

.panel-tag {
  font-family: var(--font-sans);
  color: var(--text-muted);
  font-weight: 500;
}

.inspector-section {
  min-height: 390px;
}

.inspector-content {
  padding: 12px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-hint {
  color: var(--text-muted);
  line-height: 1.65;
}

.empty-hint ul {
  margin-top: 10px;
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.empty-hint strong {
  color: var(--text-main);
}

.unit-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.unit-name {
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
}

.unit-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.16);
  color: var(--cyan);
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.commander-box {
  background: #0a1220;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.commander-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.commander-name {
  font-weight: 700;
  color: #f8fafc;
}

.match-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.5);
}

.skill-line {
  font-size: 11px;
  color: #cbd5e1;
}

.skill-name {
  color: var(--amber);
  font-weight: 700;
}

.bar-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bar-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.bar-track {
  height: 7px;
  background: #08101c;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #1b2c45;
}

.bar-fill {
  height: 100%;
  transition: width 0.15s linear;
}

.bar-fill.hp { background: var(--green); }
.bar-fill.ammo { background: var(--amber); }
.bar-fill.exp { background: var(--purple); }
.bar-fill.comm { background: var(--cyan); }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.stat-cell {
  background: #0a1220;
  border: 1px solid #192942;
  border-radius: 5px;
  padding: 5px 8px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
}

.stat-cell span:first-child {
  color: var(--text-muted);
}

.stat-cell span:last-child {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #f1f5f9;
}

.inspector-actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.inspector-actions .ctrl-btn {
  flex: 1;
}

/* 戦術ログ */
.log-section {
  flex: 1;
}

.tactical-log {
  height: 210px;
  overflow-y: auto;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #080e18;
}

.log-entry {
  border-left: 2px solid var(--border-subtle);
  padding-left: 6px;
  color: #cbd5e1;
}

.log-entry.info { border-color: var(--cyan); }
.log-entry.warn { border-color: var(--amber); color: #fde68a; }
.log-entry.alert { border-color: var(--red); color: #fecaca; }
.log-entry.success { border-color: var(--green); color: #bbf7d0; }
.log-entry.levelup { border-color: var(--purple); color: #e9d5ff; font-weight: 700; }

/* ===== 下部コマンドデッキ ===== */
.bottom-deck {
  display: grid;
  grid-template-columns: 1fr 370px;
  gap: 10px;
}

.deck-block {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.deck-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.5px;
}

.air-deck .deck-header {
  color: var(--amber);
}

.deck-hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 10px;
}

.card-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.unit-card {
  flex: 1 0 112px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 7px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.14s ease;
  position: relative;
}

.unit-card:hover:not(.disabled) {
  background: var(--bg-card-hover);
  border-color: var(--cyan);
  transform: translateY(-1px);
}

.unit-card.selected {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan);
}

.air-deck .unit-card.selected {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--amber);
  box-shadow: 0 0 0 1px var(--amber);
}

.unit-card.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-icon {
  font-size: 15px;
}

.card-cost {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
}

.air-deck .card-cost {
  color: var(--amber);
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.card-title {
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
}

.role-tag {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  white-space: nowrap;
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.role-tag.air {
  background: rgba(56, 189, 248, 0.18);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.5);
}

.role-tag.ground {
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.45);
}

.role-tag.ground-air {
  background: rgba(168, 85, 247, 0.18);
  color: #d8b4fe;
  border-color: rgba(168, 85, 247, 0.45);
}

.role-tag.support {
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.45);
}

.card-sub {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-cd-bar {
  height: 4px;
  background: #070d17;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}

.card-cd-fill {
  height: 100%;
  background: var(--amber);
}

@media (max-width: 1180px) {
  .main-area,
  .bottom-deck {
    grid-template-columns: 1fr;
  }
}


/* ===== Phase 2: インターミッション画面（戦略司令部） ===== */
.result-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.intermission-screen {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 18, 0.96);
  z-index: 50;
  overflow-y: auto;
  padding: 16px;
}

.intermission-screen.hidden {
  display: none;
}

.im-container {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.im-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 16px;
}

.im-header-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.im-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 12px;
}

.im-tab-btn {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.im-tab-btn:hover {
  color: var(--text-main);
  border-color: var(--cyan);
}

.im-tab-btn.active {
  background: rgba(56, 189, 248, 0.2);
  color: #e0f2fe;
  border-color: var(--cyan);
}

.im-toast {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
}

.im-toast.ok { color: var(--green); }
.im-toast.error { color: var(--red); }

.im-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.im-section {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.im-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--cyan);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.im-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

/* 編成（乗り換え）リスト */
.im-roster-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.im-roster-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
}

.im-roster-row.is-active {
  border-left: 3px solid var(--cyan);
}

.im-roster-row.is-reserve {
  opacity: 0.72;
  border-left: 3px solid #475569;
}

.im-roster-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 280px;
}

.im-weapon-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.im-weapon-icon { font-size: 16px; }
.im-weapon-name { font-size: 14px; font-weight: 700; color: #f8fafc; }

.tier-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.22);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.6);
}

.upg-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(168, 85, 247, 0.22);
  color: #e9d5ff;
  border: 1px solid rgba(168, 85, 247, 0.55);
}

.normal-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.im-weapon-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.im-roster-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

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

.im-cmd-select {
  background: #09101c;
  color: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  min-width: 240px;
}

/* 兵器改造タブ */
.im-upgrade-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 14px;
}

.im-upg-list {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 520px;
  overflow-y: auto;
}

.im-upg-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 10px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.im-upg-item:hover {
  border-color: var(--cyan);
}

.im-upg-item.selected {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--cyan);
}

.upg-mini {
  font-family: var(--font-mono);
  color: #e9d5ff;
  font-size: 11px;
}

.im-upg-detail {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.im-upg-header h3 {
  font-size: 18px;
  margin-bottom: 4px;
}

.im-upg-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.im-upg-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px 14px;
}

.im-upg-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.im-upg-label {
  font-size: 13px;
  font-weight: 700;
}

.im-upg-label span {
  font-family: var(--font-mono);
  color: var(--cyan);
  margin-left: 8px;
  font-size: 12px;
}

.im-upg-effect {
  font-size: 11px;
  color: var(--text-muted);
}

.upg-pips {
  display: flex;
  gap: 5px;
  margin-top: 2px;
}

.upg-pip {
  width: 26px;
  height: 7px;
  border-radius: 3px;
  background: #08101c;
  border: 1px solid #263b5a;
}

.upg-pip.filled {
  background: var(--green);
  border-color: #86efac;
}

/* 兵器ショップ */
.im-shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 10px;
}

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

.im-shop-card.tier2-card {
  border-color: rgba(245, 158, 11, 0.55);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.07), var(--bg-card));
}

.im-shop-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.im-shop-spec {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.im-shop-desc {
  font-size: 11px;
  color: #cbd5e1;
  line-height: 1.5;
  flex: 1;
}

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

.im-sell-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
}

/* 作戦選択 */
.im-stage-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 12px;
}

.im-stage-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.im-stage-card.current {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.3);
}

.im-stage-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.im-stage-head h3 {
  font-size: 15px;
}

.im-stage-desc {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.55;
  flex: 1;
}

.im-stage-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
  background: #09101c;
  padding: 8px 10px;
  border-radius: 6px;
}

.im-stage-meta strong {
  color: #f8fafc;
}

.im-danger-zone {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: #fecaca;
}

.unmanned-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.55);
}

/* ===== 指揮官ステータス一覧・作戦開始オーバーレイ ===== */
.start-card {
  max-width: 880px;
  width: 95%;
  padding: 18px 24px;
}

.start-card h2 {
  font-size: 21px;
  margin-bottom: 4px;
}

.start-card > p {
  margin-bottom: 10px;
  font-size: 12.5px;
}

.start-card .result-stats {
  padding: 10px 14px;
  margin-bottom: 12px;
  line-height: 1.65;
}

.start-card .result-actions {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.start-card .result-actions .ctrl-btn.large {
  padding: 8px 16px;
  font-size: 13px;
}

.briefing-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 14px;
  align-items: start;
}

.briefing-col-title {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #1b2e4a;
}

.briefing-rules {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@media (max-width: 720px) {
  .briefing-grid {
    grid-template-columns: 1fr;
  }
}

.im-cmd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 12px;
}

.im-cmd-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.im-cmd-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.im-cmd-pref {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-muted);
}

/* 展開中カード・装備アイテムセレクト */
.unit-card.deployed {
  border-color: rgba(34, 197, 94, 0.7);
  background: rgba(34, 197, 94, 0.12);
}

.unit-card.deployed .card-cost {
  color: #86efac;
}

.im-item-select {
  background: #09101c;
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  min-width: 175px;
}

/* 顔グラポートレート・並び替えボタン・スコアランクバッジ */
.cmd-portrait-svg {
  display: block;
  flex-shrink: 0;
  border-radius: 6px;
}

.portrait-empty {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  background: #09101c;
  border: 1px dashed #475569;
  color: #64748b;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-sub-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.im-order-btns {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.order-btn {
  background: #09101c;
  color: #94a3b8;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  width: 22px;
  height: 18px;
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.order-btn:hover {
  color: #f8fafc;
  border-color: var(--cyan);
}

.score-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.rank-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid transparent;
}

.rank-badge.large-rank {
  font-size: 16px;
  padding: 5px 12px;
}

.rank-badge.rank-S { background: rgba(251, 191, 36, 0.22); color: #fde047; border-color: #facc15; }
.rank-badge.rank-A { background: rgba(56, 189, 248, 0.22); color: #7dd3fc; border-color: #38bdf8; }
.rank-badge.rank-B { background: rgba(34, 197, 94, 0.2);  color: #86efac; border-color: #22c55e; }
.rank-badge.rank-C { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; border-color: #94a3b8; }

/* ブリーフィング無線会話 */
.briefing-dialogue {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dialogue-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #0c1626;
  border: 1px solid #1e324d;
  border-radius: 6px;
  padding: 6px 8px;
}

.dialogue-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  margin-bottom: 2px;
}

.dialogue-text {
  font-family: var(--font-sans);
  font-size: 11.5px;
  color: #e2e8f0;
  line-height: 1.45;
}

/* ===== ゲーム内マニュアルモーダル ===== */
.manual-modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 9, 17, 0.88);
  backdrop-filter: blur(4px);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.manual-modal.hidden {
  display: none;
}

.manual-dialog {
  background: var(--bg-panel);
  border: 1.5px solid var(--cyan);
  border-radius: 12px;
  max-width: 960px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
}

.manual-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #0a1220;
  border-bottom: 1px solid var(--border-subtle);
}

.manual-header h2 {
  font-size: 16px;
  color: #f8fafc;
}

.manual-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  background: #0c1525;
  border-bottom: 1px solid var(--border-subtle);
}

.manual-tab-btn {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.manual-tab-btn.active {
  background: rgba(56, 189, 248, 0.2);
  color: #e0f2fe;
  border-color: var(--cyan);
}

.manual-body {
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 13px;
  line-height: 1.65;
}

.man-section {
  background: #0a1220;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.man-section h3 {
  font-size: 14px;
  color: var(--cyan);
  border-bottom: 1px solid #1a2c47;
  padding-bottom: 5px;
}

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

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

.man-card strong {
  display: block;
  color: #f8fafc;
  margin-bottom: 4px;
}

.man-list {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.man-formula {
  background: #060b14;
  border-left: 3px solid var(--amber);
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #fde68a;
  line-height: 1.75;
  border-radius: 4px;
  overflow-x: auto;
}

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

.man-table th,
.man-table td {
  border: 1px solid #1e324d;
  padding: 6px 8px;
  text-align: left;
}

.man-table th {
  background: #112036;
  color: #bae6fd;
  font-weight: 700;
}

.man-note {
  font-size: 11.5px;
  color: var(--text-muted);
}

.man-section code {
  background: #132238;
  color: #7dd3fc;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

/* ===== パワプロ風ステータスランク表示 ＆ 陸軍/空軍パネル色調分け ===== */
.im-cmd-card.domain-army {
  background: linear-gradient(145deg, #10241c 0%, #0e1924 100%);
  border-color: rgba(34, 197, 94, 0.45);
  border-left: 4px solid #22c55e;
}

.im-cmd-card.domain-air {
  background: linear-gradient(145deg, #10223b 0%, #0e1726 100%);
  border-color: rgba(56, 189, 248, 0.5);
  border-left: 4px solid #38bdf8;
}

.im-cmd-card.domain-hybrid {
  background: linear-gradient(145deg, #211738 0%, #0e1626 100%);
  border-color: rgba(168, 85, 247, 0.5);
  border-left: 4px solid #a855f7;
}

.domain-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}

.domain-badge-army {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.55);
}

.domain-badge-air {
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.55);
}

.domain-badge-hybrid {
  background: rgba(168, 85, 247, 0.22);
  color: #e9d5ff;
  border: 1px solid rgba(168, 85, 247, 0.55);
}

.pp-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.pp-stat-cell {
  background: rgba(6, 11, 20, 0.72);
  border: 1px solid #1e314d;
  border-radius: 6px;
  padding: 6px 9px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pp-stat-label {
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
}

.pp-stat-val {
  display: flex;
  align-items: baseline;
  gap: 3px;
  font-family: var(--font-mono);
}

.pp-grade {
  font-size: 19px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.65);
}

.pp-num {
  font-size: 12px;
  font-weight: 700;
  color: #e2e8f0;
}

/* パワプロ参考のランクカラー（S〜G） */
.pp-grade.grade-S { color: #f472b6; text-shadow: 0 0 8px rgba(244, 114, 182, 0.6); }
.pp-grade.grade-A { color: #fb7185; }
.pp-grade.grade-B { color: #ef4444; }
.pp-grade.grade-C { color: #f97316; }
.pp-grade.grade-D { color: #eab308; }
.pp-grade.grade-E { color: #22c55e; }
.pp-grade.grade-F { color: #38bdf8; }
.pp-grade.grade-G { color: #94a3b8; }

/* ===== タイトル画面・モード選択・ロード・アーケード風ランキング ===== */
.ctrl-btn.gold {
  background: rgba(250, 204, 21, 0.16);
  border-color: #facc15;
  color: #fef08a;
}

.ctrl-btn.gold:hover {
  background: rgba(250, 204, 21, 0.28);
  border-color: #fde047;
}

.title-screen {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: radial-gradient(circle at 50% 20%, #0f1f38 0%, #050a12 72%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.title-screen.hidden {
  display: none;
}

.title-grid-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.06) 1px, transparent 1px);
  background-size: 40px 40px;
}

.title-panel {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 980px;
  background: rgba(11, 19, 32, 0.94);
  border: 1.5px solid rgba(56, 189, 248, 0.45);
  border-radius: 14px;
  padding: 28px 32px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.78), 0 0 40px rgba(56, 189, 248, 0.08);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.title-hero {
  text-align: center;
  padding: 12px 0 6px;
}

.title-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 3.5px;
  color: var(--cyan);
  margin-bottom: 8px;
}

.title-logo {
  font-size: 46px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #f8fafc;
  text-shadow: 0 0 28px rgba(56, 189, 248, 0.45);
  margin-bottom: 8px;
}

.title-tagline {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.title-hi-score {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  background: rgba(250, 204, 21, 0.1);
  border: 1px solid rgba(250, 204, 21, 0.45);
  color: #fde047;
  padding: 5px 16px;
  border-radius: 999px;
  letter-spacing: 1px;
}

.title-hi-score span {
  font-size: 16px;
  font-weight: 800;
  color: #fef08a;
}

.title-hi-score small {
  color: #cbd5e1;
  font-size: 11px;
}

.title-menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 540px;
  width: 100%;
  margin: 0 auto;
}

.title-menu-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: all 0.16s ease;
}

.title-menu-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--cyan);
  transform: translateX(4px);
}

.title-menu-btn.primary {
  background: rgba(56, 189, 248, 0.16);
  border-color: var(--cyan);
}

.title-menu-btn.gold {
  background: rgba(250, 204, 21, 0.1);
  border-color: rgba(250, 204, 21, 0.55);
}

.title-menu-btn.disabled,
.title-menu-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.tm-icon {
  font-size: 22px;
  width: 28px;
  text-align: center;
}

.tm-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tm-text strong {
  font-family: var(--font-mono);
  font-size: 16px;
  letter-spacing: 1.5px;
  color: #f8fafc;
}

.tm-text small {
  font-size: 11.5px;
  color: var(--text-muted);
}

.title-sub-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
}

.title-sub-header h2 {
  font-size: 19px;
  color: #f8fafc;
}

/* モード選択カード */
.mode-select-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 16px;
}

@media (max-width: 780px) {
  .mode-select-grid {
    grid-template-columns: 1fr;
  }
}

.mode-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: 10px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-card.campaign-card {
  border-color: rgba(56, 189, 248, 0.65);
  background: linear-gradient(160deg, rgba(16, 36, 62, 0.9), rgba(14, 22, 36, 0.95));
}

.mode-badge {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
  border: 1px solid var(--cyan);
}

.mode-badge.free {
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
  border-color: var(--green);
}

.mode-card h3 {
  font-size: 18px;
  color: #f8fafc;
}

.mode-desc {
  font-size: 12.5px;
  color: #cbd5e1;
  line-height: 1.6;
}

.mode-bullets {
  padding-left: 18px;
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mode-bullets strong {
  color: #fde047;
}

.slot-pick-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--cyan);
  margin-top: 4px;
}

.slot-pick-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.slot-pick-btn {
  background: #09111f;
  border: 1px solid #243b5e;
  border-radius: 7px;
  padding: 9px 12px;
  text-align: left;
  color: #f8fafc;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all 0.14s ease;
}

.slot-pick-btn:hover {
  border-color: var(--cyan);
  background: #12223a;
}

.slot-meta {
  font-size: 11px;
  color: #94a3b8;
  font-family: var(--font-mono);
}

.slot-meta.empty {
  color: #4ade80;
}

/* ロード画面スロット */
.save-slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(410px, 1fr));
  gap: 12px;
}

.save-slot-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.save-slot-card.is-cleared {
  border-color: rgba(250, 204, 21, 0.7);
  background: linear-gradient(155deg, rgba(45, 34, 12, 0.55), var(--bg-card));
}

.save-slot-card.empty {
  opacity: 0.55;
}

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

.diff-pill,
.cycle-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  margin-left: 6px;
}

.cycle-pill {
  color: #e9d5ff;
  border-color: rgba(168, 85, 247, 0.6);
  background: rgba(168, 85, 247, 0.18);
}

.save-slot-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  background: #08101c;
  padding: 8px 10px;
  border-radius: 6px;
}

.save-slot-stats strong {
  color: #f8fafc;
}

.save-slot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.save-slot-empty-text {
  font-size: 12px;
  color: var(--text-muted);
  padding: 14px 0;
  text-align: center;
}

/* 強くてニューゲーム難易度選択 */
.ngp-info-box {
  background: #08101c;
  border: 1px solid rgba(250, 204, 21, 0.45);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
}

.ngp-diff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}

.ngp-diff-card {
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: 10px;
  padding: 18px 16px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.14s ease, background 0.14s ease;
}

.ngp-diff-card:hover {
  transform: translateY(-2px);
  background: var(--bg-card-hover);
}

.ngp-diff-title {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 900;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ngp-mult {
  font-size: 12px;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
}

.ngp-diff-desc {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.5;
}

/* アーケード筐体風ハイスコアボード */
.arcade-board {
  background: #040811;
  border: 2px solid #22d3ee;
  border-radius: 10px;
  padding: 18px;
  box-shadow: inset 0 0 36px rgba(34, 211, 238, 0.14);
  font-family: var(--font-mono);
}

.arcade-header-glow {
  text-align: center;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 3px;
  color: #fde047;
  text-shadow: 0 0 14px rgba(250, 204, 21, 0.65);
  margin-bottom: 14px;
}

.arcade-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.arcade-table th {
  color: #38bdf8;
  border-bottom: 1.5px solid #1e3a5f;
  padding: 8px 6px;
  text-align: left;
  font-size: 11px;
  letter-spacing: 1px;
}

.arcade-table td {
  padding: 9px 6px;
  border-bottom: 1px dashed rgba(56, 189, 248, 0.18);
  color: #e2e8f0;
}

.arcade-table tr.rank-gold td { color: #fde047; font-weight: 800; }
.arcade-table tr.rank-silver td { color: #e2e8f0; font-weight: 700; }
.arcade-table tr.rank-bronze td { color: #fdba74; font-weight: 700; }

.arcade-table tr.arcade-highlight {
  background: rgba(56, 189, 248, 0.22);
  animation: arcadeBlink 1.1s ease-in-out infinite alternate;
}

@keyframes arcadeBlink {
  from { background: rgba(56, 189, 248, 0.14); }
  to { background: rgba(250, 204, 21, 0.24); }
}

.arc-score {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1px;
}

.arc-new {
  display: inline-block;
  font-size: 10px;
  background: #ef4444;
  color: #fff;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 6px;
}

.arcade-footer-note {
  margin-top: 14px;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 11.5px;
  color: #94a3b8;
}

/* キャンペーン全制圧・総合得点モーダル */
.campaign-clear-dialog {
  background: linear-gradient(180deg, #0d1a2d 0%, #070e19 100%);
  border: 2px solid #facc15;
  border-radius: 14px;
  max-width: 640px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  padding: 26px 30px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.85), 0 0 40px rgba(250, 204, 21, 0.18);
  text-align: center;
}

.clear-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.5px;
  color: #fde047;
  background: rgba(250, 204, 21, 0.15);
  border: 1px solid #facc15;
  padding: 3px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.clear-title {
  font-size: 26px;
  color: #f8fafc;
  margin-bottom: 4px;
}

.clear-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.clear-breakdown {
  background: #060c16;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 13px;
}

.cb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.cb-row strong {
  font-family: var(--font-mono);
  font-size: 14px;
}

.cb-divider {
  border-top: 1px dashed #263b5a;
  margin: 2px 0;
}

.clear-final-score {
  background: rgba(250, 204, 21, 0.1);
  border: 1.5px solid #facc15;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.clear-final-score span {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: #fde047;
}

.clear-final-score strong {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 900;
  color: #fef08a;
  text-shadow: 0 0 18px rgba(250, 204, 21, 0.55);
}

.arcade-entry-box {
  background: #081222;
  border: 1px solid #22d3ee;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.arcade-entry-box label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #7dd3fc;
  font-weight: 700;
}

.arcade-entry-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.arcade-input {
  background: #040811;
  border: 1.5px solid #38bdf8;
  border-radius: 6px;
  color: #fde047;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 8px 14px;
  width: 220px;
  text-align: center;
}

.clear-reg-done {
  font-size: 12px;
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.45);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.clear-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ===== 兵器開発ツリー（4ティア・設計書・換装アップグレード） ===== */
.tt-bp-bar {
  background: #08101c;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tt-bp-t3 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
}

.tt-bp-t4-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bp-chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bp-chip {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid var(--border-subtle);
  background: #0c1729;
  color: #64748b;
}

.bp-chip.owned {
  border-color: #facc15;
  background: rgba(250, 204, 21, 0.14);
  color: #fef08a;
  font-weight: 700;
}

.tt-branches {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tt-branch-row {
  background: #091220;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tt-branch-title {
  font-size: 13px;
  font-weight: 800;
  color: #e2e8f0;
  border-bottom: 1px solid #182a45;
  padding-bottom: 6px;
}

.tt-chain {
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tt-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #38bdf8;
  font-weight: 900;
  flex-shrink: 0;
}

.tt-node {
  flex: 1 0 230px;
  max-width: 270px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tt-node.developed {
  border-color: rgba(34, 197, 94, 0.65);
  background: linear-gradient(160deg, rgba(16, 42, 32, 0.55), var(--bg-card));
}

.tt-node.available {
  border-color: rgba(56, 189, 248, 0.6);
}

.tt-node.locked {
  opacity: 0.55;
}

.tt-node.tier-4.developed,
.tt-node.tier-4.available {
  border-color: rgba(250, 204, 21, 0.72);
}

.tt-node-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.tt-tier-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid transparent;
}

.tt-tier-tag.t1 { background: rgba(148, 163, 184, 0.18); color: #cbd5e1; border-color: #64748b; }
.tt-tier-tag.t2 { background: rgba(34, 197, 94, 0.18); color: #86efac; border-color: #22c55e; }
.tt-tier-tag.t3 { background: rgba(56, 189, 248, 0.2); color: #7dd3fc; border-color: #38bdf8; }
.tt-tier-tag.t4 { background: rgba(250, 204, 21, 0.22); color: #fde047; border-color: #facc15; }

.tt-upg-cap {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.tt-node-name {
  font-size: 13.5px;
  font-weight: 800;
  color: #f8fafc;
}

.tt-node-spec {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #93c5fd;
}

.tt-node-desc {
  font-size: 11px;
  color: #cbd5e1;
  line-height: 1.45;
  flex: 1;
}

.tt-req {
  font-size: 10.5px;
  color: #fde68a;
  background: rgba(245, 158, 11, 0.1);
  border-radius: 4px;
  padding: 4px 6px;
}

.tt-dev-done {
  font-size: 11px;
  font-weight: 700;
  color: #4ade80;
}

.tt-btn {
  width: 100%;
  font-size: 11.5px;
  padding: 6px 8px;
}

/* ===== 兵器ステータス画面：地形適性バー（◎○△×） ===== */
.terrain-apt-bar {
  margin-top: 8px;
  background: #08101c;
  border: 1px solid #1c2f4d;
  border-radius: 7px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.terrain-apt-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.terrain-apt-cells {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  justify-content: flex-end;
}

.terrain-apt-cell {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #0e192b;
  border: 1px solid #1e3352;
  border-radius: 5px;
  padding: 3px 8px;
  font-family: var(--font-mono);
}

.terrain-apt-cell small {
  font-family: var(--font-sans);
  font-size: 10.5px;
  color: #cbd5e1;
}

.terrain-apt-cell strong {
  font-size: 14px;
  font-weight: 900;
  min-width: 14px;
  text-align: center;
  line-height: 1;
}

.terrain-apt-cell strong.apt-best { color: #38bdf8; }
.terrain-apt-cell strong.apt-ok   { color: #4ade80; }
.terrain-apt-cell strong.apt-warn { color: #fbbf24; }
.terrain-apt-cell strong.apt-ng   { color: #ef4444; }

/* ===== 音量スライダー ＆ セーブバックアップパネル ===== */
.vol-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.vol-wrap input[type="range"] {
  width: 64px;
  accent-color: var(--cyan);
  cursor: pointer;
}

.backup-panel {
  background: #081120;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.backup-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12.5px;
}

.backup-head small {
  font-size: 11px;
  color: var(--text-muted);
}

.backup-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ===== パワプロ式 SSランク（105以上・プラチナ虹色輝き） ===== */
.pp-grade.grade-SS {
  background: linear-gradient(135deg, #f472b6 0%, #facc15 50%, #38bdf8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 900;
  text-shadow: 0 0 12px rgba(250, 204, 21, 0.55);
}

/* ===== 公開向け仕上げ：タイトルフッター・初回ガイド・狭い画面バナー ===== */
.title-footer-meta {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
}
.title-footer-meta strong {
  color: #e2e8f0;
}

.beginner-guide-box {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #e0f2fe;
  font-size: 12px;
  line-height: 1.55;
  text-align: left;
}
.beginner-guide-box strong {
  color: #7dd3fc;
}

.hq-beginner-tip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 9px 14px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.16), rgba(34, 197, 94, 0.12));
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #e0f2fe;
  font-size: 12px;
  line-height: 1.45;
}

.mobile-notice {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 12px;
  background: #1e293b;
  border-bottom: 1px solid #38bdf8;
  color: #e2e8f0;
  font-size: 11.5px;
}
@media (max-width: 900px) {
  .mobile-notice {
    display: flex;
  }
}

/* ===== 増援・緊急通信カットイン（北側スライドイン演出） ===== */
.reinforce-cutin {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translate(-50%, -130%);
  width: min(680px, 92%);
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 58, 138, 0.92));
  border: 2px solid #38bdf8;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65), 0 0 18px rgba(56, 189, 248, 0.35);
  cursor: pointer;
  opacity: 0;
  transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
}
.reinforce-cutin.cutin-show {
  transform: translate(-50%, 0);
  opacity: 1;
}
.cutin-portrait {
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid rgba(125, 211, 252, 0.7);
  background: #0f172a;
}
.cutin-body {
  flex: 1;
  min-width: 0;
}
.cutin-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 3px;
}
.cutin-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fde047;
}
.cutin-unit-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.22);
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: #e0f2fe;
}
.cutin-name {
  font-size: 13px;
  font-weight: 800;
  color: #7dd3fc;
}
.cutin-msg {
  font-size: 13px;
  font-weight: 600;
  color: #f8fafc;
  margin-top: 2px;
  line-height: 1.4;
}
.cutin-hint {
  margin-top: 5px;
  padding: 4px 8px;
  border-radius: 5px;
  background: rgba(34, 197, 94, 0.16);
  border-left: 3px solid #4ade80;
  color: #dcfce7;
  font-size: 11.5px;
  line-height: 1.4;
}
.cutin-close {
  align-self: flex-start;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 5px;
}
.cutin-close:hover {
  color: #f8fafc;
}

.cutin-npc-icon {
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  background: radial-gradient(circle at 30% 30%, #1e3a8a, #0f172a);
}

/* ===== オープニング＆エンディング シネマティック演出モーダル ===== */
.story-scene-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 35%, rgba(15, 23, 42, 0.94), rgba(2, 6, 23, 0.98));
  backdrop-filter: blur(6px);
}
.story-card {
  width: min(760px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px 32px 22px;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.92));
  border: 1px solid rgba(56, 189, 248, 0.45);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 28px rgba(56, 189, 248, 0.16);
  animation: storyFadeIn 0.35s ease;
}
.story-card.theme-red {
  border-color: rgba(248, 113, 113, 0.55);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 28px rgba(239, 68, 68, 0.18);
}
.story-card.theme-amber {
  border-color: rgba(251, 191, 36, 0.55);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 28px rgba(245, 158, 11, 0.18);
}
.story-card.theme-gold {
  border-color: rgba(250, 204, 21, 0.65);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 32px rgba(250, 204, 21, 0.22);
}
@keyframes storyFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.story-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.story-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #38bdf8;
}
.story-card.theme-red .story-eyebrow { color: #f87171; }
.story-card.theme-amber .story-eyebrow { color: #fbbf24; }
.story-card.theme-gold .story-eyebrow { color: #fde047; }
.story-title {
  margin: 0 0 18px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #f8fafc;
}
.story-card.is-fin .story-title {
  text-align: center;
  font-size: 30px;
  color: #fde047;
  text-shadow: 0 0 18px rgba(250, 204, 21, 0.45);
}
.story-content {
  min-height: 170px;
}
.story-para {
  margin: 0 0 13px;
  font-size: 15px;
  line-height: 1.85;
  color: #e2e8f0;
}
.story-card.is-fin .story-para {
  text-align: center;
}
.story-dialogues {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.story-dlg-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.22);
}
.story-dlg-name {
  font-size: 12px;
  font-weight: 800;
  color: #7dd3fc;
  margin-bottom: 2px;
}
.story-dlg-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: #f1f5f9;
}
.story-record-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.story-rec-card {
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(250, 204, 21, 0.3);
}
.story-rec-ace {
  display: flex;
  align-items: center;
  gap: 10px;
}
.story-rec-label {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 3px;
}
.story-rec-val {
  font-size: 15px;
  font-weight: 800;
  color: #f8fafc;
}
.story-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}
.story-dots {
  display: flex;
  gap: 8px;
}
.story-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.3);
  transition: all 0.2s;
}
.story-dot.done {
  background: rgba(56, 189, 248, 0.55);
}
.story-dot.active {
  width: 24px;
  border-radius: 5px;
  background: #38bdf8;
}
.story-card.theme-gold .story-dot.active {
  background: #fde047;
}
.story-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.story-key-hint {
  margin-top: 10px;
  text-align: right;
  font-size: 11px;
  color: #64748b;
}
