:root {
  --ink: #161721;
  --muted: #687084;
  --line: #d8deea;
  --paper: #f8fafc;
  --panel: #ffffff;
  --teal: #18a39a;
  --teal-dark: #0e6f6a;
  --coral: #ef5b51;
  --yellow: #f5bf3d;
  --green: #2f9d68;
  --blue: #406dd8;
  --violet: #7859cf;
  --shadow: 0 18px 48px rgba(31, 36, 56, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: linear-gradient(135deg, #eef6f5 0%, #f8fafc 42%, #fff6de 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  background: #11131b;
  color: #f8fafc;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #202432;
  color: var(--yellow);
  font-weight: 900;
}

.brand h1,
.brand p,
.side-panel h2,
.section-heading h2,
.topbar h2,
.hero-copy h2 {
  margin: 0;
}

.brand h1 {
  font-size: 1.24rem;
}

.brand p {
  margin-top: 3px;
  color: #acb4c6;
  font-size: 0.9rem;
}

.os-tabs {
  display: grid;
  gap: 10px;
}

.os-tab {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #f8fafc;
  text-align: left;
}

.os-tab:hover,
.os-tab:focus-visible {
  border-color: rgba(255, 255, 255, 0.4);
  outline: none;
}

.os-tab.is-active {
  background: #f8fafc;
  color: #151923;
}

.os-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.os-dot-mac {
  background: var(--coral);
}

.os-dot-windows {
  background: var(--blue);
}

.os-dot-linux {
  background: var(--yellow);
}

.side-panel {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.side-panel h2 {
  font-size: 0.9rem;
  color: #dfe5f1;
}

.stat-stack {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-block: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #acb4c6;
}

.stat-row:last-child {
  border-bottom: 0;
}

.stat-row strong {
  color: #ffffff;
}

.panel-heading,
.section-heading,
.topbar,
.mission-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-heading span,
.section-heading span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.side-panel .panel-heading span {
  color: #ffffff;
}

.mini-meter,
.track-meter {
  overflow: hidden;
  height: 10px;
  margin-top: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.track-meter {
  max-width: 420px;
  background: #dde5ed;
}

.mini-meter span,
.track-meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--yellow), var(--coral));
  transition: width 240ms ease;
}

.daily-copy {
  margin: 12px 0 0;
  color: #acb4c6;
  font-size: 0.9rem;
}

.main-content {
  min-width: 0;
  padding: 24px;
}

.topbar {
  margin-bottom: 18px;
}

.topbar h2 {
  font-size: 1.45rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  gap: 10px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(31, 36, 56, 0.08);
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--ink);
  outline: none;
}

.hero-band {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  align-items: stretch;
  gap: 20px;
  min-height: 250px;
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.hero-copy {
  align-self: center;
  padding: 30px;
}

.level-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin-bottom: 12px;
  padding: 0 10px;
  border-radius: 8px;
  background: #fff1bd;
  color: #765400;
  font-size: 0.82rem;
  font-weight: 900;
}

.hero-copy h2 {
  max-width: 14ch;
  font-size: 2.35rem;
  line-height: 1.05;
}

.hero-copy p {
  max-width: 50ch;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.hero-copy .hero-promise {
  color: #2c3344;
  font-weight: 800;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-band img {
  width: 100%;
  height: 100%;
  min-height: 250px;
  object-fit: cover;
  object-position: center;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(258px, 0.95fr) minmax(400px, 1.35fr) minmax(218px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.path-panel,
.lesson-panel,
.reference-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 32px rgba(31, 36, 56, 0.08);
}

.path-panel,
.reference-panel {
  padding: 18px;
}

.lesson-panel {
  padding: 20px;
}

.section-heading {
  min-height: 38px;
  margin-bottom: 16px;
}

.section-heading h2 {
  font-size: 1rem;
}

.lesson-path {
  display: grid;
  gap: 10px;
}

.lesson-node {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 66px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.lesson-node:hover,
.lesson-node:focus-visible {
  border-color: var(--teal);
  outline: none;
}

.lesson-node.is-current {
  border-color: var(--teal);
  box-shadow: inset 4px 0 0 var(--teal);
}

.lesson-node.is-complete {
  border-color: #bfe7d2;
  background: #f1fff7;
}

.lesson-node.is-locked {
  cursor: not-allowed;
  opacity: 0.52;
}

.node-badge {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #11131b;
  color: #ffffff;
  font-weight: 900;
}

.lesson-node.is-complete .node-badge {
  background: var(--green);
}

.node-title {
  display: block;
  overflow-wrap: normal;
  word-break: normal;
  font-weight: 900;
}

.node-subtitle {
  display: -webkit-box;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.node-state {
  color: var(--muted);
  font-weight: 900;
  min-width: 38px;
  text-align: right;
}

.combo-badge {
  flex: 0 0 auto;
  padding: 7px 9px;
  border-radius: 8px;
  background: #f1f5ff;
  color: var(--blue);
  font-size: 0.84rem;
  font-weight: 900;
}

.mission-block {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.mission-task {
  margin: 0 0 16px;
  color: #2c3344;
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.45;
}

.answer-zone {
  display: grid;
  gap: 10px;
}

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

.choice-button {
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  text-align: left;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.choice-button:hover,
.choice-button:focus-visible {
  border-color: var(--teal);
  outline: none;
}

.choice-button.is-correct {
  border-color: var(--green);
  background: #ecfff4;
}

.choice-button.is-wrong {
  border-color: var(--coral);
  background: #fff1ef;
}

.command-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.command-input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-weight: 800;
}

.command-input:focus {
  border-color: var(--teal);
  outline: none;
  box-shadow: 0 0 0 4px rgba(24, 163, 154, 0.12);
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 900;
}

.primary-button {
  border: 1px solid #0d6f69;
  background: var(--teal);
  color: #ffffff;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.primary-button:hover,
.primary-button:focus-visible,
.secondary-button:hover,
.secondary-button:focus-visible {
  filter: brightness(0.98);
  outline: none;
}

.feedback {
  min-height: 38px;
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.4;
}

.feedback.is-good {
  color: var(--green);
  font-weight: 900;
}

.feedback.is-bad {
  color: var(--coral);
  font-weight: 900;
}

.mission-actions {
  margin-top: 8px;
}

.terminal {
  overflow: hidden;
  margin-top: 16px;
  border: 1px solid #222638;
  border-radius: 8px;
  background: #10131c;
}

.terminal-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  background: #202432;
}

.terminal-bar span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.terminal-bar span:nth-child(1) {
  background: var(--coral);
}

.terminal-bar span:nth-child(2) {
  background: var(--yellow);
}

.terminal-bar span:nth-child(3) {
  background: var(--green);
}

.terminal pre {
  min-height: 184px;
  max-height: 260px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  color: #d9f7e8;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.command-list {
  display: grid;
  gap: 10px;
}

.command-item {
  display: grid;
  gap: 4px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.command-item code {
  color: var(--teal-dark);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-weight: 900;
}

.command-item span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 44px));
  padding: 13px 14px;
  border-radius: 8px;
  background: #11131b;
  color: #ffffff;
  font-weight: 800;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: grid;
    grid-template-columns: 1fr 1.2fr 0.8fr 0.8fr;
    align-items: start;
  }

  .workspace-grid {
    grid-template-columns: minmax(260px, 0.82fr) minmax(420px, 1.2fr);
  }

  .reference-panel {
    grid-column: 1 / -1;
  }

  .command-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .main-content,
  .sidebar {
    padding: 16px;
  }

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

  .os-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .os-tab {
    grid-template-columns: 12px minmax(0, 1fr);
  }

  .os-tab strong {
    grid-column: 2;
  }

  .hero-band,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy h2 {
    font-size: 1.9rem;
  }

  .hero-band img {
    max-height: 260px;
  }

  .choice-grid,
  .command-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
  }

  .icon-button {
    flex: 1 1 0;
  }

  .command-form {
    grid-template-columns: 1fr;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .mission-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
