:root {
  --paper: #fbf7ef;
  --panel: #fffdf8;
  --ink: #1f211d;
  --muted: #6d6a60;
  --line: #ded4c4;
  --green: #2c5f50;
  --green-2: #dbe8dc;
  --rust: #a45131;
  --gold: #d4a83f;
  --charcoal: #202722;
  --shadow: 0 18px 45px rgba(37, 31, 22, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(44, 95, 80, 0.08) 0, transparent 34%),
    var(--paper);
}

body.landing-active {
  overflow: hidden;
  background: var(--paper);
}

body.landing-active .shell {
  display: none;
}

body:not(.landing-active) .landing-gate {
  display: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: inherit;
}

.landing-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background: var(--paper);
}

.landing-emblem {
  display: grid;
  place-items: center;
  width: min(54vw, 440px);
  min-width: 220px;
  aspect-ratio: 1;
  text-decoration: none;
}

.landing-emblem img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.landing-emblem:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 18px;
  border-radius: 50%;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #1f2823;
  color: #f7f0e4;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  align-items: center;
  text-decoration: none;
}

.brand img {
  width: 52px;
  height: 45px;
  object-fit: contain;
  background: #fff8e8;
  border-radius: 6px;
  padding: 6px;
}

.brand strong {
  display: block;
  font-size: 18px;
  letter-spacing: 0.01em;
}

.brand small,
.sidebar-panel span {
  color: #cfc7ba;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav a {
  text-decoration: none;
  color: #eee6da;
  padding: 11px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
}

.nav a.active,
.nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.sidebar-panel {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-panel strong {
  display: block;
  margin: 8px 0 5px;
  font-size: 22px;
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 22px clamp(18px, 4vw, 46px);
  border-bottom: 1px solid rgba(31, 33, 29, 0.08);
  background: rgba(251, 247, 239, 0.9);
  backdrop-filter: blur(14px);
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: clamp(26px, 4vw, 44px);
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
  color: var(--rust);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

button,
.button-link {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffaf1;
  color: var(--ink);
  cursor: pointer;
  min-height: 40px;
  padding: 9px 13px;
  text-decoration: none;
}

button:hover,
.button-link:hover {
  border-color: #bda98d;
}

.primary-button {
  color: white;
  background: var(--green);
  border-color: var(--green);
}

.danger-button {
  color: white;
  background: var(--rust);
  border-color: var(--rust);
}

.view {
  padding: 28px clamp(18px, 4vw, 46px) 64px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 22px;
}

.hero-panel,
.module-card,
.lesson-card,
.chapter-card,
.practice-card,
.plan-card,
.reader-panel,
.metric-card,
.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: clamp(22px, 4vw, 38px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 24px;
  align-items: center;
}

.hero-panel h2 {
  margin: 10px 0;
  max-width: 780px;
  font-size: clamp(32px, 6vw, 68px);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-panel p {
  max-width: 640px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.hero-panel img {
  width: 140px;
  max-width: 100%;
  height: auto;
}

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

.metric-card {
  padding: 16px;
  box-shadow: none;
}

.metric-card strong {
  display: block;
  font-size: 28px;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin: 32px 0 14px;
}

.section-title h2 {
  margin: 0;
  font-size: 26px;
}

.module-grid,
.chapter-grid,
.lesson-grid,
.movement-grid,
.badge-grid,
.playbook {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.module-card,
.chapter-card,
.lesson-card,
.practice-card,
.plan-card,
.movement-card,
.badge-card,
.play-card {
  padding: 18px;
}

.module-card h3,
.chapter-card h3,
.lesson-card h3,
.practice-card h3,
.plan-card h3,
.movement-card h3,
.badge-card h3,
.play-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.module-card p,
.chapter-card p,
.lesson-card p,
.practice-card p,
.plan-card p,
.movement-card p,
.badge-card p,
.play-card p {
  color: var(--muted);
  line-height: 1.55;
}

.movement-card,
.badge-card,
.play-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.movement-card ul {
  margin: 14px 0 0;
  padding-left: 18px;
  color: #3f3b33;
  line-height: 1.55;
}

.movement-card li + li {
  margin-top: 6px;
}

.movement-hero {
  margin-bottom: 30px;
}

.badge-card {
  box-shadow: none;
  background: #f7efe1;
}

.badge-card.earned {
  border-color: rgba(44, 95, 80, 0.45);
  background: var(--green-2);
}

.badge-card span {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #fff;
  background: var(--charcoal);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.badge-card.earned span {
  background: var(--green);
}

.card-actions,
.audio-controls,
.plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  margin-top: 16px;
}

.progress-bar {
  width: 100%;
  height: 9px;
  overflow: hidden;
  border-radius: 99px;
  background: #e9dfcf;
}

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

.reader-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 18px;
  min-height: calc(100vh - 166px);
}

.chapter-list {
  position: sticky;
  top: 116px;
  align-self: start;
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 138px);
  overflow: auto;
  padding-right: 4px;
}

.chapter-list button {
  text-align: left;
  background: #fffdf8;
}

.chapter-list button.active {
  color: white;
  background: var(--green);
  border-color: var(--green);
}

.reader-panel {
  overflow: hidden;
}

.reader-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.reader-header h2 {
  margin: 0;
}

.reader-frame {
  width: 100%;
  min-height: 720px;
  border: 0;
  background: white;
}

.question-list {
  display: grid;
  gap: 14px;
}

.question-list label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fffdf8;
}

textarea {
  resize: vertical;
  min-height: 104px;
}

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

.plan-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fffaf2;
  margin-top: 10px;
}

.plan-item strong {
  display: block;
}

.plan-item span {
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  padding: 30px;
  text-align: center;
}

@media (max-width: 980px) {
  .shell,
  .dashboard-grid,
  .reader-layout,
  .plan-board {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .nav a {
    text-align: center;
    padding: 10px 6px;
    font-size: 13px;
  }

  .chapter-list {
    position: static;
    max-height: none;
  }
}

@media (max-width: 640px) {
  .topbar,
  .hero-panel,
  .reader-header {
    display: block;
  }

  .top-actions,
  .audio-controls,
  .card-actions,
  .plan-actions {
    margin-top: 14px;
  }

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

  .metric-row {
    grid-template-columns: 1fr;
  }

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

@media print {
  .sidebar,
  .topbar,
  .card-actions,
  .audio-controls,
  .chapter-list {
    display: none;
  }

  .shell,
  .reader-layout,
  .dashboard-grid,
  .plan-board {
    display: block;
  }

  body {
    background: white;
  }

  .view {
    padding: 0;
  }
}
