/* Shared by the learning app, account forms and guide. Font files stay local.
   400 = reading, 500 = controls, 600 = headings / primary actions.
   Ruby size, reading size preferences and pagination metrics remain in the reader. */
@import url('../vendor/fonts/cjk/fonts.css');
@import url('../vendor/fonts/japanese/fonts.css');
@font-face {
  font-family: 'Inter';
  src: url('../vendor/fonts/inter.woff2') format('woff2');
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

:root {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
:root, :root[data-design] {
  --font-interface: 'Inter', 'Noto Sans SC', 'Microsoft YaHei UI', sans-serif;
  --font-japanese: 'Noto Sans JP', 'Yu Gothic', 'Hiragino Kaku Gothic ProN', sans-serif;
  --ui-font: var(--font-interface);
  --font-ui: var(--font-interface);
  --journey-font: var(--font-interface);
  --reading-font: var(--font-japanese);
  --study-serif: var(--font-interface);
  --type-caption: 13px;
  --type-control: 14px;
  --type-body: 15px;
  --type-section: 16px;
  --type-card: 18px;
  --type-title: 24px;
  --weight-body: 400;
  --weight-control: 500;
  --weight-heading: 600;
}
/* Native touch inputs must remain at least 16px even when a component loaded
   later uses the smaller desktop control token. Page zoom stays available. */
@media (pointer: coarse) {
  :root :is(input:not([type='checkbox'],[type='radio'],[type='range'],[type='hidden']),
    select,textarea:not(#article-input,#article-source-display)) {
    font-size: max(16px, 1em) !important;
  }
}
:root :is(button,a[href],summary,[role='button']) { touch-action: manipulation; }
/* The listening screen previously redeclared three font stacks of its own. */
html #view-listening {
  --ui-font: var(--font-interface);
  --font-ui: var(--font-interface);
  --reading-font: var(--font-japanese);
  --study-serif: var(--font-interface);
  font-family: var(--font-interface);
}
html body {
  font-family: var(--font-interface);
  font-size: var(--type-body);
  font-weight: var(--weight-body);
  line-height: 1.65;
  letter-spacing: 0;
}
html :is(button,input,textarea,select,summary,.button) { font-family: var(--font-interface); letter-spacing: 0; }
html :is(strong,b) { font-weight: var(--weight-heading); }
html :is(button,.button,summary) { font-weight: var(--weight-control); }
html :is(input,textarea,select) { font-weight: var(--weight-body); }
html :is(input,textarea)::placeholder { color: var(--muted); opacity: 1; }

/* A single Japanese face, including article previews and selectable text. */
html :is([lang='ja'],.material-row-title,.recent-learning-title,.journey-feature h3,
  .journey-reading-sample p,.journey-course strong,:is(#article-input, #article-source-display),#current-sentence,
  #ocr-result-preview,.sentence-review-text,.dictionary-word,.dictionary-reading) {
  font-family: var(--font-japanese);
  letter-spacing: 0;
}
html #view-listening [lang='zh-CN'] { font-family: var(--font-interface); }
html :is(#article-input, #article-source-display) { font-weight: 400; }
html :is(.brand-seal,.portal-rail-layout .brand-seal) { font-family: 'Noto Serif JP', serif; }

/* Page and drawer titles share a scale; section titles never compete with them. */
html :is(.journey-section-head h2,.journey-history h3,.article-editor-heading h2,
  .article-input-heading label,.section-heading h2,.ocr-input-tools h3,
  .recent-learning-heading h3,.quick-recent-heading h2,#settings-drawer h3,
  #dictionary-ai h3,.dictionary-section-heading) {
  font-size: var(--type-section);
  font-weight: var(--weight-heading);
  line-height: 1.5;
}
html :is(.shell-view h1,.creation-header h1,.journey-heading h1,#journey-curriculum h1,
  .materials-detail h2,#settings-drawer h2,#dictionary-title,.journey-dialog h2,
  .recent-confirm-dialog h2,.ocr-merge-dialog h2,.reading-editor h2) {
  font-size: var(--type-title);
  font-weight: var(--weight-heading);
  line-height: 1.4;
  letter-spacing: 0;
}
/* The recommendation is a reading excerpt, with its own book-like voice. */
html .journey-feature { --font-japanese: 'Noto Serif JP', serif; }
html .journey-feature h3 { font-size: 32px; line-height: 1.5; font-weight: 500; }
html[data-design='focus'] .journey-feature h3 { font-size: 32px; }
html .journey-reading-sample p { font-weight: 400; }
html :is(.material-row-title,#view-my-learning .recent-learning-title) {
  font-size: var(--type-card); font-weight: 500; line-height: 1.6;
}
html :is(.material-row-description,.journey-description,.material-body p) { font-weight: 400; }
html :is(.material-row-description,.journey-description) { font-size: var(--type-body); line-height: 1.7; }
html .material-body { font-size: 18px; line-height: 1.9; }
html :is(.journey-course strong,.journey-history-list strong,.quick-recent-learning .recent-learning-title) {
  font-size: var(--type-control); font-weight: 500; line-height: 1.6;
}
html :is(.journey-route strong,.journey-feelings strong) { font-size: var(--type-body); font-weight: 500; }
html :is(.journey-level-path span,.journey-level-path small) { font-size: var(--type-caption); font-weight: 400; }
html :is(.journey-stat-strip strong,.journey-level strong) { font-size: 28px; font-weight: 500; line-height: 1.3; }
html .journey-level-path strong { font-size: 22px; font-weight: 500; }

/* Neutral controls are medium, selected states and the next step are semibold. */
html :is(.journey-button,.material-start,.material-back,.materials-toolbar button,
  .materials-filters button,.recent-learning-action,.recent-filter,#account-menu .account-menu-item,
  #main-content button,#creation-workspace button,#settings-drawer button,#dictionary-panel button) {
  font-size: var(--type-control); font-weight: 500; line-height: 1.5;
}
html :is(.journey-button.is-primary,#start-learning,#material-start,#recent-confirm-accept,
  #settings-drawer button[aria-selected='true'],.recent-filter[aria-pressed='true']) { font-weight: 600; }
/* These are symbols, not labels. Preserve their compact geometry. */
html :is(#settings-drawer button.settings-info,#dictionary-panel .context-info,.context-info) { font-size: 10px; font-weight: 400; line-height: 1; }
html :is(#main-content,#creation-workspace) .page-number { font-size: 14px; line-height: 1; }
html :is(.journey-dialog label,.journey-dialog legend,#settings-drawer legend) { font-size: 14px; font-weight: 500; }
html :is(.journey-dialog .journey-check,#settings-drawer .settings-tabs button) { font-weight: 400; }
html #settings-drawer .settings-tabs button[aria-selected='true'] { font-weight: 600; }
html #settings-drawer .voice-choice strong { font-size: 15px; font-weight: 500; }

/* Metadata is quiet but readable in either appearance. No faded text opacity. */
html :is(.journey-heading p,.journey-section-head > span,.journey-metadata,.journey-reason,
  .journey-route-note,.journey-level span,.journey-small,.journey-course small,
  .journey-course > span:last-child,.journey-stat-strip span,.journey-history-list time,
  .journey-level-path small,.journey-study-bridge span,.journey-feelings small,
  .material-level,.material-tag,.materials-summary,.material-page,.material-meta,
  .recent-learning-meta,.recent-learning-timestamp,.learning-library-summary,
  .recent-pagination,.account-menu-heading small,.sentence-review-note,.sentence-review-status,
  #dictionary-count,#dictionary-input-hint,#dictionary-ai-hint,.dictionary-label,
  .dictionary-heading p,.dictionary-footer,#settings-drawer .settings-note,
  .settings-feedback,.article-panel #input-hint,#article-save-hint,#input-status,
  #playback-status,.subtitle-hint,.app-footer,.input-hint,.recent-learning-time,
  .recent-learning-status,#tts-status,#phase-status,.sentence-counter,.app-header-note,
  .ocr-mode-option small,.ocr-mode-option em,.ocr-review-sources p,.ocr-page-state,
  .ocr-review-reference > span,.recent-search-label > span) {
  font-size: var(--type-caption);
  font-weight: 400;
  line-height: 1.6;
}
html :is(.journey-heading p,.journey-metadata,.journey-reason,.journey-route-note,
  .journey-small,.recent-learning-meta,.recent-learning-timestamp,.material-tag) { color: var(--muted); }
html .journey-section-head .journey-button { font-size: 13px; font-weight: 500; }
html .journey-study-bridge strong { font-weight: 500; }
html .sentence-review-text { font-size: 18px; font-weight: 400; line-height: 1.9; }
html #journey-curriculum h1, html #workspace-title, html #journey-progress .journey-section-head h2 { font-size: var(--type-title); line-height: 1.4; font-weight: 600; }
html #material-source-title { font-size: 14px; font-weight: 500; }
html :is(.recent-confirm-dialog,.ocr-merge-dialog,.reading-editor) button { font-size: 14px; font-weight: 500; line-height: 1.5; }
html :is(.recent-confirm-shell p,.reading-editor label) { font-size: 14px; font-weight: 400; line-height: 1.7; }
html :is(#settings-drawer .shortcut-key-help small,#dictionary-panel .dictionary-senses details,#dictionary-panel .dictionary-footer) { color: var(--muted); }
html #settings-drawer a { color: var(--accent); }
html .reading-editor-summary dt { color: var(--muted); font-size: 13px; line-height: 1.6; }
html #dictionary-panel :is(.dictionary-ai-examples caption,.dictionary-ai-note) { color: var(--muted); }
html #dictionary-panel .dictionary-senses li::marker { color: var(--muted); }
html #dictionary-panel .dictionary-ai-translation { color: var(--ink); }

/* The same text hierarchy has to survive the inverted night-time controls. */
html[data-design='focus'] :is(.btn-primary,#material-start) {
  --button-text: var(--journey-on-primary);
  color: var(--journey-on-primary);
  font-weight: 600;
}
html[data-design='focus'] #save-article {
  --button-background: var(--journey-raised);
  --button-background-hover: var(--journey-active);
  --button-background-active: var(--journey-active);
  --button-text: var(--ink);
  color: var(--ink);
  background-color: var(--journey-raised);
}
html[data-design='focus'] #view-listening #listening-continue {
  color: var(--journey-on-primary); background: var(--journey-primary);
}
html[data-design='focus'] :is(.material-quick-filter[aria-pressed='true'],.material-page[aria-current='page']) {
  color: var(--paper); font-weight: 600;
}
html .material-option-count { font-size: 13px; font-weight: 400; opacity: 1; }

/* Listening: retain the responsive answer-card geometry. */
html #view-listening :is(button,summary,.listening-choice-control button) {
  font-family: var(--font-interface); font-size: 14px; font-weight: 500;
}
html #view-listening :is(#listening-question-title,.listening-sheet h2) {
  font-family: var(--font-interface); font-size: 22px; font-weight: 600; line-height: 1.4;
}
html #view-listening #listening-questions button {
  font-family: var(--font-interface); font-size: 16px; font-weight: 400; line-height: 1;
}
html #view-listening :is(#listening-questions button[aria-current='step'],
  button[aria-pressed='true'],#listening-check,#listening-finish,#listening-next) { font-weight: 600; }
html #view-listening :is(.listening-paper-context,.listening-timeline-caption,
  .listening-legend,.listening-session,.listening-submit-summary,.listening-review-meta) {
  font-size: 13px; font-weight: 400; line-height: 1.6;
}
html #view-listening #listening-options label { font-size: 16px; font-weight: 400; line-height: 1.6; }
html #view-listening #listening-options label:has(input:checked) { font-weight: 500; }
html #view-listening .listening-review-body h3 { font-size: 16px; font-weight: 600; color: var(--ink); }
html #view-listening :is(.listening-choice-control button,.listening-timeline-caption,
  #listening-questions button,.listening-session) { font-variant-numeric: tabular-nums; }

/* Account, authentication, guide and administration use the same hierarchy. */
html .portal-rail-layout :is(h1,.page-heading h1,.guide-heading h1) {
  font-family: var(--font-interface); font-size: 24px; font-weight: 600; line-height: 1.4; letter-spacing: 0;
}
html .portal-rail-layout :is(h2,.panel h2,.guide-sheet h2) { font-size: 18px; font-weight: 600; line-height: 1.5; }
html .portal-rail-layout .auth-note h2 { font-size: 24px; font-weight: 600; line-height: 1.4; margin: 8px 0 12px; }
html .portal-rail-layout :is(h3,.setting-row strong,.guide-features dt) { font-size: 15px; font-weight: 500; }
html .portal-rail-layout :is(button,.button,.text-button,nav,.form-links,label) { font-size: 14px; font-weight: 500; }
html .portal-rail-layout :is(.help,.eyebrow,.badge,.summary-strip span,td small,th,footer,.pagination) { font-size: 13px; font-weight: 400; line-height: 1.6; }
html .portal-rail-layout :is(input,select,textarea) { font-family: var(--font-interface); font-size: 16px; }
html .portal-rail-layout :is(table,.guide-index a) { font-size: 14px; }
html .portal-rail-layout :is(.guide-sheet p,.guide-sheet li,.guide-sheet dd) { font-size: 15px; line-height: 1.8; }
html .portal-rail-layout .summary-strip strong { font-size: 28px; font-weight: 500; }
html .portal-rail-layout .summary-strip .small-value { font-size: 18px; }
html .portal-rail-layout .portal-nav-glyph { font-family: var(--font-interface); font-weight: 500; }

@media (max-width: 600px) {
  html :is(.journey-heading h1,#journey-curriculum h1,.creation-header h1), html #journey-progress .journey-section-head h2 { font-size: 22px; }
  html[data-design='focus'] .journey-feature h3 { font-size: 25px; }
  html .journey-level-path strong { font-size: 18px; }
  html :is(.journey-dialog input,.journey-dialog select,#dictionary-query) { font-size: 16px; }
}
