:root {
  color-scheme: light;
  --bg: #f5f7f2;
  --surface: #ffffff;
  --surface-2: #edf3eb;
  --ink: #18211f;
  --muted: #62706a;
  --line: #d8e1d9;
  --accent: #1d7b68;
  --accent-2: #c65f35;
  --accent-3: #d59b19;
  --accent-4: #5b65b7;
  --shadow: 0 18px 44px rgba(26, 37, 32, 0.12);
  --radius: 8px;
  --topbar: 72px;
  --sidebar: 320px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101513;
  --surface: #171f1b;
  --surface-2: #1e2a24;
  --ink: #edf7ef;
  --muted: #a9b8af;
  --line: #2e3d36;
  --accent: #55c2a8;
  --accent-2: #e18156;
  --accent-3: #e4b84a;
  --accent-4: #9ca6ff;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(29, 123, 104, 0.14), transparent 32rem),
    linear-gradient(135deg, rgba(214, 155, 25, 0.08), transparent 28rem),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.progress-line {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 50;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-3), var(--accent-2));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar);
  padding: 0 28px;
  border-bottom: 1px solid color-mix(in srgb, var(--line), transparent 25%);
  background: color-mix(in srgb, var(--bg), transparent 8%);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--accent);
  font-size: 28px;
  line-height: 1;
  box-shadow: 0 8px 24px rgba(29, 123, 104, 0.12);
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
.home-link,
.language-button,
.soft-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.icon-button {
  width: 40px;
  padding: 0;
}

.home-link,
.language-button,
.soft-button {
  padding: 0 14px;
}

.icon-button:hover,
.home-link:hover,
.language-button:hover,
.soft-button:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent), var(--line) 35%);
}

.icon-button svg,
.home-link svg,
.language-button svg,
.soft-button svg,
.search-box svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.language-button {
  min-width: 78px;
  font-weight: 800;
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  gap: 28px;
  width: min(1500px, calc(100vw - 48px));
  margin: 24px auto 56px;
}

.sidebar {
  position: sticky;
  top: calc(var(--topbar) + 24px);
  align-self: start;
  height: calc(100vh - var(--topbar) - 48px);
  padding: 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface), transparent 4%);
  box-shadow: var(--shadow);
}

.sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.sidebar h1 {
  margin: 2px 0 0;
  font-size: 24px;
  line-height: 1.2;
}

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

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 0 12px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.search-results {
  display: none;
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.search-results.is-open {
  display: block;
}

.result-button {
  display: block;
  width: 100%;
  padding: 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.result-button:last-child {
  border-bottom: 0;
}

.result-button strong,
.result-button span {
  display: block;
}

.result-button strong {
  margin-bottom: 4px;
  font-size: 14px;
}

.result-button span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.chapter-block + .chapter-block {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.chapter-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.chapter-count {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.doc-link {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 9px 8px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.doc-link::before {
  content: "";
  display: block;
  width: 4px;
  height: 100%;
  border-radius: 999px;
  background: transparent;
}

.doc-link span {
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.42;
}

.doc-link:hover,
.doc-link.is-active {
  background: color-mix(in srgb, var(--accent), transparent 88%);
}

.doc-link.is-active::before {
  background: var(--accent);
}

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

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 18px;
  margin-bottom: 22px;
}

.visual-panel {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(120deg, rgba(29, 123, 104, 0.16), rgba(198, 95, 53, 0.08)),
    var(--surface);
  box-shadow: var(--shadow);
}

.visual-panel canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.visual-copy {
  position: absolute;
  inset: auto 24px 22px 24px;
  width: min(560px, calc(100% - 48px));
  color: var(--ink);
}

.visual-copy h2 {
  margin: 6px 0 8px;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.04;
}

.visual-copy p:last-child {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.stat-grid,
.quick-grid {
  display: grid;
  gap: 12px;
}

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

.quick-grid {
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card,
.quick-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 26px rgba(24, 33, 31, 0.08);
}

.stat-card {
  min-height: 144px;
  padding: 18px;
}

.stat-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 34px;
  font-variant-numeric: tabular-nums;
}

.stat-card span {
  color: var(--muted);
  line-height: 1.5;
}

.quick-card {
  display: flex;
  flex-direction: column;
  min-height: 132px;
  padding: 16px;
  color: var(--ink);
  text-decoration: none;
}

.quick-card small {
  margin-bottom: 10px;
  color: var(--accent-2);
  font-weight: 800;
}

.quick-card strong {
  margin-bottom: 10px;
  line-height: 1.35;
}

.quick-card span {
  margin-top: auto;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.reader {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.reader-toolbar {
  position: sticky;
  top: var(--topbar);
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface), transparent 6%);
  backdrop-filter: blur(16px);
}

.reader-toolbar h2 {
  margin: 6px 0 4px;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.18;
}

.article-path {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

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

.article-body {
  width: min(880px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0 64px;
  font-size: 17px;
  line-height: 1.82;
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4 {
  scroll-margin-top: 120px;
  line-height: 1.25;
}

.article-body h1 {
  margin: 0 0 22px;
  font-size: 34px;
}

.article-body h2 {
  margin: 42px 0 14px;
  padding-top: 4px;
  font-size: 27px;
}

.article-body h3 {
  margin: 30px 0 12px;
  font-size: 21px;
}

.article-body h4 {
  margin: 24px 0 8px;
  color: var(--accent);
  font-size: 17px;
}

.article-body p {
  margin: 12px 0;
}

.article-body strong {
  color: color-mix(in srgb, var(--ink), var(--accent) 35%);
}

.article-body blockquote {
  margin: 20px 0;
  padding: 14px 18px;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: color-mix(in srgb, var(--accent), transparent 90%);
}

.has-translation {
  position: relative;
  border-radius: 6px;
  transition:
    background 160ms ease,
    box-shadow 160ms ease;
}

.has-translation:hover,
.has-translation:focus {
  outline: none;
  background: color-mix(in srgb, var(--accent), transparent 92%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent), transparent 88%);
}

.has-translation::after {
  content: none;
}

.translation-tooltip {
  position: fixed;
  z-index: 120;
  left: 0;
  top: 0;
  display: none;
  width: max-content;
  max-width: min(440px, calc(100vw - 28px));
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent), var(--line) 45%);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface), transparent 2%);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 14px;
  line-height: 1.6;
  text-align: left;
  overflow-wrap: anywhere;
}

.translation-tooltip.is-visible {
  display: block;
}

.translation-tooltip-body > :first-child {
  margin-top: 0;
}

.translation-tooltip-body > :last-child {
  margin-bottom: 0;
}

.translation-tooltip mjx-container {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}


.semantic-box {
  margin: 18px 0 24px;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--accent), var(--line) 52%);
  border-left: 5px solid var(--accent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent), transparent 92%);
}

.semantic-box > :first-child {
  margin-top: 0;
}

.semantic-box > :last-child {
  margin-bottom: 0;
}

.semantic-box h2,
.semantic-box h3,
.semantic-box h4 {
  margin-top: 0;
}

.example-box {
  background: color-mix(in srgb, var(--accent), transparent 92%);
}

.practice-box {
  background: color-mix(in srgb, var(--accent-2), transparent 90%);
  border-left-color: var(--accent-2);
}

.answer-box {
  background: color-mix(in srgb, var(--accent-3), transparent 88%);
  border-left-color: var(--accent-3);
}

.answer-line {
  font-weight: 650;
}

.article-body hr {
  height: 1px;
  margin: 30px 0;
  border: 0;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

.article-body pre {
  overflow: auto;
  margin: 20px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #111917;
  color: #ecf7ef;
  line-height: 1.6;
}

.article-body code {
  padding: 0.12em 0.34em;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent-3), transparent 82%);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
}

.article-body pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.math-display {
  max-width: 100%;
  margin: 18px 0;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: pre-wrap;
}

.md-list,
.md-ordered-list {
  margin: 12px 0 18px;
  padding-left: 24px;
}

.md-list li,
.md-ordered-list li {
  margin: 7px 0;
  padding-left: calc(var(--level, 0) * 18px);
}

.table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  margin: 22px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  background: var(--surface);
}

.article-body mjx-container {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.article-body th,
.article-body td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.article-body th {
  background: var(--surface-2);
  color: var(--ink);
  font-size: 14px;
}

.article-body tr:last-child td {
  border-bottom: 0;
}

.empty-state {
  padding: 16px;
  color: var(--muted);
  font-size: 13px;
}

.mobile-only {
  display: none;
}

@media (max-width: 1120px) {
  .layout {
    width: min(100% - 28px, 920px);
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(88vw, 340px);
    height: 100vh;
    border-radius: 0;
    transform: translateX(-105%);
    transition: transform 220ms ease;
  }

  body .sidebar.is-open,
  body.menu-open .sidebar {
    transform: translateX(0) !important;
  }

  .mobile-only {
    display: inline-flex;
  }

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

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

@media (max-width: 720px) {
  .topbar {
    height: 64px;
    padding: 0 14px;
  }

  .brand small {
    display: none;
  }

  .home-link span {
    display: none;
  }

  .language-button {
    min-width: 58px;
    padding: 0 10px;
  }

  .language-button span {
    display: none;
  }

  .layout {
    width: min(100% - 20px, 640px);
    margin-top: 14px;
  }

  .visual-panel {
    min-height: 360px;
  }

  .visual-copy {
    inset: auto 18px 18px 18px;
    width: calc(100% - 36px);
  }

  .stat-grid,
  .quick-grid {
    grid-template-columns: 1fr;
  }

  .reader-toolbar {
    position: static;
    display: block;
    padding: 20px;
  }

  .reader-actions {
    justify-content: flex-start;
    margin-top: 16px;
  }

  .soft-button {
    min-width: 0;
    flex: 1;
    padding: 0 10px;
  }

  .article-body {
    width: min(100% - 32px, 620px);
    padding: 24px 0 46px;
    font-size: 16px;
  }

  .article-body h1 {
    font-size: 27px;
  }

  .article-body h2 {
    font-size: 23px;
  }
}


/* v5 layout cleanup: remove old dashboard recommendation cards. */
.quick-grid {
  display: none !important;
}

.phase-title {
  margin: 24px 4px 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
  line-height: 1.45;
}

.day-block .chapter-title {
  align-items: flex-start;
}


/* v6: per-document table of contents */
.page-toc {
  margin: 4px 0 30px;
  padding: 22px 26px;
  border-left: 4px solid color-mix(in srgb, var(--accent), var(--line) 35%);
  border-radius: 0 14px 14px 0;
  background: color-mix(in srgb, var(--surface-2), transparent 8%);
}

.page-toc strong {
  display: block;
  margin-bottom: 12px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.25;
}

.page-toc ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

.page-toc li {
  color: var(--muted);
  line-height: 1.55;
}

.page-toc li.toc-level-3 {
  margin-left: 18px;
}

.page-toc li.toc-level-4 {
  margin-left: 36px;
  font-size: 0.95em;
}

.page-toc a {
  color: color-mix(in srgb, var(--ink), var(--accent) 20%);
  text-decoration: none;
}

.page-toc a:hover,
.page-toc a:focus {
  color: var(--accent);
  text-decoration: underline;
}

/* v7: current-page table of contents in the sidebar, not inside the article */
.sidebar-page-toc {
  margin: 12px 0 16px;
  padding: 14px 14px 12px;
  border: 1px solid color-mix(in srgb, var(--accent), var(--line) 55%);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-2), transparent 8%);
}

.sidebar-page-toc[hidden] {
  display: none !important;
}

.sidebar-page-toc strong {
  display: block;
  margin-bottom: 9px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 850;
}

.sidebar-page-toc ol {
  display: grid;
  gap: 7px;
  max-height: min(40vh, 420px);
  margin: 0;
  padding-left: 19px;
  overflow: auto;
}

.sidebar-page-toc li {
  color: var(--muted);
  line-height: 1.35;
}

.sidebar-page-toc li.toc-level-3 {
  margin-left: 12px;
}

.sidebar-page-toc li.toc-level-4 {
  margin-left: 24px;
  font-size: 0.94em;
}

.sidebar-page-toc a {
  color: color-mix(in srgb, var(--ink), var(--accent) 18%);
  text-decoration: none;
}

.sidebar-page-toc a:hover,
.sidebar-page-toc a:focus {
  color: var(--accent);
  text-decoration: underline;
}

/* v9 responsive layout: left course nav + center reader + right page toc on desktop */
.layout {
  grid-template-columns: var(--sidebar) minmax(0, 1fr) minmax(220px, 280px);
  align-items: start;
  width: min(1720px, calc(100vw - 48px));
}

.article-toc-shell {
  position: sticky;
  top: calc(var(--topbar) + 24px);
  align-self: start;
  max-height: calc(100vh - var(--topbar) - 48px);
  min-width: 0;
  overflow: auto;
}

.article-toc-shell[hidden] {
  display: none !important;
}

.article-toc-shell .sidebar-page-toc {
  margin: 0;
  padding: 16px 16px 14px;
  border: 1px solid color-mix(in srgb, var(--accent), var(--line) 55%);
  border-left: 4px solid var(--accent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface), transparent 3%);
  box-shadow: 0 12px 30px rgba(24, 33, 31, 0.08);
}

.article-toc-shell .sidebar-page-toc ol {
  max-height: calc(100vh - var(--topbar) - 150px);
}

.sidebar-backdrop {
  display: none;
}

.reader,
.visual-panel,
.stat-card,
.semantic-box,
.article-body blockquote,
.article-body pre,
.table-wrap,
.math-display {
  max-width: 100%;
}

.semantic-box,
.article-body blockquote,
.article-body p,
.article-body li,
.article-body td,
.article-body th {
  overflow-wrap: anywhere;
}

.article-body mjx-container[display="true"] {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0 6px;
}

.article-body mjx-container:not([display="true"]) {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.article-body svg {
  max-width: none;
}

@media (max-width: 1380px) {
  :root {
    --sidebar: 300px;
  }

  .layout {
    grid-template-columns: var(--sidebar) minmax(0, 1fr) minmax(200px, 240px);
    gap: 20px;
    width: min(100% - 32px, 1320px);
  }

  .article-body {
    width: min(820px, calc(100% - 40px));
  }

  .sidebar {
    padding: 16px;
  }
}

@media (max-width: 1220px) {
  .layout {
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
  }

  .article-toc-shell {
    display: none !important;
  }

  .article-body {
    width: min(860px, calc(100% - 44px));
  }
}

@media (max-width: 1120px) {
  body.menu-open {
    overflow: hidden;
  }

  .layout {
    width: min(100% - 28px, 980px);
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .sidebar {
    inset: 0 auto 0 0;
    z-index: 80;
    width: min(86vw, 380px);
    height: 100dvh;
    max-height: none;
    padding: 18px;
    border-width: 0 1px 0 0;
    box-shadow: 24px 0 54px rgba(0, 0, 0, 0.24);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: block;
    border: 0;
    background: rgba(8, 15, 13, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  body.menu-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .reader-toolbar {
    top: var(--topbar);
  }

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

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

@media (max-width: 860px) {
  :root {
    --topbar: 66px;
  }

  .topbar {
    padding: 0 14px;
    gap: 10px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 24px;
  }

  .brand strong {
    max-width: 34vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top-actions {
    gap: 8px;
  }

  .home-link span,
  .language-button span,
  .brand small {
    display: none;
  }

  .home-link,
  .language-button,
  .icon-button {
    min-width: 38px;
    width: 38px;
    height: 38px;
    padding: 0;
  }

  .layout {
    width: min(100% - 20px, 780px);
    margin: 14px auto 42px;
  }

  .visual-panel {
    min-height: 260px;
  }

  .visual-copy h2 {
    font-size: clamp(26px, 9vw, 42px);
  }

  .reader-toolbar {
    position: static;
    display: block;
    padding: 18px;
  }

  .reader-toolbar h2 {
    font-size: clamp(22px, 7vw, 30px);
  }

  .reader-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-top: 14px;
  }

  .soft-button {
    width: 100%;
    min-width: 0;
    padding: 0 10px;
  }

  .article-body {
    width: min(100% - 28px, 720px);
    padding: 22px 0 46px;
    font-size: 16px;
    line-height: 1.78;
  }

  .article-body h1 {
    font-size: 27px;
  }

  .article-body h2 {
    margin-top: 34px;
    font-size: 23px;
  }

  .article-body h3 {
    font-size: 19px;
  }

  .semantic-box {
    margin: 16px 0 22px;
    padding: 14px 14px;
    border-radius: 14px;
  }

  .article-body blockquote {
    padding: 13px 14px;
  }

  .article-body table {
    min-width: 520px;
  }

  .article-body th,
  .article-body td {
    padding: 10px 11px;
  }

  .translation-tooltip {
    max-width: calc(100vw - 24px) !important;
    font-size: 13px;
  }
}

@media (max-width: 520px) {
  .topbar {
    height: 62px;
    padding: 0 10px;
  }

  .brand strong {
    max-width: 28vw;
    font-size: 14px;
  }

  .home-link {
    display: none;
  }

  .layout {
    width: calc(100% - 14px);
    margin-top: 10px;
  }

  .sidebar {
    width: min(92vw, 360px);
    padding: 15px;
  }

  .sidebar h1 {
    font-size: 21px;
  }

  .search-box {
    min-height: 42px;
  }

  .doc-link {
    padding: 8px 6px;
  }

  .visual-panel {
    min-height: 220px;
  }

  .visual-copy {
    inset: auto 15px 15px 15px;
    width: calc(100% - 30px);
  }

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

  .stat-card {
    min-height: 104px;
    padding: 14px;
  }

  .reader {
    border-radius: 12px;
  }

  .reader-toolbar {
    padding: 15px;
  }

  .reader-actions {
    grid-template-columns: 1fr;
  }

  .article-body {
    width: min(100% - 20px, 520px);
    font-size: 15.5px;
  }

  .article-body h1 {
    font-size: 24px;
  }

  .article-body h2 {
    font-size: 21px;
  }

  .article-body pre {
    padding: 12px;
  }

  .article-body table {
    min-width: 480px;
  }
}

@media (hover: none) {
  .icon-button:hover,
  .home-link:hover,
  .language-button:hover,
  .soft-button:hover {
    transform: none;
  }

  .has-translation:hover {
    background: transparent;
    box-shadow: none;
  }
}
