:root {
  --ink: #293c35;
  --muted: #707b74;
  --accent: #b75339;
  --accent-hover: #99422d;
  --border: #e4e8e1;
  --canvas: #fafbf8;
  --sage: #eaf0e7;
  --white: #fff;
  --radius: 10px;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  font-size: 14px;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
}
a {
  color: inherit;
  text-decoration: none;
}
svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
button {
  color: inherit;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #b7533980;
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.svg-definitions {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.accent,
.brand-dot {
  color: var(--accent);
}
.eyebrow {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 1.9px;
  color: var(--muted);
  margin: 0 0 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  font-size: 27px;
  letter-spacing: -1.3px;
  font-weight: 700;
}
.brand-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: white;
  border-radius: 9px;
}
.brand-icon svg {
  width: 24px;
  height: 24px;
}
.brand small {
  display: block;
  font-size: 10px;
  letter-spacing: 3px;
  line-height: 1.4;
  font-weight: 650;
  margin: 1px 0 0 2px;
}
.workspace-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12px;
  color: #617064;
  letter-spacing: 0.1px;
  background: #fff9;
}
.workspace-badge > span,
.small-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #829782;
  border-radius: 50%;
}
.button {
  border: 0;
  border-radius: 7px;
  min-height: 42px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition:
    background 0.15s,
    box-shadow 0.15s;
}
.button-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 3px #9b4a2610;
}
.button-primary:hover {
  background: var(--accent-hover);
}
.button-secondary {
  background: var(--sage);
  color: var(--ink);
}
.button-danger {
  background: #af4937;
  color: white;
}
.button-danger:hover { background: #963b2d; }
.icon-button {
  border: 0;
  background: transparent;
  padding: 8px;
  display: grid;
  place-items: center;
  min-width: 38px;
  min-height: 38px;
  border-radius: 6px;
}
.icon-button:hover {
  background: var(--sage);
}
/* Sign-in */
.login-layout {
  min-height: 100svh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.welcome-panel {
  background: #edf1e9;
  padding: 44px 9% 28px;
  display: flex;
  flex-direction: column;
  position: relative;
}
.welcome-panel > .brand {
  align-self: flex-start;
}
.welcome-content {
  max-width: 470px;
  width: 100%;
  margin: auto;
  padding: 65px 0;
}
.welcome-content .eyebrow {
  font-size: 12px;
  letter-spacing: 2.2px;
  color: #617464;
}
.welcome-content h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(40px, 4.1vw, 62px);
  font-weight: 400;
  letter-spacing: -2px;
  line-height: 1.12;
  margin: 0;
}
.welcome-description {
  font-size: 14px;
  line-height: 1.85;
  color: #66736a;
  margin: 21px 0 30px;
}
.lesson-sample {
  background: #ffffffd9;
  border: 1px solid #dce4d7;
  border-radius: 12px;
  padding: 24px 26px;
  box-shadow: 0 16px 35px -25px #45544366;
  max-width: 405px;
}
.reading-dialog {
  width: min(1215px, calc(100vw - 32px));
  max-width: 1215px;
  height: min(850px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  color: var(--ink);
  background: #fcfdfb;
  overflow: auto;
}
.reading-dialog[open] { display: flex; flex-direction: column; }
.reading-experience {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: min(760px, calc(100dvh - 190px));
  min-height: 520px;
}
.reading-player-content {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}
.reading-loader {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  place-content: center;
  justify-items: center;
  border-radius: inherit;
  background: #fcfdfb;
  color: var(--ink);
  text-align: center;
}
.reading-experience.reading-loading .reading-loader { display: grid; }
.reading-experience.reading-loading .reading-player-content { visibility: hidden; }
.reading-loader-spinner {
  width: 34px;
  height: 34px;
  margin-bottom: 16px;
  border: 3px solid #dfe6d9;
  border-top-color: #70845f;
  border-radius: 50%;
  animation: reading-loader-spin .8s linear infinite;
}
.reading-loader strong { font: 22px/1.25 Georgia, serif; font-weight: 400; }
.reading-loader small { margin-top: 7px; color: var(--muted); font-size: 12px; }
@keyframes reading-loader-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .reading-loader-spinner { animation-duration: 1.8s; }
}
.reading-experience .reading-close { display: none; }
.reading-stories {
  display: flex;
  flex-shrink: 0;
  gap: 7px;
  margin: 0 0 22px;
}
.reading-story {
  position: relative;
  flex: 1;
  height: 5px;
  min-width: 18px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #dfe5da;
  cursor: pointer;
}
.reading-story > span {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, #6f845e var(--page-progress, 0%), transparent var(--page-progress, 0%));
}
.reading-story.current { box-shadow: 0 0 0 1px #aebba4; }
.reading-story:disabled {
  background: repeating-linear-gradient(90deg, #e2e5df 0 5px, transparent 5px 8px);
  cursor: not-allowed;
}
.reading-story:focus-visible { outline: 2px solid #748763; outline-offset: 3px; }
.reading-controls, .reading-mode { display: flex; align-items: center; gap: 8px; }
.reading-controls { margin-top: 24px; }
.reading-mode button, .reading-context, .reading-voice-open { width: 44px; height: 40px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #899181; cursor: pointer; }
.reading-mode svg, .reading-context svg, .reading-voice-open svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.reading-voice-open { margin-left: auto; }
.reading-voice-open[hidden] { display: none; }
.reading-voice-open:hover { background: #edf2e8; color: #354a2d; }
.reading-word-guide { display: inline-flex; flex-shrink: 0; color: #526b46; }
.reading-word-guide svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.reading-word-guide-mark { fill: #c9dfa5; }
.reading-voice-open.has-word-guide > svg { display: none; }
.reading-voice-open:focus-visible { outline: 2px solid #748763; outline-offset: 2px; }
.reading-mode button[aria-pressed="true"] { background: #e3ebd8; border-color: #b5c29c; color: #354a2d; font-weight: 700; }
.reading-mode button[aria-pressed="true"] svg { stroke-width: 3; }
.reading-mode button:disabled, .reading-context:disabled { opacity: .35; cursor: not-allowed; }
.reading-mode button:focus-visible, .reading-context:focus-visible { outline: 2px solid #748763; outline-offset: 2px; }
.reading-context { position: relative; margin-left: 8px; }
.reading-context[hidden] { display: none; }
.reading-context::before { content: ""; position: absolute; left: -9px; width: 1px; height: 24px; background: #d7dfd1; }
.reading-context > span { position: absolute; right: 2px; bottom: 1px; min-width: 13px; padding: 1px 2px; border-radius: 3px; background: #eef2e9; color: #677460; font: 8px/1.1 sans-serif; letter-spacing: .04em; }
.reading-context[aria-pressed="true"] { background: #e3ebd8; border-color: #b5c29c; color: #354a2d; }
.reading-word.reading-selected { background: #edf1e6; box-shadow: 0 2px 0 #9aab84; }
.reading-word.reading-speaking-sentence { background: #edf1e6; }
dialog:not([open]) { display: none !important; }
.reading-dialog::backdrop { background: rgb(30 44 35 / 40%); }
.reading-close { position: absolute; right: 7px; top: 3px; border: 0; background: transparent; color: #7a8475; font-size: 22px; cursor: pointer; }
.reading-dialog .sample-heading > div { min-width: 0; }
.reading-heading-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.reading-contents-open { display: inline-flex; align-items: center; gap: 7px; padding: 7px 9px; border: 1px solid #dce4d7; border-radius: 7px; background: #f8faf6; color: #526349; font: inherit; font-size: 12px; cursor: pointer; }
.reading-contents-open:hover { background: #edf2e8; color: #354a2d; }
.reading-contents-open:focus-visible { outline: 2px solid #748763; outline-offset: 2px; }
.reading-contents-open svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.reading-dialog .mini-book { flex-shrink: 0; }
.reading-dialog .sample-tag { display: block; flex-shrink: 0; }
.reading-dialog .reading-text { flex: 1; min-height: 0; overflow-y: auto; white-space: pre-wrap; font: 25px/1.65 Georgia, serif; padding: 3px 5px; margin-left: -5px; margin-right: -5px; }
.reading-dialog .sample-heading, .reading-dialog .sample-player, .reading-controls { flex-shrink: 0; }
.reading-token { white-space: nowrap; }
.reading-word { display: inline; border: 0; padding: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; border-radius: 4px; }
.reading-word:disabled { color: inherit; cursor: text; }
.reading-word.reading-current { background: #dde8c7; color: #354a2d; box-shadow: 0 2px 0 #b5c29c, 4px 0 #dde8c7, -4px 0 #dde8c7; }
.reading-word:focus-visible { outline: 2px solid #748763; outline-offset: 2px; }
.reading-dialog .sample-play { border: 0; flex-shrink: 0; cursor: pointer; }
.reading-seek { appearance: none; min-width: 0; flex: 1; width: 100%; height: 3px; padding: 0; border: 0; border-radius: 2px; background: linear-gradient(to right, #748763 var(--played, 0%), #e3e9dd var(--played, 0%)); cursor: pointer; }
.reading-seek::-webkit-slider-thumb { appearance: none; width: 6px; height: 6px; border-radius: 50%; background: #748763; }
.reading-seek::-moz-range-thumb { width: 6px; height: 6px; border: 0; border-radius: 50%; background: #748763; }
.reading-dialog [data-reading-time] { white-space: nowrap; }
.reading-dialog [data-reading-error] { font-size: 12px; color: #9b3929; margin: 8px 0 0; }
.reading-dialog [data-reading-error]:empty { display: none; }
.reading-voice-shade:not([hidden]) { position: fixed; inset: 0; z-index: 10000; background: rgb(30 44 35 / 42%); }
.reading-voice-dialog { box-sizing: border-box; width: calc(100vw - 32px); max-width: 420px; max-height: calc(100vh - 32px); max-height: min(650px, calc(100dvh - 32px)); overflow-y: auto; padding: 22px; border: 1px solid #dce4d7; border-radius: 12px; color: var(--ink); background: #fcfdfb; box-shadow: 0 18px 60px rgb(29 43 32 / 24%); }
.reading-voice-dialog.legacy-modal { position: fixed; top: 50%; left: 50%; z-index: 10001; margin: 0; transform: translate(-50%, -50%); }
.reading-voice-dialog::backdrop { background: rgb(30 44 35 / 42%); }
.reading-voice-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.reading-voice-heading h2 { margin: 0; font: 26px/1.2 Georgia, serif; }
.reading-voice-close { width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 50%; background: white; color: var(--muted); font: 24px/1 sans-serif; cursor: pointer; }
.reading-voice-dialog [data-reading-voice-language], .reading-voice-note { color: var(--muted); font-size: 13px; }
.reading-voice-list { max-height: min(430px, 55dvh); overflow-y: auto; border-block: 1px solid var(--border); }
.reading-voice-choice { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; padding: 12px 4px; border-bottom: 1px solid #e6ebe2; cursor: pointer; }
.reading-voice-choice:last-child { border-bottom: 0; }
.reading-voice-choice:has(input:checked) { color: #354a2d; background: #edf2e8; }
.reading-voice-choice input { accent-color: #526b46; }
.reading-voice-choice small { margin-left: auto; color: var(--muted); }
.reading-voice-note { margin-bottom: 0; }
.reading-contents-dialog { width: min(680px, calc(100vw - 32px)); max-height: min(760px, calc(100dvh - 32px)); padding: 0; border: 1px solid #dce4d7; border-radius: 12px; color: var(--ink); background: #fcfdfb; box-shadow: 0 18px 60px rgb(29 43 32 / 24%); }
.reading-contents-dialog[open] { display: flex; flex-direction: column; }
.reading-contents-dialog::backdrop { background: rgb(30 44 35 / 42%); backdrop-filter: blur(3px); }
.reading-contents-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 24px 26px 18px; border-bottom: 1px solid var(--border); }
.reading-contents-heading .eyebrow { margin: 0 0 3px; }
.reading-contents-heading h2 { margin: 0; font: 28px/1.2 Georgia, serif; font-weight: 400; }
.reading-contents-meta { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.reading-contents-close { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: white; color: var(--muted); font: 24px/1 sans-serif; cursor: pointer; }
.reading-contents-close:hover { color: var(--ink); background: #f0f3ec; }
.reading-contents-close:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.reading-chapter-list { margin: 0; padding: 10px 16px 18px; overflow-y: auto; list-style: none; counter-reset: none; }
.reading-chapter-list li { margin: 0; }
.reading-chapter-list button { display: grid; grid-template-columns: 34px 1fr; gap: 12px; width: 100%; padding: 14px 10px; border: 0; border-bottom: 1px solid #e6ebe2; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.reading-chapter-list li:last-child button { border-bottom: 0; }
.reading-chapter-list button:hover { background: #f0f4ec; }
.reading-chapter-list button:focus-visible { outline: 2px solid #748763; outline-offset: -2px; }
.reading-chapter-list button:disabled { opacity: .48; cursor: not-allowed; }
.reading-chapter-number { padding-top: 2px; color: #7a8872; font: 13px/1.4 sans-serif; text-align: right; }
.reading-chapter-list strong { display: block; font: 17px/1.35 Georgia, serif; font-weight: 400; }
.reading-chapter-list small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.reading-chapter-list button.current { background: #edf2e8; }
.reading-chapter-list button.current strong { font-weight: 700; color: #354a2d; }
.sample-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mini-book {
  width: 32px;
  height: 35px;
  display: grid;
  place-items: center;
  background: #e8efdf;
  border-radius: 5px;
  font:
    17px Georgia,
    serif;
  color: #4b6449;
}
.sample-heading strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}
.sample-heading div > span {
  font-size: 11px;
  color: var(--muted);
}
.sample-tag {
  font-size: 10px;
  letter-spacing: 1px;
  margin-left: auto;
  color: var(--muted);
}
.sample-sentence {
  font:
    25px/1.65 Georgia,
    serif;
  color: #45513f;
  margin: 23px 0 12px;
}
.sample-sentence mark {
  background: #dde8c7;
  color: #354a2d;
  border-radius: 4px;
  padding: 3px 5px;
  box-shadow: 0 2px 0 #b5c29c;
}
.sample-translation {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #7d857b;
}
.sample-translation > span:first-child {
  font-weight: 600;
  color: #536647;
}
.translation-line {
  width: 18px;
  height: 1px;
  background: #c5cebe;
}
.sample-player {
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid #edf0e9;
  padding-top: 15px;
  margin-top: 20px;
  font-size: 10px;
  color: #7a8475;
  font-variant-numeric: tabular-nums;
}
.sample-play {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  padding-left: 2px;
  font-size: 10px;
}
.sample-track {
  height: 3px;
  background: #e3e9dd;
  flex: 1;
  border-radius: 2px;
}
.reading-transport { display: flex; align-items: center; justify-content: center; gap: 8px; flex-shrink: 0; }
.reading-transport .sample-play { position: relative; width: 48px; height: 48px; padding: 0; background: #526b46; box-shadow: 0 6px 16px rgb(82 107 70 / 20%); }
.reading-transport .sample-play svg { position: absolute; width: 30px; height: 30px; fill: currentColor; opacity: 0; transition: opacity 130ms ease-out; }
.reading-transport .playback-play { transform: translateX(1px); }
.sample-play[data-playback-state="play"] .playback-play, .sample-play[data-playback-state="pause"] .playback-pause { opacity: 1; }
.playback-preparing { display: none; width: 20px; height: 20px; border: 2px solid #ffffff60; border-top-color: white; border-radius: 50%; animation: reading-loader-spin .8s linear infinite; }
.sample-play[data-playback-state="preparing"] .playback-preparing { display: block; }
.reading-skip { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: #edf2e8; color: #526b46; cursor: pointer; }
.reading-skip svg { width: 20px; height: 20px; fill: currentColor; }
.reading-transport button:disabled { background: #f3f4f0; color: #697162; border: 1px solid #7a8373; box-shadow: none; cursor: default; }
.reading-transport button:focus-visible { outline: 2px solid #748763; outline-offset: 3px; }
.reading-transport button:active:not(:disabled) { transform: scale(.96); }
@media (max-width: 600px) {
  .reading-dialog .sample-player { flex-wrap: wrap; }
  .reading-transport { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .reading-transport .sample-play svg { transition: none; }
  .playback-preparing { animation: none; }
  .reading-transport button:active:not(:disabled) { transform: none; }
}
.sample-track > span {
  display: block;
  height: 3px;
  width: 24%;
  background: #748763;
  position: relative;
}
.sample-track > span:after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #748763;
  right: 0;
  top: -1.5px;
}
.welcome-caption {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #73826f;
  font-size: 12px;
  margin-top: 24px;
}
.welcome-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #7a8774;
  font-size: 11px;
}
.welcome-footer span:first-child {
  font-size: 10px;
  letter-spacing: 1.6px;
}
.signin-panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 110px 45px 85px;
  background: #fff;
}
.signin-badge {
  position: absolute;
  right: 34px;
  top: 38px;
}
.signin-content {
  width: 100%;
  max-width: 360px;
}
.signin-heading .eyebrow {
  color: #879080;
  margin-bottom: 13px;
  letter-spacing: 1.8px;
}
.signin-heading h2 {
  font-size: 28px;
  font-weight: 550;
  letter-spacing: -1px;
  margin: 0 0 11px;
}
.signin-heading > p:last-child {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}
.login-form {
  margin-top: 34px;
}
.login-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 9px;
}
.login-form input {
  width: 100%;
  height: 45px;
  background: #fff;
  border: 1px solid #dce1d8;
  border-radius: 6px;
  padding: 0 13px;
  font-size: 14px;
  color: var(--ink);
  transition: border-color 0.15s;
}
.login-form input::placeholder {
  color: #939a91;
}
.login-form input:focus {
  border-color: #9ba98b;
  box-shadow: 0 0 0 3px #edf1e6;
  outline: none;
}
.login-form .remember-me {
  display: flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  margin: 16px 0 0;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
}
.login-form .remember-me input {
  width: 17px;
  height: 17px;
  margin: 0;
  padding: 0;
  accent-color: #63744f;
}
.password-label {
  margin-top: 22px;
}
.password-input {
  position: relative;
}
.password-input input {
  padding-right: 48px;
}
.password-toggle {
  position: absolute;
  right: 1px;
  top: 1px;
  width: 43px;
  height: 43px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #8a9484;
  display: grid;
  place-items: center;
}
.password-toggle:hover {
  color: var(--ink);
}
.password-toggle svg {
  width: 18px;
  height: 18px;
}
.signin-button {
  width: 100%;
  margin-top: 25px;
  height: 45px;
  justify-content: space-between;
  padding: 0 17px;
}
.signin-button > span {
  font-size: 20px;
  font-weight: 400;
}
.account-note {
  display: flex;
  gap: 11px;
  padding: 18px 0 0;
  border-top: 1px solid #edf0e9;
  margin-top: 29px;
  color: var(--muted);
}
.info-icon {
  display: grid;
  place-items: center;
  border: 1px solid #a1aa99;
  border-radius: 50%;
  width: 15px;
  height: 15px;
  font:
    11px Georgia,
    serif;
  flex-shrink: 0;
  margin-top: 1px;
}
.account-note strong {
  font-size: 12px;
  font-weight: 500;
  color: #778170;
}
.account-note p {
  font-size: 12px;
  margin: 6px 0 0;
  line-height: 1.7;
}
.account-note code {
  font-size: 12px;
  color: #697961;
  background: #f2f5ed;
  padding: 2px 4px;
  border-radius: 3px;
}
.signin-footer {
  position: absolute;
  bottom: 29px;
  left: 24px;
  right: 24px;
  text-align: center;
  color: #949c8f;
  font-size: 11px;
}
.form-error {
  font-size: 14px;
  line-height: 1.6;
  background: #fff1ed;
  color: #9b3929;
  border: 1px solid #f1d7d0;
  border-radius: 6px;
  padding: 10px 12px;
  margin: 0 0 18px;
}
/* Workspace */
.admin-page {
  background: var(--canvas);
}
.skip-link {
  position: fixed;
  left: 250px;
  top: -70px;
  padding: 12px;
  background: var(--ink);
  color: white;
  z-index: 20;
}
.skip-link:focus {
  top: 8px;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 232px;
  background: #f4f6f0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 18px 0;
}
.sidebar > .brand {
  margin-left: 8px;
  align-self: flex-start;
}
.workspace-label {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 34px 0 26px;
  padding: 12px 8px;
  border-top: 1px solid #e1e6db;
  border-bottom: 1px solid #e1e6db;
}
.workspace-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 32px;
  border: 1px solid #dce1d3;
  background: #fff;
  border-radius: 6px;
  font:
    17px Georgia,
    serif;
  color: #738066;
}
.workspace-label strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}
.workspace-label div > span {
  color: #7d8777;
  font-size: 11px;
}
.nav-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  font-weight: 650;
  color: #8a9481;
  margin: 0 12px 12px;
}
.administration-label {
  margin-top: 32px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  font-size: 13px;
  margin: 3px 0;
  min-height: 42px;
}
.nav-item svg {
  width: 17px;
  height: 17px;
  color: #748268;
}
.nav-item.active {
  background: #e6ecdf;
  color: #34482d;
  font-weight: 600;
}
.nav-item.active svg {
  color: #556c43;
}
.nav-item:disabled {
  color: #92998e;
}
.nav-item:disabled svg {
  color: #92998e;
}
.nav-count {
  font-size: 11px;
  margin-left: auto;
  background: #d9e2d0;
  padding: 2px 5px;
  border-radius: 3px;
}
.soon-label {
  font-size: 10px;
  margin-left: auto;
  font-weight: 400;
  color: #92998e;
}
.model-server {
  margin-top: auto;
  margin-bottom: 18px;
  padding: 16px 8px 18px;
  border-top: 1px solid #e0e5d9;
}
.gpu-stats {
  display: grid;
  gap: 9px;
  margin-bottom: 15px;
}
.gpu-stat-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  color: #6f796a;
  font-size: 10px;
  line-height: 1.2;
}
.gpu-stat-heading strong {
  color: #4c5e45;
  font-size: 10px;
  font-weight: 600;
}
.gpu-memory-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe5d9;
  box-shadow: inset 0 0 0 1px rgb(71 91 62 / 8%);
}
.gpu-memory-bar > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #6f925b;
  transition: width .25s ease;
}
.model-server-state {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.model-server-state > span:last-child {
  min-width: 0;
}
.model-server-state strong,
.model-server-state small {
  display: block;
}
.model-server-state strong {
  font-size: 12px;
  font-weight: 600;
}
.model-server-state small {
  margin-top: 4px;
  color: #818b7b;
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.model-server-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #c14e3b;
  box-shadow: 0 0 0 3px rgb(193 78 59 / 12%);
}
.model-server[data-status="starting"] .model-server-dot,
.model-server[data-status="stopping"] .model-server-dot {
  background: #d38a2e;
  box-shadow: 0 0 0 3px rgb(211 138 46 / 14%);
  animation: server-pulse 1.4s ease-in-out infinite;
}
.model-server[data-status="running"] .model-server-dot {
  background: #599348;
  box-shadow: 0 0 0 3px rgb(89 147 72 / 14%);
}
.model-server-actions { display: flex; gap: 6px; margin-top: 12px; }
.model-server-actions > .button {
  width: 100%;
  min-height: 34px;
  padding: 7px 12px;
  font-size: 11px;
}
.model-server-actions .model-cache-clear { width: 34px; flex: 0 0 34px; padding: 6px; }
.model-cache-clear svg { width: 20px; height: 20px; }
.model-cache-clear[aria-busy="true"] svg { animation: server-pulse 1s ease-in-out infinite; }
.model-server > [data-model-cache-message] { color: #4b6449; }
.model-server > [data-model-cache-message].is-error { color: #9b3929; }
.model-server > p {
  margin: 9px 0 0;
  color: #9b3929;
  font-size: 10px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.model-server[data-status="starting"] > p,
.model-server[data-status="stopping"] > p {
  color: #967b42;
}
@keyframes server-pulse {
  50% { opacity: .45; }
}

.profile {
  border-top: 1px solid #e0e5d9;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 17px 4px;
}
.avatar {
  display: grid;
  place-items: center;
  background: #e7dece;
  color: #786a54;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  font-size: 13px;
}
.profile strong {
  display: block;
  font-weight: 550;
  font-size: 12px;
}
.profile div > span {
  display: block;
  color: #8b9482;
  font-size: 11px;
  margin-top: 4px;
}
.profile form {
  margin-left: auto;
}
.profile .icon-button {
  color: #7f8a73;
}
.profile svg {
  width: 17px;
  height: 17px;
}
.workspace-main {
  margin-left: 232px;
}
.topbar {
  height: 75px;
  border-bottom: 1px solid var(--border);
  padding: 0 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff9;
  gap: 15px;
}
.breadcrumb {
  font-size: 12px;
  color: #8e9787;
  display: flex;
  gap: 14px;
  align-items: center;
}
.breadcrumb strong {
  font-weight: 500;
  color: #64725a;
}
.breadcrumb > span {
  color: #c3cbbb;
}
.topbar-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: #87927c;
}
.topbar-label .small-dot {
  width: 5px;
  height: 5px;
  background: #91a67f;
}
.content-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 39px 38px 24px;
}
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 31px;
}
.page-heading .eyebrow {
  font-size: 10px;
  letter-spacing: 1.8px;
  color: #86907d;
  margin: 0 0 11px;
}
.page-heading h1 {
  font-size: 30px;
  letter-spacing: -1px;
  font-weight: 550;
  line-height: 1.2;
  margin: 0;
}
.page-heading p:last-child {
  font-size: 13px;
  color: #8a9383;
  margin: 10px 0 0;
}
.page-heading .button {
  font-size: 13px;
  min-height: 39px;
  padding: 10px 15px;
  margin-top: 14px;
}
.page-heading .button span {
  font-size: 18px;
  font-weight: 400;
}
.lesson-create-panel { max-width: 720px; padding: 28px; }
.lesson-create-form { display: grid; gap: 22px; }
.lesson-create-form label { display: grid; gap: 9px; font-size: 13px; font-weight: 600; }
.lesson-create-form input, .lesson-create-form select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 6px;
  background: white; color: inherit; font: inherit; font-weight: 400;
}
.lesson-create-form input:focus, .lesson-create-form select:focus { outline: 2px solid #b8c6a9; outline-offset: 2px; }
.lesson-create-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 21px 0;
  margin-bottom: 30px;
}
.stat {
  padding: 0 23px;
  border-right: 1px solid var(--border);
}
.stat:last-child {
  border: 0;
}
.stat > span {
  font-size: 12px;
  color: #7a8570;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat > div {
  display: flex;
  align-items: baseline;
  gap: 11px;
  margin-top: 13px;
}
.stat strong {
  font-size: 29px;
  font-weight: 500;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}
.stat-caption {
  font-size: 11px;
  color: #9aa18f;
}
.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: inline-block;
}
.published-dot {
  background: #84956a;
}
.draft-dot {
  background: #a6aaa0;
}
.review-dot {
  background: #c39e60;
}
.library-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 21px;
  border-bottom: 1px solid var(--border);
  gap: 18px;
}
.filter-tabs {
  display: flex;
  gap: 24px;
}
.filter-tab {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 18px 0 17px;
  white-space: nowrap;
  font-size: 13px;
  color: #8b9481;
  display: flex;
  align-items: center;
  gap: 7px;
}
.filter-tab.selected {
  border-color: #72855e;
  color: #435637;
  font-weight: 600;
}
.filter-tab > span {
  font-size: 10px;
  background: #edf1e6;
  border-radius: 3px;
  padding: 2px 5px;
}
.sample-data-label {
  font-size: 10px;
  letter-spacing: 1.4px;
  color: #969f8b;
  white-space: nowrap;
}
.library-filters {
  display: flex;
  gap: 12px;
  padding: 18px 21px;
}
.search-input {
  position: relative;
  max-width: 295px;
  width: 100%;
}
.search-input svg {
  position: absolute;
  top: 10px;
  left: 11px;
  color: #96a08b;
  width: 15px;
  height: 15px;
}
.search-input input {
  width: 100%;
  height: 35px;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0 10px 0 33px;
  color: var(--ink);
  font-size: 12px;
  background: #fff;
}
.search-input input::placeholder {
  color: #9aa38f;
}
.library-filters select {
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0 28px 0 11px;
  font-size: 12px;
  color: #758169;
  background: #fff;
  min-height: 35px;
  max-width: 180px;
}
.table-scroll {
  overflow-x: auto;
}
.lesson-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  white-space: nowrap;
}
.lesson-table thead {
  background: #f9faf6;
}
.lesson-table th {
  padding: 12px 16px;
  border-top: 1px solid #edf0e8;
  border-bottom: 1px solid #edf0e8;
  font-size: 10px;
  letter-spacing: 1.1px;
  font-weight: 550;
  color: #929c85;
}
.lesson-table th:first-child {
  padding-left: 23px;
  width: 39%;
}
.lesson-table th:last-child {
  width: 30px;
  padding-left: 0;
}
.lesson-table td {
  padding: 17px 16px;
  border-bottom: 1px solid #edf0e8;
  font-size: 12px;
  color: #78846d;
}
.lesson-table td:first-child {
  padding-left: 21px;
}
.lesson-table tbody tr:last-child td {
  border-bottom: 0;
}
.lesson-table tbody tr:hover {
  background: #fcfdf9;
}
.lesson-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}
.lesson-link > span:last-child {
  display: block;
}
.lesson-link strong {
  font-size: 13px;
  display: block;
  font-weight: 550;
  color: #46553d;
}
.lesson-link small {
  display: block;
  font-size: 11px;
  color: #9aa18e;
  margin-top: 6px;
}
.lesson-link:hover strong {
  color: var(--accent);
}
.lesson-cover {
  display: grid;
  place-items: center;
  width: 36px;
  height: 44px;
  border-radius: 5px;
  font:
    19px Georgia,
    serif;
  box-shadow: inset 3px 0 #00000004;
  flex-shrink: 0;
}
.cover-sage {
  background: #e8eedf;
  color: #79875d;
}
.cover-sand {
  background: #eee9db;
  color: #9a8863;
}
.cover-peach {
  background: #f3e5dc;
  color: #b58c73;
}
.cover-lilac {
  background: #eee8f0;
  color: #9b85a4;
}
.cover-blue {
  background: #e5ebf0;
  color: #8497a9;
}
.cover-sea {
  background: #e4ede7;
  color: #809c8d;
}
.language-code {
  font-size: 10px;
  border: 1px solid #e8ebdf;
  background: #fafbf7;
  padding: 3px 4px;
  margin-right: 6px;
  border-radius: 3px;
  color: #95a088;
}
.duration {
  font-variant-numeric: tabular-nums;
}
.status {
  font-size: 10px;
  padding: 5px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.status:before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}
.status.published {
  background: #eff3e8;
  color: #6d8153;
}
.status.draft {
  background: #f0f2ed;
  color: #929a87;
}
.status.review {
  background: #f8f1e3;
  color: #ae8e4f;
}
.lesson-table td.row-arrow {
  padding-left: 0;
  color: #aab39e;
  font-size: 15px;
}
.table-footer {
  padding: 15px 21px;
  flex-wrap: wrap;
  align-items: center;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: #919c85;
}
.table-footer > span:last-child {
  font:
    italic 11px Georgia,
    serif;
  color: #9aa48f;
}
.content-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 10px;
  color: #9da691;
  margin-top: 22px;
}
.empty-results {
  padding: 45px 20px;
  text-align: center;
  color: #798570;
}
.empty-results strong {
  font-size: 16px;
  color: var(--ink);
}
.empty-results p {
  font-size: 14px;
  margin-bottom: 20px;
}
@media (min-width: 1600px) {
  .welcome-panel {
    padding-left: 13%;
    padding-right: 13%;
  }
  .signin-content {
    max-width: 400px;
  }
  .signin-heading h2 {
    font-size: 32px;
  }
  .content-main {
    padding-top: 48px;
  }
}
@media (max-width: 1200px) {
  .stat > div {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
  .stat-caption {
    font-size: 10px;
  }
  .content-main {
    padding: 30px 24px;
  }
  .topbar {
    padding: 0 24px;
  }
  .sidebar {
    width: 212px;
    padding-left: 13px;
    padding-right: 13px;
  }
  .workspace-main {
    margin-left: 212px;
  }
  .lesson-table th,
  .lesson-table td {
    padding-left: 11px;
    padding-right: 11px;
  }
  .lesson-table th:first-child {
    width: auto;
  }
  .filter-tabs {
    gap: 20px;
  }
  .lesson-link strong {
    font-size: 12px;
  }
  .sample-tag {
    display: none;
  }
  .welcome-content h1 {
    font-size: 48px;
  }
  .welcome-panel {
    padding-left: 9%;
    padding-right: 9%;
  }
  .sample-sentence {
    font-size: 23px;
  }
}
@media (max-width: 900px) {
  .sidebar {
    width: 185px;
    padding-left: 9px;
    padding-right: 9px;
  }
  .workspace-main {
    margin-left: 185px;
  }
  .sidebar .brand {
    font-size: 24px;
  }
  .workspace-label {
    padding-left: 3px;
    gap: 7px;
  }
  .workspace-label strong {
    font-size: 11px;
  }
  .workspace-label div > span {
    font-size: 10px;
  }
  .nav-item {
    padding: 10px;
    font-size: 12px;
    gap: 8px;
  }
  .nav-label {
    font-size: 10px;
  }
  .profile {
    gap: 6px;
  }
  .profile strong {
    font-size: 11px;
  }
  .profile .icon-button {
    min-width: 30px;
    padding: 5px;
  }
  .stat {
    padding: 0 15px;
  }
  .sample-data-label {
    display: none;
  }
  .lesson-table {
    min-width: 670px;
  }
  .topbar-label {
    display: none;
  }
  .welcome-content h1 {
    font-size: 40px;
  }
  .welcome-description {
    font-size: 14px;
  }
  .lesson-sample {
    padding: 20px 18px;
  }
  .sample-sentence {
    font-size: 21px;
  }
  .signin-panel {
    padding: 100px 30px 80px;
  }
  .signin-heading h2 {
    font-size: 25px;
  }
  .welcome-panel {
    padding: 34px 30px 25px;
  }
  .welcome-content {
    padding: 55px 0;
  }
  .welcome-footer span:last-child {
    display: none;
  }
  .signin-badge {
    right: 26px;
    top: 35px;
  }
}
@media (max-width: 650px) {
  .login-layout {
    display: flex;
    flex-direction: column;
  }
  .welcome-panel {
    padding: 25px 26px;
    background: #edf1e9;
  }
  .welcome-panel .brand {
    font-size: 25px;
  }
  .welcome-content,
  .welcome-footer {
    display: none;
  }
  .signin-panel {
    padding: 75px 26px 85px;
    flex: 1;
    min-height: calc(100svh - 92px);
  }
  .signin-content {
    max-width: 380px;
  }
  .signin-badge {
    top: 26px;
    right: 26px;
    font-size: 11px;
  }
  .signin-heading h2 {
    font-size: 29px;
  }
  .signin-footer {
    bottom: 25px;
    font-size: 10px;
  }
  .sidebar {
    position: relative;
    inset: auto;
    width: 100%;
    padding: 17px 20px 0;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr auto;
  }
  .sidebar > .brand {
    margin: 0;
  }
  .workspace-label,
  .nav-label,
  .nav-item:disabled {
    display: none;
  }
  .main-nav {
    grid-row: 2;
    grid-column: 1/-1;
    margin-top: 17px;
  }
  .nav-item.active {
    margin: 0;
    background: transparent;
    padding: 12px 0;
    border-radius: 0;
    border-bottom: 2px solid #6d8455;
    max-width: 160px;
  }
  .nav-count {
    margin-left: 8px;
  }

  .profile {
    border: 0;
    padding: 0;
  }
  .profile > div {
    display: none;
  }
  .avatar {
    width: 29px;
    height: 29px;
  }
  .profile .icon-button {
    margin-left: 7px;
  }
  .workspace-main {
    margin-left: 0;
  }
  .topbar {
    height: 48px;
    padding: 0 20px;
  }
  .breadcrumb {
    font-size: 11px;
  }
  .content-main {
    padding: 27px 17px 20px;
  }
  .page-heading {
    gap: 10px;
    margin-bottom: 24px;
    align-items: center;
  }
  .page-heading h1 {
    font-size: 27px;
  }
  .page-heading p:last-child {
    font-size: 12px;
    max-width: 170px;
    line-height: 1.6;
  }
  .page-heading .eyebrow {
    font-size: 10px;
    letter-spacing: 1.2px;
  }
  .page-heading .button {
    font-size: 12px;
    padding: 9px 11px;
    white-space: nowrap;
  }
  .stats {
    grid-template-columns: 1fr 1fr;
    gap: 21px 0;
    padding: 20px 0;
    margin-bottom: 24px;
  }
  .stat {
    padding: 0 20px;
  }
  .stat:nth-child(2) {
    border-right: 0;
  }
  .stat:nth-child(n + 3) {
    padding-top: 18px;
    border-top: 1px solid var(--border);
  }
  .stat > div {
    flex-direction: row;
    align-items: baseline;
    gap: 9px;
  }
  .stat strong {
    font-size: 26px;
  }
  .stat-caption {
    font-size: 10px;
  }
  .stat > span {
    font-size: 11px;
  }
  .library-toolbar {
    padding: 0 14px;
  }
  .filter-tabs {
    gap: 18px;
    overflow-x: auto;
  }
  .filter-tab {
    font-size: 12px;
    padding-top: 15px;
    padding-bottom: 14px;
  }
  .library-filters {
    padding: 15px 13px;
    gap: 8px;
  }
  .library-filters select {
    padding: 0 5px;
    font-size: 11px;
    max-width: 120px;
  }
  .search-input input {
    font-size: 12px;
  }
  .table-footer {
    padding: 14px;
    font-size: 10px;
  }
  .table-footer > span:last-child {
    display: none;
  }
  .content-footer {
    font-size: 10px;
    line-height: 1.6;
  }
  .skip-link {
    left: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Shared header and sections */
.table-scroll {
  position: relative;
}
.user-menu {
  position: relative;
  z-index: 5;
}
.user-menu summary {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 7px;
  border-radius: 8px;
  list-style: none;
}
.user-menu summary::-webkit-details-marker {
  display: none;
}
.user-menu summary:hover,
.user-menu[open] summary {
  background: #f0f3eb;
}
.user-menu summary:focus-visible {
  outline: 3px solid #b7533980;
  outline-offset: 2px;
}
.header-user strong,
.header-user small {
  display: block;
}
.header-user strong {
  font-size: 13px;
  font-weight: 600;
}
.header-user small {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}
.menu-chevron {
  color: #87947d;
  margin-left: 10px;
}
.user-dropdown {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  width: 205px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: white;
  box-shadow: 0 12px 30px #26392f12;
}
.dropdown-identity {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 5px;
}
.dropdown-identity strong,
.dropdown-identity span {
  display: block;
  font-size: 12px;
}
.dropdown-identity span {
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
}
.user-dropdown a,
.user-dropdown button {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 11px;
  font-size: 13px;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  border-radius: 5px;
}
.user-dropdown a:hover,
.user-dropdown button:hover {
  background: var(--sage);
}
.user-dropdown svg {
  width: 17px;
  height: 17px;
}
.section-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  font-size: 13px;
  color: var(--muted);
  margin: 5px 0 20px;
}
.language-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.language-card {
  padding: 26px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.language-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.language-card h2 {
  font-size: 21px;
  font-weight: 550;
  letter-spacing: -0.5px;
  margin: 23px 0 6px;
}
.language-card > p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.language-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 26px;
  color: var(--muted);
  font-size: 12px;
}
.language-card-footer strong {
  font-weight: 600;
  color: var(--ink);
}
.text-button {
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: #647955;
  font-size: 12px;
  white-space: nowrap;
}
.text-button:hover {
  color: var(--accent);
}
.text-button > span {
  padding-left: 10px;
}
.section-footnote {
  margin-top: 24px;
  font-size: 12px;
  color: #829076;
  line-height: 1.7;
}
.age-list {
  display: grid;
  gap: 15px;
}
.age-card {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 26px;
  border: 1px solid var(--border);
  background: white;
  border-radius: var(--radius);
}
.age-range {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  width: 100px;
  height: 98px;
  border-radius: 8px;
  font:
    27px Georgia,
    serif;
  flex-shrink: 0;
}
.age-range small {
  font:
    9px -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  letter-spacing: 1.5px;
  margin-top: 8px;
}
.age-description {
  flex: 1;
}
.age-description h2 {
  font-size: 18px;
  font-weight: 550;
  margin: 0 0 9px;
}
.age-description p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 13px;
}
.topic-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.topic-tags span {
  font-size: 10px;
  color: #7a876f;
  background: #f4f6ef;
  border: 1px solid #eaf0e0;
  border-radius: 4px;
  padding: 4px 7px;
}

/* Reader search */
.read-heading {
  margin-bottom: 22px;
}
.read-search {
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  margin-bottom: 28px;
}
.read-search-input {
  position: relative;
}
.read-search-input svg {
  position: absolute;
  left: 18px;
  top: 50%;
  width: 25px;
  height: 25px;
  color: #829076;
  transform: translateY(-50%);
}
.read-search-input input {
  width: 100%;
  min-height: 64px;
  padding: 0 130px 0 58px;
  border: 1px solid #dce2d8;
  border-radius: 8px;
  color: var(--ink);
  background: #fbfcf9;
  font-size: 18px;
}
.read-search-input input::placeholder {
  color: #9aa38f;
}
.read-search-input input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}
.read-filter-group {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  min-width: 0;
  padding: 0;
  border: 0;
  margin: 0;
}
.read-filter-group legend {
  float: left;
  width: 90px;
  padding: 8px 0 0;
  color: #64725f;
  font-size: 12px;
  font-weight: 650;
}
.read-filter-options {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 8px;
}
.read-filter-option {
  position: relative;
  cursor: pointer;
}
.read-filter-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.read-filter-option > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid #e1e6dc;
  border-radius: 6px;
  color: #71806b;
  background: #fafbf8;
  font-size: 12px;
}
.read-filter-option input:checked + span {
  border-color: #9aae89;
  color: #526447;
  background: #eaf0e7;
  box-shadow: inset 0 0 0 1px #9aae8933;
}
.read-filter-option input:focus-visible + span {
  outline: 3px solid #b7533980;
  outline-offset: 3px;
}
.translation-playback-modes { margin: 0; padding: 0; border: 0; }
.translation-playback-modes legend { margin-bottom: 9px; font-size: 13px; font-weight: 700; }
.translation-playback-modes > small { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; }
.translation-playback-modes .read-filter-options { flex: none; gap: 6px; }
.translation-playback-mode > span { width: 38px; min-height: 34px; justify-content: center; padding: 4px; }
.translation-playback-mode svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.translation-playback-mode button { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 100px; min-height: 80px; border: 1px solid #a9b3a1; border-radius: 8px; padding: 10px; cursor: pointer; background: #edf2e8; color: #354a2d; }
.translation-playback-mode button[data-state="off"] { background: #f2f2f0; color: #73786e; border-style: dashed; }
.translation-playback-mode button[data-state="audio"], .reading-mode button.natural-available { background: #fff2cc; color: #805917; border-color: #c99b3b; }
.translation-playback-mode button:focus-visible { outline: 2px solid #526b46; outline-offset: 3px; }
.translation-playback-mode small { font-size: 11px; }
.reading-mode button.natural-available[aria-pressed="true"] { background: #e8bd5a; color: #49350e; border-color: #9a701f; }
.reading-context[data-natural="true"] { background: #fff2cc; color: #805917; border-color: #c99b3b; }
.translation-playback-mode input:checked + span svg { stroke-width: 2.5; }
.translation-tts-option { margin: 4px 0 18px; }
.translation-tts-option small { display: block; margin: 3px 0 0 25px; color: var(--muted); }
.language-editor:has([data-use-tts]:checked) .page-controls,
.language-editor:has([data-use-tts]:checked) .emotion-toggle { opacity: .5; }
.read-age-switcher .read-filter-options { flex-wrap: nowrap; gap: 0; overflow-x: auto; padding: 3px; margin: -3px; }
.read-age-switcher .read-filter-option > span { border-radius: 0; }
.read-age-switcher .read-filter-option:first-child > span { border-radius: 7px 0 0 7px; }
.read-age-switcher .read-filter-option:last-child > span { border-radius: 0 7px 7px 0; }
.read-age-switcher .read-filter-option + .read-filter-option > span { margin-left: -1px; }
.read-age-switcher .read-filter-option input:checked + span { position: relative; z-index: 1; }
.read-age-option > span { min-width: 48px; justify-content: center; padding: 5px 10px; }
.read-age-icon { display: grid; place-items: center; color: #7b8973; }
.read-age-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round; }
.read-age-option input:checked + span .read-age-icon { color: #465a3e; }
.read-filter-actions {
  display: flex;
  justify-content: flex-end;
  min-height: 20px;
}
.read-clear-filters {
  padding: 2px 0;
  border: 0;
  color: #7b8874;
  background: transparent;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.read-clear-filters:hover { color: var(--accent); }
.read-clear-filters:focus-visible {
  outline: 2px solid #b7533980;
  outline-offset: 3px;
}
.read-search-button {
  position: absolute;
  top: 8px;
  right: 8px;
  bottom: 8px;
  min-width: 120px;
}
.read-results {
  display: grid;
  gap: 15px;
}
.read-result-card {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 25px;
  padding: 25px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.read-result-card:hover {
  border-color: #cdd8c5;
  box-shadow: 0 6px 18px #45583b0d;
  transform: translateY(-1px);
}
.read-result-main-link:focus-visible {
  outline: 3px solid #b7533980;
  outline-offset: 3px;
}
.read-result-ages {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-shrink: 0;
}
.read-age {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: 100px;
}
.read-age .age-range {
  width: 82px;
  height: 80px;
  font-size: 23px;
}
.read-age strong {
  color: #71806b;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
}
.read-age-missing {
  display: grid;
  place-items: center;
  width: 100px;
  min-height: 80px;
  border-radius: 8px;
  color: #929a87;
  background: #f0f2ed;
  font-size: 11px;
  text-align: center;
}
.read-result-copy {
  flex: 1;
  min-width: 0;
}
.read-result-copy h2 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 19px;
  font-weight: 550;
}
.read-result-copy > p {
  max-width: 850px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}
.read-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin-top: 17px;
}
.read-result-meta > div {
  display: flex;
  align-items: center;
  gap: 10px;
}
.read-result-meta > div > strong {
  color: #8b9583;
  font-size: 10px;
  letter-spacing: .8px;
  text-transform: uppercase;
}
.read-language-flags {
  display: flex;
  align-items: center;
  gap: 6px;
}
.read-language-flag {
  display: inline-block;
  font-size: 22px;
  line-height: 1;
}
.read-language-flag.active:hover {
  transform: translateY(-1px) scale(1.08);
}
.read-language-flag.inactive {
  cursor: default;
  opacity: .62;
}
.read-empty {
  padding: 55px 24px;
  border: 1px dashed #dce2d8;
  border-radius: var(--radius);
  color: #65715e;
  background: white;
  text-align: center;
}
.read-empty strong {
  font-size: 16px;
}
.read-empty p {
  margin: 8px 0 0;
  color: var(--muted);
}
.read-language-dialog {
  width: min(620px, calc(100vw - 34px));
  padding: 32px;
  border: 1px solid #dfe5da;
  border-radius: 12px;
  color: var(--ink);
  background: white;
  box-shadow: 0 22px 70px #2330213d;
}
.read-language-dialog::backdrop {
  background: #26302966;
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}
.read-language-dialog .eyebrow,
.read-language-panel .eyebrow {
  margin-bottom: 10px;
}
.read-language-dialog h2,
.read-language-panel h1 {
  margin: 0;
  font-size: 27px;
  font-weight: 550;
}
.read-dialog-close {
  position: absolute;
  top: 13px;
  right: 15px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #78846d;
  background: #f2f4ef;
  font-size: 23px;
  line-height: 1;
}
.read-dialog-close:hover {
  color: var(--ink);
  background: #e9ede5;
}
.read-language-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 27px;
}
.read-language-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 155px;
  padding: 15px 18px;
  border: 1px solid #e1e6dc;
  border-radius: 8px;
  color: #526447;
  background: #fafbf8;
}
.read-language-choice:hover {
  border-color: #aebda3;
  background: #f1f5ed;
}
.read-language-choice > span {
  font-size: 30px;
  line-height: 1;
}
.read-language-choice strong {
  font-size: 13px;
  font-weight: 600;
}
.read-back-link {
  display: inline-flex;
  margin-bottom: 24px;
  padding: 8px 0;
  color: #647955;
  font-size: 13px;
}
.read-back-link:hover {
  color: var(--accent);
}
.read-language-panel {
  max-width: 760px;
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
}
@media (max-width: 760px) {
  .read-search { padding: 18px; }
  .read-search-input input { padding-right: 105px; }
  .read-search-button { min-width: 96px; }
  .read-filter-group { display: block; }
  .read-filter-group legend { float: none; width: auto; padding: 0 0 9px; }
  .read-result-card { flex-direction: column; }
  .read-result-ages { flex-wrap: wrap; }
  .reading-experience { height: calc(100dvh - 160px); min-height: 430px; padding: 18px; }
  .reading-stories { gap: 4px; margin-bottom: 17px; }
  .reading-heading-actions { gap: 7px; }
  .reading-contents-open span { display: none; }
}




.simple-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  gap: 10px;
}
.simple-panel-heading h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 550;
}
.simple-panel-heading > span {
  font-size: 12px;
  color: var(--muted);
}



.profile-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  max-width: 980px;
}
.account-card,
.password-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.account-card {
  text-align: center;
}
.large-avatar {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 50%;
  font:
    27px Georgia,
    serif;
  background: #e8e0d1;
  color: #786a54;
}
.account-card h2 {
  font-size: 19px;
  font-weight: 550;
  margin: 0 0 8px;
}
.account-card > p {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 14px;
}
.account-card dl {
  text-align: left;
  margin: 28px 0;
  border-top: 1px solid var(--border);
}
.account-card dl > div {
  padding-top: 17px;
}
.account-card dt {
  font-size: 11px;
  color: var(--muted);
}
.account-card dd {
  margin: 6px 0 0;
  font-size: 13px;
}
.account-card .button {
  width: 100%;
}
.account-card .button svg {
  width: 17px;
  height: 17px;
}
.password-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 550;
}
.password-card > p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
}
.form-notice {
  background: #f7f1e5;
  padding: 12px;
  border-radius: 6px;
  color: #967b42;
  font-size: 12px;
  line-height: 1.6;
  margin-top: 22px;
}
.password-card .login-form {
  margin-top: 24px;
}
.password-card input {
  margin-bottom: 20px;
}
.password-card .button {
  margin-top: 4px;
}
@media (max-width: 1000px) {
  .profile-grid {
    grid-template-columns: 1fr;
    max-width: 600px;
  }
  .account-card {
    text-align: left;
    display: grid;
    grid-template-columns: 65px 1fr;
    gap: 0 20px;
    align-items: center;
  }
  .account-card .large-avatar {
    grid-row: 1 / 4;
    margin: 0;
  }
  .account-card h2,
  .account-card > p {
    margin: 0;
  }
  .account-card > .status {
    justify-self: start;
    margin-top: 7px;
  }
  .account-card dl {
    grid-column: 1/-1;
    display: flex;
    gap: 40px;
    margin: 20px 0;
  }
  .account-card form {
    grid-column: 1/-1;
  }
  .language-card {
    padding: 22px;
  }
  .language-card-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
  .age-card {
    flex-wrap: wrap;
    gap: 17px;
  }
  .age-range {
    width: 80px;
    height: 90px;
  }
  .age-card > .text-button {
    margin-left: 97px;
  }
}
@media (max-width: 650px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 88px;
    padding: 20px 6px;
    display: flex;
    border-right: 1px solid var(--border);
    border-bottom: 0;
  }
  .sidebar > .brand {
    align-self: center;
  }
  .sidebar > .brand > span:last-child {
    display: none;
  }
  .main-nav {
    display: flex;
    flex-direction: column;
    margin-top: 30px;
    gap: 8px;
  }
  .nav-item,
  .nav-item.active {
    width: 100%;
    max-width: none;
    min-height: 62px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding: 10px 3px;
    font-size: 11px;
    border: 0;
    border-radius: 6px;
    margin: 0;
  }
  .nav-item.active {
    background: #e6ecdf;
  }
  .nav-item svg {
    width: 19px;
    height: 19px;
  }
  .model-server {
    padding: 14px 4px 4px;
    margin-bottom: 0;
    text-align: center;
  }
  .gpu-stats { margin-bottom: 12px; }
  .gpu-stat-heading {
    display: block;
    font-size: 9px;
  }
  .gpu-stat-heading strong { display: none; }
  .gpu-memory-bar { height: 6px; }
  .model-server-state {
    justify-content: center;
  }
  .model-server-state > span:last-child,
  .model-server > p {
    display: none;
  }
  .model-server-actions { flex-wrap: wrap; justify-content: center; }
  .model-server-actions > .button {
    padding: 6px 2px;
    font-size: 10px;
  }
  .model-server > [data-model-cache-message]:not([hidden]) { display: block; overflow-wrap: anywhere; }
  .workspace-main {
    margin-left: 88px;
    min-width: 0;
  }
  .topbar {
    height: 74px;
    padding: 0 12px;
    justify-content: flex-end;
  }
  .breadcrumb {
    display: none;
  }
  .header-user small {
    font-size: 10px;
  }
  .user-menu summary {
    padding: 5px;
  }
  .content-main {
    padding: 25px 13px;
  }
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
  .page-heading h1 {
    font-size: 25px;
  }
  .page-heading .eyebrow {
    font-size: 9px;
  }
  .page-heading p:last-child {
    max-width: none;
    font-size: 12px;
  }
  .page-heading .button {
    margin: 0;
    font-size: 12px;
  }
  .stat {
    padding: 0 12px;
  }
  .stat > div {
    flex-direction: column;
    gap: 4px;
  }
  .stat > span {
    font-size: 11px;
  }
  .stat-caption {
    font-size: 10px;
  }
  .library-toolbar {
    overflow: hidden;
  }
  .filter-tabs {
    gap: 18px;
  }
  .filter-tab {
    font-size: 12px;
  }
  .library-filters {
    flex-direction: column;
  }
  .library-filters select {
    max-width: none;
    width: 100%;
    font-size: 12px;
    padding: 0 10px;
  }
  .search-input input {
    font-size: 12px;
  }
  .section-intro {
    align-items: flex-start;
    flex-direction: column;
    font-size: 12px;
  }
  .language-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .language-card {
    padding: 20px;
  }
  .language-card-footer {
    flex-direction: row;
    align-items: center;
  }
  .text-button {
    font-size: 11px;
  }
  .text-button > span {
    padding-left: 3px;
  }
  .age-card {
    padding: 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }
  .age-range {
    width: 100%;
    height: 75px;
    flex-direction: row;
    gap: 10px;
  }
  .age-range small {
    margin-top: 4px;
  }
  .age-card > .text-button {
    margin: 0;
  }




  .simple-panel-heading {
    padding: 18px;
    align-items: flex-start;
    flex-direction: column;
  }
  .simple-panel-heading > span {
    font-size: 11px;
  }
  .account-card,
  .password-card {
    padding: 20px;
  }
  .account-card {
    display: block;
    text-align: center;
  }
  .account-card .large-avatar {
    margin: 0 auto 15px;
  }
  .account-card > p {
    margin-top: 8px;
  }
  .account-card dl {
    display: block;
  }
  .password-card h2 {
    font-size: 18px;
  }
  .form-notice {
    padding: 10px;
    font-size: 11px;
  }
  .content-footer {
    flex-direction: column;
    font-size: 10px;
  }
}

/* Database-backed lesson preparation */
.wrap-cell {
  white-space: normal;
  min-width: 130px;
  line-height: 1.7;
}
.variant-badge {
  display: inline-block;
  background: #eff3e8;
  color: #61734e;
  padding: 3px 7px;
  border-radius: 4px;
  margin: 2px;
  font-size: 11px;
}
.muted {
  color: var(--muted);
}
.library-filters {
  flex-wrap: wrap;
}
.lesson-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}
.variant-panel {
  margin: 20px 0;
}

.page-heading h1 {
  overflow-wrap: anywhere;
}
.header-user {
  min-width: 0;
}
.header-user strong {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 650px) {
  .header-user strong {
    max-width: 140px;
  }
}
.page-heading > div { min-width: 0; max-width: 100%; }

/* Lesson authoring: empty language blocks stay in the browser until saved. */
.primary-language-form, .editor-heading, .editor-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.primary-language-form { margin: 24px 0 32px; }
.primary-language-form label { font-weight: 600; font-size: 13px; }
.primary-language-form select {
  padding: 10px 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: inherit;
  font: inherit;
  max-width: 100%;
}
.editor-heading { justify-content: space-between; margin-bottom: 16px; }
.editor-heading h2 { font-size: 18px; margin: 0; }
.add-language { position: relative; }
.add-language summary { list-style: none; cursor: pointer; }
.add-language summary::-webkit-details-marker { display: none; }
.language-choices {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 5;
  width: 220px; padding: 8px; border: 1px solid var(--border);
  border-radius: 8px; background: white; box-shadow: 0 8px 24px #23332614;
}
.language-choices button {
  display: block; width: 100%; padding: 12px; text-align: left;
  background: none; border: 0; border-radius: 5px; font: inherit; color: inherit; cursor: pointer;
}
.language-choices button:hover { background: #f0f3ec; }
.language-choices p { padding: 8px; font-size: 13px; }
.language-block { margin-bottom: 16px; overflow: hidden; }
.language-block > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 22px 24px; cursor: pointer; list-style: none;
}
.language-block > summary::-webkit-details-marker { display: none; }
.block-language { display: flex; gap: 14px; align-items: center; min-width: 0; }
.block-language strong { font-size: 17px; overflow-wrap: anywhere; }
.block-language small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.language-flag { font-size: 27px; }
.block-state { color: var(--muted); font-size: 12px; text-align: right; }
.language-editor { padding: 24px; border-top: 1px solid var(--border); }
.editor-fields label, .editor-page-title { font-size: 13px; font-weight: 600; }
.editor-fields label { display: block; }
.editor-fields input, .language-editor textarea {
  display: block; width: 100%; margin: 9px 0 20px; padding: 12px 14px;
  color: inherit; font: inherit; font-weight: 400; line-height: 1.6;
  background: white; border: 1px solid var(--border); border-radius: 6px;
}
.language-editor textarea { resize: vertical; }
.editor-fields input:focus, .language-editor textarea:focus { outline: 2px solid #b8c6a9; outline-offset: 2px; }
.editor-pages-heading { padding-top: 8px; }
.editor-pages-heading h3 { font-size: 15px; margin: 0; }
.editor-pages-heading p { color: var(--muted); font-size: 12px; line-height: 1.6; margin-bottom: 12px; }
.editor-page-tabs { display: flex; align-items: flex-end; gap: 6px; max-width: 100%; margin-bottom: 12px; padding: 2px 1px; overflow-x: auto; scrollbar-width: thin; }
.editor-page-tab { flex: 0 0 auto; min-width: 66px; padding: 8px 12px; border: 1px solid #cfd5cc; border-radius: 7px 7px 3px 3px; background: #dce0d9; color: #4d584a; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.editor-page-tab[data-page-state=generated] { border-color: #60864d; background: #6a9154; color: white; }
.editor-page-tab[data-page-state=running] { border-color: #b58b16; background: #d7a929; color: #342b12; }
.editor-page-tab[data-page-state=error] { border-color: #a83e30; background: #bd4a39; color: white; }
.editor-page-tab[aria-selected=true] { box-shadow: 0 3px 0 var(--ink); transform: translateY(-2px); }
.editor-page-tab:hover { filter: brightness(.96); }
.editor-page-tab:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.editor-page { margin-bottom: 24px; padding: 14px; border: 1px solid #dce0d9; border-radius: 9px; background: #f4f5f2; transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease; }
.editor-page[hidden] { display: none; }
.editor-page[data-page-state=generated] { border-color: #bdd3b3; background: #f0f6ec; }
.editor-page[data-page-state=running] { border-color: #e1c46e; background: #fff8df; }
.editor-page[data-page-state=error] { border-color: #e4b8af; background: #fcf0ed; }
.editor-page:target { box-shadow: 0 0 0 3px rgb(116 135 99 / 28%); }
.editor-page-title { display: flex; align-items: center; gap: 7px; }
.emotion-toggle {
  display: grid; place-items: center; width: 27px; height: 27px; padding: 0;
  border: 1px solid transparent; border-radius: 50%; background: transparent;
  color: var(--muted); font: 18px/1 sans-serif; cursor: pointer;
}
.emotion-toggle:hover, .emotion-toggle[aria-expanded=true] { background: #edf1e8; border-color: var(--border); color: var(--ink); }
.emotion-toggle:focus-visible, .emotion-option:focus-visible { outline: 2px solid #8ea27e; outline-offset: 2px; }
.emotion-panel {
  display: flex; align-items: center; gap: 5px; max-width: 100%; overflow-x: auto;
  margin: 7px 0 2px; padding: 8px; border: 1px solid var(--border); border-radius: 7px;
  background: #f8faf6; scrollbar-width: thin;
}
.emotion-option {
  display: grid; place-items: center; flex: 0 0 35px; width: 35px; height: 35px; padding: 0;
  border: 1px solid transparent; border-radius: 6px; background: transparent;
  font: 20px/1 sans-serif; cursor: pointer;
}
.emotion-option:hover { border-color: #cbd5c3; background: white; transform: translateY(-1px); }
.emotion-hint {
  position: fixed; z-index: 1000; max-width: min(240px, calc(100vw - 16px));
  padding: 6px 9px; border-radius: 5px; background: #20332d; color: white;
  font-size: 12px; font-weight: 500; line-height: 1.35; pointer-events: none;
}
.editor-page textarea { font: 18px/1.8 Georgia, serif; margin-bottom: 8px; }
.editor-page small { font-size: 11px; }
.editor-actions { justify-content: space-between; padding-top: 12px; }
.editor-notice { background: #edf3e6; color: #4c6638; border-radius: 6px; padding: 14px; }
[hidden] { display: none !important; }
@media (max-width: 650px) {
  .language-block > summary, .language-editor { padding: 16px; }
  .primary-language-form { align-items: stretch; flex-direction: column; }
  .editor-actions { align-items: stretch; flex-direction: column; }
  .editor-heading { align-items: flex-start; }
  .language-flag { font-size: 23px; }
  .block-language { gap: 8px; }
}

/* Keep the selected language visible while scrolling through long pages. */
.content-main.has-language-rail { padding-right: 92px; }
.language-rail {
  position: fixed;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: calc(100dvh - 120px);
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 30px;
  background: #fffffff2;
  box-shadow: 0 4px 20px #2333260d;
}
.language-rail button {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.language-rail .language-flag {
  font-size: 22px;
  line-height: 1;
  filter: grayscale(1);
  opacity: .5;
  transition: transform .15s, filter .15s, opacity .15s;
}
.language-rail button[aria-pressed="true"] {
  background: #edf3e6;
  border-color: #cbd8bd;
}
.language-rail button[aria-pressed="true"] .language-flag {
  filter: none;
  opacity: 1;
  transform: scale(1.3);
}
.language-rail button:hover { background: #f0f3ec; }
.language-rail button:focus-visible { outline: 2px solid #63744f; outline-offset: 1px; }
.language-block { scroll-margin-top: 20px; }
@media (max-width: 650px) {
  .content-main.has-language-rail { padding-right: 62px; }
  .language-rail { right: 5px; padding: 4px; gap: 4px; }
  .language-rail button { width: 36px; height: 40px; }
  .language-rail .language-flag { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .language-rail .language-flag { transition: none; }
}
@media (max-width: 650px) {
  .has-language-rail .language-block > summary { flex-wrap: wrap; }
  .has-language-rail .block-language { flex: 1 1 140px; }
  .has-language-rail .block-state { margin-left: auto; }
}

.add-language-panel { padding: 24px; margin-top: 28px; max-width: 720px; }
.add-language-panel h2 { margin-top: 0; font-size: 20px; }
.add-language-panel > p { font-size: 13px; line-height: 1.6; }
.language-management-form { display: grid; gap: 16px; margin-top: 20px; }
.language-management-form label { display: grid; gap: 8px; font-size: 13px; font-weight: 600; }
.language-management-form input:not([type=checkbox]):not([type=hidden]) {
  width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 6px; font: inherit; color: inherit; background: white;
}
.language-management-form .language-checkbox { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; line-height: 1.5; }
.language-checkbox input { margin-top: 3px; accent-color: #63744f; }
.language-card .language-flag { font-size: 32px; }
.language-settings { margin-top: 18px; }
.language-settings summary { cursor: pointer; }
.interface-state { font-size: 12px; }
.delete-language-form { margin-top: 16px; }
.delete-language { color: #af4937; }

.lesson-table .reorder-cell { width: 44px; padding: 8px; }
.reorder-handle {
  width: 36px; height: 40px; padding: 0; border: 0; border-radius: 5px;
  background: transparent; color: #8b9788; font-size: 26px; cursor: grab;
}
.reorder-handle:hover, .reorder-handle:focus-visible { background: #eaf0e4; color: #42543b; }
.reorder-handle:active { cursor: grabbing; }
.reorder-handle:disabled { cursor: wait; opacity: .4; }
.lesson-table tr.dragging { opacity: .45; }
.lesson-table tr.drop-before td { box-shadow: inset 0 3px #71865d; }
.lesson-table tr.drop-after td { box-shadow: inset 0 -3px #71865d; }
#order-status { font-size: 12px; }
.lesson-table[data-order-csrf] th:first-child { width: 44px; padding: 8px; }
.lesson-table[data-order-csrf] th:nth-child(2) { width: 39%; }
.lesson-table[data-order-csrf] td.reorder-cell { padding: 8px; }

.settings-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px; border-bottom: 1px solid var(--border); }
.settings-tabs a { padding: 12px 16px; color: var(--muted); border-bottom: 3px solid transparent; }
.settings-tabs a[aria-current=page] { color: #42543b; border-bottom-color: #71865d; }
.settings-help { color: var(--muted); line-height: 1.7; font-size: 13px; max-width: 850px; }
.model-type-tabs { display: flex; gap: 6px; margin-top: 22px; border-bottom: 1px solid var(--border); }
.model-type-tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.model-type-tab span { min-width: 20px; padding: 2px 6px; border-radius: 10px; background: #e8ece5; color: #61705c; font-size: 10px; text-align: center; }
.model-type-tab[aria-selected=true] { border-bottom-color: #71865d; color: #42543b; }
.model-type-tab[aria-selected=true] span { background: #71865d; color: white; }
.model-type-tab:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.model-type-panel[hidden] { display: none; }
.model-type-empty { grid-column: 1 / -1; padding: 22px 4px; }
.settings-records { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; margin: 24px 0; align-items: start; }
.settings-record { position: relative; padding: 24px; max-width: 850px; }
.settings-record-open { position: absolute; inset: 0; z-index: 1; padding: 0; border: 0; border-radius: inherit; background: transparent; cursor: pointer; }
.settings-record-open:hover { background: rgb(101 126 83 / 5%); }
.settings-record-open:focus-visible { outline: 3px solid #71865d; outline-offset: 3px; }
.settings-record h2, .settings-record h3 { margin: 0 0 12px; overflow-wrap: anywhere; }
.settings-record h3 { font-size: 18px; }
.settings-record > p { font-size: 13px; line-height: 1.6; }
.settings-record summary { cursor: pointer; margin-top: 20px; }
.settings-record-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.settings-record-heading h3 { margin-bottom: 8px; }
.settings-record-heading p { margin: 0; font-size: 13px; line-height: 1.6; }
.model-state { flex: none; padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; letter-spacing: .3px; }
.model-state.enabled { color: #567044; background: #eaf1e4; }
.model-state.disabled { color: #7f8878; background: #ecefeb; }
.model-record[data-enabled=false] { background: #f8f9f6; }
.settings-form { display: grid; gap: 18px; margin-top: 24px; }
.settings-form label { display: grid; gap: 8px; font-size: 13px; font-weight: 600; }
.settings-form input:not([type=hidden]), .settings-form select, .settings-form textarea {
  width: 100%; min-width: 0; padding: 12px; border: 1px solid var(--border); border-radius: 6px; background: white; color: inherit; font: inherit;
}
.settings-form textarea { font: 12px/1.7 monospace; resize: vertical; }
.settings-form .settings-checkbox { grid-template-columns: auto 1fr; align-items: center; column-gap: 10px; }
.settings-form .settings-checkbox input { width: 18px; height: 18px; margin: 0; }
.settings-form .settings-checkbox small { grid-column: 2; color: var(--muted); font-weight: 400; line-height: 1.5; }
.settings-record-dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid #dce4d7; border-radius: 12px; color: var(--ink); background: #fcfdfb; box-shadow: 0 18px 60px rgb(29 43 32 / 24%); overflow: auto; }
.settings-record-dialog[open] { display: block; }
.settings-record-dialog::backdrop { background: rgb(30 44 35 / 42%); }
.settings-record-dialog .settings-form { margin: 0; padding: 0 26px 26px; }
.settings-record-dialog > .form-error { margin: 0 26px 20px; }
.settings-dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 24px 26px 18px; border-bottom: 1px solid var(--border); }
.settings-dialog-heading h2 { margin: 3px 0 0; }
.settings-dialog-heading .eyebrow { margin: 0; }
.settings-dialog-close { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: white; color: var(--muted); font: 24px/1 sans-serif; cursor: pointer; }
.settings-dialog-close:hover { color: var(--ink); background: #f0f3ec; }
.settings-dialog-close:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.settings-dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 4px; }
.settings-dialog-primary-actions { display: flex; justify-content: flex-end; gap: 10px; }
.lesson-heading-actions { display: flex; align-items: center; gap: 12px; }
.lesson-settings-form fieldset { margin: 0; padding: 0; border: 0; }
.lesson-settings-form legend { margin-bottom: 9px; font-size: 13px; font-weight: 700; }
.lesson-setting-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 16px; padding: 13px; border: 1px solid var(--border); border-radius: 7px; background: #f7f9f5; }
.lesson-setting-choices .settings-checkbox { display: flex; }
.lesson-settings-form .contents-metadata-settings { display: grid; gap: 14px; margin-top: 4px; padding: 18px; border: 1px solid var(--border); border-radius: 9px; background: #f7f9f5; }
.contents-metadata-settings > .muted { margin: -5px 0 0; font-size: 12px; }
.contents-metadata-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(120px, 1fr); gap: 12px; }
.contents-cover-editor { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center; gap: 16px; padding-top: 2px; }
.contents-cover-editor img, .contents-cover-placeholder { width: 120px; height: 150px; border: 1px solid var(--border); border-radius: 8px; object-fit: cover; background: white; }
.contents-cover-placeholder { display: grid; place-items: center; padding: 12px; color: var(--muted); font-size: 11px; text-align: center; }
.contents-cover-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.contents-cover-actions small { flex-basis: 100%; color: var(--muted); font-size: 12px; }
.contents-cover-actions small.is-error { color: #af4937; }
@media (max-width: 560px) { .lesson-setting-choices { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .contents-metadata-grid { grid-template-columns: minmax(0, 1fr); } }
.configuration-editor { display: grid; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: #f7f9f5; }
.configuration-panel { display: grid; gap: 16px; }
.configuration-panel[hidden], .configuration-field[hidden] { display: none; }
.configuration-panel h3 { margin: 0; font-size: 15px; }
.configuration-field small { color: var(--muted); font-weight: 400; line-height: 1.45; }
.configuration-empty { margin: 0; }
.voice-language-settings { display: grid; gap: 14px; padding-top: 6px; }
.voice-language-settings-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.voice-language-settings-heading h3 { margin: 0 0 5px; font-size: 15px; }
.voice-language-settings-heading p { margin: 0; font-size: 12px; }
.voice-language-add { display: flex; align-items: stretch; gap: 8px; }
.voice-language-add select { min-width: 190px; }
.voice-language-config-list { display: grid; gap: 9px; }
.voice-language-config { overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: #f7f9f5; }
.voice-language-config > summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0; padding: 13px 15px; list-style: none; cursor: pointer; }
.voice-language-config > summary::-webkit-details-marker { display: none; }
.voice-language-title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.voice-language-title strong { display: block; font-size: 14px; }
.voice-language-title small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 500; text-transform: uppercase; }
.voice-language-chevron { color: var(--muted); font-size: 18px; transition: transform .15s ease; }
.voice-language-config[open] .voice-language-chevron { transform: rotate(180deg); }
.voice-language-config-body { display: grid; gap: 13px; padding: 0 14px 14px; border-top: 1px solid var(--border); }
.voice-language-config-body .configuration-editor { margin-top: 14px; background: white; }
.voice-language-remove { justify-self: start; }
.audio-toolbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 20px 0; padding: 18px 20px; border: 1px solid var(--border); border-radius: 8px; background: white;
}
.audio-toolbar strong { font-size: 14px; }
.audio-toolbar p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.audio-toolbar .audio-feedback { flex-basis: 100%; color: #526742; overflow-wrap: anywhere; }
.audio-feedback:empty { display: none; }
.audio-split { display: flex; align-items: stretch; }
.audio-split > button { border-radius: 6px 0 0 6px; }
.audio-profile-picker { position: relative; }
.audio-profile-picker > summary { border-radius: 0 6px 6px 0; border-left: 1px solid #ffffff55; list-style: none; cursor: pointer; height: 100%; }
.audio-profile-picker > summary::-webkit-details-marker { display: none; }
.audio-profile-picker[data-disabled=true] > summary { opacity: .45; cursor: not-allowed; }
.audio-profile-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 25; width: 280px; max-width: 65vw; max-height: 320px; overflow-y: auto;
  padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: white; box-shadow: 0 8px 24px #23332614;
}
.audio-profile-menu button { display: block; width: 100%; text-align: left; padding: 12px; background: white; border: 0; border-radius: 5px; color: inherit; cursor: pointer; }
.audio-profile-menu button:hover { background: #f0f3ec; }
.audio-profile-menu small { display: block; margin-top: 6px; color: var(--muted); }
.audio-profile-menu a { display: block; padding: 12px; font-size: 12px; }
.audio-toolbar button:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 800px) {
  .settings-records { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 650px) {
  .settings-record { padding: 16px; }
  .settings-tabs a { padding: 10px 8px; font-size: 12px; }
  .model-type-tab { flex: 1; justify-content: center; padding: 10px 8px; }
  .settings-record-dialog .settings-form { padding: 0 18px 20px; }
  .settings-dialog-heading { padding: 20px 18px 16px; }
  .settings-record-dialog > .form-error { margin: 0 18px 18px; }
  .voice-language-add { width: 100%; flex-wrap: wrap; }
  .voice-language-add select { flex: 1; min-width: 150px; }
  .audio-toolbar { padding: 14px; }
  .audio-split > button { padding: 10px; font-size: 12px; }
  .audio-profile-picker > summary { padding: 10px; }
}

.generation-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex: 1; flex-wrap: wrap; }
.timings-controls { min-width: 0; }
.timings-controls .audio-profile-picker > summary { border-radius: 0 6px 6px 0; }
.timings-controls p { overflow-wrap: anywhere; }
.generation-options { position: relative; }
.generation-options > summary { list-style: none; cursor: pointer; }
.generation-options > summary::-webkit-details-marker { display: none; }
.generation-options-toggle { min-height: 42px; padding: 9px 12px; border: 1px solid var(--border); background: #f7f9f5; color: var(--muted); font-size: 11px; }
.generation-options-toggle:hover, .generation-options[open] > .generation-options-toggle { background: #edf1e8; color: var(--ink); }
.generation-options-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 25; display: grid; gap: 12px; width: 285px; padding: 15px; border: 1px solid var(--border); border-radius: 8px; background: white; box-shadow: 0 8px 24px #23332614; }
.generation-options-menu strong { font-size: 12px; }
.publish-lesson-button { min-height: 46px; margin-left: auto; border-color: #3978bd; background: #3978bd; color: white; box-shadow: 0 2px 3px #245b9218; }
.publish-lesson-button:hover:not(:disabled) { border-color: #2e659f; background: #2e659f; }
.publish-lesson-button:disabled { border-color: #9eb6cf; background: #9eb6cf; color: white; }
.generation-worker-controls { display: inline-flex; align-items: center; gap: 9px; padding: 4px 5px 4px 11px; border: 1px solid #dce5d7; border-radius: 8px; background: #f7faf5; }
.generation-worker-controls[hidden] { display: none; }
.generation-worker-status { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.generation-worker-dot { width: 8px; height: 8px; border-radius: 50%; background: #aeb5ab; box-shadow: 0 0 0 3px #aeb5ab20; }
.generation-worker-status[data-state=active] { color: #526742; }
.generation-worker-status[data-state=active] .generation-worker-dot { background: #6a9154; box-shadow: 0 0 0 3px #6a915433; animation: generation-worker-pulse 1.3s ease-in-out infinite; }
.generation-worker-status[data-state=stopping] { color: #936f13; }
.generation-worker-status[data-state=stopping] .generation-worker-dot { background: #d7a929; box-shadow: 0 0 0 3px #d7a92933; }
.generation-stop-button { min-height: 34px; padding: 7px 12px; }
@keyframes generation-worker-pulse { 50% { opacity: .45; transform: scale(.85); } }

.page-controls { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.page-play { display: grid; place-items: center; flex: 0 0 30px; width: 30px; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: #edf1e8; color: var(--ink); cursor: pointer; font-size: 11px; }
.page-play:disabled { opacity: .35; cursor: not-allowed; }
.timings-tune { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: #f7f8f4; color: #536647; cursor: pointer; }
.timings-tune svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.timings-tune:hover:not(:disabled) { background: #e8efdf; }
.timings-tune:disabled { opacity: .3; cursor: not-allowed; }
.page-audio-upload { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 15px; background: #f7f8f4; color: #536647; font: inherit; font-size: 10px; font-weight: 700; cursor: pointer; }
.page-audio-upload svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.page-audio-upload:hover:not(:disabled) { background: #e8efdf; }
.page-audio-upload:disabled { opacity: .35; cursor: not-allowed; }
[data-playback-error]:empty { display: none; }
[data-playback-error] { color: #b95239; font-size: 12px; }
[data-upload-feedback]:empty { display: none; }
[data-upload-feedback] { color: #587248; font-size: 12px; }
[data-upload-feedback].is-error { color: #b95239; }

.generation-progress { flex-basis: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.generation-progress[hidden] { display: none; }
.generation-progress-heading { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12px; margin-bottom: 9px; }
.generation-progress-language { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.generation-progress-language > small { color: var(--muted); font-size: 10px; flex: 0 0 40px; overflow-wrap: anywhere; }
.generation-segments { display: flex; flex: 1; flex-wrap: wrap; gap: 4px; min-width: 0; }
.generation-page-status { display: inline-flex; align-items: center; gap: 2px; flex: 0 0 20px; min-width: 20px; }
.generation-segment { position: relative; flex: 0 0 8px; width: 8px; min-width: 8px; height: 8px; padding: 0; border: 0; border-radius: 4px; background: #dce0d9; cursor: pointer; }
.generation-segment[data-auto-aligned=true]::after { content: "✦"; position: absolute; right: -3px; top: -8px; color: #486b3c; font-size: 8px; line-height: 1; pointer-events: none; }
.generation-segment[data-state=generated] { background: #6a9154; }
.generation-segment[data-state=running] { background: #d7a929; outline: 1px solid #b58b16; outline-offset: 1px; }
.generation-segment[data-state=error] { background: #bd4a39; }
.generation-segment.selected { outline: 2px solid var(--ink); outline-offset: 2px; transform: scaleY(1.35); }
.generation-segment:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.generation-segment:disabled { cursor: wait; }
.generation-page-link { flex: 0 0 10px; color: #73806d; font-size: 9px; line-height: 1; text-align: center; text-decoration: none; }
.generation-page-link:hover, .generation-page-link:focus-visible { color: var(--ink); transform: scale(1.15); }
.generation-selection-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 10px 48px; }
.generation-selection-controls small { color: var(--muted); }
.generation-selection-button { padding: 3px 7px; border: 1px solid var(--border); border-radius: 4px; background: #f7f8f4; color: var(--ink); font: inherit; font-size: 10px; cursor: pointer; }
.generation-selection-button:hover:not(:disabled) { background: #edf1e8; }
.generation-selection-button:disabled { opacity: .45; cursor: default; }
.progress-error-label { color: #b13c2d; }
@media (max-width: 650px) { .generation-progress { grid-template-columns: minmax(0, 1fr); gap: 16px; } }
.audio-toolbar .audio-feedback.is-error { color: #b13c2d; }

.voice-playground { max-width: 900px; padding: 28px; overflow: visible; }
.voice-playground-form { display: grid; gap: 22px; }
.voice-playground-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.voice-playground-form label { display: grid; gap: 8px; font-size: 13px; font-weight: 600; }
.voice-playground-form select, .voice-playground-form textarea {
  width: 100%; min-width: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 6px;
  background: white; color: inherit; font: inherit;
}
.voice-playground-form textarea { min-height: 190px; line-height: 1.65; resize: vertical; }
.voice-playground-form select:focus, .voice-playground-form textarea:focus { outline: 2px solid #b8c6a9; outline-offset: 2px; }
.voice-playground-generation { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding-top: 2px; }
.voice-playground-progress { display: flex; align-items: center; gap: 16px; min-width: 220px; flex: 1; }
.voice-playground-progress > div { display: grid; gap: 4px; min-width: 120px; }
.voice-playground-progress small { color: var(--muted); font-size: 11px; }
.voice-playground-segment { flex: 1; max-width: 360px; height: 9px; cursor: default; }
.voice-playground-feedback { margin: -7px 0 0; color: #526742; overflow-wrap: anywhere; }
.voice-playground-feedback:empty { display: none; }
.voice-playground-feedback.is-error { color: #b13c2d; }
.voice-playground-audio { width: 100%; margin-top: -3px; }
@media (max-width: 680px) {
  .voice-playground { padding: 20px; }
  .voice-playground-fields { grid-template-columns: 1fr; }
  .voice-playground-generation { align-items: stretch; flex-direction: column; }
  .voice-playground-progress { width: 100%; }
  .voice-playground-segment { max-width: none; }
}

.progress-toggle { position: relative; display: grid; place-items: center; width: 34px; height: 34px; margin-top: 4px; padding: 0; border: 1px solid transparent; border-radius: 50%; color: #929b90; background: transparent; cursor: pointer; }
.progress-toggle:hover, .progress-toggle[aria-expanded=true] { background: #edf1e8; border-color: var(--border); }
.progress-toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.progress-icon-ring { fill: none; stroke: currentColor; stroke-width: 1.6; }
.progress-icon-half, .progress-icon-check { display: none; }
.progress-toggle[data-state=partial], .progress-toggle[data-state=complete] { color: #6a9154; }
.progress-toggle[data-state=partial] .progress-icon-half { display: block; fill: currentColor; }
.progress-toggle[data-state=complete] .progress-icon-ring { fill: currentColor; }
.progress-toggle[data-state=complete] .progress-icon-check { display: block; fill: none; stroke: white; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.progress-icon-error { position: absolute; top: -1px; right: -2px; width: 13px; height: 13px; border-radius: 50%; background: #b13c2d; color: white; font-size: 10px; line-height: 13px; text-align: center; }

.audio-generation-controls { display: flex; align-items: center; }
.auto-cache-option { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; }
.auto-cache-option input { width: 14px; height: 14px; margin: 0; }

.timing-dialog { width: min(1280px, calc(100vw - 32px)); max-width: 1280px; height: min(880px, calc(100dvh - 32px)); max-height: calc(100dvh - 32px); padding: 26px; border: 1px solid #dce4d7; border-radius: 12px; color: var(--ink); background: #fcfdfb; }
.timing-dialog[open] { display: flex; flex-direction: column; gap: 18px; }
.timing-dialog::backdrop { background: rgb(30 44 35 / 42%); }
.timing-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.timing-toolbar label { display: flex; align-items: center; gap: 7px; }
.timing-zoom { display: flex; align-items: center; gap: 7px; }
.timing-zoom output { min-width: 30px; color: var(--ink); font-variant-numeric: tabular-nums; }
.timing-wave-viewport { flex: 0 0 250px; overflow-x: auto; overflow-y: hidden; border: 1px solid var(--border); border-radius: 8px; background: #f8faf6; cursor: zoom-in; }
.timing-wave-stage { --segment-height: 38px; position: relative; width: 100%; min-width: 100%; height: 248px; user-select: none; }
.timing-wave-stage canvas { display: block; width: 100%; height: 190px; }
.timing-wave-segments { position: absolute; inset: 190px 0 0; }
.timing-wave-segment { position: absolute; top: 7px; height: 27px; min-width: 2px; padding: 0; border: 0; border-top: 3px solid #9ca899; border-left: 1px solid #bcc6b8; border-right: 1px solid #bcc6b8; background: rgb(220 228 215 / 46%); cursor: grab; touch-action: none; }
.timing-wave-segment:hover, .timing-wave-segment.selected { border-color: #526a49; border-top-color: #526a49; background: rgb(181 198 156 / 52%); z-index: 2; }
.timing-wave-segment:focus-visible { outline: 2px solid #748763; outline-offset: 2px; }
.timing-selection-range { pointer-events: none; position: absolute; top: 0; bottom: 20px; border: 1px solid rgb(74 101 64 / 72%); border-top-width: 3px; background: rgb(181 198 156 / 12%); z-index: 3; }
.timing-selection-range [data-timing-handle] { pointer-events: auto; position: absolute; top: -7px; bottom: -7px; width: 13px; padding: 0; border: 0; background: transparent; cursor: ew-resize; touch-action: none; }
.timing-selection-range [data-timing-handle]::after { content: ""; position: absolute; top: 0; bottom: 0; left: 5px; width: 3px; border-radius: 2px; background: #40583a; }
.timing-selection-range [data-timing-handle=start] { left: -7px; }
.timing-selection-range [data-timing-handle=end] { right: -7px; }
.timing-draft-range { pointer-events: none; position: absolute; top: 0; bottom: 20px; z-index: 5; border: 2px solid; }
.timing-draft-range.valid { border-color: #56804b; background: rgb(126 169 104 / 24%); }
.timing-draft-range.invalid { border-color: #b6503d; background: rgb(190 79 59 / 20%); }
.timing-playhead { position: absolute; top: 0; bottom: 20px; left: 0; width: 1px; background: #b95239; z-index: 4; pointer-events: none; }
.timing-text { flex: 1; min-height: 100px; overflow-y: auto; padding: 12px; border: 1px solid var(--border); border-radius: 8px; white-space: pre-wrap; font: 21px/1.7 Georgia, serif; color: #45513f; }
.timing-word { display: inline; padding: 2px 3px; border: 0; border-radius: 4px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.timing-word:hover { background: #edf1e6; }
.timing-word.selected { background: #dde8c7; box-shadow: 0 2px 0 #9aab84; }
.timing-word.untimed { color: #879184; text-decoration: underline dotted #a9b2a5; text-underline-offset: 4px; }
.timing-word.untimed.selected { color: inherit; }
.timing-word.capture-target { background: #f7d9d3; color: #8d3327; box-shadow: 0 2px 0 #c46a59; }
.timing-word.sentence-end { text-decoration: underline solid #657b4e; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.timing-word.sentence-continue { text-decoration: underline dashed #b16a42; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.timing-dialog.timing-capture-active .timing-playhead { width: 2px; background: #a93e2f; }
.timing-word:focus-visible { outline: 2px solid #748763; outline-offset: 1px; }
.timing-boundaries { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.timing-boundaries label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.timing-boundaries input, .timing-boundaries select { width: 160px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--ink); font: inherit; font-variant-numeric: tabular-nums; }
.timing-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.timing-actions p { margin: 0 auto 0 0; color: #526742; font-size: 12px; }
.timing-actions p.is-error { color: #b13c2d; }
@media (max-width: 650px) {
  .timing-dialog { padding: 18px 14px; }
  .timing-wave-viewport { flex-basis: 220px; }
  .timing-wave-stage { height: 218px; }
  .timing-wave-stage canvas { height: 160px; }
  .timing-wave-segments { top: 160px; }
}

/* Recorded narration is an optional upgrade; the neutral state is device speech. */
.reading-engine {
  border: 1px solid #b58b36; border-radius: 999px; padding: .45rem .8rem;
  background: #fff7df; color: #6d4a0b; font: inherit; cursor: pointer;
}
.reading-engine[aria-pressed="true"] {
  background: linear-gradient(135deg, #ffe6a1, #e5b950);
  border-color: #a97a20; color: #392500; box-shadow: 0 2px 8px #a97a2026;
}
.reading-engine:disabled { background: transparent; border-color: #bbb; color: inherit; cursor: default; }
