/* File: public/assets/css/styles.css */

:root {
  color-scheme: dark;
  --bg: #050711;
  --bg-soft: #090d1b;
  --surface: rgba(13, 18, 35, 0.9);
  --surface-strong: #11172a;
  --surface-hover: rgba(25, 33, 58, 0.94);
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.28);
  --text: #f8fafc;
  --text-soft: #cbd5e1;
  --muted: #8792aa;
  --accent: #72ddf7;
  --accent-strong: #36c6e8;
  --accent-soft: rgba(114, 221, 247, 0.14);
  --violet: #a78bfa;
  --warning: #fbbf24;
  --danger: #fb7185;
  --success: #4ade80;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --panel-width: 372px;
  --topbar-height: 70px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
output {
  font: inherit;
}

button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  color: inherit;
}

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

svg {
  display: block;
  flex: 0 0 auto;
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-rows: var(--topbar-height) minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 0%, rgba(79, 70, 229, 0.13), transparent 26%),
    var(--bg);
}

.topbar {
  position: relative;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto minmax(210px, 1fr);
  align-items: center;
  min-height: 0;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 7, 17, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(114, 221, 247, 0.28);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(114, 221, 247, 0.18), rgba(167, 139, 250, 0.07));
  color: var(--accent);
  box-shadow: inset 0 0 22px rgba(114, 221, 247, 0.07), 0 8px 25px rgba(0, 0, 0, 0.2);
}

.brand-mark svg {
  width: 28px;
  height: 28px;
  stroke-width: 1.45;
}

.brand-mark circle {
  fill: currentColor;
  stroke: none;
}

.brand-copy {
  display: grid;
  gap: 3px;
  line-height: 1;
}

.brand-copy strong {
  font-size: 15px;
  font-weight: 780;
  letter-spacing: 0.055em;
}

.brand-copy span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.06em;
}

.mode-switch {
  display: flex;
  align-items: center;
  justify-self: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.mode-button {
  display: inline-flex;
  height: 38px;
  align-items: center;
  gap: 7px;
  padding: 0 15px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 720;
  transition: 160ms ease;
}

.mode-button svg {
  width: 16px;
  height: 16px;
}

.mode-button:hover {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.045);
}

.mode-button.is-active {
  background: linear-gradient(145deg, rgba(114, 221, 247, 0.2), rgba(114, 221, 247, 0.08));
  color: #dffaff;
  box-shadow: inset 0 0 0 1px rgba(114, 221, 247, 0.18);
}

.topbar-actions,
.stage-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-actions {
  justify-self: end;
}

.icon-button,
.mini-icon-button,
.transport-secondary,
.transport-primary,
.glass-button,
.text-button,
.primary-button,
.secondary-button,
.preset-card,
.mission-card,
.mini-action-button,
.color-swatch,
.dialog-close-button {
  border: 0;
  cursor: pointer;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
  transition: 160ms ease;
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.icon-button svg {
  width: 20px;
  height: 20px;
}

.mobile-panel-button {
  display: none;
}

.workspace {
  display: grid;
  grid-template-columns: var(--panel-width) minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.control-panel {
  position: relative;
  z-index: 20;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(9, 13, 27, 0.99), rgba(7, 10, 21, 1));
}

.panel-scroll {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.32) transparent;
}

.panel-scroll::-webkit-scrollbar {
  width: 8px;
}

.panel-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.panel-scroll::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.32);
  background-clip: content-box;
}

.panel-section {
  padding: 22px 22px;
  border-bottom: 1px solid var(--line);
}

.intro-section {
  padding-top: 27px;
  padding-bottom: 24px;
}

.intro-section h1 {
  max-width: 292px;
  margin: 0;
  font-size: 24px;
  line-height: 1.42;
  letter-spacing: -0.04em;
}

.eyebrow,
.section-kicker {
  margin: 0 0 9px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 820;
  letter-spacing: 0.2em;
}

.section-kicker {
  margin-bottom: 5px;
  color: #7292a9;
  letter-spacing: 0.14em;
}

.section-description {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.section-heading.compact {
  align-items: center;
  margin-bottom: 17px;
}

.section-heading h2,
.mission-brief-heading h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.035em;
}

.section-hint {
  color: var(--muted);
  font-size: 9px;
}

.text-button {
  padding: 4px 0;
  background: transparent;
  color: var(--accent);
  font-size: 10px;
  font-weight: 720;
}

.text-button:hover {
  color: #c4f6ff;
}

.mission-counter {
  min-width: 52px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 720;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

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

.mission-card {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 12px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 65px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.022);
  text-align: left;
  transition: 170ms ease;
}

.mission-card:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
}

.mission-card.is-active {
  border-color: rgba(114, 221, 247, 0.38);
  background: linear-gradient(135deg, rgba(114, 221, 247, 0.13), rgba(167, 139, 250, 0.04));
  box-shadow: inset 0 0 0 1px rgba(114, 221, 247, 0.035);
}

.mission-card.is-complete {
  border-color: rgba(74, 222, 128, 0.25);
}

.mission-card-index {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 820;
}

.mission-card.is-active .mission-card-index {
  border-color: rgba(114, 221, 247, 0.28);
  background: rgba(114, 221, 247, 0.1);
  color: var(--accent);
}

.mission-card-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.mission-card-copy strong {
  font-size: 11px;
  font-weight: 760;
}

.mission-card-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mission-card-state {
  color: rgba(148, 163, 184, 0.2);
  font-size: 8px;
}

.mission-card.is-active .mission-card-state {
  color: var(--accent);
  text-shadow: 0 0 10px rgba(114, 221, 247, 0.7);
}

.mission-card.is-complete .mission-card-state {
  color: var(--success);
  text-shadow: 0 0 10px rgba(74, 222, 128, 0.55);
}

.mission-brief-section {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.012), transparent);
}

.mission-brief-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.difficulty-badge {
  display: inline-flex;
  margin-bottom: 7px;
  padding: 4px 7px;
  border: 1px solid rgba(114, 221, 247, 0.2);
  border-radius: 99px;
  background: rgba(114, 221, 247, 0.07);
  color: var(--accent);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.mini-action-button {
  display: inline-flex;
  height: 32px;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.mini-action-button:hover {
  border-color: var(--line-strong);
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.055);
}

.mini-action-button svg {
  width: 14px;
  height: 14px;
}

.mission-objective {
  margin: 15px 0 0;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.75;
}

.mission-steps {
  display: grid;
  gap: 9px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.mission-steps li {
  display: grid;
  grid-template-columns: 23px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
}

.mission-steps li > span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--accent);
  font-size: 8px;
  font-weight: 800;
}

.mission-steps p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.55;
}

.mission-progress-card {
  margin-top: 17px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(3, 7, 18, 0.52);
}

.mission-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-soft);
  font-size: 9px;
}

.mission-progress-head strong {
  color: var(--accent);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.progress-track,
.mission-hud-progress {
  position: relative;
  height: 5px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.14);
}

.progress-track span,
.mission-hud-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #4ade80);
  box-shadow: 0 0 12px rgba(114, 221, 247, 0.34);
  transition: width 180ms ease;
}

.mission-progress-card > p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.hint-card {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  margin-top: 11px;
  padding: 12px;
  border: 1px solid rgba(251, 191, 36, 0.16);
  border-radius: 13px;
  background: rgba(251, 191, 36, 0.045);
}

.hint-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 9px;
  background: rgba(251, 191, 36, 0.09);
  color: var(--warning);
}

.hint-icon svg {
  width: 16px;
  height: 16px;
}

.hint-card strong {
  display: block;
  color: #f8e9bd;
  font-size: 9px;
}

.hint-card p {
  margin: 4px 0 0;
  color: #a99e83;
  font-size: 9px;
  line-height: 1.55;
}

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

.preset-card {
  display: grid;
  min-width: 0;
  min-height: 112px;
  padding: 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.022);
  transition: 170ms ease;
}

.preset-card:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
}

.preset-card.is-active {
  border-color: rgba(114, 221, 247, 0.34);
  background: linear-gradient(145deg, rgba(114, 221, 247, 0.105), rgba(167, 139, 250, 0.035));
}

.preset-card > span:last-child {
  align-self: end;
  display: grid;
  min-width: 0;
  gap: 4px;
}

.preset-card strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.preset-visual {
  position: relative;
  width: 100%;
  height: 46px;
  overflow: hidden;
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 24%, rgba(255,255,255,.55) 0 1px, transparent 1.4px),
    radial-gradient(circle at 76% 34%, rgba(255,255,255,.4) 0 1px, transparent 1.4px),
    radial-gradient(circle at 62% 76%, rgba(255,255,255,.35) 0 1px, transparent 1.4px),
    rgba(3, 6, 16, 0.7);
}

.preset-visual::after {
  content: "";
  position: absolute;
  inset: 5px 19px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 50%;
  transform: rotate(-11deg);
}

.preset-visual i {
  position: absolute;
  z-index: 1;
  display: block;
  border-radius: 50%;
}

.preset-solar i:nth-child(1) { top: 14px; left: 47%; width: 15px; height: 15px; background: #fbbf24; box-shadow: 0 0 18px rgba(251, 191, 36, 0.72); }
.preset-solar i:nth-child(2) { top: 8px; right: 16px; width: 6px; height: 6px; background: var(--accent); box-shadow: 0 0 10px rgba(114, 221, 247, 0.58); }
.preset-solar i:nth-child(3) { bottom: 7px; left: 17px; width: 4px; height: 4px; background: var(--violet); }
.preset-binary i:nth-child(1), .preset-binary i:nth-child(2) { top: 15px; width: 12px; height: 12px; box-shadow: 0 0 15px currentColor; }
.preset-binary i:nth-child(1) { left: 29%; color: #72ddf7; background: currentColor; }
.preset-binary i:nth-child(2) { right: 29%; color: #fb7185; background: currentColor; }
.preset-slingshot i:nth-child(1) { top: 11px; left: 44%; width: 20px; height: 20px; background: var(--violet); box-shadow: 0 0 22px rgba(167, 139, 250, 0.62); }
.preset-slingshot i:nth-child(2) { top: 7px; left: 14px; width: 5px; height: 5px; background: #f8fafc; box-shadow: 29px 14px 0 -1px rgba(114, 221, 247, .65), 43px 21px 0 -1px rgba(114, 221, 247, .3); }
.preset-chaos::after { inset: 3px 11px; border-radius: 45% 55% 44% 56%; transform: rotate(23deg); }
.preset-chaos i { width: 8px; height: 8px; box-shadow: 0 0 10px currentColor; }
.preset-chaos i:nth-child(1) { top: 9px; left: 23%; color: var(--accent); background: currentColor; }
.preset-chaos i:nth-child(2) { top: 22px; right: 24%; color: var(--violet); background: currentColor; }
.preset-chaos i:nth-child(3) { bottom: 5px; left: 48%; color: var(--danger); background: currentColor; }

.control-row {
  display: grid;
  gap: 10px;
  margin-top: 17px;
}

.control-row:first-of-type {
  margin-top: 0;
}

.control-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-soft);
  font-size: 10px;
}

.control-label output {
  min-width: 48px;
  color: var(--text);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

input[type="range"] {
  width: 100%;
  height: 4px;
  margin: 0;
  appearance: none;
  border-radius: 99px;
  background: linear-gradient(to right, var(--accent) 0 var(--range-progress, 50%), rgba(148, 163, 184, 0.18) var(--range-progress, 50%) 100%);
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  appearance: none;
  border: 3px solid #0c1121;
  border-radius: 50%;
  background: #e8fbff;
  box-shadow: 0 0 0 1px rgba(114, 221, 247, 0.4), 0 0 13px rgba(114, 221, 247, 0.35);
}

input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 3px solid #0c1121;
  border-radius: 50%;
  background: #e8fbff;
  box-shadow: 0 0 0 1px rgba(114, 221, 247, 0.4), 0 0 13px rgba(114, 221, 247, 0.35);
}

.color-fieldset {
  margin: 18px 0 0;
  padding: 0;
  border: 0;
}

.color-fieldset legend {
  margin-bottom: 11px;
  color: var(--text-soft);
  font-size: 10px;
}

.color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
}

.color-swatch {
  position: relative;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 16px color-mix(in srgb, var(--swatch) 35%, transparent);
}

.color-swatch.is-selected::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
}

.toggle-list {
  display: grid;
  gap: 1px;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--line);
}

.single-toggle {
  margin-top: 19px;
}

.toggle-row {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 10px 12px;
  background: rgba(7, 11, 24, 0.95);
  cursor: pointer;
}

.toggle-row > span:first-child {
  display: grid;
  gap: 4px;
}

.toggle-row strong {
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 690;
}

.toggle-row small {
  color: var(--muted);
  font-size: 8px;
}

.toggle-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle {
  position: relative;
  flex: 0 0 auto;
  width: 36px;
  height: 20px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.22);
  transition: 160ms ease;
}

.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #cbd5e1;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
  transition: 160ms ease;
}

.toggle-row input:checked + .toggle {
  background: rgba(54, 198, 232, 0.72);
  box-shadow: 0 0 14px rgba(54, 198, 232, 0.18);
}

.toggle-row input:checked + .toggle::after {
  left: 19px;
  background: #effcff;
}

.shortcut-section {
  padding-bottom: 30px;
}

.shortcut-list {
  display: grid;
  gap: 9px;
  margin: 0;
}

.shortcut-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.shortcut-list dt,
.shortcut-list dd {
  margin: 0;
  font-size: 9px;
}

.shortcut-list dd {
  color: var(--muted);
  text-align: right;
}

kbd {
  display: inline-flex;
  min-width: 24px;
  min-height: 21px;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-bottom-color: rgba(148, 163, 184, 0.46);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-soft);
  font-size: 8px;
  font-weight: 700;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.22);
}

.simulation-stage {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: #03050d;
}

#simulationCanvas {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

#simulationCanvas.is-panning,
#simulationCanvas.is-grabbing-body {
  cursor: grabbing;
}

.canvas-gradient {
  position: absolute;
  z-index: 1;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(2, 5, 14, 0.18), transparent 18%, transparent 72%, rgba(2, 5, 14, 0.32)),
    radial-gradient(circle at 50% 50%, transparent 52%, rgba(2, 4, 11, 0.22) 100%);
  pointer-events: none;
}

.stage-topbar {
  position: absolute;
  z-index: 6;
  top: 18px;
  right: 18px;
  left: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.stage-topbar > * {
  pointer-events: auto;
}

.status-chip,
.glass-button,
.metrics-panel,
.selection-card,
.transport-bar,
.stage-hint,
.mission-hud {
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(7, 11, 24, 0.72);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(16px);
}

.status-chip {
  display: inline-flex;
  height: 35px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 99px;
  color: var(--text-soft);
  font-size: 9px;
  font-weight: 680;
  letter-spacing: 0.03em;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.08), 0 0 12px rgba(251, 191, 36, 0.48);
}

.status-chip[data-tone="running"] .status-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.09), 0 0 12px rgba(74, 222, 128, 0.58);
}

.status-chip[data-tone="paused"] .status-dot {
  background: var(--warning);
}

.status-chip[data-tone="success"] .status-dot {
  background: var(--success);
}

.status-chip[data-tone="failure"] .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.09), 0 0 12px rgba(251, 113, 133, 0.58);
}

.glass-button {
  display: inline-flex;
  height: 36px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  color: var(--text-soft);
  font-size: 9px;
  font-weight: 680;
  transition: 160ms ease;
}

.glass-button:hover {
  border-color: var(--line-strong);
  background: rgba(21, 29, 51, 0.82);
  color: var(--text);
}

.glass-button svg {
  width: 15px;
  height: 15px;
}

.mission-hud {
  position: absolute;
  z-index: 5;
  top: 70px;
  left: 18px;
  width: min(310px, calc(100% - 36px));
  padding: 14px 15px 13px;
  border-radius: 15px;
  pointer-events: none;
}

.mission-hud-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 8px;
  font-weight: 820;
  letter-spacing: 0.13em;
}

.mission-hud-topline span:last-child {
  color: var(--muted);
}

.mission-hud > strong {
  display: block;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.mission-hud > p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.55;
}

.mission-hud-progress {
  margin-top: 11px;
  height: 4px;
}

.stage-hint {
  position: absolute;
  z-index: 4;
  top: 52%;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  border-radius: 99px;
  color: var(--muted);
  font-size: 9px;
  transform: translate(-50%, -50%);
  transition: opacity 300ms ease, transform 300ms ease;
  pointer-events: none;
}

.stage-hint.is-hidden {
  opacity: 0;
  transform: translate(-50%, -43%);
}

.stage-hint strong {
  color: var(--text-soft);
  font-weight: 720;
}

.mouse-gesture {
  width: 16px;
  height: 21px;
  color: var(--accent);
}

.metrics-panel {
  position: absolute;
  z-index: 4;
  right: 18px;
  bottom: calc(18px + var(--safe-bottom));
  display: flex;
  overflow: hidden;
  border-radius: 14px;
}

.metric {
  display: grid;
  min-width: 102px;
  gap: 4px;
  padding: 11px 14px;
  border-left: 1px solid var(--line);
}

.metric:first-child {
  border-left: 0;
}

.metric span,
.selection-stats span {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.03em;
}

.metric strong,
.selection-stats strong {
  font-size: 11px;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
}

.selection-card {
  position: absolute;
  z-index: 4;
  bottom: calc(18px + var(--safe-bottom));
  left: 18px;
  width: min(285px, calc(100% - 36px));
  overflow: hidden;
  border-radius: 14px;
}

.selection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 11px 9px 13px;
  border-bottom: 1px solid var(--line);
}

.selection-header > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.selection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--selection-color, var(--accent));
  box-shadow: 0 0 10px var(--selection-color, var(--accent));
}

.selection-header strong {
  font-size: 10px;
  font-weight: 720;
}

.mini-icon-button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.mini-icon-button:hover {
  background: rgba(251, 113, 133, 0.1);
  color: var(--danger);
}

.mini-icon-button svg {
  width: 15px;
  height: 15px;
}

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

.selection-stats > div {
  display: grid;
  gap: 4px;
  padding: 11px 13px;
  border-left: 1px solid var(--line);
}

.selection-stats > div:first-child {
  border-left: 0;
}

.transport-bar {
  position: absolute;
  z-index: 7;
  bottom: calc(18px + var(--safe-bottom));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px;
  border-radius: 99px;
  transform: translateX(-50%);
}

.transport-secondary,
.transport-primary {
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: 160ms ease;
}

.transport-secondary {
  width: 37px;
  height: 37px;
  background: transparent;
  color: var(--muted);
}

.transport-secondary:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.transport-primary {
  width: 48px;
  height: 48px;
  background: linear-gradient(145deg, #8ae9fb, #4ccfe9);
  color: #031017;
  box-shadow: 0 8px 28px rgba(54, 198, 232, 0.26);
}

.transport-primary:hover {
  transform: scale(1.04);
  box-shadow: 0 10px 32px rgba(54, 198, 232, 0.34);
}

.transport-secondary svg { width: 18px; height: 18px; }
.transport-primary svg { width: 22px; height: 22px; stroke-width: 2.3; }
.transport-primary .play-icon { display: none; fill: currentColor; stroke: none; }
.transport-primary.is-paused .pause-icon { display: none; }
.transport-primary.is-paused .play-icon { display: block; }

.mission-result {
  position: absolute;
  z-index: 12;
  top: 50%;
  left: 50%;
  width: min(430px, calc(100% - 36px));
  padding: 24px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 21px;
  background:
    radial-gradient(circle at 50% 0%, rgba(114, 221, 247, 0.1), transparent 35%),
    rgba(9, 14, 29, 0.95);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.58);
  text-align: center;
  transform: translate(-50%, -50%);
  backdrop-filter: blur(22px);
}

.result-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin: 0 auto 13px;
  place-items: center;
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 17px;
  background: rgba(74, 222, 128, 0.1);
  color: var(--success);
  box-shadow: 0 0 28px rgba(74, 222, 128, 0.12);
}

.result-icon[data-result="failure"] {
  border-color: rgba(251, 113, 133, 0.3);
  background: rgba(251, 113, 133, 0.1);
  color: var(--danger);
  box-shadow: 0 0 28px rgba(251, 113, 133, 0.12);
}

.result-icon svg {
  width: 27px;
  height: 27px;
  stroke-width: 2.2;
}

.result-icon[data-result="success"] .result-failure-icon,
.result-icon[data-result="failure"] .result-success-icon {
  display: none;
}

.result-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 8px;
  font-weight: 820;
  letter-spacing: 0.18em;
}

.mission-result h2 {
  margin: 8px 0 0;
  font-size: 21px;
  letter-spacing: -0.025em;
}

.mission-result > p:not(.result-kicker) {
  margin: 9px auto 0;
  max-width: 340px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 18px 0 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}

.result-stats > div {
  display: grid;
  gap: 5px;
  padding: 12px 8px;
  background: rgba(6, 10, 22, 0.96);
}

.result-stats dt,
.result-stats dd {
  margin: 0;
}

.result-stats dt {
  color: var(--muted);
  font-size: 8px;
}

.result-stats dd {
  color: var(--text);
  font-size: 11px;
  font-weight: 740;
  font-variant-numeric: tabular-nums;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 9px;
  margin-top: 18px;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 760;
}

.primary-button {
  background: linear-gradient(145deg, #8ae9fb, #4ccfe9);
  color: #031017;
  box-shadow: 0 9px 24px rgba(54, 198, 232, 0.18);
}

.primary-button:hover {
  filter: brightness(1.06);
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
}

.secondary-button:hover {
  background: rgba(255, 255, 255, 0.075);
  color: var(--text);
}

.toast-region {
  position: absolute;
  z-index: 15;
  top: 66px;
  left: 50%;
  display: grid;
  gap: 8px;
  width: min(380px, calc(100% - 34px));
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: rgba(12, 18, 34, 0.92);
  color: var(--text-soft);
  font-size: 9px;
  line-height: 1.5;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  animation: toast-in 220ms ease both;
}

.toast::before {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(114, 221, 247, 0.5);
}

.toast.is-leaving {
  animation: toast-out 180ms ease both;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(-5px); }
}

.help-dialog {
  width: min(900px, calc(100% - 34px));
  max-height: min(880px, calc(100dvh - 34px));
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: transparent;
  color: #172033;
}

.help-dialog::backdrop {
  background: rgba(1, 3, 10, 0.78);
  backdrop-filter: blur(8px);
}

.dialog-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(880px, calc(100dvh - 34px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 24px;
  background: #f7f9fc;
  color: #172033;
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.58);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 25px 28px 22px;
  border-bottom: 1px solid #dce3ec;
  background: linear-gradient(135deg, #ffffff, #eef8fb);
}

.dialog-header .eyebrow {
  color: #1687a3;
}

.dialog-header h2 {
  margin: 0;
  font-size: 23px;
  letter-spacing: -0.03em;
}

.dialog-header p:last-child {
  margin: 8px 0 0;
  color: #637087;
  font-size: 12px;
  line-height: 1.65;
}

.dialog-close-button {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid #d3dce7;
  border-radius: 12px;
  background: #ffffff;
  color: #59667c;
}

.dialog-close-button:hover {
  background: #eef3f8;
  color: #172033;
}

.dialog-close-button svg {
  width: 20px;
  height: 20px;
}

.dialog-body {
  min-height: 0;
  padding: 24px 28px 28px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #aab6c7 transparent;
}

.guide-section + .guide-section {
  margin-top: 25px;
  padding-top: 25px;
  border-top: 1px solid #dce3ec;
}

.guide-section-title {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}

.guide-section-title > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: #dff6fb;
  color: #1687a3;
  font-size: 10px;
  font-weight: 820;
}

.guide-section-title strong {
  display: block;
  font-size: 15px;
}

.guide-section-title p {
  margin: 4px 0 0;
  color: #6d788b;
  font-size: 11px;
  line-height: 1.6;
}

.guide-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 17px;
}

.guide-flow article {
  padding: 15px;
  border: 1px solid #dce3ec;
  border-radius: 15px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(32, 52, 78, 0.045);
}

.guide-flow article > strong {
  display: block;
  margin-top: 11px;
  font-size: 12px;
}

.guide-flow article > p {
  margin: 6px 0 0;
  color: #6d788b;
  font-size: 10px;
  line-height: 1.65;
}

.guide-visual {
  position: relative;
  display: block;
  height: 64px;
  overflow: hidden;
  border-radius: 11px;
  background: linear-gradient(145deg, #081126, #101d3a);
}

.drag-visual i {
  position: absolute;
  top: 24px;
  left: 27px;
  width: 14px;
  height: 14px;
  border: 2px solid #72ddf7;
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(114, 221, 247, 0.5);
}

.drag-visual b {
  position: absolute;
  top: 31px;
  left: 43px;
  width: 56px;
  border-top: 2px solid #72ddf7;
}

.drag-visual b::after {
  content: "";
  position: absolute;
  top: -5px;
  right: -1px;
  width: 8px;
  height: 8px;
  border-top: 2px solid #72ddf7;
  border-right: 2px solid #72ddf7;
  transform: rotate(45deg);
}

.route-visual i {
  position: absolute;
  top: 23px;
  left: 26px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fbbf24;
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.6);
}

.route-visual b {
  position: absolute;
  top: 12px;
  left: 47px;
  width: 75px;
  height: 43px;
  border: 2px dashed #72ddf7;
  border-left-color: transparent;
  border-radius: 50%;
  transform: rotate(-10deg);
}

.result-visual i {
  position: absolute;
  top: 14px;
  left: 50%;
  width: 36px;
  height: 36px;
  border: 2px solid #4ade80;
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 22px rgba(74, 222, 128, 0.28);
}

.result-visual i::before,
.result-visual i::after {
  content: "";
  position: absolute;
  height: 2px;
  background: #4ade80;
  transform-origin: left center;
}

.result-visual i::before {
  top: 20px;
  left: 8px;
  width: 9px;
  transform: rotate(43deg);
}

.result-visual i::after {
  top: 24px;
  left: 14px;
  width: 16px;
  transform: rotate(-48deg);
}

.operation-table {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 16px;
}

.operation-table > div {
  display: grid;
  grid-template-columns: minmax(118px, 0.8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid #dce3ec;
  border-radius: 11px;
  background: #ffffff;
}

.operation-key {
  color: #1b4960;
  font-size: 10px;
  font-weight: 760;
}

.operation-table p {
  margin: 0;
  color: #6d788b;
  font-size: 10px;
  line-height: 1.55;
}

.keyboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 16px;
}

.keyboard-grid > div {
  display: flex;
  min-height: 49px;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid #dce3ec;
  border-radius: 11px;
  background: #ffffff;
}

.keyboard-grid kbd {
  flex: 0 0 auto;
  border-color: #c7d1dd;
  background: #eef2f7;
  color: #273449;
  box-shadow: 0 2px 0 #c5cfda;
}

.keyboard-grid span {
  color: #5f6c80;
  font-size: 10px;
  line-height: 1.45;
}

.guide-free-note {
  padding-bottom: 2px;
}

.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 28px;
  border-top: 1px solid #dce3ec;
  background: #ffffff;
}

.dialog-footer p {
  margin: 0;
  color: #6d788b;
  font-size: 10px;
}

.dialog-footer .primary-button {
  min-width: 170px;
  background: linear-gradient(145deg, #54d4ef, #35bcd8);
  color: #05202a;
}

.noscript-message {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #060914;
  color: #f8fafc;
  text-align: center;
}

.mobile-panel-backdrop {
  position: fixed;
  z-index: 15;
  inset: var(--topbar-height) 0 0;
  background: rgba(1, 3, 10, 0.64);
  backdrop-filter: blur(4px);
}

@media (max-width: 1120px) {
  :root {
    --panel-width: 348px;
  }

  .topbar {
    grid-template-columns: minmax(190px, 1fr) auto minmax(70px, 1fr);
  }

  .brand-copy span {
    display: none;
  }

  .metrics-panel .metric:nth-child(2) {
    display: none;
  }
}

@media (max-width: 860px) {
  :root {
    --topbar-height: 64px;
  }

  .topbar {
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    padding: 0 13px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand-copy strong {
    font-size: 13px;
  }

  .mode-button {
    height: 35px;
    padding: 0 10px;
  }

  .mode-button svg {
    display: none;
  }

  .mobile-panel-button {
    display: grid;
  }

  .workspace {
    display: block;
  }

  .control-panel {
    position: fixed;
    z-index: 25;
    top: var(--topbar-height);
    bottom: 0;
    left: 0;
    width: min(372px, calc(100% - 44px));
    height: auto;
    border-right: 1px solid var(--line-strong);
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.4);
    transform: translateX(-102%);
    transition: transform 220ms ease;
  }

  .control-panel.is-open {
    transform: translateX(0);
  }

  .simulation-stage {
    width: 100%;
    height: 100%;
  }

  .stage-topbar {
    top: 13px;
    right: 13px;
    left: 13px;
  }

  .mission-hud {
    top: 61px;
    left: 13px;
    width: min(292px, calc(100% - 26px));
  }

  .glass-button span {
    display: none;
  }

  .glass-button {
    width: 36px;
    justify-content: center;
    padding: 0;
  }

  .metrics-panel {
    right: 12px;
    bottom: calc(12px + var(--safe-bottom));
  }

  .metric {
    min-width: 74px;
    padding: 10px 11px;
  }

  .selection-card {
    bottom: calc(80px + var(--safe-bottom));
    left: 12px;
    width: min(274px, calc(100% - 24px));
  }

  .transport-bar {
    bottom: calc(12px + var(--safe-bottom));
  }

  .stage-hint {
    top: 49%;
  }
}

@media (max-width: 620px) {
  .brand-copy {
    display: none;
  }

  .mode-switch {
    justify-self: start;
  }

  .mode-button {
    padding: 0 9px;
    font-size: 10px;
  }

  .stage-actions .glass-button:first-child {
    display: none;
  }

  .metrics-panel .metric:last-child {
    display: none;
  }

  .mission-hud {
    width: min(270px, calc(100% - 80px));
  }

  .mission-hud > p {
    display: none;
  }

  .selection-card {
    right: 12px;
    width: auto;
  }

  .mission-result {
    padding: 21px 18px;
  }

  .result-stats {
    grid-template-columns: 1fr;
  }

  .result-stats > div {
    grid-template-columns: 1fr auto;
    align-items: center;
    text-align: left;
  }

  .guide-flow,
  .operation-table,
  .keyboard-grid {
    grid-template-columns: 1fr;
  }

  .operation-table > div {
    grid-template-columns: minmax(105px, 0.65fr) minmax(0, 1.35fr);
  }

  .dialog-header,
  .dialog-body,
  .dialog-footer {
    padding-right: 18px;
    padding-left: 18px;
  }

  .dialog-header h2 {
    font-size: 19px;
  }

  .dialog-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .dialog-footer p {
    display: none;
  }

  .dialog-footer .primary-button {
    width: 100%;
  }
}

@media (max-height: 620px) and (min-width: 861px) {
  :root {
    --topbar-height: 58px;
  }

  .topbar {
    padding-top: 0;
    padding-bottom: 0;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .mode-button {
    height: 34px;
  }

  .stage-topbar {
    top: 10px;
  }

  .mission-hud {
    top: 55px;
  }

  .metrics-panel,
  .selection-card,
  .transport-bar {
    bottom: 10px;
  }

  .selection-card {
    width: 255px;
  }
}

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