:root {
  color-scheme: dark;
  font-family:
    Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei UI", "Noto Sans SC",
    sans-serif;
  --bg: #03101b;
  --bg-deep: #020b13;
  --surface: #071827;
  --surface-soft: #0a1d2c;
  --surface-raised: #0d2232;
  --border: #263c4d;
  --border-soft: #1a3040;
  --text: #dce7ed;
  --text-strong: #eef6f8;
  --muted: #8398a7;
  --muted-dark: #5d7485;
  --accent: #3dc6dc;
  --accent-soft: #163e4b;
  --accent-pale: #9ce8f2;
  --amber: #f3a43a;
  --amber-soft: #4a321b;
  --danger: #ee7d73;
  --positive: #61dba7;
  --body-glow: rgba(31, 83, 108, 0.18);
  --body-top: #061522;
  --decoration-strong: #476477;
  --decoration: #314c5e;
  --header-button-bg: rgba(9, 29, 43, 0.78);
  --workspace-bg: rgba(4, 19, 31, 0.72);
  --section-heading: #bfcdd5;
  --active-bg: rgba(24, 84, 101, 0.42);
  --bonus-bg: rgba(7, 28, 42, 0.62);
  --segmented-active-bg: rgba(19, 81, 99, 0.44);
  --input-bg: #091725;
  --control-label: #c5d1d8;
  --range-track: #38505f;
  --range-thumb-border: #9fb5c2;
  --range-thumb: #39596d;
  --mode-bg: rgba(16, 53, 67, 0.32);
  --panel-from: rgba(14, 38, 55, 0.48);
  --panel-to: rgba(5, 20, 32, 0.7);
  --panel-inset: rgba(255, 255, 255, 0.018);
  --dpm-label: #aab9c2;
  --tile-bg: rgba(8, 29, 43, 0.58);
  --tile-label: #93a7b2;
  --panel-heading: #c7d4db;
  --value-muted: #b9c9d2;
  --bar-track: #112736;
  --bar-fill: #7b9fb6;
  --cycle-label: #8fa4af;
  --legend-label: #b9c7ce;
  --detail-label: #d0dce2;
  --accent-border: #315263;
  --accent-panel: rgba(14, 50, 64, 0.24);
  --secondary-text: #aebec7;
  --secondary-value: #c4d1d8;
  --feature-heading: #d1dde3;
  --timeline-label: #8da1ae;
  --timeline-value: #c9d8df;
  --formula-bg: rgba(5, 23, 36, 0.55);
  --formula-text: #9fb1bc;
  --assumption-bg: rgba(4, 18, 29, 0.45);
  --chart-structure: #48c7db;
  --chart-kinetic: #ffbf5e;
  --chart-system: #ffa436;
  --chart-true-damage: #d878ff;
  --chart-module-1: #48c7db;
  --chart-module-2: #ffa436;
  --chart-module-3: #d878ff;
  --chart-module-4: #61dba7;
  --chart-structure-area: rgba(72, 199, 219, 0.08);
  --chart-system-area: rgba(255, 164, 54, 0.06);
  --chart-true-damage-area: rgba(216, 120, 255, 0.06);
  --chart-legend: #b6c6ce;
  --chart-tooltip-bg: rgba(5, 21, 33, 0.96);
  --chart-tooltip-border: #29485a;
  --chart-tooltip-text: #d8e4e9;
  --chart-axis-pointer: #6b8290;
  --chart-axis-title: #748b98;
  --chart-axis-label: #8298a4;
  --chart-axis: #35505f;
  --chart-grid: rgba(61, 91, 106, 0.28);
  --chart-marker-label: #78909c;
  --chart-marker: #526c79;
  --radius: 9px;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #e7f0f4;
  --bg-deep: #d8e5eb;
  --surface: #ffffff;
  --surface-soft: #f0f6f8;
  --surface-raised: #dcecef;
  --border: #83a5b2;
  --border-soft: #afc5ce;
  --text: #173744;
  --text-strong: #071f2a;
  --muted: #3f606e;
  --muted-dark: #4c6b78;
  --accent: #007f99;
  --accent-soft: #cceaf0;
  --accent-pale: #005f74;
  --amber: #cf7600;
  --amber-soft: #f8e4c6;
  --danger: #c34e47;
  --positive: #16825d;
  --body-glow: rgba(32, 125, 151, 0.14);
  --body-top: #fbfdfe;
  --decoration-strong: #8aadb9;
  --decoration: #abc3cc;
  --header-button-bg: rgba(255, 255, 255, 0.94);
  --workspace-bg: rgba(249, 252, 253, 0.98);
  --section-heading: #143541;
  --active-bg: #c6e5ec;
  --bonus-bg: #ffffff;
  --segmented-active-bg: #c6e5ec;
  --input-bg: #ffffff;
  --control-label: #173744;
  --range-track: #9fb9c3;
  --range-thumb-border: #007f99;
  --range-thumb: #ffffff;
  --mode-bg: #d6ebf0;
  --panel-from: rgba(255, 255, 255, 0.98);
  --panel-to: rgba(244, 249, 251, 0.95);
  --panel-inset: rgba(255, 255, 255, 0.75);
  --dpm-label: #3d5c69;
  --tile-bg: #edf5f7;
  --tile-label: #345764;
  --panel-heading: #173744;
  --value-muted: #2f5360;
  --bar-track: #cfdee3;
  --bar-fill: #638e9f;
  --cycle-label: #42616e;
  --legend-label: #315563;
  --detail-label: #1d404d;
  --accent-border: #79aebb;
  --accent-panel: #d9eef2;
  --secondary-text: #3d5f6c;
  --secondary-value: #244956;
  --feature-heading: #163845;
  --timeline-label: #405f6c;
  --timeline-value: #1f4350;
  --formula-bg: #f2f7f9;
  --formula-text: #375966;
  --assumption-bg: #f0f6f8;
  --chart-structure: #078fa7;
  --chart-kinetic: #b76400;
  --chart-system: #cf7600;
  --chart-true-damage: #8b35b5;
  --chart-module-1: #078fa7;
  --chart-module-2: #cf7600;
  --chart-module-3: #8b35b5;
  --chart-module-4: #16825d;
  --chart-structure-area: rgba(7, 143, 167, 0.12);
  --chart-system-area: rgba(207, 118, 0, 0.09);
  --chart-true-damage-area: rgba(139, 53, 181, 0.09);
  --chart-legend: #415e6a;
  --chart-tooltip-bg: rgba(255, 255, 255, 0.97);
  --chart-tooltip-border: #9eb8c3;
  --chart-tooltip-text: #203c48;
  --chart-axis-pointer: #728e9a;
  --chart-axis-title: #617b87;
  --chart-axis-label: #526e7a;
  --chart-axis: #9eb5bf;
  --chart-grid: rgba(100, 132, 145, 0.2);
  --chart-marker-label: #607c88;
  --chart-marker: #91aab4;
}

:root[data-theme="light"] .control-rail,
:root[data-theme="light"] .result-canvas {
  box-shadow: 0 8px 24px rgba(26, 66, 82, 0.08);
}

:root[data-theme="light"] .preset-grid,
:root[data-theme="light"] .preset-category-grid,
:root[data-theme="light"] .carrier-grid,
:root[data-theme="light"] .segmented {
  background: #ffffff;
}

:root[data-theme="light"] .preset-grid button.is-active,
:root[data-theme="light"] .preset-category-grid button.is-active,
:root[data-theme="light"] .carrier-grid button.is-active,
:root[data-theme="light"] .segmented button.is-active {
  color: #004f61;
  font-weight: 650;
  box-shadow: inset 0 -3px var(--accent);
}

:root[data-theme="light"] .carrier-bonuses span {
  border-color: #a8c0ca;
  box-shadow: 0 1px 2px rgba(22, 60, 75, 0.04);
}

:root[data-theme="light"] .number-control.is-disabled,
:root[data-theme="light"] .select-control.is-disabled,
:root[data-theme="light"] .segmented-field.is-disabled {
  opacity: 0.62;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--bg-deep);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 78% -10%, var(--body-glow), transparent 35rem),
    linear-gradient(180deg, var(--body-top) 0%, var(--bg) 16rem, var(--bg-deep) 100%);
  transition: color 180ms ease, background-color 180ms ease;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  position: relative;
}

.app-shell::before {
  content: "";
  position: fixed;
  z-index: 0;
  inset: 0 0 auto auto;
  width: 42rem;
  height: 11rem;
  opacity: 0.22;
  pointer-events: none;
  background:
    radial-gradient(circle at 70% 110%, transparent 0 4.3rem, var(--decoration-strong) 4.35rem 4.45rem, transparent 4.5rem),
    radial-gradient(circle at 70% 110%, transparent 0 8.2rem, var(--decoration) 8.25rem 8.35rem, transparent 8.4rem),
    linear-gradient(105deg, transparent 48%, var(--decoration) 48.1% 48.3%, transparent 48.4%);
  mask-image: linear-gradient(90deg, transparent, #000 35%);
}

.app-header,
.workspace,
footer {
  position: relative;
  z-index: 1;
}

.app-header {
  height: 68px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-soft);
}

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

.brand-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  border-radius: 10px;
  object-fit: cover;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--bg) 65%, transparent),
    0 0 18px color-mix(in srgb, var(--accent) 22%, transparent);
}

.brand div {
  display: flex;
  align-items: baseline;
  gap: 18px;
}

.brand strong {
  color: var(--text-strong);
  font-size: 20px;
  letter-spacing: 0.05em;
}

.brand span {
  color: var(--muted);
  font-size: 15px;
  letter-spacing: 0.08em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-button {
  min-height: 36px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--header-button-bg);
  color: var(--text);
  font-size: 15px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.header-button:hover {
  border-color: var(--accent);
  background: var(--surface-raised);
}

.header-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon-moon {
  display: none;
}

:root[data-theme="light"] .theme-icon-sun {
  display: none;
}

:root[data-theme="light"] .theme-icon-moon {
  display: block;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(370px, 31.5%) minmax(0, 1fr);
  min-height: calc(100vh - 68px);
  padding: 0 14px;
  gap: 8px;
}

.control-rail,
.result-canvas {
  border-inline: 1px solid var(--border);
  background: var(--workspace-bg);
  transition: background-color 180ms ease, border-color 180ms ease;
}

.control-rail {
  border-top: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  counter-reset: control-section;
}

.control-section {
  padding: 11px 14px 12px;
  border-bottom: 1px solid var(--border-soft);
}

.control-section:not([hidden]) {
  counter-increment: control-section;
}

.control-section-heading {
  margin: -3px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 30px;
  color: var(--section-heading);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.control-section-heading::-webkit-details-marker {
  display: none;
}

.control-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-section-index {
  color: var(--accent);
  font-family: var(--mono);
}

.control-section-index::before {
  content: counter(control-section);
}

.control-section-chevron {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--muted);
  transition: transform 160ms ease, color 160ms ease;
}

.control-section-heading:hover .control-section-chevron {
  color: var(--accent);
}

.control-section:not([open]) .control-section-chevron {
  transform: rotate(-90deg);
}

.control-section-body {
  display: grid;
  gap: 8px;
  padding-top: 6px;
}

.preset-category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.preset-category-grid button {
  min-width: 0;
  height: 35px;
  padding: 0 8px;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease;
}

.preset-category-grid button:last-child {
  border-right: 0;
}

.preset-category-grid button:hover {
  color: var(--text);
  background: var(--surface-raised);
}

.preset-category-grid button.is-active {
  color: var(--accent-pale);
  background: var(--active-bg);
  box-shadow: inset 0 -3px var(--accent);
}

.target-category-grid button {
  border-bottom: 1px solid var(--border);
}

.target-category-grid button:nth-child(4n) {
  border-right: 0;
}

.target-category-grid button:nth-last-child(-n + 4) {
  border-bottom: 0;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.preset-grid button {
  min-width: 0;
  height: 31px;
  padding: 0 4px;
  border: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 140ms ease, background 140ms ease;
}

.preset-grid button:nth-child(4n) {
  border-right: 0;
}

.preset-grid button:hover {
  color: var(--text);
  background: var(--surface-raised);
}

.preset-grid button.is-active {
  color: var(--accent-pale);
  background: var(--active-bg);
  box-shadow: inset 0 -2px var(--accent);
}

.preset-grid.preset-secondary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  border: 0;
  border-radius: 0;
  overflow: visible;
}

.preset-grid.preset-secondary-grid button {
  height: 34px;
  border: 1px solid var(--border) !important;
  border-radius: 5px;
}

.preset-grid.preset-secondary-grid button[data-preset="custom"] {
  border-style: dashed !important;
}

.preset-grid.preset-secondary-grid button[data-target-template="custom"] {
  border-style: dashed !important;
}

.carrier-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.carrier-grid button {
  min-width: 0;
  height: 31px;
  padding: 0 5px;
  border: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 140ms ease, background 140ms ease;
}

.carrier-grid button:hover {
  color: var(--text);
  background: var(--surface-raised);
}

.carrier-grid button.is-active {
  color: var(--accent-pale);
  background: var(--active-bg);
  box-shadow: inset 0 -2px var(--accent);
}

.interception-picker {
  display: grid;
  gap: 9px;
  margin: 12px 0 0;
  padding: 0;
  border: 0;
}

.interception-picker legend {
  margin-bottom: 8px;
  padding: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.super-capital-config,
.super-slot-list {
  display: grid;
  gap: 10px;
}

.super-capital-note {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.super-slot-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-raised);
}

.super-slot-card > header {
  min-height: 38px;
  padding: 0 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.super-slot-card > header strong,
.super-slot-card > header span {
  font-size: 15px;
}

.super-slot-card > header span {
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
}

.super-slot-card > header .is-required {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  color: var(--accent);
}

.super-module-grid,
.super-module-build-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.super-module-grid button,
.super-module-build-grid button {
  min-width: 0;
  min-height: 36px;
  padding: 5px 8px;
  border: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
}

.super-module-grid button:hover,
.super-module-build-grid button:hover,
.super-module-grid button.is-active,
.super-module-build-grid button.is-active {
  color: var(--accent-pale);
  background: var(--active-bg);
}

.super-module-grid button.is-active,
.super-module-build-grid button.is-active {
  box-shadow: inset 0 -2px var(--accent);
}

.super-module-detail {
  padding: 10px 11px 11px;
}

.super-module-detail > p,
.super-module-detail > small {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.super-module-strategy-list {
  margin-top: 9px;
}

.super-module-strategy > p {
  margin: 0;
  padding: 8px 9px 10px;
  border-top: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.super-module-build-grid {
  margin: 8px 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 5px;
}

.super-module-editor {
  margin-top: 10px;
  border-top: 1px solid var(--border);
}

.super-module-editor > summary {
  padding: 10px 0 2px;
  color: var(--accent-pale);
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
}

.super-module-editor-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.super-module-control-group {
  padding-top: 10px;
}

.super-module-control-group + .super-module-control-group {
  margin-top: 6px;
  border-top: 1px solid var(--border-soft);
}

.super-module-control-group h4 {
  margin: 0 0 7px;
  color: var(--text);
  font-size: 15px;
}

.carrier-bonuses {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.self-build-bonuses {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.self-build-hit-rate-control,
.self-build-custom-controls {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}

.target-property-grid {
  margin-top: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.weapon-property-grid {
  margin-top: 0;
}

.strategy-bonuses {
  grid-template-columns: repeat(3, 1fr);
}

.strategy-list {
  display: grid;
  gap: 8px;
}

.strategy-card {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bonus-bg);
  overflow: hidden;
}

.strategy-card-header {
  min-height: 48px;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.strategy-card-header > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.strategy-card-header strong {
  color: var(--text);
  font-size: 16px;
}

.strategy-card-header small {
  color: var(--muted);
  font-size: 15px;
}

.strategy-toggle,
.strategy-status {
  flex: 0 0 auto;
  min-width: 76px;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}

.strategy-toggle {
  cursor: pointer;
}

.strategy-toggle.is-active,
.strategy-status.is-forced {
  border-color: var(--accent);
  background: var(--active-bg);
  color: var(--accent-pale);
}

.strategy-config {
  padding: 0 9px 8px;
  border-top: 1px solid var(--border-soft);
}

.strategy-variant-grid {
  margin-top: 8px;
}

.carrier-bonuses span {
  min-width: 0;
  min-height: 42px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  background: var(--bonus-bg);
  color: var(--muted);
  font-size: 15px;
  text-align: center;
  white-space: nowrap;
}

.carrier-bonuses strong {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
}

.preset-note,
.carrier-note {
  min-height: 34px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.segmented-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 12px;
  border: 0;
}

.segmented-field legend {
  display: contents;
  color: var(--text);
  font-size: 15px;
}

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.segmented button {
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.is-active {
  color: var(--accent-pale);
  background: var(--segmented-active-bg);
}

.segmented-field.is-disabled {
  opacity: 0.48;
}

.segmented-field.is-disabled button {
  cursor: not-allowed;
}

.number-control {
  min-width: 0;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.select-control {
  min-width: 0;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.select-control select {
  width: 100%;
  height: 31px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  outline: 0;
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%) calc(100% - 14px) 13px / 5px 5px no-repeat,
    linear-gradient(135deg, var(--muted) 50%, transparent 50%) calc(100% - 9px) 13px / 5px 5px no-repeat,
    var(--input-bg);
  color: var(--text);
  font-size: 15px;
  appearance: none;
  cursor: pointer;
}

.select-control.is-disabled {
  opacity: 0.38;
}

.select-control.is-disabled select {
  cursor: not-allowed;
}

.control-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.control-label {
  color: var(--control-label);
  font-size: 15px;
  white-space: nowrap;
}

.control-hint {
  color: var(--muted-dark);
  font-size: 15px;
  line-height: 1.2;
}

.control-inputs {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(60px, 1fr) 76px;
  align-items: center;
  gap: 10px;
}

input[type="range"] {
  width: 100%;
  height: 16px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 1px;
  background:
    linear-gradient(
      90deg,
      var(--accent) 0 var(--range-progress),
      var(--range-track) var(--range-progress) 100%
    );
}

input[type="range"]::-webkit-slider-thumb {
  width: 11px;
  height: 11px;
  margin-top: -4.5px;
  appearance: none;
  border: 2px solid var(--range-thumb-border);
  border-radius: 50%;
  background: var(--range-thumb);
  box-shadow: 0 0 0 2px var(--bg);
}

input[type="range"]::-moz-range-track {
  height: 2px;
  background: var(--range-track);
}

input[type="range"]::-moz-range-progress {
  height: 2px;
  background: var(--accent);
}

input[type="range"]::-moz-range-thumb {
  width: 8px;
  height: 8px;
  border: 2px solid var(--range-thumb-border);
  border-radius: 50%;
  background: var(--range-thumb);
}

.number-box {
  height: 29px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--input-bg);
}

.number-box input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  text-align: right;
  appearance: textfield;
}

.number-box input::-webkit-inner-spin-button,
.number-box input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.number-box span {
  min-width: 15px;
  margin-left: 4px;
  color: var(--muted);
  font-size: 15px;
  text-align: right;
}

.number-control.is-disabled {
  opacity: 0.38;
}

.number-control.is-disabled input {
  cursor: not-allowed;
}

.rail-footnote {
  margin: 0;
  padding: 11px 14px 13px;
  color: var(--muted-dark);
  font-size: 15px;
  line-height: 1.5;
}

.result-canvas {
  padding: 18px;
  border-top: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}

.title-row {
  min-height: 54px;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.title-row h1 {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(22px, 2vw, 29px);
  line-height: 1.15;
  letter-spacing: 0.04em;
}

.title-row p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  letter-spacing: 0.02em;
}

.title-row .warning-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-top: 9px;
}

.title-row .warning-list[hidden] {
  display: none;
}

.title-row .hit-rate-warning {
  width: fit-content;
  max-width: min(100%, 680px);
  display: inline-flex;
  align-items: flex-start;
  gap: 7px;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid color-mix(in srgb, var(--amber) 58%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--amber-soft) 58%, transparent);
  color: var(--amber);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.35;
}

.hit-rate-warning svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mode-readout {
  padding: 7px 10px;
  border-left: 2px solid var(--accent);
  background: var(--mode-bg);
  color: var(--accent-pale);
  font-family: var(--mono);
  font-size: 15px;
  white-space: nowrap;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, var(--panel-from), var(--panel-to));
  box-shadow: inset 0 1px var(--panel-inset);
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

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

.primary-metric {
  min-height: 170px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dpm-window {
  min-width: 0;
  padding: 16px 20px;
  display: grid;
  align-content: center;
}

.dpm-window + .dpm-window {
  border-left: 1px solid var(--border-soft);
}

.dpm-window p,
.metric p {
  margin: 0;
  color: var(--dpm-label);
  font-size: 15px;
  letter-spacing: 0.09em;
}

.dpm-window .combat-duration {
  display: inline-block;
  margin-right: 0.35em;
  color: var(--text-strong);
  font-family: var(--mono);
  letter-spacing: 0;
  white-space: nowrap;
}

.dpm-window > strong {
  margin-top: 7px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: clamp(28px, 2.6vw, 42px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
}

.primary-breakdown {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  align-items: center;
  gap: 12px;
}

.primary-breakdown > span {
  min-height: 64px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-content: center;
  gap: 7px;
  border-left: 2px solid var(--accent);
  background: var(--tile-bg);
  color: var(--tile-label);
  font-size: 15px;
}

.primary-breakdown > span:last-child {
  border-left-color: var(--amber);
}

.primary-breakdown strong {
  grid-column: 1 / -1;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 500;
}

.primary-breakdown > span:last-child strong {
  color: var(--amber);
}

.positive {
  color: var(--positive);
}

.negative {
  color: var(--danger);
}

.comparison {
  min-width: 0;
  min-height: 132px;
  padding: 14px 16px;
}

.comparison header {
  margin-bottom: 15px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.comparison h2,
.composition h2,
.detail-panel h2,
.cycle-panel h2,
.formula-flow h2 {
  margin: 0;
  color: var(--panel-heading);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.comparison h2 span {
  color: var(--muted);
  font-family: var(--mono);
  font-weight: 400;
}

.difference {
  display: grid;
  text-align: right;
}

.difference small {
  color: var(--muted);
  font-size: 15px;
}

.difference strong {
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 15px;
}

.comparison-rows {
  display: grid;
  gap: 11px;
}

.comparison-row {
  display: grid;
  grid-template-columns: 50px minmax(70px, 1fr) 82px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 15px;
}

.comparison-row > strong {
  color: var(--value-muted);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  text-align: right;
}

.comparison-row.is-active > span,
.comparison-row.is-active > strong {
  color: var(--accent-pale);
}

.bar-track {
  height: 8px;
  overflow: hidden;
  background: var(--bar-track);
}

.bar-track i {
  display: block;
  height: 100%;
  background: var(--bar-fill);
  transition: width 240ms ease;
}

.comparison-row.is-active .bar-track i {
  background: var(--accent);
}

.breakdown-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  gap: 8px;
}

.metric-strip {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.module-contribution {
  min-width: 0;
  padding: 15px 16px;
}

.module-contribution > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.module-contribution > header h2,
.module-contribution > header span {
  font-size: 15px;
}

.module-contribution > header span {
  color: var(--muted);
}

.module-contribution-list {
  margin-top: 10px;
  display: grid;
  gap: 9px;
}

.module-contribution-row {
  position: relative;
  padding-bottom: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.module-contribution-row > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.module-contribution-row strong,
.module-contribution-row span {
  font-size: 15px;
}

.module-contribution-row span {
  color: var(--muted);
}

.module-contribution-value {
  align-items: flex-end;
  font-family: var(--mono);
}

.module-contribution-value strong {
  color: var(--accent);
}

.module-contribution-row > i {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--border);
}

.module-contribution-row > i::after {
  content: "";
  display: block;
  width: var(--module-share);
  height: 100%;
  background: var(--accent);
}

.metric {
  min-width: 0;
  min-height: 142px;
  padding: 17px 15px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.metric strong {
  margin: 12px 0 8px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: clamp(20px, 2vw, 31px);
  font-weight: 600;
  letter-spacing: -0.04em;
}

.metric.system strong,
.metric.system span {
  color: var(--amber);
}

.metric span {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 15px;
}

.metric > small {
  margin-top: 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 15px;
}

.cycle-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.cycle-breakdown span {
  color: var(--cycle-label);
  font-family: inherit;
  font-size: 15px;
}

.cycle-breakdown b {
  margin-left: 4px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
}

.cycle-breakdown span:last-child b {
  color: var(--amber);
}

.number-control.is-infinite .number-box {
  border-color: rgba(72, 199, 219, 0.55);
}

.number-control.is-infinite .number-box > span {
  color: var(--accent);
  font-size: 15px;
}

.composition {
  min-width: 0;
  min-height: 142px;
  padding: 14px 16px;
}

.composition h2 span {
  color: var(--muted);
  font-weight: 400;
}

.composition-body {
  margin-top: 9px;
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  gap: 18px;
}

.donut {
  width: 98px;
  height: 98px;
  flex: 0 0 auto;
  padding: 11px;
  border-radius: 50%;
  transition: background 240ms ease;
}

.donut > div {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface);
}

.donut small,
.donut span {
  color: var(--muted);
  font-size: 15px;
  letter-spacing: 0.1em;
}

.donut strong {
  margin: 2px 0;
  color: var(--accent-pale);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
}

.legend {
  min-width: 130px;
  margin: 0;
  display: grid;
  gap: 12px;
}

.legend div {
  display: grid;
  gap: 3px;
}

.legend dt,
.legend dd {
  margin: 0;
}

.legend dt {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--legend-label);
  font-size: 15px;
}

.legend dd {
  padding-left: 15px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
}

.legend dd span {
  color: var(--muted);
  font-size: 15px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.legend-dot.structure {
  background: var(--accent);
}

.legend-dot.system {
  background: var(--amber);
}

.legend-dot.ordinary {
  background: linear-gradient(135deg, var(--accent) 0 50%, var(--amber) 50% 100%);
}

.legend-dot.true-damage,
.timeline-dot.true-damage {
  background: var(--chart-true-damage);
}

.true-damage-value {
  color: var(--chart-true-damage) !important;
}

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

.detail-panel,
.cycle-panel {
  min-width: 0;
  min-height: 250px;
  padding: 15px 17px;
}

.detail-table {
  margin-top: 12px;
  display: grid;
}

.detail-table > div {
  min-height: 39px;
  display: grid;
  grid-template-columns: 1fr 1.2fr 90px;
  align-items: center;
  border-bottom: 1px solid var(--border-soft);
  font-size: 15px;
}

.detail-table span {
  color: var(--detail-label);
  font-size: 15px;
}

.detail-table small {
  color: var(--muted);
  font-size: 15px;
}

.detail-table strong {
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  text-align: right;
}

.amber {
  color: var(--amber) !important;
}

.expected-shot,
.cycle-total {
  margin-top: 12px;
  min-height: 46px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--accent-border);
  border-radius: 6px;
  background: var(--accent-panel);
}

.expected-shot span,
.cycle-total span {
  color: var(--accent-pale);
  font-size: 15px;
}

.expected-shot strong,
.cycle-total strong {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 500;
}

.cycle-panel dl {
  margin: 12px 0 0;
}

.cycle-panel dl div {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-soft);
}

.cycle-panel dt {
  color: var(--secondary-text);
  font-size: 15px;
}

.cycle-panel dd {
  margin: 0;
  color: var(--secondary-value);
  font-family: var(--mono);
  font-size: 15px;
}

.projection-panel {
  margin-top: 8px;
  padding: 15px 17px;
}

.timeline-panel {
  margin-top: 8px;
  padding: 15px 17px 12px;
}

.timeline-panel header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.timeline-panel h2 {
  margin: 0;
  color: var(--feature-heading);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.timeline-panel h2 span {
  margin-left: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0;
}

.timeline-view-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--input-bg);
}

.timeline-view-toggle[hidden] {
  display: none;
}

.timeline-view-toggle button {
  min-height: 34px;
  padding: 6px 13px;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.timeline-view-toggle button:last-child {
  border-right: 0;
}

.timeline-view-toggle button.is-active {
  background: var(--segmented-active-bg);
  color: var(--accent-pale);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.timeline-totals {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 16px;
  color: var(--timeline-label);
  font-size: 15px;
}

.timeline-totals > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.timeline-totals strong {
  color: var(--timeline-value);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
}

.timeline-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
}

.timeline-dot.structure {
  background: var(--chart-structure);
}

.timeline-dot.kinetic {
  background: var(--chart-kinetic);
}

.timeline-dot.system {
  background: var(--chart-system);
}

.timeline-chart {
  width: 100%;
  height: 300px;
  margin-top: 9px;
}

.timeline-note {
  margin: 3px 0 0;
  color: var(--muted-dark);
  font-size: 15px;
  text-align: right;
}

.projection-panel header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
}

.projection-panel h2 {
  margin: 0;
  color: var(--feature-heading);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.projection-panel header > span {
  color: var(--muted);
  font-size: 15px;
}

.projection-metrics {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.projection-metrics.no-system {
  grid-template-columns: 1fr;
}

.projection-metrics > div {
  min-width: 0;
  min-height: 92px;
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 2px solid var(--accent);
  background: var(--tile-bg);
}

.projection-metrics > div:first-child {
  border-left-color: var(--amber);
}

.projection-metrics small {
  color: var(--muted);
  font-size: 15px;
}

.projection-metrics strong {
  margin: 7px 0 5px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 500;
}

.projection-metrics > div:first-child strong {
  color: var(--amber);
}

.projection-metrics span {
  color: var(--timeline-label);
  font-size: 15px;
}

.formula-flow {
  margin-top: 8px;
  padding: 13px 17px 16px;
}

.formula-steps {
  margin-top: 11px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.formula-step {
  min-width: 0;
  min-height: 104px;
  padding: 11px;
  position: relative;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--formula-bg);
}

.formula-step::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -7px;
  z-index: 2;
  width: 7px;
  height: 1px;
  background: var(--muted-dark);
}

.formula-step:last-child::after {
  display: none;
}

.formula-step small {
  display: block;
  margin-bottom: 6px;
  color: var(--muted-dark);
  font-family: var(--mono);
  font-size: 15px;
}

.formula-step strong {
  color: var(--accent-pale);
  font-size: 15px;
  font-weight: 600;
}

.formula-step:nth-child(2) strong {
  color: var(--amber);
}

.formula-step p {
  margin: 6px 0 0;
  color: var(--formula-text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.55;
}

footer {
  min-height: 44px;
  padding: 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--border-soft);
  color: var(--muted-dark);
  font-size: 15px;
}

.formula-dialog {
  width: min(1120px, calc(100vw - 40px));
  max-width: none;
  max-height: calc(100vh - 40px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface);
  box-shadow:
    0 26px 90px rgba(0, 0, 0, 0.48),
    0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent);
}

.formula-dialog::backdrop {
  background: rgba(0, 10, 18, 0.76);
  backdrop-filter: blur(5px);
}

.formula-dialog-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: calc(100vh - 42px);
}

.formula-dialog-header {
  min-height: 62px;
  padding: 0 18px 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-soft);
}

.formula-dialog-header > div {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.formula-dialog-header h2 {
  margin: 0;
  color: var(--panel-heading);
  font-size: 18px;
}

.formula-dialog-header span {
  color: var(--accent);
  font-size: 15px;
}

.formula-dialog-content {
  min-height: 0;
  margin: 0;
  padding: 18px;
  overflow: auto;
}

.formula-dialog-content .formula-steps {
  margin-top: 0;
}

.announcement-dialog {
  width: min(640px, calc(100vw - 40px));
  max-width: none;
  max-height: calc(100vh - 40px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface);
  box-shadow:
    0 26px 90px rgba(0, 0, 0, 0.48),
    0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent);
}

.announcement-dialog::backdrop {
  background: rgba(0, 10, 18, 0.76);
  backdrop-filter: blur(5px);
}

.announcement-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: calc(100vh - 42px);
}

.announcement-header {
  min-height: 62px;
  padding: 0 18px 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--border-soft);
  background:
    linear-gradient(90deg, var(--accent-panel), transparent 68%),
    var(--surface-soft);
}

.announcement-header h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 21px;
  letter-spacing: 0.05em;
}

.announcement-close {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted);
  background: var(--input-bg);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.announcement-close:hover {
  color: var(--text-strong);
  border-color: var(--accent);
}

.announcement-body {
  padding: 20px 22px;
  overflow: auto;
}

.announcement-text {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.8;
  white-space: pre-line;
}

.announcement-text:last-child {
  margin-bottom: 0;
}

.announcement-text strong,
.announcement-image figcaption strong {
  color: var(--accent-pale);
  font-weight: 750;
}

.announcement-image {
  margin: 16px 0 0;
}

.announcement-image img {
  display: block;
  width: 100%;
  max-height: 340px;
  object-fit: contain;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: var(--bg-deep);
}

.announcement-image figcaption {
  margin-top: 9px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  text-align: center;
}

.announcement-footer {
  min-height: 66px;
  padding: 12px 22px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-direction: row;
  gap: 0;
  border-top: 1px solid var(--border-soft);
  background: var(--surface-soft);
}

.announcement-confirm {
  min-width: 120px;
  min-height: 40px;
  padding: 0 20px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  color: var(--text-strong);
  background: var(--accent-soft);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.announcement-confirm:hover {
  background: var(--active-bg);
}

.ship-data-dialog {
  width: min(1540px, calc(100vw - 32px));
  max-width: none;
  height: min(860px, calc(100vh - 32px));
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface);
  box-shadow:
    0 26px 90px rgba(0, 0, 0, 0.52),
    0 0 0 1px color-mix(in srgb, var(--accent) 16%, transparent);
}

.ship-data-dialog::backdrop {
  background: rgba(0, 10, 18, 0.8);
  backdrop-filter: blur(5px);
}

.ship-data-card {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.ship-data-header {
  min-height: 72px;
  padding: 12px 18px 12px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--border-soft);
  background:
    linear-gradient(90deg, var(--accent-panel), transparent 68%),
    var(--surface-soft);
}

.ship-data-header h2,
.ship-data-header p {
  margin: 0;
}

.ship-data-header h2 {
  color: var(--text-strong);
  font-size: 22px;
  letter-spacing: 0.05em;
}

.ship-data-header p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 15px;
}

.ship-data-toolbar {
  padding: 12px 18px;
  display: grid;
  grid-template-columns:
    minmax(280px, 1fr)
    minmax(190px, 0.42fr)
    minmax(180px, 0.38fr)
    minmax(210px, 0.44fr);
  align-items: end;
  gap: 12px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-soft);
}

.ship-data-search,
.ship-data-select-filter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 15px;
}

.ship-data-search input,
.ship-data-select-filter select {
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  outline: none;
  color: var(--text-strong);
  background: var(--input-bg);
  font: inherit;
}

.ship-data-search input:focus,
.ship-data-select-filter select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
}

.ship-data-filters {
  grid-column: 1 / -1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}

.ship-data-filters button {
  min-height: 40px;
  padding: 5px 10px;
  border: 0;
  border-right: 1px solid var(--border);
  color: var(--muted);
  background: transparent;
  font-size: 15px;
  cursor: pointer;
}

.ship-data-filters button:last-child {
  border-right: 0;
}

.ship-data-filters button:hover,
.ship-data-filters button.is-active {
  color: var(--accent-pale);
  background: var(--active-bg);
}

.ship-data-filters button.is-active {
  box-shadow: inset 0 -3px var(--accent);
}

.ship-data-table-wrap {
  min-height: 0;
  overflow: auto;
  background: var(--workspace-bg);
}

.ship-data-table {
  width: 100%;
  min-width: 2220px;
  border-spacing: 0;
  border-collapse: separate;
  color: var(--text);
  font-size: 15px;
}

.ship-data-table th,
.ship-data-table td {
  height: 49px;
  padding: 8px 12px;
  border-right: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  background: var(--workspace-bg);
  text-align: left;
  white-space: nowrap;
}

.ship-data-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  height: 46px;
  color: var(--text-strong);
  background: var(--surface-raised);
  font-weight: 700;
}

.ship-data-table tbody th {
  color: var(--text-strong);
  font-weight: 700;
}

.ship-data-table tbody tr:hover th,
.ship-data-table tbody tr:hover td {
  background: var(--accent-panel);
}

.ship-data-table th:first-child,
.ship-data-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 104px;
  min-width: 104px;
}

.ship-data-table th:nth-child(2),
.ship-data-table td:nth-child(2) {
  position: sticky;
  left: 104px;
  z-index: 2;
  width: 190px;
  min-width: 190px;
  box-shadow: 1px 0 var(--border);
}

.ship-data-table thead th:first-child,
.ship-data-table thead th:nth-child(2) {
  z-index: 6;
  background: var(--surface-raised);
}

.ship-data-category,
.hit-rate-status,
.ship-data-legend i {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 15px;
  font-style: normal;
  white-space: nowrap;
}

.ship-data-category {
  color: var(--accent-pale);
  background: var(--accent-panel);
}

.hit-rate-status.is-tested,
.ship-data-legend .is-tested {
  color: var(--positive);
  border-color: color-mix(in srgb, var(--positive) 42%, var(--border));
  background: color-mix(in srgb, var(--positive) 10%, transparent);
}

.hit-rate-status.is-official-range,
.ship-data-legend .is-official-range {
  color: var(--amber);
  border-color: color-mix(in srgb, var(--amber) 42%, var(--border));
  background: color-mix(in srgb, var(--amber) 10%, transparent);
}

.hit-rate-status.is-untested,
.ship-data-legend .is-untested {
  color: var(--muted);
  background: var(--input-bg);
}

.ship-data-empty {
  margin: 0;
  padding: 42px 20px;
  color: var(--muted);
  font-size: 16px;
  text-align: center;
}

.ship-data-footer {
  min-height: 58px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid var(--border-soft);
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 15px;
}

.ship-data-footer strong {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 16px;
}

.ship-data-legend {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 900px) {
  .ship-data-toolbar {
    grid-template-columns: 1fr;
  }

  .ship-data-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ship-data-filters button:nth-child(3) {
    border-right: 0;
  }

  .ship-data-filters button:nth-child(-n + 3) {
    border-bottom: 1px solid var(--border);
  }

  .ship-data-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (min-width: 1181px) {
  html,
  body,
  #root {
    height: 100%;
    min-height: 0;
  }

  body {
    overflow: hidden;
  }

  .app-shell {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    display: grid;
    grid-template-rows: 68px minmax(0, 1fr);
    overflow: hidden;
  }

  .workspace {
    min-height: 0;
    overflow: hidden;
  }

  .control-rail,
  .result-canvas {
    min-height: 0;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-color: var(--border) transparent;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
  }

  .control-rail::-webkit-scrollbar,
  .result-canvas::-webkit-scrollbar {
    width: 9px;
  }

  .control-rail::-webkit-scrollbar-track,
  .result-canvas::-webkit-scrollbar-track {
    background: transparent;
  }

  .control-rail::-webkit-scrollbar-thumb,
  .result-canvas::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: var(--border);
    background-clip: padding-box;
  }
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 360px minmax(0, 1fr);
  }

  .control-inputs {
    grid-template-columns: minmax(45px, 1fr) 68px;
    gap: 7px;
  }

  .breakdown-grid {
    grid-template-columns: 1fr;
  }

  .composition {
    min-height: 126px;
  }

  .composition-body {
    justify-content: center;
  }
}

@media (max-width: 900px) {
  .app-header {
    padding-inline: 14px;
  }

  .brand div {
    align-items: flex-start;
    flex-direction: column;
    gap: 1px;
  }

  .workspace {
    display: block;
    padding: 0 10px;
  }

  .control-rail {
    border-radius: var(--radius);
  }

  .result-canvas {
    margin-top: 8px;
    border-radius: var(--radius);
  }

  .preset-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .carrier-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .overview-grid {
    grid-template-columns: 1fr;
  }

  .primary-metric {
    min-height: 120px;
    grid-template-columns: 1fr;
  }

  .dpm-window + .dpm-window {
    border-top: 1px solid var(--border-soft);
    border-left: 0;
  }

  .details-grid {
    grid-template-columns: 1fr;
  }

  footer {
    padding: 14px 18px;
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }
}

@media (max-width: 620px) {
  .app-shell::before {
    display: none;
  }

  .app-header {
    height: 62px;
  }

  .brand-icon {
    display: none;
  }

  .brand strong {
    font-size: 15px;
  }

  .brand span {
    font-size: 15px;
  }

  .header-button {
    width: 34px;
    padding: 0;
    justify-content: center;
  }

  .header-button span {
    display: none;
  }

  .header-button svg {
    width: 17px;
    height: 17px;
  }

  .workspace {
    padding-inline: 6px;
  }

  .control-section {
    padding-inline: 10px;
  }

  .preset-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .carrier-grid,
  .carrier-bonuses {
    grid-template-columns: repeat(2, 1fr);
  }

  .preset-grid button {
    font-size: 15px;
  }

  .preset-grid button:nth-child(4n) {
    border-right: 1px solid var(--border);
  }

  .preset-grid button:nth-child(2n) {
    border-right: 0;
  }

  .number-control,
  .segmented-field,
  .select-control {
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 8px;
  }

  .control-inputs {
    grid-template-columns: minmax(40px, 1fr) 70px;
  }

  .result-canvas {
    padding: 13px 10px;
  }

  .title-row {
    min-height: auto;
    align-items: flex-start;
  }

  .title-row h1 {
    font-size: 21px;
  }

  .title-row p {
    line-height: 1.5;
  }

  .mode-readout {
    display: none;
  }

  .comparison-row {
    grid-template-columns: 45px minmax(50px, 1fr) 74px;
    gap: 7px;
  }

  .metric-strip {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 95px;
    padding: 14px;
  }

  .metric strong {
    margin: 7px 0 3px;
  }

  .composition-body {
    flex-direction: column;
  }

  .legend {
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .detail-table > div {
    grid-template-columns: 1fr 1fr 70px;
  }

  .projection-panel header {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .timeline-panel header {
    flex-direction: column;
    gap: 8px;
  }

  .timeline-totals {
    justify-content: flex-start;
  }

  .timeline-chart {
    height: 280px;
    margin-left: -8px;
    width: calc(100% + 8px);
  }

  .timeline-note {
    text-align: left;
  }

  .projection-metrics {
    grid-template-columns: 1fr;
  }

  .formula-steps {
    grid-template-columns: 1fr;
  }

  .formula-step {
    min-height: auto;
  }

  .formula-step::after {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
