:root {
  color-scheme: dark;
  --bg: #06101d;
  --bg-deep: #030914;
  --panel: rgba(12, 26, 43, 0.78);
  --panel-solid: #0c1a2b;
  --panel-soft: rgba(18, 37, 60, 0.62);
  --line: rgba(148, 178, 210, 0.14);
  --line-strong: rgba(148, 178, 210, 0.25);
  --text: #f4f8fc;
  --text-soft: #b7c7d9;
  --muted: #7f94aa;
  --blue: #6f9df2;
  --blue-bright: #8fb6ff;
  --blue-deep: #315ea8;
  --cyan: #58d5df;
  --mint: #67d5ac;
  --amber: #f0bb64;
  --coral: #f07f76;
  --danger: #e95e66;
  --shadow: 0 24px 70px rgba(0, 4, 12, 0.42);
  --radius-xl: 26px;
  --radius-lg: 19px;
  --radius-md: 14px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -20%, rgba(67, 112, 183, 0.2), transparent 42rem),
    linear-gradient(145deg, #071421 0%, #050d18 48%, #07111d 100%);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(111, 157, 242, 0.72);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 999;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  transform: translateY(-160%);
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  font-weight: 800;
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.ambient,
.noise {
  position: fixed;
  pointer-events: none;
}

.ambient {
  z-index: 0;
  width: 36rem;
  height: 36rem;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.15;
}

.ambient-one {
  top: 16%;
  left: -22rem;
  background: #3475d5;
}

.ambient-two {
  right: -23rem;
  bottom: -9rem;
  background: #2ca59e;
}

.noise {
  z-index: 1;
  inset: 0;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

.app-shell {
  position: relative;
  z-index: 2;
  width: min(1540px, 100%);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 22px clamp(16px, 2.4vw, 38px) 14px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 62px;
  margin-bottom: 18px;
  padding: 0 4px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(111, 157, 242, 0.34);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(111, 157, 242, 0.2), rgba(88, 213, 223, 0.06));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08), 0 10px 30px rgba(20, 80, 150, 0.15);
}

.brand-mark svg {
  width: 32px;
  fill: none;
  stroke: var(--blue-bright);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
}

.brand-mark .brand-spark {
  fill: var(--cyan);
  stroke: none;
}

.brand > span:last-child {
  display: flex;
  flex-direction: column;
}

.brand strong {
  font-size: 16px;
  font-weight: 780;
  letter-spacing: -0.01em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.topbar-status {
  justify-self: center;
}

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

.live-indicator,
.score-chip {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(7, 19, 32, 0.62);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 720;
  letter-spacing: 0.04em;
}

.live-indicator i {
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 5px rgba(103, 213, 172, 0.09), 0 0 12px rgba(103, 213, 172, 0.6);
}

.score-chip {
  border-color: rgba(111, 157, 242, 0.22);
  color: var(--blue-bright);
  font-variant-numeric: tabular-nums;
}

.rank-chip {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(88, 213, 223, 0.2);
  border-radius: 999px;
  background: rgba(88, 213, 223, 0.06);
  color: var(--cyan);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(13, 29, 47, 0.68);
  color: var(--text-soft);
  cursor: pointer;
  transition: 160ms ease;
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: rgba(24, 45, 70, 0.82);
  color: var(--text);
  transform: translateY(-1px);
}

.icon-button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.bonus-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 11px;
  border: 1px solid rgba(88, 213, 223, 0.19);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(88, 213, 223, 0.08), rgba(111, 157, 242, 0.07));
  color: var(--text-soft);
  cursor: pointer;
  transition: 160ms ease;
}

.bonus-button:hover {
  border-color: rgba(88, 213, 223, 0.36);
  color: var(--text);
  transform: translateY(-1px);
}

.bonus-button svg {
  width: 17px;
  fill: none;
  stroke: var(--cyan);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.bonus-button > span {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-size: 9px;
  font-weight: 800;
}

.bonus-button small {
  margin-top: 1px;
  color: var(--cyan);
  font-size: 6px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(230px, 0.72fr) minmax(500px, 1.65fr) minmax(280px, 0.9fr);
  gap: clamp(14px, 1.4vw, 22px);
  min-height: calc(100vh - 132px);
  min-height: calc(100dvh - 132px);
}

.glass-panel {
  border: 1px solid var(--line);
  background: linear-gradient(155deg, rgba(15, 31, 51, 0.83), rgba(8, 20, 34, 0.78));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035), var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.mission-panel,
.telemetry-panel {
  align-self: stretch;
  border-radius: var(--radius-xl);
}

.mission-panel {
  display: flex;
  flex-direction: column;
  padding: clamp(22px, 2.1vw, 32px);
}

.mission-kicker,
.incident-meta,
.workbench-head,
.progress-label,
.decision-head,
.telemetry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mission-kicker > span:first-child,
.section-kicker,
.dialog-kicker {
  color: var(--blue-bright);
  font-size: 10px;
  font-weight: 820;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.domain-chip {
  padding: 5px 9px;
  border: 1px solid rgba(88, 213, 223, 0.18);
  border-radius: 999px;
  background: rgba(88, 213, 223, 0.07);
  color: var(--cyan);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mission-panel h1 {
  max-width: 12ch;
  margin: 26px 0 13px;
  font-size: clamp(27px, 2.3vw, 38px);
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.mission-panel > p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.65;
}

.progress-block {
  margin-top: 32px;
}

.progress-label {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.progress-label strong {
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  box-shadow: 0 0 16px rgba(88, 213, 223, 0.38);
  transition: width 500ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.objective-card {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding: 15px;
  border: 1px solid rgba(111, 157, 242, 0.15);
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, rgba(111, 157, 242, 0.09), rgba(88, 213, 223, 0.025));
}

.objective-icon {
  display: grid;
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 9px;
  background: rgba(111, 157, 242, 0.13);
  color: var(--blue-bright);
}

.objective-icon svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.objective-card small,
.quality-copy > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.objective-card p {
  margin: 5px 0 0;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.48;
}

.run-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: auto;
  padding-top: 28px;
}

.run-stats > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 11px 4px;
  border-right: 1px solid var(--line);
}

.run-stats > div:last-child {
  border-right: 0;
}

.run-stats span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.run-stats strong {
  color: var(--text);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.shortcut-card {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 11px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
}

.rank-progress-card {
  margin-top: 16px;
  padding: 13px;
  border: 1px solid rgba(88, 213, 223, 0.14);
  border-radius: 13px;
  background: rgba(88, 213, 223, 0.035);
}

.rank-progress-card > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.rank-progress-card span {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
}

.rank-progress-card small,
.rank-progress-card p {
  color: var(--muted);
  font-size: 9px;
}

.rank-progress-card p {
  margin: 8px 0 0;
  line-height: 1.4;
}

.rank-progress-track {
  height: 5px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
}

.rank-progress-track span {
  display: block;
  width: var(--rank-progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  transition: width 400ms ease;
}

kbd {
  display: inline-grid;
  min-width: 20px;
  min-height: 19px;
  margin-right: 3px;
  padding: 2px 5px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-soft);
  font-family: inherit;
  font-size: 8px;
}

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

.workbench-head {
  min-height: 48px;
  padding: 0 7px 10px;
}

.workbench-head > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.workbench-head p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.severity {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--amber);
  font-size: 9px;
  font-weight: 780;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.severity i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

.severity.high {
  color: var(--coral);
}

.severity.critical {
  color: var(--danger);
}

.incident-card {
  position: relative;
  flex: 1;
  overflow: hidden;
  padding: clamp(24px, 2.7vw, 42px);
  border-radius: var(--radius-xl);
}

.incident-glow {
  position: absolute;
  top: -10rem;
  right: -10rem;
  width: 24rem;
  height: 24rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(111, 157, 242, 0.11), transparent 68%);
  pointer-events: none;
}

.incident-meta {
  position: relative;
  justify-content: flex-start;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.incident-meta span:first-child {
  color: var(--cyan);
}

.incident-card h2 {
  position: relative;
  max-width: 20ch;
  margin: 15px 0 10px;
  font-size: clamp(25px, 2.25vw, 35px);
  line-height: 1.08;
  letter-spacing: -0.037em;
}

.incident-description {
  position: relative;
  max-width: 70ch;
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.58;
}

.tutorial-coach {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 18px;
  margin: 18px 0 8px;
  padding: 15px 16px;
  border: 1px solid rgba(88, 213, 223, 0.24);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(88, 213, 223, 0.085), rgba(111, 157, 242, 0.055));
  animation: reveal 260ms ease both;
}

.tutorial-coach[hidden] {
  display: none;
}

.tutorial-coach > span {
  grid-column: 1 / -1;
  color: var(--cyan);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tutorial-coach strong {
  font-size: 13px;
}

.tutorial-coach p {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
}

.tutorial-coach button {
  align-self: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(88, 213, 223, 0.22);
  border-radius: 10px;
  background: rgba(88, 213, 223, 0.08);
  color: var(--cyan);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.tutorial-focus {
  outline: 2px solid rgba(88, 213, 223, 0.35);
  outline-offset: 4px;
  box-shadow: 0 0 26px rgba(88, 213, 223, 0.08);
}

.record-preview {
  position: relative;
  display: grid;
  gap: 7px;
  margin: 22px 0 24px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(3, 12, 22, 0.42);
}

.record-row {
  display: grid;
  grid-template-columns: minmax(105px, 0.78fr) minmax(78px, 0.58fr) minmax(135px, 1.12fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 13px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.027);
}

.record-row.bad {
  border-color: rgba(240, 127, 118, 0.11);
  background: rgba(240, 127, 118, 0.045);
}

.record-row.good {
  border-color: rgba(103, 213, 172, 0.09);
}

.record-source {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-field {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.record-row strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 730;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: var(--amber);
  font-size: 9px;
  font-weight: 800;
}

.record-status::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.record-status.bad { color: var(--coral); }
.record-status.good { color: var(--mint); }

.decision-head {
  margin-bottom: 12px;
}

.decision-head > div {
  display: flex;
  flex-direction: column;
}

.decision-head > div > span {
  font-size: 13px;
  font-weight: 820;
}

.decision-head > div > small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.hint-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid rgba(240, 187, 100, 0.17);
  border-radius: 9px;
  background: rgba(240, 187, 100, 0.055);
  color: var(--amber);
  font-size: 11px;
  font-weight: 780;
  cursor: pointer;
  transition: 160ms ease;
}

.hint-button:hover:not(:disabled) {
  background: rgba(240, 187, 100, 0.1);
}

.hint-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.hint-button svg {
  width: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.hint-button span {
  display: grid;
  min-width: 16px;
  height: 16px;
  place-items: center;
  border-radius: 5px;
  background: rgba(240, 187, 100, 0.12);
}

.hint-panel {
  margin-bottom: 10px;
  padding: 11px 13px;
  border: 1px solid rgba(240, 187, 100, 0.17);
  border-radius: 11px;
  background: rgba(240, 187, 100, 0.055);
  animation: reveal 240ms ease both;
}

.hint-panel strong {
  display: block;
  margin-bottom: 3px;
  color: var(--amber);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hint-panel p {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
}

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

.choice-button {
  position: relative;
  display: grid;
  grid-template-columns: 22px 34px 1fr 20px;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 74px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.choice-button:hover:not(:disabled) {
  border-color: rgba(111, 157, 242, 0.36);
  background: rgba(111, 157, 242, 0.07);
  transform: translateX(3px);
}

.choice-button:disabled {
  cursor: default;
}

.choice-number {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
}

.choice-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  background: rgba(111, 157, 242, 0.09);
  color: var(--blue-bright);
}

.choice-icon svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.choice-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.choice-copy strong {
  font-size: 14px;
  font-weight: 780;
}

.choice-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.choice-heading em {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.choice-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
}

.choice-arrow {
  color: var(--muted);
  font-size: 16px;
  transition: transform 160ms ease;
}

.choice-button:hover .choice-arrow {
  color: var(--blue-bright);
  transform: translateX(2px);
}

.choice-button.is-correct {
  border-color: rgba(103, 213, 172, 0.36);
  background: rgba(103, 213, 172, 0.065);
}

.choice-button.is-correct .choice-icon,
.choice-button.is-correct .choice-arrow {
  color: var(--mint);
}

.choice-button.is-wrong {
  border-color: rgba(240, 127, 118, 0.35);
  background: rgba(240, 127, 118, 0.06);
}

.choice-button.is-wrong .choice-icon,
.choice-button.is-wrong .choice-arrow {
  color: var(--coral);
}

.choice-button:not(.is-selected):disabled {
  opacity: 0.55;
}

.feedback-panel {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: start;
  gap: 13px;
  margin-top: 13px;
  padding: 16px;
  border: 1px solid rgba(103, 213, 172, 0.18);
  border-radius: 15px;
  background: rgba(103, 213, 172, 0.055);
  animation: reveal 300ms ease both;
}

.feedback-panel[hidden] {
  display: none;
}

.feedback-panel.failure {
  border-color: rgba(240, 127, 118, 0.18);
  background: rgba(240, 127, 118, 0.05);
}

.feedback-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 10px;
  background: rgba(103, 213, 172, 0.13);
  color: var(--mint);
  font-size: 17px;
  font-weight: 900;
}

.failure .feedback-icon {
  background: rgba(240, 127, 118, 0.12);
  color: var(--coral);
}

.feedback-eyebrow {
  color: var(--mint);
  font-size: 8px;
  font-weight: 840;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.failure .feedback-eyebrow {
  color: var(--coral);
}

.feedback-panel h3 {
  margin: 3px 0 4px;
  font-size: 13px;
}

.feedback-panel p {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.52;
}

.learning-note {
  display: flex;
  gap: 6px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.impact-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.impact-summary span {
  padding: 5px 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.impact-summary .positive {
  background: rgba(103, 213, 172, 0.07);
  color: var(--mint);
}

.impact-summary .negative {
  background: rgba(240, 127, 118, 0.07);
  color: var(--coral);
}

.learning-note strong {
  flex: 0 0 auto;
  color: var(--text-soft);
  text-transform: uppercase;
}

.primary-button,
.secondary-button,
.danger-button,
.text-button {
  border: 0;
  cursor: pointer;
  font-weight: 780;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid rgba(143, 182, 255, 0.22);
  border-radius: 11px;
  background: linear-gradient(135deg, #537fce, #3968b7);
  box-shadow: 0 10px 24px rgba(30, 84, 160, 0.22), inset 0 1px rgba(255, 255, 255, 0.16);
  color: white;
  font-size: 9px;
  white-space: nowrap;
  transition: 160ms ease;
}

.primary-button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.primary-button.large {
  min-height: 48px;
  padding: 0 22px;
  border-radius: 13px;
  font-size: 11px;
}

.case-timeline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-height: 46px;
  margin: 0;
  padding: 12px 0 0;
  list-style: none;
}

.case-timeline li {
  display: flex;
  align-items: center;
}

.case-timeline span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
}

.case-timeline i {
  width: 38px;
  height: 1px;
  background: var(--line-strong);
}

.case-timeline li:last-child i {
  display: none;
}

.case-timeline .is-current span {
  border-color: var(--blue);
  color: var(--blue-bright);
  box-shadow: 0 0 0 4px rgba(111, 157, 242, 0.08);
}

.case-timeline .is-done span {
  border-color: rgba(103, 213, 172, 0.25);
  background: rgba(103, 213, 172, 0.1);
  color: var(--mint);
}

.case-timeline .is-done i {
  background: rgba(103, 213, 172, 0.35);
}

.telemetry-panel {
  padding: clamp(20px, 1.9vw, 28px);
}

.telemetry-head h2 {
  margin: 4px 0 0;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.network-state {
  padding: 6px 9px;
  border: 1px solid rgba(103, 213, 172, 0.18);
  border-radius: 999px;
  background: rgba(103, 213, 172, 0.07);
  color: var(--mint);
  font-size: 8px;
  font-weight: 820;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.network-state.warn {
  border-color: rgba(240, 187, 100, 0.18);
  background: rgba(240, 187, 100, 0.06);
  color: var(--amber);
}

.network-state.bad {
  border-color: rgba(240, 127, 118, 0.18);
  background: rgba(240, 127, 118, 0.06);
  color: var(--coral);
}

.quality-overview {
  display: grid;
  grid-template-columns: 98px 1fr;
  align-items: center;
  gap: 18px;
  margin-top: 25px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.quality-ring {
  --quality: 266deg;
  position: relative;
  display: grid;
  width: 94px;
  height: 94px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--amber) var(--quality), rgba(255, 255, 255, 0.055) 0);
  box-shadow: 0 0 24px rgba(240, 187, 100, 0.08);
}

.quality-ring::before {
  position: absolute;
  width: 78px;
  height: 78px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel-solid);
  content: "";
}

.quality-ring[data-level="good"] {
  background: conic-gradient(var(--mint) var(--quality), rgba(255, 255, 255, 0.055) 0);
  box-shadow: 0 0 24px rgba(103, 213, 172, 0.1);
}

.quality-ring[data-level="bad"] {
  background: conic-gradient(var(--coral) var(--quality), rgba(255, 255, 255, 0.055) 0);
  box-shadow: 0 0 24px rgba(240, 127, 118, 0.1);
}

.quality-ring > div {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.quality-ring strong {
  font-size: 25px;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.quality-ring span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 7px;
  font-weight: 700;
  text-transform: uppercase;
}

.quality-copy {
  display: flex;
  flex-direction: column;
}

.quality-copy strong {
  margin-top: 5px;
  font-size: 15px;
}

.quality-copy p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.system-map {
  position: relative;
  min-height: 310px;
  margin-top: 16px;
}

.system-nodes {
  position: absolute;
  inset: 0;
}

.system-node {
  position: absolute;
  z-index: 2;
  display: grid;
  grid-template-columns: 8px 1fr;
  align-items: center;
  gap: 8px;
  width: 98px;
  min-height: 50px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(7, 18, 31, 0.9);
  box-shadow: 0 10px 24px rgba(0, 5, 13, 0.28);
  transition: border-color 300ms ease, transform 300ms ease;
}

.system-node[data-system="crm"] {
  top: 15px;
  left: 0;
}

.system-node[data-system="erp"] {
  top: 15px;
  right: 0;
}

.system-node[data-system="shop"] {
  right: 0;
  bottom: 28px;
}

.system-node[data-system="service"] {
  bottom: 28px;
  left: 0;
}

.system-node.is-affected {
  border-color: rgba(240, 187, 100, 0.33);
  transform: translateY(-2px);
}

.system-node.is-affected::after {
  position: absolute;
  inset: -4px;
  border: 1px solid rgba(240, 187, 100, 0.16);
  border-radius: 14px;
  content: "";
  animation: pulse 1.8s ease-out infinite;
}

.system-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px rgba(240, 187, 100, 0.5);
}

.system-node.good .system-dot {
  background: var(--mint);
  box-shadow: 0 0 8px rgba(103, 213, 172, 0.5);
}

.system-node.bad .system-dot {
  background: var(--coral);
  box-shadow: 0 0 8px rgba(240, 127, 118, 0.5);
}

.system-node > span:nth-child(2) {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.system-node strong {
  font-size: 9px;
}

.system-node small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.system-node > i {
  grid-column: 1 / -1;
  display: block;
  height: 2px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
}

.system-node > i b {
  display: block;
  width: var(--health);
  height: 100%;
  background: currentColor;
  color: var(--amber);
}

.system-delta {
  position: absolute;
  top: -9px;
  right: -7px;
  display: grid;
  min-width: 28px;
  height: 22px;
  padding: 0 6px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: var(--panel-solid);
  color: var(--mint);
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
  animation: impact-pop 500ms ease both;
}

.impact-down .system-delta { color: var(--coral); }
.impact-up { box-shadow: 0 0 20px rgba(103, 213, 172, 0.12); }
.impact-down { box-shadow: 0 0 20px rgba(240, 127, 118, 0.12); }

.system-node.good > i b {
  color: var(--mint);
}

.system-node.bad > i b {
  color: var(--coral);
}

.master-hub {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  display: grid;
  width: 78px;
  height: 78px;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(111, 157, 242, 0.3);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(111, 157, 242, 0.18), rgba(23, 45, 73, 0.92));
  box-shadow: 0 0 0 7px rgba(111, 157, 242, 0.035), 0 0 35px rgba(61, 115, 199, 0.18);
}

.master-hub svg {
  width: 29px;
  fill: none;
  stroke: var(--blue-bright);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.master-hub span {
  margin-top: -17px;
  color: var(--blue-bright);
  font-size: 7px;
  font-weight: 850;
  letter-spacing: 0.13em;
}

.network-lines {
  position: absolute;
  z-index: 1;
  inset: 42px 38px 58px;
}

.network-lines i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50%;
  height: 1px;
  transform-origin: left center;
  background: linear-gradient(90deg, rgba(111, 157, 242, 0.32), transparent);
}

.network-lines i:nth-child(1) { transform: rotate(-135deg); }
.network-lines i:nth-child(2) { transform: rotate(-45deg); }
.network-lines i:nth-child(3) { transform: rotate(45deg); }
.network-lines i:nth-child(4) { transform: rotate(135deg); }

.impact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 4px;
}

.impact-grid > div {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.impact-icon {
  display: grid;
  flex: 0 0 auto;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 8px;
}

.impact-icon.blue {
  background: rgba(111, 157, 242, 0.1);
  color: var(--blue-bright);
}

.impact-icon.mint {
  background: rgba(103, 213, 172, 0.09);
  color: var(--mint);
}

.impact-icon svg {
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.impact-grid > div > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.impact-grid small {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.impact-grid strong {
  margin-top: 2px;
  font-size: 15px;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 5px 0;
  color: rgba(127, 148, 170, 0.6);
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app-dialog {
  max-width: calc(100vw - 28px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  background: linear-gradient(145deg, #10243a, #081523 70%);
  box-shadow: 0 45px 120px rgba(0, 4, 12, 0.72);
  color: var(--text);
}

.app-dialog::backdrop {
  background: rgba(2, 7, 14, 0.78);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.intro-dialog {
  display: none;
  grid-template-columns: 0.9fr 1.1fr;
  width: min(800px, calc(100vw - 28px));
  min-height: 490px;
}

.intro-dialog[open] {
  display: grid;
  animation: dialog-in 360ms ease both;
}

.dialog-visual {
  position: relative;
  min-height: 490px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 48%, rgba(111, 157, 242, 0.2), transparent 34%),
    linear-gradient(145deg, rgba(111, 157, 242, 0.06), rgba(4, 13, 24, 0.15));
}

.dialog-visual::after {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(111, 157, 242, 0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(111, 157, 242, 0.045) 1px, transparent 1px);
  background-size: 32px 32px;
  content: "";
  mask-image: radial-gradient(circle, black, transparent 75%);
}

.dialog-core {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  display: grid;
  width: 105px;
  height: 105px;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(111, 157, 242, 0.36);
  border-radius: 34px;
  background: linear-gradient(145deg, rgba(70, 115, 190, 0.35), rgba(10, 27, 45, 0.94));
  box-shadow: 0 0 0 12px rgba(111, 157, 242, 0.035), 0 0 65px rgba(67, 120, 204, 0.3);
}

.dialog-core svg {
  width: 58px;
  fill: none;
  stroke: var(--blue-bright);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.35;
}

.orbit {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  border: 1px solid rgba(111, 157, 242, 0.13);
  border-radius: 50%;
  transform: translate(-50%, -50%) rotate(-20deg);
}

.orbit-one {
  width: 240px;
  height: 240px;
}

.orbit-two {
  width: 350px;
  height: 350px;
  transform: translate(-50%, -50%) rotate(22deg);
}

.orbit-node {
  position: absolute;
  z-index: 4;
  display: grid;
  width: 48px;
  height: 27px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: rgba(9, 24, 40, 0.92);
  color: var(--text-soft);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: 0 8px 22px rgba(0, 4, 12, 0.35);
}

.node-one { top: 26%; left: 12%; }
.node-two { top: 24%; right: 11%; }
.node-three { right: 12%; bottom: 23%; }

.dialog-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 50px;
}

.dialog-copy h2,
.compact-dialog h2,
.result-dialog h2 {
  margin: 12px 0 14px;
  font-size: clamp(30px, 4vw, 43px);
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.dialog-copy h2 em {
  color: var(--blue-bright);
  font-style: normal;
}

.dialog-copy > p,
.compact-dialog p,
.result-dialog > p {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.65;
}

.dialog-copy ul {
  display: grid;
  gap: 9px;
  margin: 23px 0 28px;
  padding: 0;
  list-style: none;
}

.dialog-copy li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 690;
}

.dialog-copy li span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--blue-bright);
  font-size: 7px;
}

.dialog-copy .primary-button {
  align-self: flex-start;
}

.dialog-copy > small {
  margin-top: 12px;
  color: var(--muted);
  font-size: 8px;
}

.compact-dialog {
  width: min(480px, calc(100vw - 28px));
  padding: 34px;
}

.compact-dialog[open],
.result-dialog[open] {
  animation: dialog-in 300ms ease both;
}

.compact-dialog form {
  position: relative;
}

.compact-dialog h2 {
  max-width: 13ch;
  font-size: 28px;
}

.dialog-close {
  position: absolute;
  top: -20px;
  right: -20px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 20px;
}

.help-list {
  display: grid;
  gap: 10px;
  margin: 23px 0;
  padding: 0;
  counter-reset: help;
  list-style: none;
}

.help-list li {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.help-list strong {
  font-size: 10px;
}

.help-list span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.help-tip {
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 9px !important;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 25px;
}

.secondary-button,
.danger-button {
  min-height: 40px;
  padding: 0 15px;
  border-radius: 10px;
  color: var(--text);
  font-size: 10px;
}

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

.danger-button {
  border: 1px solid rgba(240, 127, 118, 0.2);
  background: rgba(240, 127, 118, 0.11);
  color: #ffaaa3;
}

.result-dialog {
  width: min(560px, calc(100vw - 28px));
  padding: 44px;
  text-align: center;
}

.result-medal {
  display: grid;
  width: 74px;
  height: 74px;
  margin: 0 auto 20px;
  place-items: center;
  border: 1px solid rgba(111, 157, 242, 0.3);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(111, 157, 242, 0.18), rgba(88, 213, 223, 0.06));
  box-shadow: 0 0 0 8px rgba(111, 157, 242, 0.035), 0 18px 40px rgba(0, 5, 13, 0.28);
}

.result-medal svg {
  width: 45px;
  fill: none;
  stroke: var(--blue-bright);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.result-dialog h2 {
  max-width: none;
  font-size: 34px;
}

.result-dialog > p {
  max-width: 52ch;
  margin-inline: auto;
}

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

.result-stats > div {
  display: flex;
  flex-direction: column;
  padding: 14px 6px;
  background: rgba(8, 21, 35, 0.96);
}

.result-stats span {
  color: var(--muted);
  font-size: 8px;
  text-transform: uppercase;
}

.result-stats strong {
  margin-top: 5px;
  font-size: 17px;
}

.result-rank {
  margin: 14px 0 2px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
}

.result-dialog .primary-button {
  margin: 0 auto;
}

.text-button {
  display: block;
  margin: 14px auto 0;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.merge-dialog {
  width: min(850px, calc(100vw - 28px));
  padding: 28px;
}

.merge-dialog[open] {
  animation: dialog-in 300ms ease both;
}

.merge-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 0 2px 22px;
}

.merge-header h2 {
  margin: 4px 0 3px;
  font-size: 30px;
  letter-spacing: -0.04em;
}

.merge-header p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.dialog-close.static {
  position: static;
  flex: 0 0 auto;
}

.merge-layout {
  display: grid;
  grid-template-columns: minmax(340px, 1.18fr) minmax(220px, 0.82fr);
  gap: 22px;
}

.merge-game-area {
  min-width: 0;
}

.merge-mode-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 9px;
}

.merge-mode-switch button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 780;
}

.merge-mode-switch button.is-active {
  border-color: rgba(88, 213, 223, 0.3);
  background: rgba(88, 213, 223, 0.09);
  color: var(--cyan);
}

.merge-mode-switch button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.merge-mode-switch small {
  color: var(--amber);
  font-size: 9px;
  font-weight: 750;
}

.merge-mode-switch small[hidden] {
  display: none;
}

.merge-hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 9px;
}

.merge-hud > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 7px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.026);
}

.merge-hud span {
  color: var(--muted);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.merge-hud strong {
  color: var(--text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.merge-board-shell {
  position: relative;
  width: min(100%, 420px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(111, 157, 242, 0.18);
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 0, rgba(111, 157, 242, 0.08), transparent 55%),
    rgba(3, 11, 20, 0.76);
  box-shadow: inset 0 0 40px rgba(0, 5, 14, 0.24);
}

.merge-board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(10, 1fr);
  aspect-ratio: 6 / 8.4;
  padding: 6px;
}

.merge-cell {
  position: relative;
  min-width: 0;
  border-right: 1px solid rgba(148, 178, 210, 0.04);
  border-bottom: 1px solid rgba(148, 178, 210, 0.04);
}

.merge-tile {
  position: absolute;
  z-index: 2;
  inset: 3px;
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  --identity-accent: var(--blue-bright);
  border: 1px solid color-mix(in srgb, var(--identity-accent) 52%, var(--line));
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.035));
  color: var(--text);
  box-shadow: inset 0 3px var(--identity-accent), inset 0 1px rgba(255, 255, 255, 0.1), 0 5px 12px rgba(0, 5, 13, 0.26);
  text-align: center;
}

.merge-tile.identity-b {
  --identity-accent: #f5a39c;
}

.merge-tile.identity-c {
  --identity-accent: #85e3bf;
}

.merge-tile.is-falling {
  box-shadow: inset 0 3px var(--identity-accent), 0 0 18px color-mix(in srgb, var(--identity-accent) 30%, transparent);
}

.merge-tile.is-merging {
  border-color: var(--mint);
  animation: merge-pulse 360ms ease both;
}

.merge-tile strong {
  display: block;
  width: 100%;
  overflow: hidden;
  padding: 0 2px;
  font-size: clamp(10px, 1.05vw, 13px);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.merge-tile small {
  display: block;
  width: 100%;
  overflow: hidden;
  margin-top: 3px;
  padding: 0 2px;
  color: var(--identity-accent);
  font-size: clamp(8px, 0.78vw, 10px);
  font-weight: 800;
  letter-spacing: 0.03em;
  opacity: 0.96;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.merge-status-toast {
  position: absolute;
  z-index: 4;
  top: 10px;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 7px 10px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: rgba(4, 14, 25, 0.92);
  color: var(--blue-bright);
  font-size: 10px;
  font-weight: 780;
  text-align: center;
  transform: translateX(-50%);
  animation: reveal 180ms ease both;
}

.merge-status-toast[hidden] { display: none; }
.merge-status-toast.match { color: var(--mint); }
.merge-status-toast.different { color: var(--amber); }

.merge-overlay {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 35px;
  background: rgba(4, 14, 25, 0.86);
  text-align: center;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.merge-overlay[hidden] {
  display: none;
}

.merge-overlay > span {
  color: var(--cyan);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.merge-overlay h3 {
  margin: 8px 0 8px;
  font-size: 24px;
  letter-spacing: -0.035em;
}

.merge-overlay p {
  max-width: 38ch;
  margin: 0 0 20px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.55;
}

.merge-controls {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 8px;
  width: min(100%, 420px);
  margin: 9px auto 0;
}

.merge-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 8px;
  font-weight: 760;
}

.merge-controls button.drop {
  border-color: rgba(111, 157, 242, 0.23);
  background: rgba(111, 157, 242, 0.09);
  color: var(--blue-bright);
}

.merge-controls button:disabled {
  cursor: default;
  opacity: 0.35;
}

.merge-controls button span {
  font-size: 15px;
}

.merge-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.next-tile-card,
.merge-rule-card,
.merge-legend {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.next-tile-card {
  padding: 13px;
}

.next-tile-card > span,
.merge-legend > strong {
  display: block;
  color: var(--muted);
  font-size: 7px;
  font-weight: 820;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.merge-next-tile {
  position: relative;
  width: 74px;
  height: 57px;
  margin: 12px auto 4px;
}

.merge-next-tile .merge-tile {
  inset: 0;
}

.merge-rule-card {
  display: flex;
  gap: 11px;
  padding: 14px;
}

.merge-rule-icon {
  display: grid;
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 9px;
  background: rgba(240, 187, 100, 0.09);
  color: var(--amber);
  font-size: 15px;
  font-weight: 900;
}

.merge-rule-card strong {
  display: block;
  font-size: 11px;
  line-height: 1.35;
}

.merge-rule-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.merge-legend {
  display: grid;
  gap: 9px;
  padding: 14px;
}

.merge-legend > span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 10px;
}

.merge-legend i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--blue);
  box-shadow: 0 0 8px rgba(111, 157, 242, 0.28);
}

.merge-legend i.identity-b {
  background: var(--coral);
  box-shadow: 0 0 8px rgba(240, 127, 118, 0.25);
}

.merge-legend i.identity-c {
  background: var(--mint);
  box-shadow: 0 0 8px rgba(103, 213, 172, 0.24);
}

.merge-keyboard {
  margin: auto 0 0;
  color: var(--muted);
  font-size: 7px;
  text-align: center;
  text-transform: uppercase;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

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

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pulse {
  0% { opacity: 0.7; transform: scale(0.96); }
  70%, 100% { opacity: 0; transform: scale(1.08); }
}

@keyframes impact-pop {
  0% { opacity: 0; transform: translateY(5px) scale(0.8); }
  55% { opacity: 1; transform: translateY(-2px) scale(1.12); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes merge-pulse {
  0% { opacity: 1; transform: scale(1); }
  70% { opacity: 0.72; transform: scale(1.08); box-shadow: inset 0 3px var(--mint), 0 0 24px rgba(103, 213, 172, 0.55); }
  100% { opacity: 0; transform: scale(0.78); }
}

@media (max-width: 1180px) {
  .game-layout {
    grid-template-columns: minmax(210px, 0.72fr) minmax(480px, 1.55fr);
  }

  .telemetry-panel {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(210px, 0.7fr) minmax(330px, 1.3fr) minmax(220px, 0.7fr);
    align-items: center;
    gap: 22px;
  }

  .telemetry-head {
    display: none;
  }

  .quality-overview {
    margin: 0;
    padding: 0;
    border: 0;
  }

  .system-map {
    min-height: 250px;
    margin: 0;
  }

  .system-node[data-system="shop"],
  .system-node[data-system="service"] {
    bottom: 12px;
  }

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

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

  .topbar {
    grid-template-columns: 1fr auto;
  }

  .topbar-status {
    display: none;
  }

  .game-layout {
    display: flex;
    flex-direction: column;
  }

  .mission-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 24px;
  }

  .mission-panel h1,
  .mission-panel > p,
  .mission-kicker {
    grid-column: 1;
  }

  .mission-panel h1 {
    margin: 10px 0 0;
  }

  .progress-block,
  .objective-card {
    grid-column: 2;
  }

  .progress-block {
    grid-row: 1;
    margin: 4px 0 0;
  }

  .objective-card {
    grid-row: 2 / span 2;
    margin: 0;
  }

  .run-stats,
  .shortcut-card {
    display: none;
  }

  .telemetry-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .system-map {
    grid-row: span 2;
  }

  .intro-dialog {
    grid-template-columns: 0.75fr 1.25fr;
  }

  .dialog-copy {
    padding: 38px 32px;
  }

  .merge-layout {
    grid-template-columns: minmax(320px, 1.15fr) minmax(180px, 0.85fr);
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding: 10px 10px 12px;
  }

  .topbar {
    min-height: 54px;
    margin-bottom: 9px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

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

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

  .brand small {
    font-size: 8px;
  }

  .mission-panel {
    display: block;
    padding: 18px;
  }

  .mission-panel h1 {
    max-width: none;
    margin-top: 14px;
    font-size: 26px;
  }

  .mission-panel > p {
    margin-top: 8px;
  }

  .progress-block {
    margin-top: 18px;
  }

  .objective-card {
    display: none;
  }

  .workbench-head {
    min-height: 42px;
    padding: 5px 7px 9px;
  }

  .incident-card {
    padding: 22px 17px;
  }

  .incident-card h2 {
    font-size: 26px;
  }

  .record-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px;
  }

  .record-source,
  .record-field {
    min-width: 0;
  }

  .record-field {
    grid-column: 1;
    grid-row: 2;
    font-size: 10px;
  }

  .record-row strong {
    grid-column: 2;
    grid-row: 1;
    max-width: 175px;
  }

  .record-status {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
  }

  .choice-button {
    grid-template-columns: 20px 31px 1fr 14px;
    gap: 8px;
    padding-inline: 9px;
  }

  .choice-copy small {
    white-space: normal;
  }

  .feedback-panel {
    grid-template-columns: 32px 1fr;
  }

  .feedback-panel .primary-button {
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 4px;
  }

  .learning-note {
    display: block;
  }

  .learning-note strong {
    margin-right: 5px;
  }

  .telemetry-panel {
    display: block;
  }

  .telemetry-head {
    display: flex;
  }

  .quality-overview {
    margin-top: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
  }

  .system-map {
    min-height: 280px;
    margin-top: 12px;
  }

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

  .app-footer {
    display: none;
  }

  .intro-dialog[open] {
    display: block;
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
  }

  .dialog-visual {
    min-height: 210px;
  }

  .dialog-core {
    width: 78px;
    height: 78px;
    border-radius: 25px;
  }

  .dialog-core svg {
    width: 44px;
  }

  .orbit-one { width: 170px; height: 170px; }
  .orbit-two { width: 245px; height: 245px; }
  .node-one { top: 22%; }
  .node-two { top: 19%; }
  .node-three { bottom: 18%; }

  .dialog-copy {
    padding: 29px 24px 28px;
  }

  .dialog-copy h2 {
    font-size: 34px;
  }

  .dialog-copy ul {
    margin: 18px 0 22px;
  }

  .compact-dialog,
  .result-dialog {
    padding: 29px 22px;
  }

  .bonus-button {
    width: 38px;
    padding: 0;
    justify-content: center;
  }

  .bonus-button > span {
    display: none;
  }

  .merge-dialog {
    max-height: calc(100dvh - 18px);
    padding: 19px 14px;
    overflow-y: auto;
  }

  .merge-header {
    padding-bottom: 14px;
  }

  .merge-header h2 {
    font-size: 25px;
  }

  .merge-layout {
    display: block;
  }

  .merge-mode-switch {
    justify-content: center;
    flex-wrap: wrap;
  }

  .merge-board-shell {
    width: min(100%, 330px);
  }

  .merge-controls {
    width: min(100%, 330px);
  }

  .merge-side {
    display: grid;
    grid-template-columns: 0.75fr 1.25fr;
    width: min(100%, 330px);
    margin: 12px auto 0;
  }

  .merge-legend,
  .merge-keyboard {
    display: none;
  }
}

@media (max-width: 380px) {
  .brand small,
  .severity span,
  .workbench-head .section-kicker {
    display: none;
  }

  .incident-card {
    padding-inline: 14px;
  }

  .record-row strong {
    max-width: 145px;
  }

  .choice-number {
    display: none;
  }

  .choice-button {
    grid-template-columns: 31px 1fr 14px;
  }

  .system-node {
    width: 90px;
  }

  .result-stats strong {
    font-size: 14px;
  }
}

@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;
  }
}
