:root {
  --ink: #101619;
  --ink-soft: #3e4b50;
  --paper: #f3f2ed;
  --paper-deep: #e7e8e1;
  --line: #d3d6cf;
  --white: #fffefa;
  --signal: #d3613e;
  --signal-dark: #983d2a;
  --lime: #c4d94d;
  --blue: #8ec9d1;
  --gold: #e7bb6c;
  --shadow: 0 18px 44px rgba(16, 22, 25, 0.12);
  --radius: 6px;
}

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(460px, 1.6fr) minmax(160px, 0.7fr);
  align-items: center;
  gap: 22px;
  min-height: 76px;
  padding: 12px clamp(18px, 4vw, 64px);
  color: var(--white);
  background: var(--ink);
  border-bottom: 1px solid rgba(255, 254, 250, 0.14);
}

.brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  color: var(--ink);
  background: var(--lime);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}
.brand-copy { display: grid; min-width: 0; }
.brand-copy strong { overflow: hidden; font-size: 16px; white-space: nowrap; text-overflow: ellipsis; }
.brand-copy small { margin-top: 2px; color: #aeb7b9; font-size: 11px; letter-spacing: 0; }

.main-nav { display: flex; align-items: stretch; justify-content: center; gap: 2px; min-width: 0; }
.main-nav [hidden] { display: none !important; }
.main-nav a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 11px;
  color: #aeb7b9;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.main-nav a:hover, .main-nav a.active { color: var(--white); background: rgba(255, 254, 250, .07); border-bottom-color: var(--lime); }
.main-nav svg { width: 15px; height: 15px; }

.top-actions { display: flex; justify-content: flex-end; gap: 8px; min-width: 0; }
.topbar .ghost-button { color: var(--white); border-color: rgba(255, 255, 255, .72); }
.topbar .ghost-button:hover { color: var(--ink); background: var(--white); border-color: var(--white); }
.top-user { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: #dbe2df; font-size: 12px; }
.top-user strong { overflow: hidden; max-width: 110px; white-space: nowrap; text-overflow: ellipsis; }

.main { max-width: 1480px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 64px) 64px; }

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, .88fr);
  gap: 32px;
  min-height: 420px;
  padding: clamp(34px, 7vw, 96px) 0 48px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.hero::before {
  position: absolute;
  inset: 0 45% 0 0;
  content: "";
  pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 68px, rgba(16, 22, 25, .04) 69px 70px);
  mix-blend-mode: multiply;
}
.hero-copy, .hero-panel { position: relative; z-index: 1; }
.eyebrow { margin: 0 0 12px; color: var(--signal-dark); font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.hero h1 { max-width: 780px; margin: 0; font-size: clamp(46px, 7vw, 112px); font-weight: 800; letter-spacing: 0; line-height: .9; text-wrap: balance; }
.hero h1 em { color: var(--signal); font-style: normal; }
.hero-lede { max-width: 580px; margin: 28px 0 0; color: var(--ink-soft); font-size: 17px; line-height: 1.8; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 28px; color: var(--ink-soft); font-size: 12px; }
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta svg { width: 14px; height: 14px; color: var(--signal-dark); }

.hero-panel {
  align-self: end;
  padding: 22px;
  color: var(--white);
  background: var(--signal-dark);
  box-shadow: var(--shadow);
}
.panel-kicker { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #ffd9c7; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.panel-kicker svg { width: 17px; height: 17px; }
.hero-panel h2 { margin: 46px 0 10px; font-size: 38px; line-height: 1; }
.hero-panel p { margin: 0; color: #ffe9dd; font-size: 13px; line-height: 1.7; }
.panel-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 20px; margin-top: 22px; border-top: 1px solid rgba(255,255,255,.24); color: #ffe9dd; font-size: 12px; }

.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.primary-button, .secondary-button, .ghost-button, .danger-button, .icon-button, .filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: transform .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
}
.primary-button:hover, .secondary-button:hover, .ghost-button:hover, .danger-button:hover, .filter-button:hover { transform: translateY(-1px); }
.primary-button { color: var(--ink); background: var(--lime); }
.primary-button:hover { background: #d4e96b; }
.secondary-button { color: var(--white); background: var(--ink); }
.secondary-button:hover { background: #263136; }
.ghost-button { color: var(--ink); background: transparent; border-color: var(--line); }
.ghost-button:hover, .filter-button.active { color: var(--white); background: var(--ink); border-color: var(--ink); }
.danger-button { color: var(--white); background: var(--signal-dark); }
.icon-button { width: 40px; padding: 0; color: var(--ink); background: transparent; border-color: var(--line); }
.icon-button:hover { color: var(--white); background: var(--ink); border-color: var(--ink); }
.button-small { min-height: 34px; padding: 0 11px; font-size: 12px; }
.full-width { width: 100%; }
button:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
svg { width: 16px; height: 16px; stroke-width: 1.8; }

.section { padding: 38px 0 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: 27px; letter-spacing: 0; line-height: 1.1; }
.section-head p { max-width: 580px; margin: 6px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.65; }
.section-head .eyebrow { margin-bottom: 8px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.metric { padding: 17px; background: var(--white); border: 1px solid var(--line); border-top: 3px solid var(--ink); }
.metric:nth-child(2) { border-top-color: var(--signal); }
.metric:nth-child(3) { border-top-color: var(--blue); }
.metric:nth-child(4) { border-top-color: var(--gold); }
.metric-label { display: flex; align-items: center; justify-content: space-between; color: var(--ink-soft); font-size: 12px; }
.metric-label svg { width: 16px; height: 16px; }
.metric strong { display: block; margin-top: 17px; font-size: 35px; line-height: 1; }
.metric small { display: block; margin-top: 8px; color: var(--ink-soft); font-size: 11px; }

.split-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 14px; }
.surface { min-width: 0; padding: 20px; background: var(--white); border: 1px solid var(--line); }
.surface.dark { color: var(--white); background: var(--ink); border-color: var(--ink); }
.surface-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.surface-title h3 { margin: 0; font-size: 17px; }
.surface-title p { margin: 4px 0 0; color: var(--ink-soft); font-size: 12px; }
.dark .surface-title p { color: #aeb7b9; }

.progress-track { height: 8px; overflow: hidden; background: var(--paper-deep); }
.progress-track span { display: block; height: 100%; background: var(--signal); transition: width .3s ease; }
.progress-summary { display: flex; justify-content: space-between; gap: 12px; margin-top: 9px; color: var(--ink-soft); font-size: 12px; }
.dark .progress-summary { color: #aeb7b9; }

.feature-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.feature-list li { display: flex; gap: 9px; align-items: start; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.feature-list svg { flex: 0 0 auto; margin-top: 2px; color: var(--signal); }
.dark .feature-list li { color: #dbe2df; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; background: var(--white); border: 1px solid var(--line); }
.search-box { position: relative; min-width: min(100%, 280px); flex: 1 1 280px; }
.search-box svg { position: absolute; top: 50%; left: 12px; color: var(--ink-soft); transform: translateY(-50%); }
.search-box input { width: 100%; height: 40px; padding: 0 12px 0 38px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); outline: none; }
.search-box input:focus, .field input:focus, .field select:focus, .test-input:focus { border-color: var(--signal); box-shadow: 0 0 0 3px rgba(211, 97, 62, .13); }
.filter-group { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-button { min-height: 34px; padding: 0 10px; color: var(--ink-soft); background: var(--paper); border-color: var(--line); font-size: 12px; }

.word-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.word-card { position: relative; display: flex; min-height: 210px; flex-direction: column; padding: 17px; background: var(--white); border: 1px solid var(--line); transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease; }
.word-card:hover { border-color: var(--signal); box-shadow: 0 10px 28px rgba(16, 22, 25, .09); transform: translateY(-2px); }
.word-top { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.word-top h3 { max-width: calc(100% - 48px); margin: 0; font-size: 25px; line-height: 1; overflow-wrap: anywhere; }
.word-top .word-index { color: var(--ink-soft); font-size: 11px; }
.word-phonetic { margin-top: 8px; color: var(--signal-dark); font-family: Georgia, serif; font-size: 13px; }
.word-meaning { margin-top: 13px; color: var(--ink); font-size: 14px; font-weight: 700; line-height: 1.5; }
.word-example { margin: 12px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.55; }
.word-translation { margin: 5px 0 0; color: #687378; font-size: 11px; line-height: 1.5; }
.word-actions { display: flex; gap: 6px; padding-top: 15px; margin-top: auto; }
.word-actions .icon-button { width: 34px; min-height: 34px; }
.mastered-mark { position: absolute; top: 14px; right: 14px; color: var(--signal); }

.learn-layout { display: grid; grid-template-columns: minmax(220px, .28fr) minmax(0, .72fr); gap: 14px; align-items: start; }
.unit-list { display: grid; gap: 6px; }
.unit-button { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 58px; padding: 10px 12px; color: var(--ink); text-align: left; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.unit-button:hover, .unit-button.active { color: var(--white); background: var(--ink); border-color: var(--ink); }
.unit-button strong { display: block; font-size: 13px; }
.unit-button small { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 11px; }
.unit-button.active small, .unit-button:hover small { color: #aeb7b9; }
.learn-card { min-height: 500px; padding: clamp(22px, 5vw, 56px); color: var(--white); background: var(--ink); }
.learn-card-top { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.learn-card-top .eyebrow { color: var(--lime); }
.learn-card-top small { color: #aeb7b9; }
.learn-word { margin: 54px 0 6px; font-size: clamp(48px, 9vw, 110px); font-weight: 800; letter-spacing: 0; line-height: .9; overflow-wrap: anywhere; }
.learn-phonetic { color: var(--lime); font-family: Georgia, serif; font-size: 18px; }
.learn-meaning { max-width: 760px; margin-top: 26px; color: #f7f9f2; font-size: 22px; font-weight: 700; line-height: 1.4; }
.learn-example { max-width: 760px; margin-top: 24px; color: #dbe2df; font-size: 16px; line-height: 1.65; }
.learn-translation { max-width: 760px; margin-top: 5px; color: #aeb7b9; font-size: 13px; line-height: 1.55; }
.learn-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 30px; }
.learn-controls .ghost-button { color: var(--white); border-color: #445155; }
.learn-controls .ghost-button:hover { background: #263136; border-color: #263136; }
.learn-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 20px; margin-top: 30px; color: #aeb7b9; border-top: 1px solid #364247; font-size: 12px; }

.audio-queue { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 18px; margin-top: 14px; color: var(--white); background: var(--signal-dark); border-left: 4px solid var(--lime); }
.audio-queue-copy { min-width: 0; }
.queue-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.audio-queue-copy strong { display: block; font-size: 14px; }
.audio-queue-copy span { display: block; margin-top: 4px; color: #ffd9c7; font-size: 12px; }
.audio-queue-copy .queue-phase { display: inline-flex; align-items: center; min-height: 21px; padding: 0 8px; margin: 0; color: var(--ink); background: var(--lime); font-size: 10px; font-weight: 800; }
.queue-progress { height: 3px; margin-top: 12px; overflow: hidden; background: rgba(255,255,255,.28); }
.queue-progress span { display: block; height: 100%; margin: 0; background: var(--lime); transition: width .35s ease; }
.audio-queue .button-row { flex: 0 0 auto; }
.audio-queue .ghost-button { color: var(--white); border-color: rgba(255,255,255,.35); }
.audio-queue .ghost-button:disabled { color: #e7a797; border-color: rgba(255,255,255,.16); }

.test-layout { display: grid; grid-template-columns: minmax(210px, .27fr) minmax(0, .73fr); gap: 14px; align-items: start; }
.test-menu { display: grid; gap: 8px; }
.mode-card { padding: 15px; color: var(--ink); text-align: left; background: var(--white); border: 1px solid var(--line); cursor: pointer; }
.mode-card:hover, .mode-card.active { color: var(--white); background: var(--ink); border-color: var(--ink); }
.mode-card strong { display: block; font-size: 14px; }
.mode-card span { display: block; margin-top: 6px; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.mode-card.active span, .mode-card:hover span { color: #aeb7b9; }
.test-stage { min-height: 500px; padding: clamp(20px, 5vw, 52px); background: var(--white); border: 1px solid var(--line); }
.test-stage-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.test-stage-head h2 { margin: 0; font-size: 25px; }
.test-stage-head p { margin: 7px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.test-counter { color: var(--signal-dark); font-size: 12px; font-weight: 800; }
.test-question { margin: 50px 0 24px; font-size: clamp(22px, 3vw, 36px); line-height: 1.25; }
.test-subquestion { margin: -12px 0 24px; color: var(--ink-soft); font-size: 13px; }
.option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.option-button { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 10px 13px; color: var(--ink); text-align: left; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.option-button:hover, .option-button.selected { color: var(--white); background: var(--ink); border-color: var(--ink); }
.option-index { display: grid; place-items: center; width: 25px; height: 25px; flex: 0 0 auto; color: var(--ink); background: var(--lime); font-size: 11px; font-weight: 800; }
.test-input { width: 100%; min-height: 52px; padding: 0 14px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); outline: none; }
.test-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 30px; }
.result-banner { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; padding: 16px; margin-top: 24px; background: #edf1d1; border-left: 4px solid var(--lime); }
.result-banner svg { width: 26px; height: 26px; color: var(--signal-dark); }
.result-banner strong { display: block; font-size: 16px; }
.result-banner span { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 12px; }

.wrong-list, .history-list { display: grid; gap: 8px; }
.wrong-row, .history-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px; background: var(--white); border: 1px solid var(--line); }
.wrong-row-main, .history-main { min-width: 0; }
.wrong-row h3, .history-row h3 { margin: 0; font-size: 17px; }
.wrong-row p, .history-row p { margin: 5px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.wrong-row-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.tag { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; color: var(--ink-soft); background: var(--paper-deep); border-radius: 999px; font-size: 11px; }
.tag.good { color: #496115; background: #e2edab; }
.tag.alert { color: var(--signal-dark); background: #f4d5c9; }

.read-band { display: grid; grid-template-columns: minmax(0, .75fr) minmax(280px, 1.25fr); gap: 18px; align-items: stretch; }
.read-cover { min-height: 330px; padding: 24px; color: var(--white); background: var(--ink); }
.read-cover .cover-number { color: var(--lime); font-size: 72px; font-weight: 800; line-height: .9; }
.read-cover h2 { max-width: 380px; margin: 30px 0 0; font-size: 38px; line-height: 1; }
.read-cover p { max-width: 430px; margin: 14px 0 0; color: #aeb7b9; font-size: 13px; line-height: 1.7; }
.read-info { padding: 24px; background: var(--white); border: 1px solid var(--line); }
.read-info h3 { margin: 0; font-size: 20px; }
.read-info p { color: var(--ink-soft); font-size: 13px; line-height: 1.7; }
.page-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; margin: 20px 0; }
.page-chip { display: grid; place-items: center; min-height: 56px; color: var(--ink-soft); background: var(--paper); border: 1px solid var(--line); font-size: 12px; }
.page-chip strong { display: block; margin-bottom: 3px; color: var(--signal-dark); font-size: 16px; }

.empty-state { padding: 38px 20px; color: var(--ink-soft); text-align: center; background: var(--white); border: 1px dashed var(--line); }
.empty-state svg { width: 28px; height: 28px; margin-bottom: 10px; color: var(--signal); }
.empty-state h3 { margin: 0; color: var(--ink); font-size: 18px; }
.empty-state p { max-width: 420px; margin: 8px auto 0; font-size: 12px; line-height: 1.6; }

.access-gate { max-width: 760px; padding: 96px 20px 70px; margin: 0 auto; text-align: center; }
.access-mark { display: grid; width: 62px; height: 62px; place-items: center; margin: 0 auto 22px; color: var(--signal-dark); background: var(--lime); border: 1px solid var(--ink); }
.access-mark svg { width: 28px; height: 28px; }
.access-gate h1 { margin: 0; font-size: 40px; line-height: 1.08; }
.access-gate > p:not(.eyebrow) { max-width: 520px; margin: 16px auto 0; color: var(--ink-soft); font-size: 15px; line-height: 1.75; }
.access-gate .hero-actions { justify-content: center; }
.profile-copy { max-width: 520px; margin: 12px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.7; }
.dark .profile-copy { color: #dbe2df; }
.admin-list { display: grid; gap: 10px; margin-top: 14px; }
.admin-user { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; background: var(--white); border: 1px solid var(--line); }
.admin-user h3 { margin: 0; font-size: 15px; }
.admin-user h3 .tag { margin-left: 6px; vertical-align: middle; }
.admin-user p { margin: 7px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.preview-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.preview-cta { display: flex; align-items: end; justify-content: space-between; gap: 18px; padding: 26px; color: var(--white); background: var(--ink); }
.preview-cta h2 { margin: 0; font-size: 28px; }
.preview-cta p:not(.eyebrow) { max-width: 540px; margin: 8px 0 0; color: #dbe2df; font-size: 13px; line-height: 1.65; }
.preview-cta .eyebrow { color: var(--lime); }
.preview-cta .ghost-button { color: var(--white); border-color: #657176; }
.preview-cta .ghost-button:hover { color: var(--ink); background: var(--white); border-color: var(--white); }

.modal { width: min(92vw, 520px); padding: 0; border: 0; border-radius: 6px; box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(16, 22, 25, .64); }
.modal-panel { position: relative; padding: 30px; background: var(--white); }
.modal-close { position: absolute; top: 16px; right: 16px; }
.modal-head h2 { margin: 0; font-size: 28px; }
.modal-head p:last-child { max-width: 370px; margin: 8px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.6; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 23px 0 17px; background: var(--paper-deep); }
.segment { min-height: 36px; color: var(--ink-soft); background: transparent; border: 0; border-radius: var(--radius); cursor: pointer; font-size: 12px; font-weight: 700; }
.segment.active { color: var(--white); background: var(--ink); }
.form-grid { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; color: var(--ink-soft); font-size: 12px; }
.field input, .field select { width: 100%; min-height: 42px; padding: 0 11px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); outline: none; }
.register-only.hidden { display: none; }
.form-error { min-height: 21px; margin: 10px 0 4px; color: var(--signal-dark); font-size: 12px; }

.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 40; display: grid; gap: 8px; width: min(360px, calc(100vw - 36px)); }
.toast { display: flex; align-items: start; gap: 10px; padding: 13px; color: var(--white); background: var(--ink); border-left: 3px solid var(--lime); box-shadow: var(--shadow); font-size: 12px; line-height: 1.5; }
.toast svg { flex: 0 0 auto; color: var(--lime); }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; padding: 22px clamp(16px, 4vw, 64px); color: #687378; border-top: 1px solid var(--line); font-size: 11px; }

/* Do not hide the first screen while waiting for an animation frame. */
.motion-ready { opacity: 1; transform: none; }
.motion-ready.motion-in { opacity: 1; transform: none; transition: opacity .25s ease; }

@media (max-width: 1100px) {
  .topbar { grid-template-columns: 1fr auto; }
  .main-nav { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; overflow-x: auto; }
  .top-actions { grid-column: 2; grid-row: 1; }
  .hero { grid-template-columns: 1fr; }
  .hero-panel { max-width: 560px; }
  .word-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
  .topbar { gap: 10px; padding: 10px 14px; }
  .brand-mark { width: 40px; height: 40px; }
  .brand-copy strong { font-size: 14px; }
  .main-nav { margin: 0 -14px; padding: 0 14px; }
  .main-nav a { min-width: 62px; padding: 0 8px; flex-direction: column; gap: 3px; font-size: 10px; }
  .main-nav a svg { width: 16px; height: 16px; }
  .top-user strong { display: none; }
  .hero { min-height: auto; padding-top: 44px; }
  .hero h1 { font-size: clamp(50px, 17vw, 88px); }
  .hero-lede { font-size: 15px; }
  .metric-grid, .split-grid, .learn-layout, .test-layout, .read-band { grid-template-columns: 1fr; }
  .word-grid { grid-template-columns: 1fr; }
  .section-head { align-items: start; flex-direction: column; }
  .learn-card { min-height: 540px; padding: 22px; }
  .learn-word { margin-top: 54px; font-size: clamp(48px, 17vw, 86px); }
  .learn-meaning { font-size: 18px; }
  .option-grid { grid-template-columns: 1fr; }
  .test-stage { padding: 22px; }
  .test-question { margin-top: 38px; font-size: 25px; }
  .audio-queue { align-items: stretch; flex-direction: column; }
  .audio-queue .button-row { width: 100%; }
  .audio-queue .button-row button { flex: 1; }
  .wrong-row, .history-row { align-items: start; flex-direction: column; }
  .wrong-row-actions { width: 100%; }
  .wrong-row-actions button { flex: 1; }
  .page-strip { grid-template-columns: repeat(5, 1fr); }
  .footer { flex-direction: column; }
  .access-gate { padding-top: 64px; }
  .access-gate h1 { font-size: 30px; }
  .admin-user { align-items: flex-start; flex-direction: column; }
  .preview-cta { align-items: flex-start; flex-direction: column; }
  .preview-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .motion-ready { opacity: 1; transform: none; }
}
