/* Student surfaces: quiet navigation, full-width reading, compact controls. */
:root {
  --ink: #252a30;
  --muted: #656d76;
  --line: #e1e5e9;
  --paper: #f3f5f6;
  --shadow: 0 6px 20px rgba(25, 30, 40, 0.07);
}

body { letter-spacing: 0; }
body { font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif; }
.pagearea { min-width: 0; }
.topbar { border-bottom: 1px solid var(--line); }
.topbar h2 { font-weight: 650; }
.section-heading { padding-bottom: 12px; }
.today-task { padding: 20px 0; }
.task-index { border-radius: 4px; font-variant-numeric: tabular-nums; }
.navbtn.active { box-shadow: inset 3px 0 var(--green); }
.exam-tabs { gap: 4px; }
.exam-tab { border-radius: 4px; }
.question + .question { border-top: 1px solid var(--line); }
.qhead .source { color: var(--muted); font-size: 12px; }
.option { border-radius: 6px; }
.question-explanation { border: 0; border-left: 3px solid var(--green); border-radius: 0; padding: 16px 20px; }
.wrongbook-toolbar { border-radius: 0; box-shadow: none; }
.ai-wait { display: flex; align-items: center; gap: 12px; padding: 14px 0; color: #3d5962; font-size: 14px; line-height: 1.6; }
.ai-wait .loader { display: inline-block; flex: 0 0 20px; width: 20px; height: 20px; border-width: 2px; }
.ai-wait > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.translator-body .ai-wait { padding: 10px 0; }
.shell { grid-template-columns: 184px minmax(0, 1fr); gap: 32px; padding: 24px; }
.sidebar { align-self: start; position: sticky; top: 24px; }
.brand, .panel, .workspace { border: 0; border-radius: 0; box-shadow: none; }
.brand { padding: 12px 0 24px; background: transparent; }
.brand h1 { font-size: 23px; }
.brand p { font-size: 12px; }
.mark { flex-shrink: 0; }
.navbtn { border-color: transparent; background: transparent; min-height: 52px; }
.navbtn.active { border-color: transparent; background: #dfece7; color: #105b4e; }
.navbtn:not(.active):hover { background: #e9ecf0; }
.stats { margin-top: 20px; padding: 18px 12px; border-top: 1px solid var(--line); background: transparent; font-size: 13px; }
.account-button { box-shadow: none; max-width: 280px; font-weight: 600; }
#accountButtonName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-dropdown { width: min(300px, calc(100vw - 24px)); }
.pagearea { padding-top: 46px; }
.page-workspace { min-height: calc(100vh - 94px); }
.topbar { padding: 24px 32px; flex-wrap: wrap; }
.topbar h2 { font-size: 24px; }
.study-header { background: #fff; }
.section-heading h2 { font-size: 18px; }
.eyebrow { font-weight: 500; }
.study-content { gap: 28px; }
.today-task { border-width: 0 0 1px; border-radius: 0; }
.task-index { background: #edf1f8; color: var(--blue); }
.practice-layout { grid-template-columns: 238px minmax(0, 1fr); gap: 24px; }
.practice-tools { gap: 0; background: #fff; }
.practice-tools > .panel + .panel { border-top: 1px solid var(--line); }
.results { grid-column: 2; }
.results > .panel + .panel { border-top: 1px solid var(--line); }
.exam-overview { border: 0; border-radius: 0; box-shadow: none; background: #fff; }
.quiz { padding: 24px; }
.question { padding: 24px 0; }
.stem, .passage-body, .option { font-size: 17px; line-height: 1.8; overflow-wrap: anywhere; }
.passage { padding: 20px; border-radius: 0; background: #f4f7fb; }
.option { cursor: pointer; padding: 12px 14px; }
.option:hover { border-color: #9aa9b9; }
.option:has(input:checked):not(.correct):not(.wrong) { border-color: var(--green); background: #f0f7f4; }
.option input { flex-shrink: 0; margin-top: 8px; accent-color: var(--green); }
.empty { min-height: 300px; place-content: center; justify-items: center; gap: 12px; }
.empty h2 { font-size: 20px; }
.word-layout { gap: 32px; grid-template-columns: minmax(0, 1fr) 240px; padding: 24px 32px; }
.word-main { padding: 0; }
.word-side { gap: 24px; border-left: 1px solid var(--line); padding-left: 24px; }
.word-side > .panel { padding: 0; }
.word-side > .panel + .panel { border-top: 1px solid var(--line); padding-top: 20px; }
.word-card { border: 0; border-radius: 0; padding: 24px 0 12px; box-shadow: none; background: #fff; align-content: start; }
.word-card h3 { font-family: "Segoe UI", Arial, sans-serif; font-size: 44px; line-height: 1.3; }
.word-meaning, .word-examples { border: 0; border-top: 1px solid var(--line); border-radius: 0; background: #fff; padding: 16px 0; }
.word-examples { color: var(--muted); }
.word-actions, .word-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.word-actions button, .word-nav button { min-height: 50px; padding: 10px 6px; }
.review-pool-item strong { color: var(--ink); overflow-wrap: anywhere; }
.panel, .topbar > div, .study-split > div, .word-side, .word-controls > * { min-width: 0; }
button { transition: background-color 140ms ease, border-color 140ms ease; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 3px;
}
input[type="password"] { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 6px; padding: 10px; }
@media (max-width: 1180px) {
  .shell { grid-template-columns: 156px minmax(0, 1fr); gap: 18px; padding: 18px; }
  .practice-layout { grid-template-columns: 210px minmax(0, 1fr); gap: 18px; }
  .word-layout { grid-template-columns: minmax(0, 1fr) 220px; gap: 18px; padding: 18px; }
  .word-side { padding-left: 18px; }
  .word-controls { grid-template-columns: minmax(80px, 1fr) minmax(100px, 1fr); }
  .today-task { grid-template-columns: 30px minmax(0, 1fr) 100px; }
  .task-progress { grid-column: 2; }
  .today-task .secondary { grid-column: 3; grid-row: 1 / span 2; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; padding: 12px; gap: 16px; }
  .sidebar { position: static; gap: 8px; }
  .brand { padding: 0 0 8px; min-height: 52px; padding-right: 145px; }
  .brand h1 { font-size: 20px; }
  .brand .mark { width: 34px; height: 34px; }
  .brand p { display: none; }
  .account-menu { position: absolute; top: 14px; right: 12px; left: auto; }
  .account-button { width: auto; max-width: 155px; min-height: 38px; font-size: 12px; }
  .account-dropdown { width: min(300px, calc(100vw - 24px)); }
  .mainnav { gap: 4px; }
  .navbtn { padding: 10px 4px; min-height: 44px; }
  .stats { display: none; }
  .pagearea { padding-top: 0; }
  .topbar { padding: 18px 16px; }
  .topbar h2 { font-size: 22px; }
  .practice-layout, .word-layout { grid-template-columns: 1fr; }
  .results { grid-column: 1; }
  .word-side { border-left: 0; border-top: 1px solid var(--line); padding: 20px 0 0; }
  .word-card h3 { font-size: 34px; min-height: 110px; }
  .word-card { min-height: 410px; }
  .word-actions, .word-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .word-nav button { font-size: 14px; }
  .quiz { padding: 16px; }
  .passage { padding: 14px; }
  .today-task { grid-template-columns: 30px minmax(0, 1fr); }
  .today-task .secondary { grid-column: 2; grid-row: auto; }
  .section-heading { gap: 8px; }
  .empty { padding: 24px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* State visibility must win over the responsive layout declarations. */
.hidden { display: none !important; }

.auth-page { padding: 40px 16px; }
.auth-surface { max-width: 400px; margin: 0 auto; padding: 28px; background: #fff; }
.auth-brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; margin-bottom: 32px; font-size: 23px; font-weight: 700; text-decoration: none; color: var(--ink); }
.auth-brand span { font-family: Georgia, serif; font-size: 15px; font-weight: 400; color: var(--blue); }
.auth-surface h1 { margin-bottom: 24px; }
.auth-surface input { min-width: 0; }
.auth-surface select { width: 100%; min-width: 0; }
.general-learning-controls { display: flex; gap: 16px; align-items: end; flex-wrap: wrap; padding: 12px 24px; }
.general-learning-controls .field { width: 144px; margin: 0; }
.general-learning-controls p { margin: 0 0 8px; }
.word-aspect { border-top: 1px solid #dce4e1; padding-top: 12px; }
.word-aspect summary { cursor: pointer; color: #247259; }
.word-aspect p[lang="ru"] { font-size: 22px; line-height: 1.7; }
#wordText { font-family: Arial, "Segoe UI", sans-serif; line-height: 1.6; overflow: visible; letter-spacing: 0; }
@media (max-width: 480px) {
  .word-exam-switch { flex-wrap: wrap; }
  .word-exam-switch .exam-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .word-exam-switch .exam-tab { min-width: 0; padding: 8px 6px; white-space: normal; font-size: 14px; }
}
.auth-surface .primary { width: 100%; min-width: 0; }
#authMessage { margin-bottom: 16px; color: var(--green-dark); overflow-wrap: anywhere; }
.auth-alternate { margin-top: 24px; font-size: 14px; }
.auth-alternate a { color: var(--green-dark); text-underline-offset: 3px; }

/* Cyrillic identity stays secondary to the student's Chinese navigation. */
.mark { background: #344d70; font-family: Georgia, "Times New Roman", serif; font-size: 32px; font-weight: 400; }
.brand { align-items: flex-start; }
.brand-russian { display: block; margin-top: 3px; color: #526583; font-family: Georgia, "Times New Roman", serif; font-size: 14px; }
.navbtn { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.navbtn small { font-family: "Segoe UI", Arial, sans-serif; font-size: 12px; font-weight: 400; color: var(--muted); }
.word-card h3 { font-weight: 600; }
.account-menu { display: flex; align-items: center; gap: 10px; }
.feedback-entry { min-height: 40px; border: 1px solid #344d70; border-radius: 6px; padding: 8px 16px; color: #fff; background: #344d70; font-weight: 600; white-space: nowrap; }
.feedback-entry:hover { background: #243b5b; border-color: #243b5b; }
.product-feedback-dialog { width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; margin: auto; padding: 24px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff; box-shadow: 0 20px 70px rgba(20, 30, 45, .18); }
.product-feedback-dialog::backdrop { background: rgba(25, 35, 48, .32); }
.feedback-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.feedback-dialog-head h2 { margin: 0; font-size: 24px; }
.feedback-dialog-head .eyebrow { color: #526583; font-family: Georgia, "Times New Roman", serif; font-size: 15px; }
.feedback-dialog-head .secondary { margin: 0; min-height: 40px; width: auto; min-width: 64px; flex-shrink: 0; }
.feedback-dialog-head > div { min-width: 0; }
.feedback-dialog-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.feedback-dialog-footer .primary { flex-shrink: 0; }
.product-feedback-dialog textarea { min-height: 150px; resize: vertical; }
body:has(.product-feedback-dialog[open]) { overflow: hidden; }
@media (max-width: 820px) {
  .brand { padding-right: 0; min-height: 62px; }
  .brand p { display: block; font-size: 12px; }
  .brand-russian { position: absolute; right: 0; top: 8px; font-size: 15px; }
  .sidebar { position: relative; top: auto; }
  .account-menu { top: 78px; left: 12px; right: 12px; justify-content: space-between; }
  .account-button { max-width: 185px; }
  .account-dropdown { top: 48px; }
  .mainnav { margin-top: 52px; }
  .navbtn { flex-direction: column; justify-content: center; gap: 2px; }
  .navbtn small { font-size: 11px; }
  .product-feedback-dialog { padding: 20px; }
  .feedback-dialog-footer { flex-wrap: wrap; }
  .feedback-dialog-footer .primary { margin-left: auto; }
}

/* Learning content takes precedence over setup and statistical summaries. */
.word-exam-switch { padding: 12px 32px; background: #fff; }
.general-learning-controls { padding: 12px 32px 0; align-items: center; }
.general-learning-controls .field { display: flex; align-items: center; gap: 12px; width: auto; }
.general-learning-controls select { width: 110px; }
.general-learning-controls p { margin: 0; }
.word-controls { display: flex; align-items: center; gap: 12px; margin: 16px 0 0; }
.word-controls .field { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.word-controls .field > span { white-space: nowrap; }
.word-controls input { width: 84px; }
.word-controls .primary { width: auto; min-width: 112px; flex: 0 0 auto; }
.word-session-progress { height: 4px; border-radius: 0; }
.word-card-head .badge { background: transparent; padding-left: 0; color: var(--muted); font-weight: 500; }
#wordIndex { color: var(--green-dark); font-variant-numeric: tabular-nums; }
#wordText { min-height: 140px; margin: 0; color: #202d35; }
#wordPart { margin: 0; }
.word-meaning { min-height: 88px; border-top-color: #cddbd5; }
.word-nav #nextWordBtn { background: var(--green); color: #fff; border-color: var(--green); }
.word-nav #nextWordBtn:hover:not(:disabled) { background: var(--green-dark); }
.word-nav #prevWordBtn { background: #f3f5f6; }
.word-feedback { justify-items: start; }
.word-feedback .feedback-form { width: 100%; }
.word-feedback .linkbtn { font-size: 13px; color: var(--muted); }
.word-side { align-content: start; }
.word-stat-grid > div { border: 0; border-radius: 0; background: transparent; padding: 12px 0; border-bottom: 1px solid var(--line); }
.word-side h2 { font-size: 16px; }
.review-pool-item { border-radius: 0; }
.study-content > section { background: transparent; }
.auth-surface { border-top: 3px solid var(--green); }
button:active:not(:disabled) { transform: translateY(1px); }
@media (max-width: 820px) {
  .shell { padding: 12px; gap: 12px; }
  .brand { min-height: 48px; padding-bottom: 0; }
  .brand-russian { top: 6px; }
  .account-menu { top: 64px; }
  .mainnav { margin-top: 44px; }
  .navbtn { min-height: 44px; padding: 6px 4px; }
  .topbar { padding: 14px 16px; gap: 6px; }
  .topbar h2 { font-size: 20px; }
  #wordsPage .eyebrow { display: none; }
  #wordMeta { font-size: 12px; }
  .word-exam-switch { padding: 8px 16px; gap: 4px; }
  .word-exam-switch .switch-label { display: none; }
  .word-exam-switch .exam-tab { min-height: 40px; }
  .general-learning-controls { padding: 10px 16px 0; gap: 8px; }
  .general-learning-controls .field { gap: 8px; font-size: 13px; }
  .general-learning-controls select { width: 90px; padding: 6px; min-height: 36px; }
  .general-learning-controls p { font-size: 12px; }
  .word-layout { padding: 16px; gap: 20px; }
  .word-main > .panel-titleline h2 { font-size: 15px; }
  .word-controls { margin-top: 10px; gap: 8px; justify-content: space-between; }
  .word-controls .field { gap: 8px; font-size: 13px; }
  .word-controls input { width: 64px; padding: 8px; }
  .word-controls .primary { min-width: 100px; padding: 10px; }
  .word-card { min-height: 0; padding-top: 18px; gap: 10px; }
  #wordText { min-height: 100px; }
  .word-meaning { min-height: 76px; padding: 12px 0; font-size: 17px; }
  .word-actions button, .word-nav button { min-height: 46px; }
  .word-side { gap: 20px; }
  .word-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
