/* Shared reading and control styles; model SVG coordinates and force colors stay local. */
:root {
  --ink: #203e36;
  --muted: #607368;
  --teal: #13766d;
  --teal-light: #e7f1eb;
  --paper: #f5f6f0;
  --line: #dce5da;
  --white: #fffefa;
  --serif: "Source Han Serif SC", "Noto Serif SC", "Songti SC", SimSun, serif;
  --sans: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --number: "Cascadia Code", Consolas, monospace;
  --ui-radius: 12px;
  --ui-focus: #32836c;
  --ui-shadow: 0 3px 16px #173f2c06;
}

body {
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
}

::selection { background: #cce5d8; color: #183e32; }

:is(button, a, input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--ui-focus);
  outline-offset: 3px;
}

button, input, select, textarea { font-family: var(--sans); }
button, select, summary { touch-action: manipulation; }
button { transition: background-color .16s, border-color .16s, box-shadow .16s, transform .16s; }
button:disabled { cursor: not-allowed; }

input:not([type=range]):not([type=checkbox]):not([type=radio]):not([type=file]),
select, textarea {
  border-radius: 8px;
  font-size: 15px;
  transition: border-color .16s, box-shadow .16s;
}

input::placeholder, textarea::placeholder { color: #77887b; opacity: 1; }

:is(input:not([type=range]), select, textarea):focus-visible {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px #13766d0c;
}

body :is(.eyebrow, .section-label) { font-size: 11px; letter-spacing: 1.7px; }
body :is(.notice, .section-note, .subtitle, .section-description, .assistant-intro) { font-size: 14px; line-height: 1.85; }
body :is(.model-page-heading, .practice-heading, .teacher-heading, .page-heading) p { font-size: 14px; line-height: 1.8; }

body :is(.text-button, .secondary-button, .teacher-text-button, .reset-parameters, .heading-link) { font-size: 13px; }

body :is(.panel, .card, .library-card, .teacher-question-card, .practice-card, .learning-card) {
  border-color: var(--line);
  border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow);
}

body :is(.primary-button, .teacher-primary, .button.primary, button.primary, a.primary) {
  min-height: 44px;
  border-radius: 8px;
  background: var(--teal);
  color: #fffefa;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 2px 5px #164a3612;
}

body :is(.secondary-button, .button.secondary, button.secondary) {
  min-height: 42px;
  border-color: #c3d7c7;
  border-radius: 8px;
  background: #f0f5ec;
  color: #285e49;
  font-size: 14px;
}

body :is(.notice.error, .assistant-error) { color: #9a4137; }
body :is(.demo-note, .small-note, .privacy-note, .model-footnote, .review-note) { font-size: 12px; line-height: 1.85; }

/* Keep content-heavy screens legible without changing their workflow. */
body :is(.model-main, .practice-main, .teacher-main) { max-width: 1440px; }
body :is(.library-filters > label, .teacher-filters label, .filter-grid label, .fact-row label) { font-size: 13px; }
body :is(.library-chapter, .question-card-meta, .practice-level, .practice-skill) { font-size: 12px; color: #607365; }
body :is(.library-subtitle, .library-assumptions, .question-skill, .question-excerpt, .assistant-scope p) { font-size: 13px; line-height: 1.85; }
body :is(.library-book-tag, .library-dimension-tag, .adaptable-tag, .manual-tag) { font-size: 11px; }
body .library-card-bottom { font-size: 12px; }
body :is(.library-card-bottom a, .teacher-load-more) { min-height: 42px; }
body :is(.library-results-heading > p, .library-results-heading > a, .results-heading, .assistant-steps li) { font-size: 13px; }
body :is(.assistant-field, .assistant-panel h3) { font-size: 14px; }
body :is(.assistant-field span, .assistant-config, .assistant-actions > span, .result-condition p) { font-size: 12px; }
body :is(.assistant-status, .assistant-error, .recognized-text, .result-assumptions, .result-missing) { font-size: 14px; }
body :is(.account-main .profile-grid dd, .account-main .access-details dd) { font-size: 15px; }
body :is(.account-main .profile-grid dt, .account-main .access-details dt, .account-main .setting-copy p) { font-size: 13px; }

.learning-return-link { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 10px; border: 1px solid #c5d9cb; border-radius: 7px; background: #edf5e9; color: #1a6653; font-weight: 600; white-space: nowrap; }

@media (hover: hover) and (pointer: fine) {
  body :is(.primary-button, .teacher-primary, .button.primary, button.primary, a.primary):hover:not(:disabled) {
    background: #0e625a;
    box-shadow: 0 4px 12px #164a3620;
  }
  body :is(.secondary-button, .button.secondary, button.secondary):hover:not(:disabled) { background: #e6efe1; border-color: #8eb39c; }
}

@media (max-width: 720px) {
  body { font-size: 14px; }
  input:not([type=range]):not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { font-size: 16px; }
  body :is(.model-page-heading h1, .practice-heading h1, .teacher-heading h1) { font-size: 28px; }
  body :is(.model-page-heading p, .practice-heading p, .teacher-heading p) { font-size: 14px; }
  body :is(.model-page-heading, .practice-heading, .teacher-heading) { gap: 16px; }
  body :is(.library-subtitle, .library-assumptions, .question-excerpt) { font-size: 14px; }
  body .assistant-steps { gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  button, input, select, textarea { transition: none; }
}
