:root {
  --bg: #090b10;
  --panel: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.28);
  --text: #f7f3ea;
  --muted: #b8bdc8;
  --muted-2: #838b9b;
  --cyan: #68e1fd;
  --gold: #f7c75c;
  --coral: #ff7e67;
  --green: #76e0a6;
  --danger: #ff5f7a;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --radius: 8px;
  --max: 1220px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(120deg, rgba(104, 225, 253, 0.08), transparent 24%),
    linear-gradient(245deg, rgba(247, 199, 92, 0.08), transparent 26%),
    linear-gradient(180deg, #080a0e, #111621 46%, #07090d);
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
}

button {
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.app-shell {
  width: min(var(--max), calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 0;
  text-align: left;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.05rem;
}

.brand small {
  color: var(--muted);
  margin-top: 2px;
  font-size: 0.82rem;
}

.logo {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(247, 199, 92, 0.55);
  background: linear-gradient(135deg, rgba(247, 199, 92, 0.95), rgba(104, 225, 253, 0.88));
  color: #101014;
  font-weight: 950;
  border-radius: var(--radius);
  box-shadow: 0 16px 38px rgba(247, 199, 92, 0.18);
}

.top-actions,
.hero-actions,
.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn,
.pill {
  min-height: 40px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  padding: 9px 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  text-decoration: none;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.pill {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.11);
}

.btn.primary {
  border-color: transparent;
  color: #0d1116;
  background: linear-gradient(135deg, var(--gold), var(--cyan));
  font-weight: 850;
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  color: #ffd7df;
  border-color: rgba(255, 95, 122, 0.45);
}

.btn:focus-visible,
.brand:focus-visible,
.mission-node:focus-visible,
.option:focus-visible,
.drill-card:focus-visible {
  outline: 3px solid rgba(104, 225, 253, 0.46);
  outline-offset: 2px;
}

.command-center {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
}

.hero-panel,
.hud-panel,
.panel,
.question-panel,
.mission-sidebar,
.result-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.045));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-panel {
  position: relative;
  min-height: 350px;
  padding: 34px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(104, 225, 253, 0.14), transparent 42%),
    linear-gradient(290deg, rgba(255, 126, 103, 0.16), transparent 36%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 88px);
  mask-image: linear-gradient(90deg, black, transparent 86%);
  pointer-events: none;
}

.hero-panel > * {
  position: relative;
  z-index: 1;
}

.kicker,
.label {
  color: var(--gold);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.13em;
  font-weight: 850;
}

.hero-panel h1 {
  max-width: 820px;
  margin: 10px 0 16px;
  font-size: clamp(2rem, 6vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.hero-panel p {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.56;
  margin: 0 0 24px;
  font-size: 1.03rem;
}

.hud-panel {
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.hud-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  padding: 15px;
  border-radius: var(--radius);
  min-height: 120px;
}

.hud-card.wide {
  grid-column: 1 / -1;
}

.hud-card strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
  margin: 8px 0 6px;
}

.hud-card small {
  color: var(--muted-2);
}

.progress-bar {
  height: 10px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 12px;
}

.progress-bar span {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  background: linear-gradient(90deg, var(--green), var(--gold), var(--cyan));
  border-radius: inherit;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin: 28px 0 12px;
}

.section-title.compact {
  margin: 0 0 14px;
}

.section-title h2 {
  margin: 0;
  font-size: 1.2rem;
}

.section-title p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.campaign-map {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025)),
    linear-gradient(90deg, rgba(104, 225, 253, 0.08), transparent 28%, rgba(247, 199, 92, 0.08) 72%, transparent);
  overflow: hidden;
}

.campaign-map::before {
  content: "";
  position: absolute;
  left: 7%;
  right: 7%;
  top: 50%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(247, 199, 92, 0.58), rgba(104, 225, 253, 0.5), transparent);
  transform: translateY(-50%);
}

.mission-node {
  position: relative;
  z-index: 1;
  min-height: 250px;
  text-align: left;
  border: 1px solid var(--line);
  color: var(--text);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.055));
  border-radius: var(--radius);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: 160ms ease;
  transform: translateY(calc(var(--tilt) * 10px));
}

.mission-node:hover:not(:disabled) {
  transform: translateY(calc(var(--tilt) * 10px - 4px));
  border-color: rgba(247, 199, 92, 0.62);
  background: linear-gradient(180deg, rgba(247, 199, 92, 0.12), rgba(255, 255, 255, 0.065));
}

.mission-node.locked {
  opacity: 0.48;
  filter: grayscale(0.55);
}

.mission-node.completed {
  border-color: rgba(118, 224, 166, 0.58);
}

.node-act {
  color: var(--muted-2);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.node-mark,
.mission-emblem {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  border: 1px solid rgba(104, 225, 253, 0.35);
  background: rgba(104, 225, 253, 0.08);
  color: var(--cyan);
  font-weight: 950;
}

.mission-node strong {
  font-size: 1rem;
}

.mission-node small {
  color: var(--muted);
  line-height: 1.42;
}

.node-meta {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.node-meta span {
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 0.72rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(350px, 0.58fr);
  gap: 16px;
  margin-top: 16px;
}

.panel {
  padding: 18px;
}

.skill-grid,
.badge-grid {
  display: grid;
  gap: 10px;
}

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

.skill-card,
.achievement,
.timeline-item,
.danger-box,
.run-stats > div,
.slot,
.drill-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
}

.skill-card {
  padding: 13px;
}

.skill-card > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.skill-card span {
  color: var(--gold);
}

.skill-card p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 8px 0 0;
}

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

.achievement {
  padding: 13px;
  min-height: 116px;
  opacity: 0.64;
}

.achievement.unlocked {
  opacity: 1;
  border-color: rgba(118, 224, 166, 0.48);
  background: rgba(118, 224, 166, 0.07);
}

.achievement span {
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 850;
}

.achievement strong,
.achievement small {
  display: block;
}

.achievement strong {
  margin: 8px 0 5px;
}

.achievement small {
  color: var(--muted);
  line-height: 1.42;
}

.history-panel {
  margin-top: 16px;
}

.empty {
  color: var(--muted);
  margin: 0;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  padding: 13px;
}

.timeline-item strong,
.timeline-item span {
  display: block;
}

.timeline-item span {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 4px;
  line-height: 1.45;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.34fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.mission-sidebar {
  position: sticky;
  top: 16px;
  padding: 18px;
}

.mission-sidebar h1 {
  margin: 12px 0 8px;
  font-size: 1.65rem;
  line-height: 1.05;
}

.mission-sidebar p {
  color: var(--muted);
  line-height: 1.48;
}

.danger-box {
  padding: 13px;
  border-color: rgba(255, 126, 103, 0.35);
  background: rgba(255, 126, 103, 0.07);
}

.danger-box strong,
.danger-box span {
  display: block;
}

.danger-box span {
  color: var(--muted);
  margin-top: 4px;
}

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

.run-stats > div {
  padding: 10px;
}

.run-stats span,
.question-top span {
  color: var(--muted);
  font-size: 0.78rem;
}

.run-stats strong {
  display: block;
  margin-top: 4px;
}

.reward-list {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.reward-list span {
  color: var(--muted);
  border-left: 3px solid var(--gold);
  padding-left: 9px;
  font-size: 0.9rem;
}

.wide-button {
  width: 100%;
}

.question-panel {
  padding: 22px;
}

.question-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.prompt {
  border: 1px solid var(--line);
  background: linear-gradient(120deg, rgba(104, 225, 253, 0.1), transparent 46%), rgba(255, 255, 255, 0.055);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
}

.prompt span {
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  font-weight: 850;
}

.prompt h2 {
  margin: 9px 0 10px;
  font-size: clamp(1.4rem, 3vw, 2.35rem);
  line-height: 1.08;
}

.prompt p {
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

.options {
  display: grid;
  gap: 10px;
}

.option {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  text-align: left;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  padding: 13px;
  transition: 130ms ease;
}

.option:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.095);
}

.option-rank {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--gold);
  font-weight: 850;
}

.option-content strong,
.option-content small {
  display: block;
}

.option-content small {
  color: var(--muted);
  line-height: 1.42;
  margin-top: 4px;
}

.score-chip {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 9px;
  color: var(--text);
}

.option.selected.good {
  border-color: rgba(118, 224, 166, 0.72);
  background: rgba(118, 224, 166, 0.09);
}

.option.selected.partial {
  border-color: rgba(247, 199, 92, 0.68);
  background: rgba(247, 199, 92, 0.08);
}

.option.selected.bad {
  border-color: rgba(255, 95, 122, 0.68);
  background: rgba(255, 95, 122, 0.08);
}

.builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
}

.builder-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.builder-head h3 {
  margin: 0;
  font-size: 1rem;
}

.builder-head span {
  color: var(--muted-2);
  font-size: 0.82rem;
}

.card-bank,
.speech-slots {
  display: grid;
  gap: 9px;
}

.analysis-lab {
  display: grid;
  gap: 14px;
}

.text-case,
.model-analysis {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
  padding: 16px;
}

.case-head {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.case-head strong,
.model-analysis strong {
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.76rem;
}

.case-head span {
  color: var(--muted-2);
  font-size: 0.84rem;
  line-height: 1.45;
}

.text-case p,
.model-analysis p {
  color: var(--text);
  line-height: 1.75;
  margin: 0;
  font-size: 1rem;
}

.analysis-axes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.analysis-axes span {
  border: 1px solid rgba(104, 225, 253, 0.34);
  background: rgba(104, 225, 253, 0.07);
  color: var(--cyan);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
}

.drill-card {
  color: var(--text);
  text-align: left;
  padding: 12px;
}

.analysis-card strong {
  color: var(--gold);
}

.drill-card:hover:not(:disabled) {
  border-color: rgba(104, 225, 253, 0.5);
}

.drill-card strong,
.drill-card span,
.slot strong,
.slot span,
.slot small {
  display: block;
}

.drill-card strong {
  color: var(--cyan);
  margin-bottom: 5px;
}

.drill-card span,
.slot span,
.slot small {
  color: var(--muted);
  line-height: 1.42;
}

.slot {
  min-height: 84px;
  padding: 12px;
  border-style: dashed;
}

.slot.filled {
  border-style: solid;
  border-color: rgba(104, 225, 253, 0.42);
  background: rgba(104, 225, 253, 0.07);
}

.slot strong {
  margin-bottom: 5px;
}

.slot small {
  color: var(--gold);
  margin-top: 6px;
}

.feedback {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(255, 255, 255, 0.06);
}

.feedback.good {
  border-color: rgba(118, 224, 166, 0.55);
}

.feedback.partial {
  border-color: rgba(247, 199, 92, 0.55);
}

.feedback.bad {
  border-color: rgba(255, 95, 122, 0.55);
}

.feedback > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.feedback span {
  color: var(--gold);
}

.feedback p {
  color: var(--muted);
  margin: 8px 0 0;
  line-height: 1.55;
}

.action-row {
  justify-content: space-between;
  margin-top: 15px;
}

.result-screen {
  min-height: 70vh;
  display: grid;
  place-items: center;
}

.result-card {
  width: min(860px, 100%);
  padding: 28px;
}

.result-card h1 {
  font-size: clamp(2rem, 5vw, 4.6rem);
  line-height: 0.98;
  margin: 12px 0 0;
}

.result-score {
  color: transparent;
  background: linear-gradient(135deg, var(--gold), var(--green), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  font-weight: 950;
  font-size: clamp(4rem, 14vw, 9rem);
  line-height: 0.92;
  margin: 16px 0 8px;
}

.result-card p {
  color: var(--muted);
  line-height: 1.55;
}

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

.result-grid div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
  background: rgba(255, 255, 255, 0.055);
}

.result-grid span,
.result-grid strong {
  display: block;
}

.result-grid span {
  color: var(--muted);
  font-size: 0.82rem;
}

.result-grid strong {
  margin-top: 6px;
  font-size: 1.5rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 7, 12, 0.76);
}

.modal {
  width: min(720px, 100%);
  max-height: min(84vh, 760px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(29, 35, 47, 0.98), rgba(10, 13, 18, 0.98));
  box-shadow: var(--shadow);
  padding: 22px;
}

.modal h2 {
  margin: 0 0 10px;
}

.modal p,
.modal li {
  color: var(--muted);
  line-height: 1.58;
}

.footer {
  color: var(--muted-2);
  margin-top: 24px;
  font-size: 0.82rem;
}

.noscript {
  max-width: 720px;
  margin: 60px auto;
  padding: 24px;
}

@media (max-width: 1100px) {
  .campaign-map {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .campaign-map::before {
    display: none;
  }

  .mission-node {
    transform: none;
    min-height: 220px;
  }

  .mission-node:hover:not(:disabled) {
    transform: translateY(-3px);
  }
}

@media (max-width: 900px) {
  .command-center,
  .dashboard-grid,
  .game-layout,
  .builder-grid {
    grid-template-columns: 1fr;
  }

  .mission-sidebar {
    position: static;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 20px, var(--max));
    padding-top: 12px;
  }

  .topbar,
  .section-title,
  .question-top {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .hero-actions,
  .action-row {
    width: 100%;
  }

  .btn {
    flex: 1;
  }

  .hero-panel,
  .question-panel,
  .mission-sidebar,
  .result-card,
  .modal {
    padding: 18px;
  }

  .hud-panel,
  .skill-grid,
  .badge-grid,
  .campaign-map,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .mission-node {
    min-height: unset;
  }

  .option {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .score-chip {
    grid-column: 2;
    width: max-content;
  }
}
