:root {
  --bg: #fff;
  --paper: #fff;
  --side: #f5f7f6;
  --line: #dce3df;
  --ink: #192621;
  --muted: #4f5f56;
  --accent: #2f604c;
  --tint: #e1f0e7;
  --soft: #f1f5f2;
  --sand: #f6efdf;
  --focus: #387457;
  --radius: 18px;
  --m3-on-primary: #fff;
  --m3-on-tonal: #153b2a;
  --m3-elevation: 0 1px 2px #19262116, 0 2px 5px #1926210b;
}
:root[data-theme=dark] {
  --m3-on-primary: #153726;
  --m3-on-tonal: #daf1df;
  --m3-elevation: 0 2px 4px #0006;
}
.shell { grid-template-columns: 196px minmax(0, 1fr); }
#content { max-width: 1520px; padding: 28px 30px 50px; }
.sidebar { padding: 22px 13px 16px; border-color: var(--line); }
.brand { margin: 1px 4px 34px; }
.brand img { width: 34px; height: 34px; }
.brand strong { font-size: 24px; }
.nav-btn { min-height: 48px; border-radius: 100px; padding-inline: 15px; font-size: 14px; color: var(--ink); }
.nav-btn[aria-current="page"] { background: var(--tint); color: var(--m3-on-tonal); }
.nav-btn .icon { width: 20px; height: 20px; }
.topbar { min-height: 61px; padding-inline: 30px; position: sticky; top: 0; z-index: 4; }
.breadcrumb { font-size: 14px; }
h1 { font-size: clamp(28px, 3.3vw, 40px); }
.page-head { margin-bottom: 20px; }
.btn { transition: background-color 130ms ease, box-shadow 130ms ease; }
.btn.primary { background: var(--accent); color: var(--m3-on-primary); }
.btn.primary:hover:not(:disabled) { box-shadow: var(--m3-elevation); }
.btn.tonal, .btn.selected { background: var(--tint); color: var(--m3-on-tonal); }
.btn.tonal:hover:not(:disabled), .btn.selected:hover:not(:disabled) { box-shadow: var(--m3-elevation); }
.btn.text { background: transparent; color: var(--accent); }
:where(button, select, textarea, summary, [tabindex="-1"]):focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.panel { box-shadow: none; padding: 19px; }
.eyebrow { color: var(--muted); font-size: 13px; font-weight: 670; }
.overview-focus {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(110px,24%);
  gap: 22px;
  align-items: stretch;
  border-radius: 24px;
  background: var(--tint);
  color: var(--m3-on-tonal);
  padding: clamp(21px,3vw,39px);
}
.overview-focus h2 { font: 680 clamp(35px,5.1vw,78px)/1.04 var(--serif); letter-spacing: -.045em; overflow-wrap: anywhere; margin: 8px 0; }
.overview-focus .eyebrow, .overview-focus .muted { color: var(--m3-on-tonal); }
.overview-focus .word-tools { margin-top: 21px; }
.overview-progress { display: grid; align-content: center; justify-items: start; gap: 3px; border-left: 1px solid var(--line); padding-left: clamp(13px,3vw,32px); }
.overview-progress strong { font-size: clamp(26px,3vw,39px); line-height: 1.2; font-variant-numeric: tabular-nums; }
.overview-progress strong small { font-size: .5em; }
.overview-progress>span { font-size: 13px; }
.overview-icon { width: 45px; height: 45px; display: grid; place-items: center; border-radius: 15px; background: var(--paper); color: var(--accent); margin-bottom: 5px; }
.today-columns,.hub-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; align-items: start; }
.today-columns { margin-top: 25px; }
.today-review { min-height: 190px; }
.today-review .row.between { max-width: 360px; justify-content: flex-start; gap: clamp(22px,6vw,75px); }
.big-number { font-size: 35px; font-weight: 720; line-height: 1.26; }
.today-metrics .metric-line { min-height: 28px; }
.today-metrics .recent { margin-top: 7px; }
.hub-grid .panel+.panel { margin: 0; }
.hub-grid h2 { margin: 0 0 10px; }
.destination {
  width: 100%;
  min-height: 66px;
  padding: 10px 2px;
  display: grid;
  align-items: center;
  grid-template-columns: 38px minmax(0,1fr) auto;
  gap: 11px;
  text-align: start;
  background: var(--paper);
  border-block-end: 1px solid var(--line);
}
.destination:last-child { border-block-end: 0; }
.destination:hover { background: var(--soft); }
.destination small { display: block; line-height: 1.5; color: var(--muted); font-size: 12px; }
.destination strong { line-height: 1.4; display: block; }
.destination>svg { color: var(--muted); width: 17px; }
.review-switch { margin: 9px 0; }
.review-row>small { text-align: end; max-width: 90px; }
.empty-review { margin: 13px 0 3px; }
.library-actions { margin-bottom: 7px; }
.library-workspace {
  display: grid;
  grid-template-columns: minmax(240px,.8fr) minmax(0,1.3fr);
  gap: 19px;
  align-items: start;
}
.library-workspace .list { max-height: 68vh; overflow: auto; padding: 3px; }
.library-workspace .list-item[aria-current="true"] { background: var(--tint); border-color: var(--accent); }
.library-preview { min-width: 0; }
.library-preview .visual { height: min(26vw,315px); }
.library-preview .card-body { padding: 16px 20px; }

.reading-workspace {
  --reading-sticky: 77px;
  display: grid;
  grid-template-columns: minmax(170px,.52fr) minmax(0,1.55fr) minmax(236px,.79fr);
  align-items: start;
  gap: 16px;
}
.reading-index,.reading-main,.reading-support { min-width: 0; border: 1px solid var(--line); border-radius: 18px; }
.reading-index,.reading-support { background: var(--side); }
.reading-index,.reading-support { position: sticky; top: var(--reading-sticky); max-height: calc(100dvh - 95px); overflow: auto; }
.reading-books { display: grid; gap: 5px; padding: 9px; border-bottom: 1px solid var(--line); }
.mobile-directory { display: none; }
.reading-book,.reading-section { width: 100%; display: flex; text-align: start; align-items: center; gap: 8px; background: transparent; min-height: 43px; padding: 6px 7px; color: var(--ink); border-radius: 10px; min-width: 0; }
.reading-book .icon,.reading-section .icon { width: 16px; height: 16px; color: var(--accent); }
.reading-book small { display: block; line-height: 1.26; color: var(--muted); font-family: var(--serif); font-size: 13px; }
.reading-book[aria-pressed="true"],.reading-section[aria-current="step"],.reading-book:hover,.reading-section:hover { background: var(--tint); color: var(--m3-on-tonal); }
.index-parts { padding: 10px; }
.index-parts h3 { font-size: 14px; }
.index-parts .row>.muted { font-size: 11px; }
.reading-section { font-size: 12.5px; }
.reading-section>span:nth-child(2) { flex: 1; hyphens: auto; overflow-wrap: anywhere; }
.part-number { font-size: 11px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 100%; flex: none; background: var(--paper); border: 1px solid var(--line); }
.queue-status { color: var(--accent); white-space: nowrap; }
.reading-main { overflow: hidden; }
.reading-header,.reading-mode-panel,.full-text { padding: 17px clamp(14px,2vw,24px); }
.reading-header h2 { font-size: clamp(29px,4vw,49px); line-height: 1.08; margin-top: 4px; }
.reading-header #reading-audio { margin: 12px 0 0; }
.audio-actions { gap: 4px; }
.audio-actions .btn { min-height: 40px; padding-inline: 11px; font-size: 12.5px; }
.audio-actions select { min-height: 36px; font-size: 12px; padding: 4px 6px; }
.reading-audio-status { min-height: 18px; font-size: 12px; margin-top: 6px; }
.reading-tabs { display: flex; padding: 0 11px; border-block: 1px solid var(--line); align-items: stretch; }
.reading-tab { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; flex: 1; position: relative; color: var(--muted); background: transparent; font-weight: 650; }
.reading-tab .icon { width: 17px; height: 17px; }
.reading-tab:hover { background: var(--soft); }
.reading-tab[aria-selected="true"] { color: var(--accent); }
.reading-tab[aria-selected="true"]::after { content: ""; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); position: absolute; inset: auto 18% 0; }
.reading-tab:focus-visible { outline-offset: -3px; }
.reading-mode-panel { min-height: 275px; }
.reading-part-heading { margin-bottom: 13px; }
.reading-part-heading h3 { font-size: 21px; margin-top: 3px; }
.reading-line { font-size: clamp(22px,2.55vw,31px); }
.reading-note,.reading-hint { border-radius: 11px; background: var(--soft); padding: 10px 12px; }
.reading-note { font-size: 13px; }
.reading-note strong { margin-right: 5px; }
.reading-traversal { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 16px; }
.full-text { border-top: 1px solid var(--line); }
.full-text summary,.visual-support summary,.cyrillic-tools summary,.reading-directory summary { cursor: pointer; color: var(--accent); font-weight: 650; }
.full-text[open] summary { margin-bottom: 12px; }
.reading-support { padding: 14px; }
.support-title { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.support-title .icon { color: var(--accent); }
.support-title h3 { font-size: 16px; }
.reading-support>.muted { font-size: 13px; }
.visual-support[open] summary { margin-bottom: 3px; }
.visual-support summary { font-size: 12px; }
.cue-toolbar .muted { font-size: 12px; }
.cue-toolbar .btn { padding: 5px 8px; min-height: 40px; font-size: 12px; }
.floor-plan {
  min-height: 244px;
  position: relative;
  isolation: isolate;
  margin: 8px 4px 12px;
  border: 2px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
}
.room-window { position: absolute; top: -2px; height: 8px; width: 31%; left: 15%; background: var(--tint); border: 1px solid var(--accent); }
.room-door { position: absolute; bottom: -7px; left: 49%; transform: translateX(-50%); min-width: 42px; min-height: 21px; background: var(--paper); color: var(--muted); text-align: center; border: 1px solid var(--line); border-radius: 4px; font-size: 11px; }
.floor-path { position: absolute; top: 43%; bottom: 3%; left: 49%; border-left: 1px dashed var(--line); }
.floor-point {
  display: inline-grid; justify-items: center; align-items: center; gap: 1px;
  position: absolute; left: var(--x); top: var(--y); transform: translate(-50%,-50%);
  min-width: 42px; min-height: 41px; padding: 4px 5px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--soft); color: var(--ink); font-size: 10px; line-height: 1.2; z-index: 1;
}
.floor-point .icon { width: 17px; height: 17px; }
.floor-point:hover,.floor-point.point-current,.memory-timeline .point-current { border-color: var(--accent); background: var(--tint); color: var(--m3-on-tonal); }
.memory-timeline { margin: 2px 0 0; padding: 0; list-style: none; }
.memory-timeline li { position: relative; }
.memory-timeline li+li::before { content: ""; position: absolute; left: 16px; top: -15px; height: 29px; border-left: 1px solid var(--line); }
.memory-timeline button { position: relative; display: flex; gap: 8px; align-items: center; width: 100%; text-align: start; min-height: 46px; border-radius: 10px; padding: 4px 5px; background: transparent; }
.memory-timeline button:hover { background: var(--tint); }
.timeline-dot { flex: 0 0 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; background: var(--paper); border: 1px solid var(--line); font-size: 11px; }
.memory-timeline small { display: block; line-height: 1.3; color: var(--muted); font-size: 11px; }
.memory-timeline strong { font-size: 13px; }
.inline-segments,.writing-kinds { margin-bottom: 8px; }
.inline-segments .btn,.writing-kinds .btn { min-height: 38px; font-size: 13px; }
.writing-prompt { display: flex; justify-content: space-between; align-items: center; gap: 5px; background: var(--soft); border-radius: 11px; padding: 4px 9px 4px 12px; margin: 9px 0 12px; }
.writing-prompt .btn { flex: none; padding-inline: 8px; font-size: 12px; min-height: 40px; }
#sentence-form label { display: block; font-size: 13px; font-weight: 650; margin-bottom: 4px; }
#sentence-answer { display: block; width: 100%; min-height: 105px; resize: vertical; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: var(--paper); color: var(--ink); font: 21px/1.45 var(--serif); }
#sentence-answer:focus { border-color: var(--accent); }
#sentence-answer[readonly] { background: var(--soft); }
#writing-rules { margin: 4px 0 6px; }
.cyrillic-tools summary { font-size: 13px; }
.cyrillic-tools .keyboard { grid-template-columns: repeat(11,minmax(22px,1fr)); }
.writing-actions { margin-top: 9px; }
.shortcut-hint { font-size: 12px; }
.shortcut-hint kbd { border: 1px solid var(--line); padding: 1px 4px; border-radius: 4px; }
.write-result { font-size: 13px; padding: 2px; border-radius: 6px; scroll-margin-block: 78px 18px; }
.result-label { display: flex; gap: 5px; align-items: center; font-weight: 700; margin: 6px 0; }
.result-label .icon { width: 16px; height: 16px; }
.result-ok { color: var(--accent); }
.result-miss { color: var(--red); }
.diff-list { list-style: none; padding: 0; margin: 0 0 10px; }
.diff-list li { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 7px; align-items: baseline; border-bottom: 1px solid var(--line); padding: 4px 0; }
.diff-list li strong { font-size: 11px; }
.diff-list li span { overflow-wrap: anywhere; font: 17px var(--serif); }
.diff-list del,.diff-list ins { padding: 0 3px; border-radius: 3px; display: inline-block; }
.diff-list del { background: var(--red-bg); color: var(--red); }
.diff-list ins { background: var(--tint); color: var(--m3-on-tonal); }
.small-heading { font-weight: 650; }
.reference-sentence { font-size: 21px; line-height: 1.25; }
.write-result .metric-line { margin-top: 8px; }
@media (max-width: 1200px) {
  .shell { grid-template-columns: 166px minmax(0,1fr); }
  #content,.topbar { padding-inline: 21px; }
  .reading-workspace { grid-template-columns: minmax(150px,.42fr) minmax(0,1.25fr); }
  .reading-support { position: static; max-height: none; grid-column: 2; grid-row: 2; }
  .reading-support .floor-plan { max-width: 330px; }
}
@media (max-width: 840px) {
  .shell { grid-template-columns: 68px minmax(0,1fr); }
  .sidebar { padding-inline: 8px; }
  .nav-btn { justify-content: center; padding-inline: 0; }
  .reading-workspace { gap: 10px; grid-template-columns: minmax(133px,.4fr) minmax(0,1fr); }
  .library-workspace { display: block; }
  .library-preview { display: none; }
  .library-workspace .list { max-height: none; }
}
@media (max-width: 620px) {
  .shell { display: block; }
  .sidebar { padding-inline: 5px; }
  .nav-group { grid-template-columns: repeat(5,minmax(0,1fr)); }
  .nav-btn { border-radius: 13px; width: 100%; }
  .nav-btn .icon { width: 19px; height: 19px; }
  .nav-btn span { font-size: 11px; }
  #content { padding: 16px 12px 80px; }
  .topbar { min-height: 52px; padding-inline: 12px; }
  .overview-focus { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .overview-progress { border-left: 0; border-top: 1px solid var(--line); padding: 9px 0 0; display: flex; align-items: center; gap: 8px; }
  .overview-icon { width: 32px; height: 32px; margin: 0; border-radius: 9px; }
  .overview-icon .icon { width: 16px; height: 16px; }
  .today-columns,.hub-grid { grid-template-columns: minmax(0,1fr); gap: 14px; }
  .reading-workspace { grid-template-columns: minmax(0,1fr); }
  .reading-index { position: static; max-height: none; }
  .reading-books { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .index-parts { display: none; }
  .mobile-directory { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 9px; padding: 9px; }
  .reading-support { grid-column: 1; grid-row: auto; }
  .reading-traversal .btn { padding-inline: 9px; }
  .writing-prompt { flex-wrap: wrap; }
  .cyrillic-tools .keyboard { grid-template-columns: repeat(8,minmax(24px,1fr)); }
}

