:root {
  /* Tactical Matte Surfaces */
  --bg-canvas: #0c1015;
  --bg-panel: #11151b;
  --bg-elevated: #181e26;
  --bg-subtle: rgba(17, 21, 27, 0.88);
  --bg-scrim: rgba(11, 14, 19, 0.72);

  /* Crisp 1px Structural Hairlines */
  --border-subtle: rgba(242, 239, 233, 0.14);
  --border-strong: rgba(242, 239, 233, 0.32);

  /* Typography & Telemetry Fills */
  --text-primary: #f2efe9;
  --text-secondary: #9aa3ad;
  --text-muted: #68737f;
  --fill-neutral: #e6e2d8;

  /* Single Primary Accent: Naval Vermilion / Persimmon */
  --accent: #d93829;
  --accent-hover: #e24637;
  --accent-subtle: rgba(217, 56, 41, 0.16);

  /* Typography Stacks */
  --font-heading: "BIZ UDPGothic", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", sans-serif;
  --font-body: "BIZ UDPGothic", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", sans-serif;
  --font-mono: "Consolas", "BIZ UDGothic", ui-monospace, monospace;

  /* Strict 4px / 8px Spacing Scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* Sharp Mechanical Radii & Unified Panel Dimensions */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --hud-margin: clamp(12px, 1.4vw, 20px);
  --hud-panel-w: clamp(264px, 21.5vw, 300px);
  --hud-bottom-h: 132px;
  --hud-ctrl-h: 36px;
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  -webkit-touch-callout: none;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.65;
  letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
strong {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

button {
  font-family: inherit;
  color: inherit;
}

code {
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 0 var(--sp-1);
  color: var(--text-primary);
}

#game-canvas,
#speed-lines-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#speed-lines-canvas {
  pointer-events: none;
  z-index: 2;
}

.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
}

.hidden {
  display: none !important;
}

.fatal-error {
  position: fixed;
  top: var(--sp-6);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-panel);
  color: var(--text-primary);
  border: 1px solid var(--accent);
  border-left: 4px solid var(--accent);
  padding: var(--sp-4) var(--sp-6);
  border-radius: var(--radius-xs);
  z-index: 999;
  font-weight: 600;
}

/* Inline Geometric SVG Icons */
.ui-icon {
  width: 16px;
  height: 16px;
  display: block;
  flex-shrink: 0;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Corner Crosshair Ticks (Technical Instrument Framing) */
.corner-ticks {
  position: relative;
}

.corner-ticks::before,
.corner-ticks::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  pointer-events: none;
}

.corner-ticks::before {
  top: -1px;
  left: -1px;
  border-top: 1px solid var(--border-strong);
  border-left: 1px solid var(--border-strong);
}

.corner-ticks::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 1px solid var(--border-strong);
  border-right: 1px solid var(--border-strong);
}

/* Micro-Interaction 01 & 10: Tactile Button Press + Subtle Click Ripple */
.btn-primary,
.btn-tactical,
.hud-ctrl-btn,
.craft-tab,
.mini-craft-btn,
.perk-card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    transform 90ms cubic-bezier(0.2, 0, 0, 1);
}

.btn-primary:active,
.btn-tactical:active,
.hud-ctrl-btn:active,
.craft-tab:active,
.mini-craft-btn:active,
.perk-card:active {
  transform: translateY(1px) scale(0.985);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  background: var(--accent);
  color: var(--text-primary);
  border: 1px solid var(--accent);
  border-radius: var(--radius-xs);
  padding: var(--sp-3) var(--sp-6);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-primary.full-w {
  width: 100%;
}

.btn-tactical {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  background: var(--bg-panel);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: var(--sp-2) var(--sp-3);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.btn-tactical:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

.btn-lg {
  padding: var(--sp-3) var(--sp-6);
  font-size: 14px;
}

.click-ripple {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: rgba(242, 239, 233, 0.24);
  pointer-events: none;
  animation: rippleExpand 420ms cubic-bezier(0.2, 0, 0, 1) forwards;
}

@keyframes rippleExpand {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0.35;
  }
  100% {
    transform: translate(-50%, -50%) scale(2.4);
    opacity: 0;
  }
}

/* Micro-Interaction 02: Real Sliding Toggle Switch */
.sr-only-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
}

.toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 20px;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  display: inline-block;
  flex-shrink: 0;
  transition: background-color 180ms cubic-bezier(0.2, 0, 0, 1), border-color 180ms cubic-bezier(0.2, 0, 0, 1);
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-secondary);
  transform: translateX(0);
  transition: transform 180ms cubic-bezier(0.2, 0, 0, 1), background-color 180ms cubic-bezier(0.2, 0, 0, 1);
}

.sr-only-input:checked + .toggle-switch,
.toggle-switch.is-on {
  background: var(--accent-subtle);
  border-color: var(--accent);
}

.sr-only-input:checked + .toggle-switch .toggle-thumb,
.toggle-switch.is-on .toggle-thumb {
  transform: translateX(16px);
  background: var(--accent);
}

.toggle-switch-sm {
  width: 32px;
  height: 16px;
}

.toggle-switch-sm .toggle-thumb {
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
}

.toggle-switch-sm.is-on .toggle-thumb {
  transform: translateX(16px);
}

.toggle-text {
  font-size: 13px;
  color: var(--text-secondary);
}

.sr-only-input:checked ~ .toggle-text {
  color: var(--text-primary);
}

/* Micro-Interaction 12: Horizontal Shake */
@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.shake-x {
  animation: shakeX 240ms cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

/* ==========================================================================
   HANGAR / FLIGHT TEST LOG SCREEN (Asymmetric Open-Viewport Layout)
   ========================================================================== */
.overlay-hangar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--hud-margin);
  pointer-events: none;
}

.hangar-header,
.hangar-ledger-dock {
  pointer-events: auto;
}

.hangar-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-4);
}

.title-block {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius-xs);
  padding: var(--sp-2) var(--sp-4);
}

.doc-code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}

.title-block h1 {
  font-size: clamp(20px, 2vw, 24px);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.06em;
  line-height: 1.25;
}

.subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.top-right-controls {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.top-right-controls .btn-tactical {
  height: 38px;
}

.record-readout {
  display: flex;
  align-items: center;
  height: 38px;
  gap: var(--sp-4);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 0 var(--sp-4);
}

.record-item {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
}

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

.record-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.record-diff {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--text-secondary);
}

.record-divider {
  width: 1px;
  height: 16px;
  background: var(--border-subtle);
}

/* Bottom-Left Dock: 5-Tab Selector Strip + Single Specification Ledger */
.hangar-ledger-dock {
  width: min(592px, calc(100vw - (var(--hud-margin) * 2)));
  display: flex;
  flex-direction: column;
}

.craft-tab-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-bottom: none;
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
}

.craft-tab {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  background: var(--bg-panel);
  border: none;
  border-right: 1px solid var(--border-subtle);
  padding: var(--sp-2) var(--sp-2);
  text-align: left;
  color: var(--text-secondary);
}

.craft-tab:last-child {
  border-right: none;
}

.craft-tab:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.craft-tab.selected {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.craft-tab.selected::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

.tab-kanji {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.craft-tab.selected .tab-kanji {
  color: var(--accent);
}

.tab-label {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spec-ledger {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 0 0 var(--radius-xs) var(--radius-xs);
}

.spec-head-row {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
}

.spec-title-group {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.spec-index-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0 var(--sp-1);
  border-radius: var(--radius-xs);
  line-height: 1.5;
}

.spec-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.spec-code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.spec-tagline {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: var(--sp-1);
}

.spec-metrics-table {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border-subtle);
}

.spec-metric-cell {
  padding: var(--sp-2) var(--sp-4);
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.spec-metric-cell:nth-child(2n) {
  border-right: none;
}

.spec-metric-cell:nth-child(n+3) {
  border-bottom: none;
}

.spec-metric-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-2);
  margin-bottom: var(--sp-1);
}

.spec-metric-label {
  font-size: 11px;
  color: var(--text-muted);
}

.spec-metric-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-primary);
}

.slim-bar {
  height: 3px;
  background: rgba(242, 239, 233, 0.1);
  border-radius: var(--radius-xs);
  overflow: hidden;
}

.slim-bar i {
  display: block;
  height: 100%;
  background: var(--fill-neutral);
  transition: width 220ms cubic-bezier(0.2, 0, 0, 1);
}

.spec-special-row {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  flex-wrap: wrap;
  padding: var(--sp-2) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
}

.spec-special-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.spec-special-name {
  color: var(--text-primary);
  font-size: 12px;
  flex-shrink: 0;
}

.spec-special-desc {
  color: var(--text-secondary);
  font-size: 12px;
}

/* Difficulty & Starting Wave Segmented Selector Row */
.spec-level-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-4);
  padding: var(--sp-2) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
}

.level-group {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}

.level-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.seg-group {
  display: inline-flex;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  background: var(--bg-panel);
  overflow: hidden;
}

.seg-btn {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: transparent;
  border: none;
  border-right: 1px solid var(--border-subtle);
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: background-color 140ms ease, color 140ms ease;
}

.seg-btn:last-child {
  border-right: none;
}

.seg-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.seg-btn.selected {
  background: var(--accent);
  color: var(--text-primary);
  font-weight: 600;
}

.level-summary-note {
  width: 100%;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.3;
}

.spec-action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-panel);
}

/* ==========================================================================
   IN-GAME TACTICAL HUD
   ========================================================================== */
.hud-layer {
  pointer-events: none;
}

.hud-top-right,
.hud-top-right button {
  pointer-events: auto;
}

#damage-flash {
  position: fixed;
  inset: 0;
  border: 0 solid rgba(217, 56, 41, 0);
  background: rgba(217, 56, 41, 0);
  opacity: 0;
  pointer-events: none;
}

#damage-flash.active {
  animation: dmgFrameFlash 340ms ease-out;
}

@keyframes dmgFrameFlash {
  0% {
    opacity: 1;
    border-width: 6px;
    border-color: rgba(217, 56, 41, 0.72);
    background: rgba(217, 56, 41, 0.14);
  }
  100% {
    opacity: 0;
    border-width: 0;
    border-color: rgba(217, 56, 41, 0);
    background: rgba(217, 56, 41, 0);
  }
}

/* Center Flight Reticle & Hit-Marker */
.center-crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  color: rgba(242, 239, 233, 0.78);
  pointer-events: none;
}

.reticle-svg {
  width: 44px;
  height: 44px;
  display: block;
}

.hit-marker {
  position: absolute;
  inset: 0;
  width: 44px;
  height: 44px;
  color: var(--text-primary);
  opacity: 0;
  transform: scale(0.82);
  transition: opacity 70ms linear, transform 90ms cubic-bezier(0.2, 0, 0, 1);
  pointer-events: none;
}

.hit-marker.is-active {
  opacity: 1;
  transform: scale(1);
}

.hit-marker.is-critical {
  color: var(--accent);
  transform: scale(1.12);
}

.aim-cursor {
  position: fixed;
  top: -9px;
  left: -9px;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(242, 239, 233, 0.72);
  border-radius: var(--radius-xs);
  pointer-events: none;
  opacity: 0;
}

.aim-cursor::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 2px;
  background: var(--accent);
  transform: translate(-50%, -50%);
}

/* 3D Projected Target Markers */
#target-markers {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.target-marker {
  position: fixed;
  top: 0;
  left: 0;
}

.tm-box {
  width: 20px;
  height: 20px;
  border: 1px solid rgba(242, 239, 233, 0.75);
  transform: translate(-50%, -50%);
  position: relative;
}

.tm-box::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 3px;
  background: var(--fill-neutral);
  transform: translate(-50%, -50%);
}

.target-marker.boss .tm-box,
.target-marker.priority .tm-box {
  width: 24px;
  height: 24px;
  border-color: var(--accent);
}

.target-marker.boss .tm-box::before,
.target-marker.priority .tm-box::before {
  background: var(--accent);
}

.tm-label {
  position: absolute;
  top: 16px;
  left: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: var(--sp-1) var(--sp-2);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--text-primary);
  line-height: 1.35;
}

.target-marker.boss .tm-label {
  border-color: var(--accent);
}

/* HUD Top-Left: Score, Wave, Lives & Fleet Ledger (Matched Column Width) */
.hud-top-left {
  position: fixed;
  top: var(--hud-margin);
  left: var(--hud-margin);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: var(--hud-panel-w);
}

.hud-score-panel {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: var(--sp-2) var(--sp-3);
}

.hud-meta-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-1);
  font-size: 11px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: var(--sp-1);
  margin-bottom: var(--sp-1);
  white-space: nowrap;
}

.hud-wave-label {
  color: var(--text-primary);
  font-weight: 600;
}

.hud-sep {
  color: var(--text-muted);
}

.hud-meta-item,
.hud-lives-inline {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
}

.life-pips {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--fill-neutral);
}

.life-pips .ui-icon {
  width: 11px;
  height: 11px;
}

.hud-score-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-2);
}

.hud-score-main {
  display: flex;
  align-items: baseline;
  gap: var(--sp-1);
}

.score-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 26px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.15;
}

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

.combo-readout {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 0 var(--sp-2);
}

.combo-readout.hot {
  color: var(--text-primary);
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.hud-best-ref {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.fleet-list {
  display: flex;
  flex-direction: column;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
}

.fleet-pill {
  padding: var(--sp-1) var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11px;
}

.fleet-pill:last-child {
  border-bottom: none;
}

.fleet-pill-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-2);
  color: var(--text-primary);
}

.fleet-pill.boss .fleet-name {
  color: var(--accent);
}

.fleet-pct {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  font-size: 11px;
}

.fleet-pill.sunk {
  opacity: 0.42;
}

.fleet-pill.sunk .fleet-name {
  text-decoration: line-through;
}

.fleet-hp {
  height: 2px;
  background: rgba(242, 239, 233, 0.12);
  margin-top: var(--sp-1);
  overflow: hidden;
}

.fleet-hp i {
  display: block;
  height: 100%;
  background: var(--fill-neutral);
  transition: width 160ms linear;
}

.fleet-hp i.is-critical {
  background: var(--accent);
}

/* HUD Top-Center: Slide-Down Toast & Radio Ticker */
.hud-top-center {
  position: fixed;
  top: var(--hud-margin);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  width: min(460px, calc(100vw - (var(--hud-panel-w) * 2) - 56px));
}

/* Micro-Interaction 09: Top Slide-Down Toast */
.hud-toast {
  background: var(--bg-panel);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius-xs);
  padding: var(--sp-2) var(--sp-4);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: toastSlideDown 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastSlideDown {
  0% {
    opacity: 0;
    transform: translateY(-12px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.radio-ticker {
  display: flex;
  align-items: center;
  height: var(--hud-ctrl-h);
  gap: var(--sp-2);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-left: 2px solid var(--fill-neutral);
  border-radius: var(--radius-xs);
  padding: 0 var(--sp-3);
  font-size: 12px;
  width: 100%;
  animation: toastSlideDown 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.radio-icon {
  color: var(--text-secondary);
  display: inline-flex;
}

.radio-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  padding-right: var(--sp-2);
  border-right: 1px solid var(--border-subtle);
}

.radio-text {
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stealth-badge {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  justify-content: center;
}

.tactical-cond-tag {
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  padding: var(--sp-1) var(--sp-2);
  font-size: 11px;
  color: var(--text-primary);
}

.tactical-cond-tag.alert {
  border-color: var(--accent);
  color: var(--accent);
}

/* HUD Top-Right Controls (Matched Control Height & Margin) */
.hud-top-right {
  position: fixed;
  top: var(--hud-margin);
  right: var(--hud-margin);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.hud-ctrl-btn {
  display: inline-flex;
  align-items: center;
  height: var(--hud-ctrl-h);
  gap: var(--sp-2);
  background: var(--bg-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 0 var(--sp-3);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.hud-ctrl-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

/* Wave Banner, Killcam Strip & Pause Panel */
.wave-banner {
  position: fixed;
  top: 24%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  background: var(--bg-subtle);
  border-left: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
  padding: var(--sp-3) var(--sp-8);
  min-width: 360px;
  max-width: calc(100vw - 64px);
  animation: toastSlideDown 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

.wave-banner-line {
  height: 1px;
  background: var(--border-strong);
}

.wave-banner h2 {
  font-size: 20px;
  color: var(--text-primary);
  margin: var(--sp-2) 0 var(--sp-1);
}

.wave-banner p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
}

.killcam-banner {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--bg-panel);
  border: 1px solid var(--accent);
  border-radius: var(--radius-xs);
  padding: var(--sp-2) var(--sp-4);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.killcam-indicator {
  width: 8px;
  height: 8px;
  background: var(--accent);
  display: inline-block;
}

.pause-badge {
  position: fixed;
  top: 44%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  padding: var(--sp-6) var(--sp-8);
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.pause-badge h2 {
  font-size: 22px;
  margin-bottom: var(--sp-2);
}

.pause-badge p {
  font-size: 13px;
  color: var(--text-secondary);
}

/* HUD Bottom-Left: Airframe Status (Exact Matched Width & 132px Height) */
.hud-bottom-left {
  position: fixed;
  bottom: var(--hud-margin);
  left: var(--hud-margin);
}

.craft-hud-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: var(--sp-2) var(--sp-3);
  width: var(--hud-panel-w);
  height: var(--hud-bottom-h);
}

.craft-hud-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-2);
  font-size: 12px;
  padding-bottom: var(--sp-1);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.craft-hud-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-hp-text {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.hud-hp-text.is-critical {
  color: var(--accent);
}

.meter-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 11px;
}

.meter-label {
  width: 48px;
  color: var(--text-muted);
  flex-shrink: 0;
  line-height: 1.2;
}

.meter {
  flex: 1;
  height: 5px;
  background: rgba(242, 239, 233, 0.12);
  border-radius: var(--radius-xs);
  overflow: hidden;
}

.hp-fill,
.boost-fill {
  display: block;
  height: 100%;
  background: var(--fill-neutral);
  transition: width 120ms linear, background-color 160ms ease;
}

.hp-fill.is-critical {
  background: var(--accent);
}

.ability-cluster {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
  padding-top: var(--sp-1);
  border-top: 1px solid var(--border-subtle);
}

.ability-slot {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 3px 6px;
  min-width: 0;
}

.ability-slot.ready {
  border-color: var(--border-strong);
}

.ring-box {
  position: relative;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.cd-ring {
  width: 30px;
  height: 30px;
  display: block;
}

.ring-track {
  fill: none;
  stroke: rgba(242, 239, 233, 0.12);
  stroke-width: 2;
}

.ring-progress {
  fill: none;
  stroke: var(--text-secondary);
  stroke-width: 2;
  stroke-dasharray: 94.25;
  stroke-dashoffset: 0;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 90ms linear, stroke 160ms ease;
}

.ability-slot.ready .ring-progress {
  stroke: var(--fill-neutral);
}

.ring-key {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-primary);
}

.ability-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ability-title {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.15;
}

.ability-status {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.ability-slot.ready .ability-status {
  color: var(--text-primary);
}

/* HUD Bottom-Center: Discrete Single-Line Key Strip */
.hud-bottom-center {
  position: fixed;
  bottom: var(--hud-margin);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: var(--sp-1) var(--sp-3);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  max-width: calc(100vw - (var(--hud-panel-w) * 2) - 56px);
  overflow: hidden;
}

/* HUD Bottom-Right: Flight Instruments & Square-Framed Radar (Exact Matched Width & 132px Height) */
.hud-bottom-right {
  position: fixed;
  bottom: var(--hud-margin);
  right: var(--hud-margin);
  display: flex;
  align-items: stretch;
  gap: var(--sp-2);
  width: var(--hud-panel-w);
  height: var(--hud-bottom-h);
}

.telemetry-box {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: var(--sp-2) var(--sp-3);
}

.tel-primary-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.tel-caption {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.2;
}

.tel-speed {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.15;
  white-space: nowrap;
}

.tel-divider {
  height: 1px;
  background: var(--border-subtle);
}

.tel-sub-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tel-sub-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-2);
  white-space: nowrap;
}

.tel-sub {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-primary);
}

.radar-wrap {
  position: relative;
  width: var(--hud-bottom-h);
  height: var(--hud-bottom-h);
  flex-shrink: 0;
  border-radius: var(--radius-xs);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#radar-canvas {
  width: 120px;
  height: 120px;
  display: block;
}

.radar-label {
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  background: rgba(17, 21, 27, 0.86);
  padding: 0 var(--sp-1);
  white-space: nowrap;
}

/* ==========================================================================
   MICRO-INTERACTION 15: SLIDE-UP BOTTOM SHEETS / LEDGER PANELS
   ========================================================================== */
.sheet-backdrop {
  background: var(--bg-scrim);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: var(--sp-6) var(--sp-6) 0;
  z-index: 30;
  animation: scrimFadeIn 180ms ease-out;
}

@keyframes scrimFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ledger-sheet {
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: var(--sp-6) var(--sp-8);
  width: min(680px, 100%);
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  animation: sheetSlideUp 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

.perk-sheet {
  width: min(760px, 100%);
}

@keyframes sheetSlideUp {
  0% {
    opacity: 0;
    transform: translateY(28px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.ledger-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-6);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
}

.ledger-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
}

.cumulative-line {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  margin-top: var(--sp-1);
  font-size: 13px;
  color: var(--text-secondary);
}

.cumulative-line strong {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.diff-note {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: var(--sp-1);
}

.ledger-hero-right {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-shrink: 0;
}

.hero-score-block {
  text-align: right;
}

.hero-caption {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.hero-num-wrap {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: var(--sp-1);
}

.hero-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 36px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.1;
}

.hero-unit {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Vermilion Hanko / Evaluation Stamp */
.hanko-stamp {
  width: 56px;
  height: 56px;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-xs);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.hanko-caption {
  font-size: 9px;
  letter-spacing: 0.08em;
  line-height: 1;
  margin-bottom: 2px;
}

.hanko-char {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
}

.hanko-stamp.rank-Splus,
.hanko-stamp.rank-A {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
  transform: rotate(-3deg);
}

.hanko-stamp.rank-B {
  border-color: var(--fill-neutral);
  color: var(--text-primary);
}

/* 1px Horizontal Table Ledger Rows (Replaces Uniform Gray Cards) */
.ledger-table {
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--sp-4);
}

.ledger-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border-subtle);
}

.ledger-row:last-child {
  border-bottom: none;
}

.ledger-cell {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
}

.ledger-cell:first-child {
  padding-right: var(--sp-4);
  border-right: 1px solid var(--border-subtle);
}

.ledger-cell:last-child {
  padding-left: var(--sp-4);
}

.cell-label {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.cell-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
}

/* Result Next-Sortie Craft Selector */
.result-craft-section {
  margin-bottom: var(--sp-4);
}

.result-switch-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: var(--sp-2);
}

.result-craft-switch {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  background: var(--bg-elevated);
}

.mini-craft-btn {
  background: transparent;
  border: none;
  border-right: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: var(--sp-2) var(--sp-2);
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-craft-btn:last-child {
  border-right: none;
}

.mini-craft-btn:hover {
  color: var(--text-primary);
  background: rgba(242, 239, 233, 0.04);
}

.mini-craft-btn.selected {
  color: var(--text-primary);
  background: var(--bg-panel);
  font-weight: 600;
}

.mini-craft-btn.selected::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

.sheet-footer-actions {
  margin-top: var(--sp-2);
}

/* Wave Clear Perk Specification List */
.perk-sheet-head {
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
}

.perk-sub {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: var(--sp-1);
}

.perk-ledger-list {
  display: flex;
  flex-direction: column;
  margin-top: var(--sp-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
}

.perk-card {
  display: grid;
  grid-template-columns: 72px 40px 1fr auto;
  align-items: center;
  gap: var(--sp-4);
  background: var(--bg-elevated);
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--sp-4);
  text-align: left;
  color: var(--text-primary);
}

.perk-card:last-child {
  border-bottom: none;
}

.perk-card:hover {
  background: var(--bg-panel);
}

.perk-card:hover::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: var(--accent);
}

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

.perk-icon {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fill-neutral);
  background: var(--bg-panel);
}

.perk-icon .ui-icon {
  width: 20px;
  height: 20px;
}

.perk-card:hover .perk-icon {
  border-color: var(--accent);
  color: var(--accent);
}

.perk-body {
  min-width: 0;
}

.perk-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.perk-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.perk-action {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.perk-card:hover .perk-action {
  color: var(--accent);
}

/* Game Over Footer Actions */
.go-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}

.go-actions .btn-primary {
  flex: 1;
}

/* Flight Manual / Help Sheet */
.manual-table {
  margin-top: var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
}

.manual-row {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: var(--sp-4);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}

.manual-row:last-child {
  border-bottom: none;
}

.manual-key {
  color: var(--text-primary);
  font-weight: 600;
}

.manual-desc {
  color: var(--text-secondary);
}

.manual-settings-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-6);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border-subtle);
}

/* Mobile / Tablet Tactical Touch Controls Overlay & Safe-Area Support */
.touch-controls {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 25;
}

.touch-stick-zone {
  position: fixed;
  bottom: calc(var(--hud-bottom-h) + var(--hud-margin) + 12px);
  left: max(var(--hud-margin), env(safe-area-inset-left));
  width: 148px;
  height: 148px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: none;
}

.touch-stick-base {
  position: relative;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: rgba(17, 21, 27, 0.58);
  border: 1px solid var(--border-strong);
  transition: border-color 120ms ease;
}

.touch-stick-base.active {
  border-color: var(--accent);
}

.touch-stick-nub {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(242, 239, 233, 0.25);
  border: 1px solid var(--fill-neutral);
}

.touch-action-pad {
  position: fixed;
  bottom: calc(var(--hud-bottom-h) + var(--hud-margin) + 14px);
  right: max(var(--hud-margin), env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--sp-2);
  pointer-events: auto;
  touch-action: none;
}

.touch-sub-row,
.touch-main-row {
  display: flex;
  gap: var(--sp-2);
}

.touch-btn {
  background: rgba(17, 21, 27, 0.78);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-weight: 600;
  touch-action: none;
}

.touch-btn-sm {
  width: 54px;
  height: 40px;
  font-size: 12px;
}

.touch-btn-lg {
  width: 84px;
  height: 54px;
  font-size: 14px;
}

.touch-btn-accent {
  border-color: var(--accent);
  background: rgba(217, 56, 41, 0.28);
}

.touch-btn:active,
.touch-btn.pressed {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(0.96);
}

.help-tip {
  margin: var(--sp-3) 0 var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-elevated);
  border-left: 2px solid var(--fill-neutral);
  font-size: 12px;
  color: var(--text-secondary);
}

/* Responsive Adjustments */
@media (max-width: 1180px) {
  .hud-bottom-center {
    display: none;
  }
}

@media (max-height: 780px) {
  :root {
    --hud-bottom-h: 120px;
    --hud-ctrl-h: 32px;
  }

  #radar-canvas {
    width: 108px;
    height: 108px;
  }

  .fleet-list {
    max-height: 148px;
    overflow-y: auto;
  }

  .spec-head-row,
  .spec-action-row {
    padding: var(--sp-2) var(--sp-3);
  }

  .spec-metric-cell,
  .spec-special-row {
    padding: 6px var(--sp-3);
  }
}

@media (max-width: 900px) {
  .overlay-hangar {
    padding: var(--sp-4);
  }

  .hangar-header {
    flex-direction: column;
    align-items: stretch;
  }

  .craft-tab-strip,
  .result-craft-switch {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .craft-tab:nth-child(2),
  .mini-craft-btn:nth-child(2) {
    border-right: none;
  }

  .craft-tab:nth-child(-n+2),
  .mini-craft-btn:nth-child(-n+2) {
    border-bottom: 1px solid var(--border-subtle);
  }

  .ledger-sheet {
    padding: var(--sp-4);
  }

  .ledger-hero {
    flex-direction: column;
    gap: var(--sp-3);
  }

  .ledger-row {
    grid-template-columns: 1fr;
  }

  .ledger-cell:first-child {
    padding-right: 0;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .ledger-cell:last-child {
    padding-left: 0;
  }

  .perk-card {
    grid-template-columns: 40px 1fr auto;
  }

  .perk-code {
    display: none;
  }

  .manual-row {
    grid-template-columns: 1fr;
    gap: var(--sp-1);
  }
}
