.encyclopedia-body { min-height: 100vh; }

/* Interview-room unseen-material panel is viewport-tall and sticky.
   Encyclopedia pages must never inherit that overlay. */
.encyclopedia-body .stimulus-workbench {
  position: static !important;
  top: auto !important;
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  overflow: visible !important;
}

.encyclopedia-shell {
  display: grid;
  grid-template-columns: minmax(220px, 268px) minmax(0, 1fr);
  min-height: calc(100vh - 76px);
  align-items: start;
}

.encyclopedia-nav {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 76px);
  max-height: calc(100vh - 76px);
  padding: 22px 16px 28px;
  overflow: auto;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(18, 59, 52, 0.04), transparent 7rem),
    rgba(251, 250, 245, 0.94);
}

.encyclopedia-header-tools {
  display: inline-flex;
  justify-self: end;
  align-items: center;
  gap: 10px;
}

.encyclopedia-menu-button,
.encyclopedia-nav-backdrop,
.encyclopedia-nav-close {
  display: none;
}

.encyclopedia-nav__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
}

.encyclopedia-nav .section-kicker {
  margin: 0 0 6px;
}

.encyclopedia-nav__summary {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.encyclopedia-nav__home,
.encyclopedia-nav__studio {
  display: grid;
  gap: 2px;
  margin: 0 0 16px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--forest);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.encyclopedia-nav__home strong,
.encyclopedia-nav__studio {
  font-size: 13px;
  font-weight: 800;
}

.encyclopedia-nav__home small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.encyclopedia-nav__home.is-active,
.encyclopedia-nav__home:hover,
.subject-nav a.is-active,
.subject-nav a:hover {
  border-color: rgba(20, 123, 108, 0.28);
  background: var(--teal-soft);
  color: var(--forest);
}

.encyclopedia-nav__studio {
  margin: auto 0 0;
  background: var(--forest);
  color: white;
  text-align: center;
}

.encyclopedia-nav__studio:hover {
  background: var(--forest-deep);
}

.encyclopedia-nav__label {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.subject-nav {
  display: grid;
  gap: 14px;
}

.nav-family__label {
  margin: 0 0 6px;
  padding-left: 8px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.subject-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px 7px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.35;
  text-decoration: none;
}

.subject-nav__name { min-width: 0; }
.subject-nav__count {
  flex: 0 0 auto;
  padding: 1px 7px;
  border-radius: 99px;
  background: rgba(20, 123, 108, 0.1);
  color: var(--forest);
  font-size: 11px;
  font-weight: 800;
}

.subject-nav a.is-active .subject-nav__count {
  background: white;
}

.encyclopedia-main {
  min-width: 0;
  padding: 28px clamp(18px, 3.2vw, 48px) 80px;
}

.encyclopedia-view:not(.encyclopedia-studio) {
  max-width: 1080px;
}

.page-hero {
  margin: 0 0 28px;
  padding: 4px 0 24px;
  border-bottom: 1px solid var(--line);
}

.page-hero .back-step { margin: 0 0 16px; }

.page-kicker {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.encyclopedia-catalog h1 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: clamp(34px, 4.4vw, 52px);
  font-weight: 500;
  letter-spacing: -0.038em;
  line-height: 1.2;
  text-wrap: pretty;
}

.page-lede {
  max-width: 42rem;
  margin: 0 0 22px;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.7;
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stat-pill {
  display: grid;
  min-width: 96px;
  padding: 10px 14px 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.stat-pill strong {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  color: var(--forest);
  letter-spacing: -0.03em;
}

.stat-pill span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.02em;
}

.catalog-section {
  margin: 0 0 42px;
}

.section-head {
  margin: 0 0 16px;
}

.section-head p,
.guide-card .section-head p,
.mosaic-group__head p {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-head h2,
.guide-card .section-head h2,
.mosaic-group__head h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.disclaimer-list {
  display: grid;
  gap: 10px;
  margin: 0 0 36px;
  padding: 18px 20px;
  border: 1px solid var(--gold-soft);
  border-left: 3px solid var(--gold);
  border-radius: 14px;
  background: rgba(239, 229, 210, 0.42);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
  list-style: none;
}

.disclaimer-list li {
  padding-left: 0;
}

.structure-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.structure-card {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 168px;
  padding: 16px 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(180deg, #fffef9, var(--white));
  box-shadow: var(--shadow-sm);
}

.structure-card__index {
  color: var(--gold);
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.structure-card strong {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.25;
}

.structure-card span:last-child {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
}

.process-timeline {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.process-timeline li {
  display: grid;
  grid-template-columns: minmax(108px, 148px) minmax(0, 1fr);
  gap: 14px 20px;
  padding: 16px 18px;
  border-top: 1px solid var(--line);
}

.process-timeline li:first-child {
  border-top: 0;
}

.process-timeline strong {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--forest);
}

.process-timeline span {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.65;
}

.official-links-note {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
}

.official-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.official-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--forest);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.official-link:hover {
  border-color: rgba(20, 123, 108, 0.28);
  background: var(--teal-soft);
}

.process-articles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.process-article.is-lead {
  grid-column: 1 / -1;
}

.process-article {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 18px 18px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.process-article__index {
  color: var(--gold);
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.process-articles h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.25;
}

.process-articles .kicker {
  margin: 0;
  color: var(--teal);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.process-article p:not(.kicker) {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.65;
}

.mosaic-group { margin-bottom: 22px; }
.mosaic-group:last-child { margin-bottom: 0; }
.mosaic-group__head { margin-bottom: 12px; }
.mosaic-group__head h3 { font-size: 22px; }

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

.subject-tile {
  display: grid;
  gap: 8px;
  min-height: 168px;
  padding: 16px 16px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 160ms ease, transform 160ms ease;
}

.subject-tile:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
}

.subject-tile strong {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.3;
}

.subject-tile__focus {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.subject-tile__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  color: var(--muted);
  font-size: 12px;
}

.subject-tile__meta em {
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--teal-soft);
  color: var(--forest);
  font-style: normal;
  font-weight: 800;
}

.subject-split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.7fr);
  gap: 28px 32px;
  align-items: start;
}

.subject-readings {
  padding: 18px 18px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(180deg, #fffef9, var(--white));
  box-shadow: var(--shadow-sm);
}

.subject-split .question-list,
.subject-split .reading-list {
  grid-template-columns: 1fr;
}

.subject-columns {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 14px;
  margin: 0 0 36px;
}

.guide-card {
  padding: 18px 18px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.guide-card.is-warning {
  border-color: rgba(113, 60, 58, 0.18);
  background: #fbf6f4;
}

.guide-card.is-reading {
  grid-column: 1 / -1;
  background:
    linear-gradient(180deg, #fffef9, var(--white));
}

.guide-steps,
.poor-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-steps li,
.poor-list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.guide-steps__num,
.poor-list__mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}

.guide-steps__num {
  background: var(--teal-soft);
  color: var(--forest);
}

.poor-list__mark {
  background: rgba(113, 60, 58, 0.1);
  color: var(--oxblood);
}

.guide-steps p,
.poor-list p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
}

.reading-note {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.reading-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.reading-list li {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.reading-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.reading-link {
  color: var(--forest);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.reading-link:hover { color: var(--teal); }

.reading-access {
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 800;
}

.reading-access.is-free { background: #e5f4ec; color: #1d6b45; }
.reading-access.is-official { background: var(--teal-soft); color: var(--forest); }
.reading-access.is-library { background: var(--gold-soft); color: #6d5428; }

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

.reading-extras {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.reading-extra {
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}

.question-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.question-card {
  display: grid;
  gap: 10px;
  min-height: 168px;
  padding: 16px 16px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 160ms ease, transform 160ms ease;
}

.question-card:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
}

.question-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.question-card__index {
  color: var(--gold);
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.question-card__badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.diff-badge,
.format-chip,
.stimulus-chip {
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.diff-badge.is-foundation { background: #e5f4ec; color: #1d6b45; }
.diff-badge.is-core { background: var(--teal-soft); color: var(--forest); }
.diff-badge.is-stretch { background: var(--gold-soft); color: #6d5428; }
.format-chip { background: var(--canvas); color: var(--ink-soft); }
.stimulus-chip { background: rgba(113, 60, 58, 0.1); color: var(--oxblood); }

.question-card strong {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.4;
}

.question-card__cta {
  margin-top: auto;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}

.studio-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-bottom: 10px;
}

.studio-top .back-step { margin-top: 0; }

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

.studio-kicker {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.studio-question {
  max-width: 52rem;
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: clamp(22px, 2.4vw, 32px);
  font-weight: 500;
  line-height: 1.35;
}

.encyclopedia-body .inline-math {
  display: inline-block;
  max-width: 100%;
  vertical-align: middle;
}

.encyclopedia-body .inline-math.is-display-math,
.encyclopedia-body .katex-display {
  display: block;
  margin: 0.35em 0;
  overflow-x: auto;
}

.encyclopedia-body .katex {
  font-size: 1.05em;
}

.studio-question .katex {
  font-size: 1em;
}

.studio-question.is-current-focus {
  box-shadow: inset 0 -3px 0 rgba(20, 123, 108, 0.35);
}

.studio-question.is-dimmed {
  cursor: pointer;
  opacity: 0.55;
}

.studio-question.is-dimmed:hover { opacity: 0.78; }

.active-probe {
  max-width: 52rem;
  margin: 0 0 14px;
  padding: 14px 16px 16px;
  border: 1px solid rgba(20, 123, 108, 0.28);
  border-left: 3px solid var(--teal);
  border-radius: 14px;
  background: #f7fbf9;
  box-shadow: 0 0 0 4px rgba(20, 123, 108, 0.08);
}

.active-probe p {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.active-probe strong {
  font-family: var(--serif);
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 500;
  line-height: 1.4;
}

.focus-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  max-width: 52rem;
  margin: 0 0 20px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--gold-soft);
}

.focus-hint p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.5;
}

.focus-hint p:first-child {
  color: var(--forest);
  font-weight: 800;
}

#clearFocus {
  padding: 7px 12px;
  border: 1px solid rgba(109, 84, 40, 0.28);
  border-radius: 8px;
  background: white;
  color: #6d5428;
  font-size: 12px;
  font-weight: 800;
}

#clearFocus:hover { background: #fbf6ee; }

.studio-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.92fr) minmax(340px, 1.18fr);
  gap: 18px;
  align-items: start;
}

.studio-brief,
.studio-practice {
  display: grid;
  gap: 14px;
  min-width: 0;
  align-content: start;
}

.material-card,
.followup-card,
.template-panel,
.chat-panel,
.speech-bar {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.material-card {
  background:
    linear-gradient(rgba(255, 254, 248, 0.96), rgba(250, 248, 239, 0.98));
}

.material-card__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.material-card__header p {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.material-card__header h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.25;
}

.material-kind {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid rgba(20, 123, 108, 0.25);
  border-radius: 99px;
  background: var(--teal-soft);
  color: var(--forest);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.material-instruction {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-left: 2px solid var(--gold);
  background: rgba(248, 242, 225, 0.72);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
}

.material-content {
  min-width: 0;
}

.material-content p,
.material-content .stimulus-text {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-line;
}

.material-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.material-content th,
.material-content td {
  padding: 6px 8px;
  border: 1px solid var(--line);
  text-align: left;
}

.followup-card h2,
.template-panel h2,
.chat-panel h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.followup-card > p:not(.reading-note):not(.followup-note),
.template-panel > div > p,
.chat-panel > div > p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.followup-note {
  margin: 0 0 12px !important;
  color: var(--ink-soft) !important;
  font-size: 13px !important;
  letter-spacing: 0 !important;
  line-height: 1.5;
}

.followup-card ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.followup-card li { margin: 0; }

.probe-btn {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.probe-btn:hover {
  border-color: var(--teal);
  background: #f7fbf9;
}

.probe-btn.is-active {
  border-color: rgba(20, 123, 108, 0.45);
  background: var(--teal-soft);
  box-shadow: 0 0 0 3px rgba(20, 123, 108, 0.12);
}

.probe-btn__index {
  color: var(--gold);
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.probe-btn.is-active .probe-btn__index { color: var(--forest); }

.probe-btn__text {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.stretch-line {
  margin: 10px 0 0;
}

.stretch-line .probe-btn.is-stretch .probe-btn__index {
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.speech-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(239, 229, 210, 0.45);
}

.speech-toggle {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.speech-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.speech-toggle__switch {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: 22px;
  margin-top: 2px;
  border-radius: 999px;
  background: #c9c2b4;
  transition: background 160ms ease;
}

.speech-toggle__switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(18, 59, 52, 0.24);
  transition: transform 160ms ease;
}

.speech-toggle input:checked + .speech-toggle__switch {
  background: var(--forest);
}

.speech-toggle input:checked + .speech-toggle__switch::after {
  transform: translateX(18px);
}

.speech-toggle input:focus-visible + .speech-toggle__switch {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.speech-toggle__copy {
  display: grid;
  gap: 2px;
}

.speech-toggle__copy strong { font-size: 13px; }
.speech-toggle__copy small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.speech-stop,
.speak-again {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--forest);
  font-size: 12px;
  font-weight: 700;
}

.studio-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--forest);
  color: white;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.studio-action svg {
  display: none;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.studio-action--hero {
  width: 100%;
  min-height: 54px;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 16px;
  box-shadow: 0 12px 26px rgba(18, 59, 52, 0.2);
}

.studio-action--hero svg { display: block; }

.speech-stop:hover,
.speak-again:hover { border-color: var(--teal); background: var(--teal-soft); }
.studio-action:hover:not(:disabled) { background: var(--forest-deep); }
.studio-action--hero:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(18, 59, 52, 0.26);
}

.studio-action:disabled {
  opacity: 0.65;
  cursor: wait;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.template-note { color: var(--muted); font-size: 13px; letter-spacing: 0; }

.template-empty {
  display: grid;
  justify-items: center;
  gap: 16px;
  margin-top: 16px;
  padding: 32px 22px 24px;
  border: 1px dashed rgba(20, 123, 108, 0.32);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(247, 251, 249, 0.98), rgba(244, 239, 224, 0.62));
  text-align: center;
}

.template-empty__art {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 18px;
  background: var(--teal-soft);
  color: var(--forest);
  box-shadow: inset 0 0 0 1px rgba(20, 123, 108, 0.12);
}

.template-empty__art svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.template-empty__copy {
  display: grid;
  gap: 6px;
  max-width: 28rem;
}

.template-empty__copy strong {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
}

.template-empty__copy p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
  letter-spacing: 0;
}

.template-empty__preview {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.template-empty__preview li {
  padding: 5px 11px;
  border: 1px solid rgba(20, 123, 108, 0.2);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--forest);
  font-size: 12px;
  font-weight: 700;
}

.template-empty[hidden],
.template-output[hidden] {
  display: none !important;
}

.template-output {
  min-height: 140px;
  max-height: 420px;
  overflow: auto;
  margin-top: 14px;
  padding: 4px;
  border-radius: 10px;
  background: transparent;
  font-size: 14px;
  line-height: 1.55;
}

.template-doc {
  display: grid;
  gap: 12px;
}

.template-block {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
}

.template-block header p {
  margin: 0 0 2px;
  color: var(--teal);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.template-block h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.template-block__hint {
  margin: 0 0 10px !important;
  color: var(--muted);
  font-size: 12px !important;
  letter-spacing: 0 !important;
  line-height: 1.5;
}

.template-block__body p { margin: 0 0 8px; color: var(--ink); font-size: 14px; letter-spacing: 0; }
.template-block__body p:last-child { margin-bottom: 0; }
.template-block__body ul {
  margin: 0;
  padding-left: 18px;
}
.template-block__body li {
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 14px;
}

.template-block.is-spoken {
  border-color: rgba(20, 123, 108, 0.28);
  background: #f7fbf9;
}

.speak-unit {
  display: inline;
  border-radius: 4px;
  transition: background 180ms ease, color 180ms ease, opacity 180ms ease;
}

.speak-unit.is-pending {
  opacity: 0.28;
}

.speak-unit.is-current {
  background: rgba(20, 123, 108, 0.16);
  box-shadow: 0 0 0 3px rgba(20, 123, 108, 0.08);
  opacity: 1;
}

.speak-unit.is-done { opacity: 1; }

.generating-card {
  display: grid;
  gap: 8px;
  padding: 22px 18px;
  border: 1px dashed rgba(20, 123, 108, 0.28);
  border-radius: 16px;
  background: linear-gradient(180deg, #f7fbf9, #eef4f1);
}

.generating-card__pulse {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(20, 123, 108, 0.45);
  animation: statusPulse 1.4s ease-out infinite;
}

.generating-card strong { font-size: 15px; }
.generating-card p { margin: 0; color: var(--muted); font-size: 13px; letter-spacing: 0; }

.generating-card__bars {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.generating-card__bars span {
  display: block;
  height: 8px;
  border-radius: 99px;
  background: linear-gradient(90deg, #d7e7e2, #f4f8f6, #d7e7e2);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}

.generating-card__bars span:nth-child(2) { width: 86%; animation-delay: 80ms; }
.generating-card__bars span:nth-child(3) { width: 72%; animation-delay: 140ms; }
.generating-card__bars span:nth-child(4) { width: 58%; animation-delay: 200ms; }

.studio-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 99px;
  background: var(--teal-soft);
  color: var(--forest);
  font-size: 12px;
  font-weight: 800;
}

.studio-status__orb {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  animation: statusPulse 1.4s ease-out infinite;
}

.suggest-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.suggest-chip {
  max-width: 100%;
  padding: 8px 11px;
  border: 1px solid rgba(20, 123, 108, 0.22);
  border-radius: 999px;
  background: #f7fbf9;
  color: var(--forest);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
  animation: suggestIn 420ms ease both;
}

.suggest-chip:hover {
  border-color: var(--teal);
  background: var(--teal-soft);
}

@keyframes statusPulse {
  0% { box-shadow: 0 0 0 0 rgba(20, 123, 108, 0.45); }
  100% { box-shadow: 0 0 0 10px rgba(20, 123, 108, 0); }
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@keyframes suggestIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.chat-log {
  display: grid;
  gap: 10px;
  max-height: min(52vh, 420px);
  overflow: auto;
  margin: 8px 0 12px;
}

.chat-bubble {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
}

.chat-bubble.is-user { background: var(--teal-soft); }
.chat-bubble.is-assistant { background: var(--canvas); }

.chat-bubble__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.chat-bubble__meta small { color: var(--muted); }
.chat-bubble__meta .speak-again {
  padding: 3px 8px;
  font-size: 11px;
}

.markdown-body { white-space: normal; overflow-wrap: anywhere; }
.markdown-body > :first-child { margin-top: 0; }
.markdown-body > :last-child { margin-bottom: 0; }
.markdown-body p { margin: 0 0 8px; }
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5 {
  margin: 12px 0 6px;
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.35;
}
.markdown-body h2 { font-size: 16px; }
.markdown-body h3 { font-size: 15px; }
.markdown-body h4,
.markdown-body h5 { font-size: 14px; }
.markdown-body ul,
.markdown-body ol { margin: 6px 0 10px; padding-left: 1.3em; }
.markdown-body li { margin: 4px 0; }
.markdown-body blockquote {
  margin: 8px 0;
  padding: 8px 11px;
  border-left: 3px solid var(--teal);
  background: rgba(20, 123, 108, 0.06);
  color: var(--ink-soft);
}
.markdown-body pre {
  max-width: 100%;
  margin: 8px 0;
  overflow-x: auto;
  padding: 10px;
  border-radius: 8px;
  background: #17211f;
  color: #edf7f4;
  font-size: 12px;
}
.markdown-body code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(16, 43, 39, 0.08);
  font-size: 0.92em;
}
.markdown-body pre code { padding: 0; background: transparent; }
.markdown-body hr { margin: 12px 0; border: 0; border-top: 1px solid var(--line); }
.markdown-body a { color: var(--teal-dark); }
.markdown-body .markdown-table-wrap { max-width: 100%; overflow-x: auto; }
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 12px;
}
.markdown-body th,
.markdown-body td {
  padding: 7px 9px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.markdown-body th { background: var(--panel-warm, #f4f1ea); font-weight: 700; }
.markdown-body .math-node.is-display {
  display: block;
  margin: 0.4em 0;
  overflow-x: auto;
}

.chat-form textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  resize: vertical;
}

.chat-form button {
  margin-top: 8px;
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--forest);
  color: white;
}

.encyclopedia-studio .reading-list {
  grid-template-columns: 1fr;
}

@media (max-width: 1100px) {
  .studio-grid { grid-template-columns: 1fr; }
  .mosaic-grid,
  .process-articles,
  .structure-row,
  .question-list,
  .encyclopedia-catalog .reading-list { grid-template-columns: 1fr 1fr; }
  .process-timeline li { grid-template-columns: 1fr; gap: 6px; }
}

@media (max-width: 1060px) {
  .encyclopedia-header-tools {
    grid-column: 2;
    grid-row: 1;
  }
}

@media (max-width: 980px) {
  .encyclopedia-shell { grid-template-columns: 1fr; }
  .encyclopedia-header-tools { grid-column: 2; grid-row: 1; }
  .encyclopedia-menu-button {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow-sm);
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
  }
  .encyclopedia-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    border: 0;
    background: rgba(15, 23, 42, 0.42);
  }
  .encyclopedia-nav-close {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-size: 12px;
    font-weight: 750;
  }
  .encyclopedia-nav {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    width: min(88vw, 320px);
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
    padding: 18px 16px 28px;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    background: rgba(251, 250, 245, 0.98);
    box-shadow: 18px 0 50px rgba(15, 23, 42, 0.18);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }
  body.encyclopedia-nav-open {
    overflow: hidden;
  }
  body.encyclopedia-nav-open .encyclopedia-nav {
    transform: translateX(0);
  }
  body.encyclopedia-nav-open .encyclopedia-nav-backdrop {
    display: block;
  }
  body.encyclopedia-nav-open .encyclopedia-menu-button {
    opacity: 0;
    pointer-events: none;
  }
  .encyclopedia-catalog h1 { max-width: none; }
  .structure-row,
  .subject-split,
  .subject-columns,
  .process-articles,
  .mosaic-grid,
  .question-list,
  .reading-list { grid-template-columns: 1fr; }
  .process-timeline li { grid-template-columns: 1fr; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .encyclopedia-nav { transition: none; }
}
