:root {
  color-scheme: light;
  --bg: #f7f8f3;
  --surface: #ffffff;
  --surface-2: #ecefe7;
  --text: #17201b;
  --muted: #5f6b62;
  --line: #d9ded4;
  --accent: #0f766e;
  --accent-2: #c2410c;
  --accent-soft: #dff3ee;
  --warn-soft: #fff1df;
  --code-bg: #111827;
  --code-text: #e5e7eb;
  --shadow: 0 18px 42px rgba(22, 32, 27, 0.09);
  --radius: 8px;
  --max: 1180px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121713;
  --surface: #1d241f;
  --surface-2: #273029;
  --text: #eff4ee;
  --muted: #adb8af;
  --line: #39433b;
  --accent: #5eead4;
  --accent-2: #fb923c;
  --accent-soft: #123b36;
  --warn-soft: #3c2a16;
  --code-bg: #090d12;
  --code-text: #e5e7eb;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: 8px;
  z-index: 20;
  transform: translateY(-140%);
  background: var(--text);
  color: var(--bg);
  padding: 8px 12px;
  border-radius: 6px;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 42px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-weight: 800;
  letter-spacing: 0;
}

.brand small,
.progress-row span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.nav {
  display: flex;
  flex: 1;
  justify-content: center;
  gap: 6px;
}

.nav a {
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.94rem;
}

.nav a:hover,
.nav a:focus-visible {
  background: var(--surface-2);
  color: var(--text);
}

.top-actions,
.hero-actions,
.dialog-actions,
.self-actions,
.module-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.icon-button,
.settings-button,
.primary-button,
.secondary-button,
.copy-button,
.module-tab,
.filter-pill {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  min-height: 40px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  padding: 0;
  font-size: 1.1rem;
}

.settings-button,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 13px;
  font-weight: 700;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

[data-theme="dark"] .primary-button {
  color: #04211e;
}

.secondary-button {
  background: var(--surface);
}

.compact {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.9rem;
}

.section,
.section-band,
.hero {
  padding: clamp(44px, 7vw, 88px) clamp(16px, 4vw, 42px);
}

.section > *,
.section-band > * {
  max-width: var(--max);
  margin-left: auto;
  margin-right: auto;
}

.section-band {
  background: var(--surface-2);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(300px, 0.96fr);
  gap: clamp(28px, 6vw, 72px);
  align-items: center;
  min-height: calc(100vh - 72px);
}

.hero > * {
  max-width: none;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  max-width: 790px;
  font-size: clamp(2.35rem, 6vw, 5.5rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(1.7rem, 3.4vw, 3rem);
  line-height: 1.06;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.16rem;
  line-height: 1.2;
}

h4 {
  margin-bottom: 8px;
  font-size: 0.98rem;
}

.lead {
  max-width: 680px;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
}

.motto {
  display: inline-block;
  margin: 16px 0 22px;
  padding: 10px 12px;
  border-left: 4px solid var(--accent-2);
  background: var(--warn-soft);
  font-weight: 800;
}

.truth-grid,
.interview-grid,
.practice-grid,
.plain-grid {
  display: grid;
  gap: 14px;
}

.truth-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 22px;
}

.truth-grid div,
.interview-card,
.practice-panel,
.plain-grid div {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.truth-grid span,
.interview-card span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.hero-art {
  position: relative;
  min-height: 460px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--accent) 18%, transparent), transparent 46%),
    linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow);
}

.matrix-panel {
  position: absolute;
  left: 10%;
  top: 12%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 62%;
}

.matrix-panel span {
  aspect-ratio: 1;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line));
  border-radius: 5px;
  background: color-mix(in srgb, var(--surface) 70%, var(--accent-soft));
}

.matrix-panel span:nth-child(3n + 1) {
  background: var(--accent);
}

.signal-line {
  position: absolute;
  left: 12%;
  right: 10%;
  bottom: 32%;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.signal-line::before,
.signal-line::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: var(--surface);
  border: 4px solid var(--accent-2);
}

.signal-line::before {
  left: 18%;
}

.signal-line::after {
  right: 20%;
  border-color: var(--accent);
}

.prompt-card {
  position: absolute;
  right: 8%;
  bottom: 9%;
  width: min(250px, 72%);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.prompt-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.section-heading {
  margin-bottom: 24px;
}

.section-heading p:not(.eyebrow) {
  max-width: 760px;
  color: var(--muted);
}

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

.interview-card {
  display: grid;
  gap: 12px;
}

.interview-card .weight {
  display: inline-flex;
  width: fit-content;
  margin: 0;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
}

.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.roadmap {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
}

.roadmap-stage {
  display: grid;
  gap: 10px;
  align-content: start;
}

.roadmap-stage h3 {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.88rem;
  text-transform: uppercase;
}

.roadmap-node {
  width: 100%;
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.roadmap-node:hover,
.roadmap-node:focus-visible,
.module-tab:hover,
.module-tab:focus-visible {
  border-color: var(--accent);
}

.roadmap-node.done {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.roadmap-node small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.module-tools {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
}

.search-box,
.field {
  display: grid;
  gap: 6px;
}

.search-box span,
.field span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 34%, transparent);
  outline-offset: 2px;
}

.filter-pills {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-pill {
  min-height: 36px;
  padding: 7px 10px;
}

.filter-pill.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}

.module-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.module-list {
  position: sticky;
  top: 88px;
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 112px);
  overflow: auto;
  padding-right: 4px;
}

.module-tab {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 72px;
  padding: 11px;
  text-align: left;
}

.module-tab.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.module-tab small {
  color: var(--muted);
}

.module-view {
  display: grid;
  gap: 16px;
}

.module-empty,
.main-line,
.self-test,
.deeper,
.resource-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.module-empty {
  padding: 24px;
  color: var(--muted);
}

.main-line {
  overflow: hidden;
}

.main-line-head {
  padding: 18px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--line);
}

.main-line-body {
  display: grid;
  gap: 16px;
  padding: 18px;
}

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

.concept-box {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 82%, var(--surface-2));
}

.concept-box p,
.question-list,
.check-list,
.resource-group ul {
  margin-bottom: 0;
}

.concept-box code,
p code,
li code {
  border-radius: 5px;
  background: var(--surface-2);
  padding: 2px 5px;
}

.code-wrap {
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid #26313c;
  background: var(--code-bg);
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid #26313c;
  color: #cbd5e1;
  font-size: 0.84rem;
}

.copy-button {
  min-height: 30px;
  padding: 4px 8px;
  border-color: #334155;
  background: #1f2937;
  color: #e5e7eb;
  font-size: 0.82rem;
}

pre {
  margin: 0;
  overflow: auto;
  padding: 14px;
  color: var(--code-text);
  font-size: 0.88rem;
  line-height: 1.55;
  tab-size: 2;
}

.kw {
  color: #93c5fd;
}

.fn {
  color: #67e8f9;
}

.str {
  color: #fbbf24;
}

.cm {
  color: #94a3b8;
}

.num {
  color: #c4b5fd;
}

.question-list {
  padding-left: 20px;
}

.self-test {
  padding: 18px;
}

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

.no-ai-badge,
.score-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--warn-soft);
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.self-test textarea {
  margin: 10px 0 12px;
}

.result,
.fallback {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.result ul,
.fallback ul {
  margin-bottom: 0;
}

.fallback-checks {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.fallback-checks label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.fallback-checks input {
  width: auto;
  margin-top: 5px;
}

details.deeper {
  overflow: hidden;
}

details.deeper summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 800;
}

details.deeper summary::after {
  content: "+";
  font-size: 1.4rem;
}

details.deeper[open] summary::after {
  content: "−";
}

.deeper-body {
  padding: 0 18px 18px;
}

.deeper-body a,
.resource-group a {
  color: var(--accent);
  font-weight: 700;
}

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

.check-list {
  padding-left: 20px;
}

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

.network-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.network-steps div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.network-steps span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
}

[data-theme="dark"] .network-steps span {
  color: #04211e;
}

.network-steps p {
  margin-bottom: 0;
}

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

.resource-group {
  padding: 18px;
}

.settings-dialog {
  width: min(560px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.settings-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.safety-note {
  padding: 12px;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  color: var(--muted);
}

.field {
  margin-bottom: 12px;
}

.dialog-actions {
  justify-content: flex-end;
}

@media (max-width: 980px) {
  .topbar {
    align-items: start;
    flex-wrap: wrap;
  }

  .nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .top-actions {
    margin-left: auto;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero-art {
    order: -1;
    min-height: 330px;
  }

  .interview-grid,
  .practice-grid,
  .plain-grid,
  .network-steps,
  .resources {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .module-shell {
    grid-template-columns: 1fr;
  }

  .module-list {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
    padding-right: 0;
  }
}

@media (max-width: 700px) {
  .brand {
    min-width: 0;
  }

  .brand small {
    display: none;
  }

  .settings-button {
    padding-left: 10px;
    padding-right: 10px;
  }

  .hero,
  .section,
  .section-band {
    padding-left: 14px;
    padding-right: 14px;
  }

  .truth-grid,
  .interview-grid,
  .practice-grid,
  .plain-grid,
  .network-steps,
  .resources,
  .concept-grid,
  .roadmap,
  .module-list,
  .module-tools {
    grid-template-columns: 1fr;
  }

  .filter-pills {
    justify-content: flex-start;
  }

  .progress-row,
  .self-head {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-art {
    min-height: 270px;
  }

  h1 {
    font-size: clamp(2.15rem, 13vw, 3.5rem);
  }
}
