:root {
  --ink: #18304a;
  --soft-ink: #45627d;
  --bg: linear-gradient(180deg, #fff8e8 0%, #eef7ff 58%, #effcf3 100%);
  --panel: rgba(255, 255, 255, 0.96);
  --line: rgba(24, 48, 74, 0.14);
  --shadow: 0 18px 42px rgba(24, 48, 74, 0.12);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

button,
a {
  font: inherit;
}

.page-shell {
  width: min(1380px, calc(100% - 28px));
  margin: 0 auto;
  padding: 16px 0 24px;
}

.app-shell {
  min-height: 100vh;
}

.site-header,
.panel,
.subject-card,
.teach-card,
.lesson-link,
.subject-button,
.visual-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: 1.45rem;
}

.brand-note {
  margin: 6px 0 0;
  color: var(--soft-ink);
  max-width: 560px;
}

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

.nav-link,
.primary-btn,
.ghost-btn {
  text-decoration: none;
  border-radius: 999px;
  padding: 11px 16px;
  font-weight: 700;
}

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

.nav-link.active {
  background: linear-gradient(180deg, #fff3cf, #ffffff);
  border-color: #d97706;
}

.learn-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
  min-height: calc(100vh - 110px);
}

.panel {
  border-radius: var(--radius);
}

.sidebar,
.content-panel {
  padding: 18px;
}

.sidebar {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
}

.sidebar-block {
  display: grid;
  gap: 12px;
  min-height: 0;
}

.sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 10px;
}

.section-kicker,
.card-kicker {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 800;
  color: #c96a12;
}

.sidebar-title,
.lesson-title,
.page-title,
.subject-card h2,
.subject-card h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

.sidebar-title {
  font-size: 1.2rem;
}

.tiny-progress {
  min-width: 58px;
  text-align: center;
  padding: 8px 10px;
  border-radius: 999px;
  background: #fff1cf;
  border: 1px solid #f0c374;
  font-weight: 800;
}

.subject-nav,
.lesson-nav {
  display: grid;
  gap: 10px;
  min-height: 0;
}

.lesson-nav {
  overflow: auto;
  padding-right: 4px;
}

.subject-button,
.lesson-link {
  width: 100%;
  text-align: left;
  border-radius: 18px;
  padding: 12px;
  cursor: pointer;
  color: var(--ink);
}

.subject-button {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  align-items: center;
}

.subject-button.active,
.lesson-link.active {
  border-color: #d97706;
  background: linear-gradient(180deg, #fff4d4, #ffffff);
  box-shadow: 0 16px 30px rgba(217, 119, 6, 0.2);
}

.subject-badge,
.mascot-face {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  border-radius: 16px;
  background: var(--accent, #2563eb);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(24, 48, 74, 0.18);
}

.big-badge {
  min-width: 62px;
  min-height: 62px;
  border-radius: 18px;
}

.subject-copy,
.lesson-link {
  display: grid;
  gap: 4px;
}

.subject-copy small,
.lesson-link small,
.brand-note,
.subject-summary,
.hero-text,
.lesson-intro,
.mascot-note p {
  color: var(--soft-ink);
}

.lesson-number {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7a8ea4;
}

.content-panel {
  overflow: auto;
}

.lesson-content {
  display: grid;
  gap: 16px;
}

.lesson-hero,
.visual-panel,
.lesson-actions,
.teach-card,
.subject-card {
  border-radius: 22px;
}

.lesson-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 18px;
  padding: 20px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 14%, white), #ffffff);
  border: 1px solid var(--line);
}

.lesson-title {
  font-size: clamp(2rem, 4vw, 3rem);
}

.lesson-intro {
  margin: 14px 0 0;
  font-size: 1.05rem;
  line-height: 1.7;
}

.mascot-note {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(24, 48, 74, 0.08);
}

.visual-panel {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 18px;
  padding: 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 12%, white), #ffffff);
}

.visual-panel h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

.visual-stage {
  min-height: 190px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  border: 1px solid rgba(24, 48, 74, 0.08);
  padding: 14px;
}

.visual-stage svg {
  width: 100%;
  max-width: 360px;
  height: auto;
}

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

.teach-card {
  padding: 18px;
}

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

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

.point-item {
  padding: 12px 14px;
  border-radius: 16px;
  background: #fff8ea;
  border: 1px solid #f0dfb7;
  line-height: 1.6;
}

.ask-card strong {
  display: block;
  margin-bottom: 10px;
}

.lesson-actions {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  background: linear-gradient(180deg, #fff7e7, #ffffff);
  border: 1px solid var(--line);
}

.primary-btn,
.ghost-btn {
  border: none;
  cursor: pointer;
}

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, #fb923c, #f97316);
}

.ghost-btn {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.ghost-btn[disabled],
.primary-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.subject-page {
  display: grid;
  gap: 16px;
}

.compact-intro {
  padding: 20px;
}

.small-title {
  font-size: clamp(2rem, 4vw, 2.8rem);
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.subject-card {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.subject-top-row {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 14px;
  align-items: start;
}

.subject-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: #fff3cf;
  border: 1px solid #f3d28a;
  font-size: 0.88rem;
}

.error-state {
  width: min(720px, calc(100% - 32px));
  margin: 80px auto;
  padding: 28px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(217, 119, 6, 0.35);
  outline-offset: 2px;
}

@media (max-width: 1080px) {
  .learn-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    grid-template-rows: auto auto;
  }

  .lesson-nav {
    max-height: 320px;
  }
}

@media (max-width: 760px) {
  .site-header,
  .lesson-hero,
  .visual-panel,
  .lesson-actions {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .site-header {
    align-items: start;
  }

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

  .page-shell {
    width: min(100% - 16px, 1380px);
  }
}