/* UI typography only: reading font/size preferences remain authoritative. */
:root {
  --muted: #62736a;
  --line: #dbe3da;
  --shadow: 0 10px 36px #263c3509;
}
body {
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 16px;
  line-height: 1.75;
}
body.dark {
  --muted: #b1c2b7;
  --line: #4b6053;
}
h1 {
  font-size: clamp(30px, 2.5vw, 38px);
  line-height: 1.35;
  letter-spacing: 0.4px;
}
h2 {
  font-size: 23px;
  line-height: 1.5;
}
h3 {
  font-size: 19px;
  line-height: 1.5;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 1.8px;
  line-height: 1.7;
}
.topbar p {
  font-size: 16px;
  line-height: 1.8;
}
.muted {
  line-height: 1.75;
}
.sidebar {
  width: 260px;
  padding: 32px 22px;
  overflow-y: auto;
}
.brand {
  font-size: 28px;
  gap: 13px;
}
.brand small {
  font-size: 11px;
  letter-spacing: 1.3px;
}
.nav-label {
  font-size: 13px;
  letter-spacing: 1px;
  margin: 38px 14px 14px;
}
nav a {
  min-height: 52px;
  padding: 14px;
  font-size: 20px;
}
nav a span {
  font-size: 16px;
}
nav b {
  font-size: 13px;
  padding: 2px 8px;
}
.local-status {
  font-size: 13px;
  padding: 14px;
}
.settings-link {
  font-size: 16px;
}
.profile {
  font-size: 15px;
  line-height: 1.6;
}
.profile small {
  font-size: 13px;
}
.profile > span {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}
.account-link {
  font-size: 14px;
  padding: 8px 6px;
}
#logout-account {
  font-size: 14px;
  min-height: 40px;
  padding: 8px 10px;
}
main {
  margin-left: 260px;
  padding: 40px clamp(26px, 3.5vw, 64px);
  max-width: 1720px;
  min-width: 0;
}
.topbar {
  gap: 20px;
  flex-wrap: wrap;
}
.topbar > div {
  min-width: 0;
}
button,
.button {
  font-size: 16px;
  line-height: 1.5;
  min-height: 46px;
  padding: 10px 17px;
  border-radius: 9px;
  white-space: normal;
}
button.primary,
.button.primary {
  box-shadow: 0 3px 8px #173b3210;
}
input,
select,
textarea {
  font-size: 16px;
  line-height: 1.55;
  min-height: 46px;
  padding: 11px 13px;
  border-color: #ccd8cf;
  max-width: 100%;
}
input::placeholder,
textarea::placeholder {
  color: #718077;
}
input[type="checkbox"] {
  width: 19px;
  height: 19px;
  min-height: 0;
  flex-shrink: 0;
  accent-color: var(--green);
}
input[type="range"] {
  min-height: 30px;
  padding: 0;
}
.field {
  font-size: 16px;
  margin: 20px 0;
  line-height: 1.8;
}
.field small {
  font-size: 14px;
  line-height: 1.8;
  margin-top: 9px;
}
.hero {
  padding: 34px 36px;
  border-radius: 16px;
}
.hero h2 {
  font-size: clamp(28px, 2.5vw, 36px);
  line-height: 1.55;
}
.hero p {
  font-size: 16px;
  line-height: 1.8;
  max-width: 58ch;
  color: #52664e;
}
.hero .eyebrow {
  font-size: 12px;
  color: #576c50;
}
.stats {
  gap: 18px;
}
.stat {
  padding: 24px;
  gap: 16px;
  min-width: 0;
}
.stat strong {
  font-size: 31px;
  line-height: 1.3;
}
.stat small {
  font-size: 14px;
  line-height: 1.65;
}
.stat-icon {
  flex-shrink: 0;
}
.section-top {
  gap: 16px;
  flex-wrap: wrap;
}
.section-top h2 {
  font-size: 23px;
}
.pill,
.badge {
  font-size: 13px;
  line-height: 1.6;
  padding: 4px 9px;
}
.search {
  max-width: 100%;
}
.search input {
  max-width: 280px;
  width: 100%;
  min-height: 46px;
}
.book-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 22px;
}
.book h3 {
  font-size: 17px;
  line-height: 1.55;
  white-space: normal;
  overflow-wrap: anywhere;
}
.book .muted {
  font-size: 14px;
}
.book-footer {
  font-size: 13px;
  gap: 8px;
  flex-wrap: wrap;
}
.cover small {
  font-size: 13px;
}
.import-tile {
  font-size: 16px;
  min-height: 340px;
  padding: 24px;
  text-align: center;
  line-height: 1.7;
}
.import-tile small {
  font-size: 13px;
  color: var(--muted);
}
.footer-note {
  font-size: 14px;
  line-height: 1.8;
  flex-wrap: wrap;
  text-align: center;
}
.notice {
  font-size: 15px;
  line-height: 1.8;
  padding: 16px 18px;
}
.panel {
  padding: 28px;
  border-radius: 14px;
  min-width: 0;
}
.panel h2 {
  font-size: 23px;
  margin-bottom: 22px;
}
.settings-grid {
  gap: 24px;
}
.panel > p {
  font-size: 16px;
  line-height: 1.85;
}
.path {
  font-size: 14px;
  line-height: 1.8;
}
.toolbar {
  gap: 12px;
}
.toolbar > small {
  font-size: 14px;
}
table {
  font-size: 16px;
}
th,
td {
  padding: 16px 18px;
  line-height: 1.65;
}
th {
  font-size: 14px;
  font-weight: 600;
}
td .word {
  font-size: 22px;
}
td button {
  font-size: 14px;
  padding: 8px 11px;
  min-height: 40px;
}
.table-wrap {
  border-radius: 12px;
}
dialog {
  width: min(940px, calc(100vw - 32px));
  max-height: 88dvh;
  padding: 28px;
}
dialog h2 {
  font-size: 24px;
}
.modal-body {
  max-height: 58dvh;
  line-height: 1.85;
}
.modal-footer {
  flex-wrap: wrap;
}
#toast {
  font-size: 15px;
  line-height: 1.7;
  left: calc(50% + 130px);
}
.reader-head {
  gap: 16px;
  padding: 17px 0;
  flex-wrap: wrap;
}
.reader-head h2 {
  font-size: 18px;
  line-height: 1.5;
}
.reader-tools button,
.reader-tools select {
  font-size: 15px;
  padding: 9px 12px;
  min-height: 42px;
}
.reader-bottom {
  left: 260px;
  font-size: 15px;
  padding: 14px;
  gap: 22px;
  flex-wrap: wrap;
}
.reading {
  padding-bottom: 120px;
}
.lookup {
  width: min(420px, calc(100vw - 36px));
  padding: 25px;
  top: 110px;
  max-height: calc(100dvh - 140px);
}
.lookup h2 {
  font-size: 34px;
}
.lookup .context {
  font-size: 17px;
  line-height: 1.85;
}
.lookup .explanation {
  font-size: 16px;
  line-height: 1.85;
}
.lookup button,
.lookup .button,
.lookup select {
  font-size: 15px;
  min-height: 42px;
  padding: 8px 12px;
}
.lookup.rich-dictionary {
  width: min(540px, calc(100vw - 36px));
}
.dict-source,
.dict-heading,
.dict-tags,
.dict-note {
  font-size: 13px;
  line-height: 1.8;
}
.dict-phon {
  font-size: 20px;
}
.dict-meaning {
  font-size: 18px;
  line-height: 1.9;
}
.dict-english summary {
  font-size: 15px;
}
.dict-english > div {
  font-size: 17px;
  line-height: 1.85;
}
.dict-lemma {
  font-size: 18px;
}
details.ai-followup > summary {
  font-size: 16px;
}
.ai-followup > small {
  font-size: 13px;
}
.review-answer {
  font-size: 17px;
  line-height: 1.85;
}
.ratings button {
  font-size: 16px;
  min-height: 64px;
}
.ratings small {
  font-size: 13px;
  line-height: 1.6;
  opacity: 0.85;
}
.review-card blockquote {
  font-size: 20px;
  line-height: 1.9;
}
.service-heading p,
.provider-banner p {
  font-size: 15px;
  line-height: 1.8;
}
.provider-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.provider-tabs button {
  font-size: 16px;
  padding: 16px 10px;
  min-height: 90px;
}
.provider-tabs button > small {
  font-size: 13px;
}
.provider-banner h3 {
  font-size: 22px;
}
.provider-banner a {
  font-size: 14px;
}
.provider-fields {
  gap: 0 24px;
}
.vocabulary-settings > p {
  font-size: 16px;
  line-height: 1.85;
}
.vocab-section-head {
  flex-wrap: wrap;
}
.vocab-section-head h3,
.vocabulary-settings > h3 {
  font-size: 19px;
}
.vocab-help {
  font-size: 14px;
  line-height: 1.85;
}
.exam-card {
  padding: 18px 15px;
  align-items: flex-start;
  line-height: 1.7;
}
.exam-card strong {
  font-size: 16px;
}
.exam-card small {
  font-size: 14px;
}
.exam-selection-summary {
  font-size: 15px;
  line-height: 1.8;
}
.exam-word-sample {
  font-size: 17px;
}
.highlight-samples {
  font-size: 20px;
  line-height: 1.9;
}
.auth-story > p:not(.eyebrow) {
  font-size: 17px;
  color: #54674e;
}
.auth-feature {
  font-size: 14px;
  line-height: 1.9;
}
.auth-card {
  width: min(470px, 85%);
  padding: 44px 0;
}
.auth-card h2 {
  font-size: 31px;
}
.auth-card > p.muted {
  font-size: 16px;
  line-height: 1.85;
}
.auth-footnote,
.guest-hint {
  font-size: 14px;
  line-height: 1.9;
}
.auth-submit,
.guest-submit {
  font-size: 17px;
  min-height: 50px;
}
.admin-summary span {
  font-size: 15px;
}
.guest-mode main:before {
  font-size: 14px;
  line-height: 1.8;
}
.auth-screen main {
  margin: 0;
  padding: 0;
}
.auth-screen .brand small {
  font-size: 11px;
}
.account-card {
  max-width: 680px;
}
:focus-visible {
  outline: 3px solid #719768;
  outline-offset: 3px;
}
body.dark input,
body.dark select,
body.dark textarea {
  border-color: #5a7062;
}
body.dark .hero {
  background: #2c4032;
  color: #e4eadd;
  border-color: #4b6053;
}
body.dark .hero p,
body.dark .hero .eyebrow {
  color: #b1c2b7;
}
.badge.new,
.badge.learning {
  color: #765524;
}
body.dark .badge.new,
body.dark .badge.learning {
  background: #4c442d;
  color: #f1d99f;
}
.stats .stat {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}
.stats .stat > div:last-child {
  display: contents;
}
.stats .stat strong {
  grid-column: 2;
  grid-row: 1;
}
.stats .stat small {
  grid-column: 1/-1;
  margin-top: 0;
}
.stats .stat strong > span {
  font-size: 14px !important;
}
@media (max-width: 1150px) {
  main {
    padding: 32px 28px;
  }
  .stats {
    gap: 12px;
  }
  .stat {
    padding: 20px 16px;
    gap: 12px;
    align-items: flex-start;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .hero {
    padding: 30px;
  }
  .hero-art {
    width: 200px;
    min-width: 200px;
  }
  .provider-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 1000px) {
  .sidebar {
    width: 232px;
    padding: 28px 16px;
  }
  main {
    margin-left: 232px;
  }
  .reader-bottom {
    left: 232px;
  }
  .brand {
    font-size: 26px;
  }
  .nav-label {
    margin-top: 32px;
  }
  .lookup {
    right: 18px;
  }
  #toast {
    left: calc(50% + 116px);
  }
}
@media (max-width: 700px) {
  .sidebar {
    position: static;
    inset: auto;
    width: 100%;
    padding: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    overflow: visible;
  }
  .brand {
    font-size: 25px;
  }
  .brand small {
    display: block;
    font-size: 10px;
  }
  .nav-label,
  .sidebar-bottom {
    display: none;
  }
  nav {
    display: flex;
    gap: 5px;
    width: 100%;
    justify-content: space-between;
  }
  nav a {
    margin: 0;
    gap: 7px;
    padding: 10px 9px;
    min-height: 46px;
    font-size: 18px;
  }
  nav a span {
    font-size: 14px;
  }
  main {
    margin-left: 0;
    padding: 26px 18px;
  }
  .reader-bottom {
    left: 0;
    padding: 12px;
    gap: 12px;
    font-size: 14px;
  }
  .reader-bottom button {
    min-height: 42px;
  }
  .topbar {
    gap: 16px;
    margin-bottom: 24px;
  }
  .topbar p {
    font-size: 15px;
  }
  h1 {
    font-size: 30px;
  }
  .hero {
    padding: 26px;
  }
  .hero h2 {
    font-size: 28px;
  }
  .hero p {
    font-size: 16px;
  }
  .stats {
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 20px 0 28px;
  }
  .stat {
    padding: 20px;
    align-items: center;
  }
  .stat strong {
    font-size: 29px;
  }
  .stat small {
    font-size: 14px;
  }
  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
  .book {
    padding: 13px;
  }
  .book h3 {
    font-size: 16px;
  }
  .cover {
    height: 200px;
    padding: 14px;
  }
  .import-tile {
    min-height: 310px;
    padding: 18px 12px;
    font-size: 15px;
  }
  .panel {
    padding: 22px;
  }
  .panel h2 {
    font-size: 22px;
  }
  .provider-fields,
  .highlight-controls {
    grid-template-columns: 1fr;
  }
  .provider-tabs {
    gap: 9px;
  }
  .provider-tabs button {
    font-size: 14px;
    padding: 14px 6px;
  }
  .provider-tabs button > small {
    font-size: 12px;
  }
  .exam-grid {
    grid-template-columns: 1fr 1fr;
  }
  .exam-card {
    padding: 15px 12px;
    gap: 10px;
  }
  .lookup,
  .lookup.rich-dictionary {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 76px;
    width: auto;
    max-height: 68dvh;
    padding: 22px;
  }
  .lookup .context {
    font-size: 16px;
  }
  .reader-head h2 {
    font-size: 17px;
  }
  .review-card {
    padding: 28px 22px;
  }
  .ratings {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .ratings button {
    padding: 14px 8px;
  }
  .auth-card {
    width: calc(100% - 40px);
    padding: 28px 0 40px;
  }
  .auth-card h2 {
    font-size: 29px;
  }
  .auth-story {
    padding: 22px;
  }
  .auth-card > p.muted {
    font-size: 16px;
  }
  dialog {
    padding: 22px;
  }
  .modal-footer {
    gap: 9px;
  }
  .modal-footer button {
    flex: 1;
  }
  .footer-note {
    font-size: 13px;
  }
  #toast {
    left: 50%;
  }
  .guest-mode main:before {
    font-size: 14px;
  }
  .auth-screen main {
    margin: 0;
    padding: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  button,
  .button {
    transition: none;
  }
  button:hover,
  .button:hover {
    transform: none;
  }
}
