:root {
  --ink: #17221e;
  --muted: #69736d;
  --paper: #f4f3ee;
  --panel: #fff;
  --line: #d9dcd7;
  --accent: #126348;
  --accent-2: #d9ece4;
  --gold: #c1903f;
  --nav: #10251e;
  --danger: #9f3b32;
  --shadow: 0 18px 50px rgba(20, 38, 31, 0.08);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
}
.app-loading {
  display: none;
}
body.app-booting {
  min-height: 100vh;
  overflow: hidden;
  background: var(--nav);
}
body.app-booting > .app-shell,
body.app-booting > .sidebar-backdrop,
body.app-booting > .toast,
body.app-booting > .rank-up-dialog,
body.app-booting > .pedagogy-dialog,
body.app-booting > .data-credit {
  visibility: hidden;
}
body.app-booting > .app-loading {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: #edf5f1;
  font-family: Georgia, serif;
  font-size: 1rem;
  letter-spacing: 0.01em;
}
.app-loading-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 50%;
  color: #edd8aa;
  font-size: 1.05rem;
}
button,
input,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--nav);
  color: #edf5f1;
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
  font-family: Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 8px 40px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: #edd8aa;
}
.sidebar nav {
  display: grid;
  gap: 6px;
}
.nav-item {
  border: 0;
  background: transparent;
  color: #aebfb8;
  border-radius: 8px;
  padding: 12px;
  text-align: left;
  display: flex;
  gap: 13px;
  align-items: center;
}
.nav-item span {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: #72877f;
}
.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.09);
  color: white;
}
.nav-item.active span {
  color: #edd8aa;
}
.sidebar-week {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.13);
  padding: 24px 8px 22px;
  display: grid;
  gap: 7px;
}
.sidebar-week .overline {
  color: #82948d;
  margin: 0;
}
.sidebar-week strong {
  font-family: Georgia, serif;
  font-size: 1.05rem;
}
.sidebar-week span {
  font-size: 0.75rem;
  color: #9caea7;
}
.mini-progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  margin-top: 9px;
}
.mini-progress i {
  display: block;
  width: 38%;
  height: 100%;
  background: #d7b56c;
}
.theme-button {
  background: transparent;
  border: 0;
  color: #92a59d;
  text-align: left;
  padding: 9px 8px;
  display: flex;
  gap: 10px;
}
.theme-button:hover {
  color: white;
}
main {
  min-width: 0;
}
.topbar {
  height: 112px;
  padding: 25px clamp(24px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 18px;
}
.topbar h1 {
  font-family: Georgia, serif;
  font-size: 1.65rem;
  margin: 3px 0 0;
  font-weight: 500;
}
.topbar-title {
  min-width: 0;
}
.topbar-title h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.overline {
  font-size: 0.7rem;
  letter-spacing: 0.13em;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
}
.streak {
  margin-left: auto;
  text-align: right;
  font-size: 0.75rem;
  color: var(--muted);
  display: grid;
  gap: 6px;
}
.streak strong {
  font-size: 0.8rem;
  color: var(--ink);
}
.streak i {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 3px;
}
.streak i.empty {
  background: var(--line);
}
.menu-button {
  display: none;
}
.topbar-brand {
  display: none;
}
.view {
  display: none;
  padding: clamp(28px, 5vw, 68px);
  max-width: 1440px;
  margin: auto;
}
.view.active {
  display: block;
}
.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(310px, 0.7fr);
  gap: clamp(32px, 6vw, 90px);
}
.setup-panel {
  position: relative;
}
.setup-panel h2 {
  font:
    850 clamp(2rem, 4vw, 3.5rem) / 1.05 Inter,
    ui-sans-serif,
    system-ui,
    sans-serif;
  max-width: 650px;
  margin: 8px 0 18px;
  letter-spacing: -0.045em;
}
.setup-panel > p {
  color: var(--muted);
  max-width: 620px;
  line-height: 1.65;
  font-size: 1.05rem;
}
.setup-panel form {
  max-width: 760px;
  margin-top: 34px;
  padding: clamp(24px, 4vw, 38px);
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.setup-panel label,
.observation-panel label {
  display: block;
  font-weight: 650;
  font-size: 0.85rem;
  margin-bottom: 9px;
}
.input-row {
  display: flex;
  border-radius: 14px;
}
.input-row:focus-within {
  outline: 3px solid #168ac2;
  outline-offset: 3px;
}
.input-row input {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 16px 17px;
  border-radius: 8px 0 0 8px;
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 1.05rem;
}
.input-row input:focus,
.input-row input:focus-visible {
  outline: none !important;
  border-color: var(--accent);
}
textarea:focus {
  outline: 3px solid rgba(18, 99, 72, 0.18);
  border-color: var(--accent);
}
.input-row button,
.primary-button {
  border: 0;
  background: var(--accent);
  color: white;
  padding: 0 20px;
  border-radius: 0 8px 8px 0;
  font-weight: 650;
}
.field-help {
  font-size: 0.78rem !important;
  margin-top: 10px !important;
}
.text-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  text-decoration: underline;
}
.error {
  color: var(--danger) !important;
}
.recent-block {
  margin-top: 48px;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.section-heading h3 {
  font:
    500 1.15rem Georgia,
    serif;
  margin: 0;
}
.section-heading span,
.section-heading button {
  font-size: 0.72rem;
  color: var(--muted);
}
.section-heading button {
  border: 0;
  background: transparent;
}
.recent-study {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 17px 4px;
  text-align: left;
  color: var(--ink);
}
.recent-study:hover {
  padding-left: 10px;
}
.recent-study > span:first-child {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 8px;
}
.recent-study b {
  font-size: 0.67rem;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 0.08em;
}
.recent-study strong {
  font-family: Georgia, serif;
}
.recent-study > span:last-child {
  font-size: 0.75rem;
  color: var(--muted);
}
.method-panel {
  border-left: 1px solid var(--line);
  padding-left: clamp(28px, 5vw, 60px);
}
.method-panel:has(.first-run-guide[hidden]) {
  display: none;
}
.setup-grid:has(.method-panel .first-run-guide[hidden]) {
  grid-template-columns: minmax(0, 780px);
}
.method-panel ol {
  list-style: none;
  padding: 0;
  margin: 28px 0;
}
.method-panel li {
  display: flex;
  gap: 18px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.method-panel li > span {
  font-size: 0.68rem;
  color: var(--gold);
  font-weight: 700;
  width: 32px;
}
.method-panel li div {
  display: grid;
  gap: 4px;
}
.method-panel li strong {
  font-family: Georgia, serif;
}
.method-panel li small {
  color: var(--muted);
}
blockquote {
  font:
    italic 1.08rem/1.55 Georgia,
    serif;
  color: var(--muted);
  margin: 34px 0 0;
}
.study-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
}
.study-header h2 {
  font:
    500 clamp(2rem, 4vw, 3.5rem) Georgia,
    serif;
  margin: 8px 0 0;
}
.progress-label {
  font-size: 0.74rem;
  color: var(--muted);
  text-align: right;
  width: 180px;
}
.progress {
  height: 5px;
  background: var(--line);
  margin-top: 8px;
}
.progress i {
  display: block;
  width: 25%;
  height: 100%;
  background: var(--accent);
}
.study-tabs {
  display: flex;
  gap: 4px;
  margin: 34px 0;
}
.study-tabs button {
  border: 1px solid var(--line);
  padding: 9px 14px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
}
.study-tabs button.active {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}
.learning-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.65fr);
  gap: 24px;
}
.word-card,
.passage-peek,
.parse-card,
.observation-panel,
.translation-panel,
.review-grid > article,
.review-grid > aside {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.word-card {
  padding: clamp(25px, 5vw, 54px);
}
.word-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.69rem;
  letter-spacing: 0.08em;
}
.word-meta button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  color: var(--accent);
}
.original-word {
  font:
    500 clamp(2.8rem, 7vw, 5rem) Georgia,
    serif;
  margin-top: 17px;
}
.lemma {
  color: var(--muted);
  font-family: Georgia, serif;
}
.context-line {
  margin: 24px 0;
  padding: 15px 0;
  border-block: 1px solid var(--line);
  font:
    1.3rem/1.6 Georgia,
    serif;
}
.question {
  font-weight: 650;
  margin-top: 24px;
}
.answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.answer {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 7px;
  padding: 13px;
  text-align: left;
  color: var(--ink);
}
.answer:hover {
  border-color: var(--accent);
}
.answer.correct {
  background: var(--accent-2);
  border-color: var(--accent);
  color: #174d3b;
}
.answer.wrong {
  border-color: var(--danger);
  color: var(--danger);
}
.feedback {
  margin-top: 17px;
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  background: var(--accent-2);
  font-size: 0.85rem;
  line-height: 1.5;
}
.card-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 28px;
}
.quiet-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 7px;
  padding: 10px 14px;
}
.primary-button {
  border-radius: 7px;
  padding: 11px 17px;
}
.passage-peek {
  padding: 24px;
}
.passage-peek #passage-text {
  font:
    1.2rem/2 Georgia,
    serif;
  margin: 22px 0;
}
.verse {
  display: block;
}
.verse sup {
  font: 600 0.62rem system-ui;
  color: var(--gold);
  margin-right: 5px;
}
.token {
  padding: 2px 1px;
  border-bottom: 2px solid transparent;
}
.token.learning {
  border-color: var(--gold);
}
.token.new {
  border-color: var(--danger);
}
.passage-key {
  display: flex;
  gap: 12px;
  font-size: 0.68rem;
  color: var(--muted);
}
.passage-key i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
}
.passage-key i.learning {
  background: var(--gold);
}
.passage-key i.new {
  background: var(--danger);
}
.status-badge {
  font-size: 0.72rem;
  background: var(--accent-2);
  color: var(--accent);
  padding: 7px 10px;
  border-radius: 999px;
}
.analysis-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 24px;
  margin-top: 36px;
}
.parse-card,
.observation-panel {
  padding: 30px;
}
.parse-word {
  font:
    2.8rem Georgia,
    serif;
  margin: 16px 0 4px;
}
.parse-card > p:not(.overline) {
  color: var(--muted);
}
fieldset {
  border: 0;
  padding: 0;
  margin: 25px 0 18px;
}
legend {
  font-weight: 650;
  margin-bottom: 12px;
}
.parse-option {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.87rem;
}
.observation-panel h3 {
  font:
    500 1.7rem Georgia,
    serif;
  margin: 14px 0;
}
.observation-item {
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  font-size: 0.88rem;
  line-height: 1.45;
}
.observation-item span {
  color: var(--gold);
}
textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
  padding: 12px;
  color: var(--ink);
  line-height: 1.5;
}
.observation-panel label {
  margin-top: 22px;
}
.translation-panel {
  margin-top: 24px;
  padding: 30px;
}
.translation-source {
  font:
    1.6rem/1.6 Georgia,
    serif;
  margin-bottom: 7px;
}
.translation-aid {
  font-size: 0.76rem;
  color: var(--muted);
}
.translation-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 0.7rem;
  color: var(--muted);
}
.aid-switch {
  font-size: 0.78rem;
  color: var(--muted);
}
.model-comparison {
  border-left: 3px solid var(--gold);
  margin-top: 17px;
  padding: 11px 15px;
  background: rgba(193, 144, 63, 0.09);
}
.model-comparison p {
  font-family: Georgia, serif;
}
.model-comparison small {
  color: var(--muted);
}
.review-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 38px 0 24px;
  border-block: 1px solid var(--line);
}
.review-metrics div {
  padding: 24px;
  border-right: 1px solid var(--line);
}
.review-metrics div:last-child {
  border: 0;
}
.review-metrics span,
.review-metrics small {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
}
.review-metrics strong {
  display: block;
  font:
    500 2rem Georgia,
    serif;
  margin: 7px 0;
}
.review-grid {
  display: grid;
  grid-template-columns: 1.45fr 0.55fr;
  gap: 24px;
}
.review-grid > article,
.review-grid > aside {
  padding: 28px;
}
.queue-item {
  display: grid;
  grid-template-columns: 45px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.queue-item > span {
  font-family: Georgia, serif;
  font-size: 1.2rem;
}
.queue-item strong {
  display: block;
}
.queue-item small {
  color: var(--muted);
}
.queue-item button {
  border: 0;
  background: transparent;
  color: var(--accent);
}
.rhythm-chart {
  height: 160px;
  display: flex;
  align-items: end;
  justify-content: space-around;
  border-bottom: 1px solid var(--line);
  margin: 30px 0;
}
.rhythm-chart div {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: end;
  align-items: center;
  gap: 7px;
  font-size: 0.7rem;
  color: var(--muted);
}
.rhythm-chart i {
  width: 17px;
  background: var(--accent);
  display: block;
}
.review-grid aside > p:last-child {
  font:
    1rem/1.5 Georgia,
    serif;
  color: var(--muted);
}
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: var(--nav);
  color: white;
  padding: 13px 17px;
  border-radius: 7px;
  box-shadow: var(--shadow);
  transform: translateY(100px);
  opacity: 0;
  transition: 0.25s;
  z-index: 10;
}
.toast.show {
  transform: none;
  opacity: 1;
}
.rank-up-dialog {
  width: min(430px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  color: var(--ink);
  padding: 38px;
  text-align: center;
  box-shadow: var(--shadow);
}
.rank-up-dialog::backdrop {
  background: rgba(10, 32, 27, 0.62);
  backdrop-filter: blur(3px);
}
.rank-up-dialog h2 {
  margin: 6px 0 10px;
}
.rank-up-dialog > p:not(.overline) {
  margin: 0 auto 24px;
  color: var(--muted);
  line-height: 1.55;
}
.rank-up-avatar {
  display: grid;
  width: 78px;
  height: 78px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 22px;
  background: var(--mint);
  font-size: 2.35rem;
}
.rank-up-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.6rem;
  cursor: pointer;
}
.pedagogy-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 42%, transparent);
  text-underline-offset: 3px;
  cursor: pointer;
}
.pedagogy-link:hover {
  text-decoration-color: currentColor;
}
.settings-pedagogy-link {
  display: block;
  margin: -4px 0 22px;
  font-size: 0.8rem;
}
.pedagogy-dialog {
  width: min(680px, calc(100% - 28px));
  max-height: min(86dvh, 820px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.pedagogy-dialog::backdrop {
  background: rgba(10, 32, 27, 0.62);
  backdrop-filter: blur(3px);
}
.pedagogy-dialog-content {
  position: relative;
  max-height: min(86dvh, 820px);
  padding: clamp(28px, 5vw, 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.pedagogy-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.65rem;
  cursor: pointer;
}
.pedagogy-dialog h2 {
  margin: 7px 44px 10px 0;
  font:
    600 clamp(1.65rem, 4vw, 2.15rem) Georgia,
    serif;
}
.pedagogy-intro {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}
.pedagogy-dialog section + section {
  margin-top: 24px;
}
.pedagogy-dialog h3 {
  margin: 0 0 7px;
  font-size: 1rem;
}
.pedagogy-dialog section p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.65;
}
.pedagogy-dialog section p + p {
  margin-top: 10px;
}
.pedagogy-dialog .learning-cycle {
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.015em;
}
.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 30px 0 0;
  max-width: 720px;
}
.mode-switch button {
  display: grid;
  gap: 4px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px 14px;
  background: var(--panel);
  color: var(--ink);
}
.mode-switch button span {
  font-size: 0.72rem;
  color: var(--muted);
}
.mode-switch button.active {
  border-color: var(--accent);
  box-shadow: inset 3px 0 var(--accent);
}
.word-mastery {
  margin-top: 20px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}
.word-mastery > div:first-child {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
}
.word-mastery strong {
  color: var(--accent);
}
.word-mastery small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.7rem;
}
.word-mastery .progress i {
  width: 0;
}
.word-mastery .progress i.beginning {
  background: var(--gold);
}
.word-mastery .progress i.developing {
  background: #169bd5;
}
.word-mastery .progress i.durable {
  background: var(--accent);
}
.mobile-mastery-toggle {
  display: none;
}
.data-credit {
  padding: 18px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.7rem;
  border-top: 1px solid var(--line);
}
.mastery-dimensions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-top: 10px;
}
.mastery-dimension {
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--soft);
  text-align: center;
}
.mastery-dimension strong {
  display: block;
  font-size: 0.76rem;
}
.mastery-dimension span {
  font-size: 0.68rem;
  color: var(--muted);
}
@media (max-width: 560px) {
  .mastery-dimensions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* Playful immersion direction: short lessons, bold progress, generous touch targets. */
:root {
  --paper: #f7faf9;
  --panel: #fff;
  --line: #dfe8e3;
  --accent: #20a66a;
  --accent-2: #dff7ec;
  --gold: #ffae32;
  --nav: #fff;
  --shadow: 0 8px 0 rgba(18, 99, 72, 0.07);
}
.sidebar {
  color: var(--ink);
  border-right: 2px solid var(--line);
}
.brand {
  color: var(--accent);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
}
.brand-mark {
  background: var(--accent);
  border: 0;
  color: #fff;
  font-weight: 800;
}
.nav-item {
  color: var(--muted);
  font-weight: 700;
  border: 2px solid transparent;
}
.nav-item:hover,
.nav-item.active {
  background: var(--accent-2);
  color: var(--accent);
  border-color: #bcebd5;
}
.sidebar-week {
  border-top: 2px solid var(--line);
}
.sidebar-week .overline {
  color: var(--accent);
}
.sidebar-week strong {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}
.theme-button {
  color: var(--muted);
}
.theme-button:hover {
  color: var(--accent);
}
.topbar {
  background: var(--panel);
  border-bottom: 2px solid var(--line);
}
.topbar h1 {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 800;
}
.game-stats {
  margin-left: auto;
  display: flex;
  gap: 22px;
  align-items: center;
}
.game-stats span {
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
}
.game-stats span:nth-child(1) {
  color: #ff9f1c;
}
.game-stats span:nth-child(2) {
  color: #ef476f;
}
.game-stats span:nth-child(3) {
  color: #169bd5;
}
.setup-panel h2,
.study-header h2 {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 850;
  letter-spacing: -0.045em;
}
.setup-panel h2 {
  color: #203f33;
}
.input-row input {
  border-width: 2px;
  border-radius: 14px 0 0 14px;
}
.input-row button,
.primary-button {
  background: var(--accent);
  border-bottom: 4px solid #14794d;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.input-row button {
  border-radius: 0 14px 14px 0;
}
.primary-button {
  border-radius: 13px;
}
.quiet-button {
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 13px;
  font-weight: 800;
}
.method-panel {
  border-left: 0;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 24px;
  padding: 26px;
  box-shadow: var(--shadow);
  max-height: 680px;
  overflow: auto;
}
.chapter-path {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.chapter-node {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 0;
  border-bottom: 5px solid #168052;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  font-size: 1rem;
  position: relative;
}
.chapter-node:nth-child(8n + 2),
.chapter-node:nth-child(8n + 4) {
  transform: translateY(10px);
}
.chapter-node:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
}
.chapter-node.done {
  background: #ffb33d;
  border-color: #c37b0b;
}
.chapter-node.current {
  outline: 4px solid #a7e3c8;
  outline-offset: 3px;
}
.word-card,
.passage-peek,
.parse-card,
.observation-panel,
.translation-panel,
.review-grid > article,
.review-grid > aside {
  border-width: 2px;
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.word-card {
  max-width: 760px;
  margin: auto;
}
.original-word {
  text-align: center;
  color: var(--accent);
  font-weight: 700;
}
.lemma {
  text-align: center;
}
.context-line {
  text-align: center;
  border: 0;
  background: var(--paper);
  border-radius: 16px;
  padding: 18px;
}
.question {
  text-align: center;
  font-size: 1.08rem;
}
.answer {
  border: 2px solid var(--line);
  border-bottom-width: 5px;
  border-radius: 15px;
  padding: 16px;
  font-weight: 750;
  background: var(--panel);
}
.answer:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-2);
}
.answers.suppress-hover .answer:hover:not(:disabled) {
  border-color: var(--line);
  background: var(--panel);
}
.answer.correct {
  border-color: var(--accent);
  background: var(--accent-2);
}
.answer.wrong {
  border-color: #ef476f;
  background: #fff0f3;
}
.answer:disabled {
  cursor: default;
}
.progress,
.mini-progress {
  height: 11px;
  border-radius: 999px;
  overflow: hidden;
}
.progress i,
.mini-progress i {
  border-radius: 999px;
}
.mode-switch button {
  border-width: 2px;
  border-radius: 15px;
  padding: 14px;
}
.mode-switch button.active {
  box-shadow: 0 4px 0 #168052;
  background: var(--accent-2);
}
.study-tabs button {
  border-width: 2px;
  font-weight: 750;
}
.feedback {
  border: 0;
  border-radius: 15px;
  padding: 16px;
}
.card-footer {
  position: sticky;
  bottom: 0;
  background: var(--panel);
  padding-top: 18px;
}
.passage-peek {
  max-height: 620px;
  overflow: auto;
}
.review-metrics div {
  background: var(--panel);
}
.auto-advance-note {
  align-self: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}
.word-card.celebrate {
  animation: lesson-pop 0.55s ease;
}
.word-card.celebrate .original-word {
  animation: word-bounce 0.55s ease;
}
.celebration-burst {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  display: grid;
  place-items: center;
  font-size: clamp(3rem, 10vw, 7rem);
  animation: burst-away 0.9s ease forwards;
}
.lesson-complete {
  padding: 32px;
  text-align: center;
  background: linear-gradient(135deg, var(--accent-2), var(--panel));
  border-radius: 18px;
}
.lesson-complete strong {
  display: block;
  color: var(--accent);
  font-size: 1.35rem;
  margin-bottom: 7px;
}
.lesson-complete > span {
  display: grid;
  width: 54px;
  height: 54px;
  margin: 0 auto 16px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 1.6rem;
  font-weight: 900;
}
.lesson-complete p {
  margin: 0;
  line-height: 1.5;
}
.lesson-complete small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
}
.word-card.lesson-finished {
  justify-content: center;
}
.word-card.lesson-finished > :not(.answers, .card-footer) {
  display: none;
}
.word-card.lesson-finished .answers {
  display: block;
}
.word-card.lesson-finished .card-footer {
  width: min(100%, 520px);
  margin: 22px auto 0;
  padding-top: 0;
}
.word-card.lesson-finished .auto-advance-note {
  display: none;
}
@keyframes lesson-pop {
  35% {
    transform: scale(1.018);
  }
  70% {
    transform: scale(0.995);
  }
}
@keyframes word-bounce {
  40% {
    transform: translateY(-10px) scale(1.05);
  }
  75% {
    transform: translateY(2px);
  }
}
@keyframes burst-away {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }
  35% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.5) translateY(-40px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .word-card.celebrate,
  .word-card.celebrate .original-word,
  .celebration-burst {
    animation: none;
  }
}
.words-intro {
  color: var(--muted);
  margin: 8px 0 0;
}
.words-summary {
  display: grid;
  text-align: center;
  background: var(--accent-2);
  color: var(--accent);
  padding: 14px 22px;
  border-radius: 18px;
}
.words-summary strong {
  font-size: 1.7rem;
}
.words-summary span {
  font-size: 0.75rem;
  font-weight: 700;
}
.vocabulary-list {
  display: grid;
  gap: 10px;
}
.vocabulary-row {
  display: grid;
  grid-template-columns:
    minmax(120px, 0.7fr) minmax(190px, 1.2fr) minmax(150px, 1fr)
    minmax(140px, 0.75fr);
  gap: 20px;
  align-items: center;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 15px 18px;
}
.vocabulary-form {
  font:
    700 1.45rem Georgia,
    serif;
  text-align: left;
}
.vocabulary-lemma strong,
.vocabulary-history strong {
  display: block;
}
.vocabulary-lemma small,
.vocabulary-history small {
  color: var(--muted);
}
.vocabulary-progress {
  text-align: right;
}
.vocabulary-progress strong {
  color: var(--muted);
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.vocabulary-progress.beginning strong {
  color: var(--gold);
}
.vocabulary-progress.discovered strong {
  color: var(--accent);
}
.vocabulary-progress.developing strong {
  color: #169bd5;
}
.vocabulary-progress.durable strong {
  color: var(--accent);
}
.vocabulary-progress .progress i.beginning {
  background: var(--gold);
}
.vocabulary-progress .progress i.discovered {
  width: 8px !important;
  min-width: 8px;
  background: var(--accent);
}
.vocabulary-progress .progress i.developing {
  background: #169bd5;
}
.vocabulary-progress .progress i.durable {
  background: var(--accent);
}
.vocabulary-progress .progress i.not-started {
  background: var(--muted);
}
.vocabulary-progress .progress {
  margin-top: 7px;
}
@media (max-width: 1050px) {
  .vocabulary-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 16px;
    row-gap: 14px;
  }
  .vocabulary-form {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .vocabulary-lemma {
    min-width: 0;
    max-width: 100%;
    align-self: start;
    justify-self: end;
    text-align: right;
  }
  .vocabulary-lemma strong,
  .vocabulary-lemma small {
    overflow-wrap: anywhere;
  }
  .vocabulary-history,
  .vocabulary-progress {
    grid-column: 1 / -1;
  }
  .vocabulary-progress {
    text-align: left;
  }
}
.empty-words {
  text-align: center;
  padding: 60px 20px;
  background: var(--panel);
  border: 2px dashed var(--line);
  border-radius: 20px;
  color: var(--muted);
}
.lexicon-pagination {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto minmax(130px, 1fr);
  gap: 14px;
  align-items: center;
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}
.lexicon-pagination[hidden] {
  display: none;
}
.pagination-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.pagination-controls button {
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}
.pagination-controls button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.pagination-controls button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.pagination-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.pagination-ellipsis {
  display: grid;
  min-width: 24px;
  min-height: 44px;
  place-items: center;
}
.lexicon-page-count {
  text-align: right;
}
@media (max-width: 760px) {
  .lexicon-pagination {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .lexicon-page-count {
    text-align: center;
  }
  .pagination-controls {
    order: -1;
  }
}
.library-tabs {
  display: flex;
  gap: 8px;
  margin-top: 28px;
}
.library-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  margin: 28px 0 18px;
}
.library-toolbar .library-tabs,
.library-toolbar .language-switch,
.library-toolbar .word-search {
  margin: 0;
}
.library-toolbar .word-search {
  flex: 1 1 220px;
}
.library-toolbar .word-search input {
  width: 100%;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.library-tabs button {
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 13px;
  background: var(--panel);
  color: var(--muted);
  padding: 11px 18px;
  font-weight: 800;
}
.library-tabs button.active {
  background: var(--accent-2);
  border-color: var(--accent);
  color: var(--accent);
}
.word-search {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}
.word-search input {
  min-width: 220px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  padding: 10px 13px;
}
.word-search input:focus {
  outline: 3px solid rgba(32, 166, 106, 0.2);
  border-color: var(--accent);
}
.settings-intro {
  color: var(--muted);
  margin: 8px 0 0;
  max-width: 650px;
}
.settings-panel {
  max-width: 820px;
  margin-top: 34px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 8px 28px;
}
.setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 30px;
  align-items: center;
  padding: 25px 0;
  border-bottom: 2px solid var(--line);
}
.setting-row label {
  display: block;
  font-weight: 850;
  font-size: 1.02rem;
  margin-bottom: 7px;
}
.setting-row p {
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
  font-size: 0.9rem;
}
.setting-row select {
  width: 100%;
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 13px;
  background: var(--paper);
  color: var(--ink);
  padding: 13px 38px 13px 14px;
  font-weight: 750;
}
.setting-row select:focus {
  outline: 3px solid rgba(32, 166, 106, 0.2);
  border-color: var(--accent);
}
.settings-summary {
  display: grid;
  gap: 4px;
  margin: 24px 0 10px;
  padding: 16px 18px;
  border-radius: 15px;
  background: var(--accent-2);
  color: var(--accent);
}
.settings-summary span {
  color: var(--ink);
  font-size: 0.85rem;
  line-height: 1.45;
}
.settings-note {
  color: var(--muted);
  font-size: 0.78rem;
  margin: 12px 0 22px;
}
.learning-layout {
  grid-template-columns: minmax(0, 820px);
  justify-content: center;
}
.context-label {
  text-align: center;
  margin-top: 24px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}
.context-line {
  margin-top: 8px;
}
.mobile-context-toggle,
.mobile-context-ellipsis {
  display: none;
}
.context-word {
  font: inherit;
  color: inherit;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  padding: 3px 2px;
  border-radius: 5px;
}
.context-word:hover,
.context-word:focus-visible {
  background: var(--accent-2);
  outline: none;
}
.context-word.focus-word {
  border-bottom-color: var(--gold);
}
.context-word.selected {
  background: var(--accent-2);
  color: var(--accent);
}
.context-meaning {
  min-height: 48px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: -12px 0 20px;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 0.84rem;
  border: 2px solid transparent;
  border-radius: 14px;
}
.context-meaning.active {
  background: var(--accent-2);
  border-color: #bcebd5;
  box-shadow: 0 4px 0 rgba(18, 99, 72, 0.08);
}
.context-meaning strong {
  font:
    700 1.2rem Georgia,
    serif;
  color: var(--accent);
}
.context-meaning span {
  color: var(--ink);
  font-weight: 650;
}
.context-heading {
  display: flex;
  justify-content: center;
  align-items: end;
  gap: 8px;
  margin-top: 24px;
}
.context-heading .context-label {
  margin-top: 0;
}
.verse-source {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 2px 4px;
  font-size: 0.72rem;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}
.verse-tooltip {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: calc(100% + 9px);
  width: min(360px, 75vw);
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--nav);
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  font:
    400 0.82rem/1.45 Inter,
    ui-sans-serif,
    system-ui,
    sans-serif;
  text-align: left;
  transform: translate(-50%, 5px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: 0.15s;
}
.verse-source:hover .verse-tooltip,
.verse-source:focus-visible .verse-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}
.lesson-preview {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 34px);
}
.preview-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
}
.preview-heading h3 {
  margin: 5px 0;
  font-size: 1.5rem;
}
.preview-heading p:last-child {
  margin: 0;
  color: var(--muted);
}
.preview-list {
  display: grid;
  gap: 9px;
  margin-top: 25px;
}
.preview-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.7fr) minmax(180px, 1fr) minmax(150px, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 13px 15px;
  border: 2px solid var(--line);
  border-radius: 15px;
}
.preview-form {
  font:
    700 1.35rem Georgia,
    serif;
  color: var(--accent);
}
.preview-lemma strong,
.preview-gloss strong {
  display: block;
}
.preview-lemma small,
.preview-gloss small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}
.mastery-action,
.mark-mastered {
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--accent);
  padding: 8px 10px;
  font-weight: 750;
}
.mastery-action:disabled {
  border-color: transparent;
  background: var(--accent-2);
  cursor: default;
}
.word-mastery > div:first-child > span:last-child {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mark-mastered {
  font-size: 0.72rem;
  padding: 5px 8px;
}
.empty-preview {
  text-align: center;
  padding: 36px;
  color: var(--muted);
  border: 2px dashed var(--line);
  border-radius: 15px;
}
[hidden] {
  display: none !important;
}
[data-theme="dark"] {
  --ink: #e8eee9;
  --muted: #a2afa8;
  --paper: #111815;
  --panel: #18221e;
  --line: #334039;
  --accent: #61bd96;
  --accent-2: #203c31;
  --gold: #e0b766;
  --nav: #09110e;
  --danger: #ed8377;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
}
[data-theme="dark"] .answer.correct {
  color: #bcebd6;
}
.recall-form {
  margin-top: 18px;
}
.recall-form label {
  display: block;
  text-align: center;
  font-weight: 750;
  margin-bottom: 9px;
}
.recall-form > div {
  display: flex;
  border-radius: 14px;
}
.recall-form > div:focus-within {
  outline: 3px solid #168ac2;
  outline-offset: 3px;
}
.recall-form input {
  flex: 1;
  min-width: 0;
  border: 2px solid var(--line);
  border-radius: 13px 0 0 13px;
  background: var(--paper);
  color: var(--ink);
  padding: 13px 15px;
  font-size: 1rem;
}
.recall-form input:focus,
.recall-form input:focus-visible {
  outline: none !important;
  border-color: var(--accent);
}
.recall-form .primary-button {
  border-radius: 0 13px 13px 0;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid #168ac2 !important;
  outline-offset: 3px;
}
.language-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 750;
}
.language-switch span {
  margin-right: 4px;
}
.language-switch button {
  min-height: 44px;
  padding: 8px 16px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
}
.language-switch button.active {
  border-color: var(--accent);
  background: var(--accent-2);
  color: var(--accent);
}
.library-toolbar :is(.library-tabs, .language-switch) {
  gap: 6px;
}
.library-toolbar :is(.library-tabs, .language-switch) button {
  min-height: 44px;
  padding: 9px 14px;
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 12px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 800;
}
.library-toolbar :is(.library-tabs, .language-switch) button.active {
  border-color: var(--accent);
  background: var(--accent-2);
  color: var(--accent);
}
.lesson-controls {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.lesson-controls .quiet-button,
.card-footer button,
.study-tabs button,
.theme-button,
.nav-item {
  min-height: 44px;
}
.review-guidance h3 {
  margin: 10px 0;
  font-size: 1.3rem;
}
.review-guidance p:last-child {
  color: var(--muted);
  line-height: 1.6;
}
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 19;
  border: 0;
  background: rgba(0, 0, 0, 0.45);
}
.toast button {
  margin-left: 12px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 7px;
  background: transparent;
  color: white;
  padding: 5px 9px;
  font-weight: 800;
}
.field-help,
.auto-advance-note,
.word-mastery small,
.mode-switch button span,
.study-tabs button {
  font-size: 0.8125rem !important;
}
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    z-index: 20;
    left: -260px;
    width: 250px;
    transition: 0.2s;
  }
  .sidebar.open {
    left: 0;
  }
  .menu-button {
    display: block;
    flex: 0 0 44px;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-size: 1.3rem;
    min-width: 44px;
    min-height: 44px;
  }
  .topbar-brand {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-weight: 900;
    text-decoration: none;
  }
  .development-badge {
    display: none;
  }
  .setup-grid,
  .learning-layout,
  .analysis-grid,
  .review-grid {
    grid-template-columns: 1fr;
  }
  .method-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 30px 0 0;
  }
  .passage-peek {
    order: -1;
  }
  .review-grid > aside {
    order: -1;
  }
}
@media (max-width: 600px) {
  .topbar {
    height: auto;
    gap: 10px;
    padding: 14px 18px;
  }
  .topbar h1 {
    font-size: 1.1rem;
  }
  .topbar-title .overline {
    display: none;
  }
  .game-stats {
    gap: 10px;
  }
  .game-stats span {
    font-size: 0.78rem;
  }
  .view {
    padding: 24px 16px;
  }
  .setup-panel h2 {
    font-size: 2.2rem;
  }
  .input-row {
    display: grid;
    gap: 8px;
  }
  .input-row input,
  .input-row button {
    border-radius: 13px;
    padding: 14px;
  }
  .study-header {
    align-items: start;
  }
  .progress-label {
    width: 110px;
  }
  .mode-switch {
    grid-template-columns: 1fr;
  }
  .study-tabs {
    overflow-x: auto;
    padding-bottom: 5px;
  }
  .answers {
    grid-template-columns: 1fr;
  }
  .review-metrics {
    grid-template-columns: 1fr;
  }
  .review-metrics div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .translation-actions {
    align-items: start;
    gap: 10px;
  }
  .recent-study > span:first-child {
    grid-template-columns: 1fr;
  }
  .chapter-path {
    grid-template-columns: repeat(5, 1fr);
    gap: 13px;
  }
  .method-panel {
    padding: 20px;
  }
  .learning-layout {
    display: block;
  }
  .passage-peek {
    margin-top: 18px;
    max-height: 260px;
  }
  .word-card {
    min-height: 65vh;
  }
  .card-footer {
    bottom: 0;
  }
  .vocabulary-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 16px;
    row-gap: 14px;
  }
  .vocabulary-form {
    min-width: 0;
    font-size: clamp(1.15rem, 5.6vw, 1.45rem);
    line-height: 1.1;
    overflow-wrap: anywhere;
  }
  .vocabulary-lemma {
    min-width: 0;
    max-width: 100%;
    align-self: start;
    justify-self: end;
    text-align: right;
  }
  .vocabulary-lemma strong {
    font-size: clamp(1rem, 4.8vw, 1.25rem);
    line-height: 1.1;
    overflow-wrap: anywhere;
  }
  .vocabulary-lemma small {
    display: block;
    margin-top: 3px;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }
  .vocabulary-history {
    grid-column: 1/-1;
  }
  .vocabulary-progress {
    grid-column: 1/-1;
    text-align: left;
  }
  .settings-panel {
    padding: 4px 18px;
  }
  .setting-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .preview-heading {
    align-items: start;
    flex-direction: column;
  }
  .preview-row {
    grid-template-columns: 1fr 1fr;
  }
  .preview-row .mastery-action {
    grid-column: 2;
    text-align: center;
  }
}

/* iPhone-first drills use one stable viewport; only long verse text scrolls internally. */
@media (max-width: 700px) {
  body.drill-active .context-line:not(.full-context) {
    max-height: none;
    overflow: hidden;
  }
  body.drill-active .context-line:not(.full-context) .context-far {
    display: none;
  }
  body.drill-active .context-line:not(.full-context) .mobile-context-ellipsis {
    display: inline;
    color: var(--muted);
  }
  body.drill-active .mobile-context-toggle {
    display: block;
    width: max-content;
    margin: -2px auto 3px;
    padding: 3px 8px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 750;
    text-decoration: underline;
  }
  body.drill-active {
    height: var(--drill-viewport-height, 100dvh);
    overflow: hidden;
    overscroll-behavior: none;
  }
  body.drill-active .topbar {
    height: 60px;
    padding: max(8px, env(safe-area-inset-top)) 14px 8px;
  }
  body.drill-active .top-sign-in {
    min-height: 40px;
    padding-inline: 10px;
  }
  body.drill-active .game-stats {
    gap: 8px;
  }
  body.drill-active .data-credit,
  body.drill-active #view-learn > .study-header,
  body.drill-active #view-learn > .study-tabs {
    display: none;
  }
  body.drill-active #view-learn {
    height: calc(var(--drill-viewport-height, 100dvh) - 60px);
    padding: 8px;
    overflow: hidden;
  }
  body.drill-active.keyboard-open .topbar {
    display: none;
  }
  body.drill-active.keyboard-open {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
  }
  body.drill-active.keyboard-open #view-learn {
    position: fixed;
    top: var(--drill-viewport-top, 0px);
    right: 0;
    left: 0;
    height: var(--drill-viewport-height, 100dvh);
    padding-block: 6px;
  }
  body.drill-active.keyboard-open .context-heading,
  body.drill-active.keyboard-open .context-meaning,
  body.drill-active.keyboard-open .word-mastery {
    display: none;
  }
  body.drill-active.keyboard-open .context-line {
    display: block;
    flex: 0 1 auto;
    max-height: 3.1em;
    margin: 4px 0 6px;
    padding: 4px 5px;
    font-size: clamp(1rem, 4.5vw, 1.2rem);
    line-height: 1.35;
  }
  body.drill-active.keyboard-open .context-line:not(.full-context) .context-distance-3,
  body.drill-active.keyboard-open .context-line:not(.full-context) .context-distance-4 {
    display: none;
  }
  body.drill-active.keyboard-open .original-word {
    margin-top: 2px;
    font-size: clamp(2rem, 10vw, 3rem);
  }
  body.drill-active.keyboard-open .word-card {
    padding-block: 8px;
  }
  body.drill-active.keyboard-open .question {
    margin-top: 6px;
  }
  body.drill-active.keyboard-open .card-footer {
    margin-top: 8px;
  }
  body.drill-active .learning-layout,
  body.drill-active .word-card {
    height: 100%;
    min-height: 0;
  }
  body.drill-active .word-card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 12px 12px max(10px, env(safe-area-inset-bottom));
    border-radius: 16px;
  }
  body.drill-active .challenge-chip {
    display: none;
  }
  body.drill-active .word-meta {
    min-height: 18px;
  }
  body.drill-active .original-word {
    margin-top: 3px;
    font-size: clamp(2.25rem, 12vw, 3.6rem);
    line-height: 1.05;
  }
  body.drill-active .lemma {
    font-size: 0.9rem;
    line-height: 1.2;
  }
  body.drill-active .context-heading {
    margin-top: 7px;
  }
  body.drill-active .context-label {
    display: none;
  }
  body.drill-active .verse-source {
    min-height: 30px;
    font-size: 0.78rem;
  }
  body.drill-active .verse-tooltip {
    position: fixed;
    inset: auto 12px calc(72px + env(safe-area-inset-bottom)) 12px;
    width: auto;
    max-height: 35dvh;
    overflow: auto;
    transform: translateY(5px);
  }
  body.drill-active .verse-source:hover .verse-tooltip,
  body.drill-active .verse-source:focus-visible .verse-tooltip {
    transform: translateY(0);
  }
  body.drill-active .context-line {
    flex: 0 1 auto;
    max-height: 5.1em;
    margin: 2px 0 6px;
    padding: 7px 5px;
    overflow: auto;
    overscroll-behavior: contain;
    border: 0;
    border-radius: 12px;
    background: var(--soft);
    font-size: clamp(1.08rem, 5vw, 1.35rem);
    line-height: 1.45;
  }
  body.drill-active .context-meaning {
    min-height: 28px;
    margin: 0 0 5px;
    padding: 4px 8px;
    font-size: 0.78rem;
  }
  body.drill-active .context-meaning strong {
    font-size: 1rem;
  }
  body.drill-active .question {
    margin: 4px 0 7px;
    font-size: 0.93rem;
    line-height: 1.25;
    text-align: center;
  }
  body.drill-active .answers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  body.drill-active .answer {
    min-height: 48px;
    padding: 8px 9px;
    font-size: 0.88rem;
    line-height: 1.2;
  }
  body.drill-active .answer kbd {
    display: none;
  }
  body.drill-active .recall-form {
    margin-top: 5px;
  }
  body.drill-active .recall-form input {
    min-height: 48px;
    font-size: 16px;
  }
  body.drill-active .recall-form .primary-button {
    min-height: 48px;
    padding-inline: 14px;
  }
  body.drill-active .feedback {
    max-height: 70px;
    margin-top: 6px;
    padding: 7px 10px;
    overflow: auto;
    font-size: 0.82rem;
    line-height: 1.3;
  }
  body.drill-active .word-mastery {
    margin-top: 7px;
    padding-top: 6px;
  }
  body.drill-active .word-mastery > div:first-child > span:first-child,
  body.drill-active .mastery-dimensions,
  body.drill-active #word-history,
  body.drill-active .mark-mastered {
    display: none;
  }
  body.drill-active .word-mastery > div:first-child {
    justify-content: flex-end;
  }
  body.drill-active .word-mastery .progress {
    margin-top: 4px;
  }
  body.drill-active .mobile-mastery-toggle {
    display: block;
    margin: 3px auto 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 0.75rem;
    text-decoration: underline;
  }
  body.drill-active .word-mastery.mobile-expanded {
    position: absolute;
    z-index: 6;
    right: 10px;
    bottom: calc(66px + env(safe-area-inset-bottom));
    left: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: var(--shadow);
  }
  body.drill-active .word-mastery.mobile-expanded .mastery-dimensions,
  body.drill-active .word-mastery.mobile-expanded .mark-mastered {
    display: grid;
  }
  body.drill-active .word-mastery.mobile-expanded #word-history {
    display: block;
  }
  body.drill-active .card-footer {
    position: static;
    flex: 0 0 auto;
    margin-top: auto;
    padding: 7px 0 0;
    background: var(--panel);
  }
  body.drill-active .card-footer button {
    min-height: 44px;
  }
}

@media (max-width: 380px), (max-height: 650px) and (max-width: 700px) {
  body.drill-active .game-stats span:nth-child(2) {
    display: none;
  }
  body.drill-active .word-card {
    padding-top: 8px;
  }
  body.drill-active .context-line {
    max-height: 4.2em;
  }
  body.drill-active .word-mastery {
    margin-top: 4px;
  }
}

/* Desktop drill and review workspaces keep every primary control in one viewport. */
@media (min-width: 701px) {
  body.drill-active,
  body.review-active {
    height: 100dvh;
    overflow: hidden;
  }

  body.drill-active .topbar,
  body.review-active .topbar {
    height: 76px;
    padding-block: 12px;
  }

  body.drill-active .data-credit,
  body.drill-active #view-learn > .study-header,
  body.drill-active #view-learn > .study-tabs {
    display: none;
  }

  body.drill-active #view-learn {
    height: calc(100dvh - 76px);
    padding: 18px clamp(24px, 3vw, 44px);
  }

  body.drill-active .learning-layout {
    height: 100%;
    grid-template-columns: minmax(0, 1fr);
  }

  body.drill-active .word-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding: clamp(18px, 2.3vh, 28px) clamp(28px, 4vw, 58px);
    overflow: hidden;
  }

  body.drill-active .original-word {
    margin-top: 6px;
    font-size: clamp(2.75rem, 6vh, 4.25rem);
    line-height: 1.05;
  }

  body.drill-active .context-heading {
    margin-top: 8px;
  }

  body.drill-active .context-line {
    margin: 8px 0;
    padding: 10px 0;
    font-size: clamp(1.05rem, 2.1vh, 1.3rem);
    line-height: 1.45;
  }

  body.drill-active .context-meaning,
  body.drill-active .question {
    margin-block: 7px;
  }

  body.drill-active .answer {
    min-height: 44px;
    padding: 9px 12px;
  }

  body.drill-active .feedback {
    margin-top: 8px;
    padding-block: 7px;
  }

  body.drill-active .word-mastery {
    margin-top: 9px;
    padding-top: 8px;
  }

  body.drill-active .mastery-dimensions {
    margin-top: 6px;
  }

  body.drill-active .mastery-dimension {
    padding-block: 5px;
  }

  body.drill-active .word-mastery small {
    margin-top: 4px;
  }

  body.drill-active .card-footer {
    margin-top: auto;
    padding-top: 8px;
  }

  body.review-active #view-review {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 76px);
    padding: 18px clamp(24px, 3vw, 44px);
    overflow: hidden;
  }

  body.review-active #view-review > .study-header h2 {
    margin-top: 3px;
    font-size: clamp(1.65rem, 3vw, 2.4rem);
  }

  body.review-active .language-switch {
    margin-top: 10px;
  }

  body.review-active .review-metrics {
    flex: 0 0 auto;
    margin: 14px 0;
  }

  body.review-active .review-metrics div {
    padding: 12px 20px;
  }

  body.review-active .review-metrics strong {
    margin: 3px 0;
    font-size: 1.55rem;
  }

  body.review-active .review-grid {
    min-height: 0;
    flex: 1 1 auto;
  }

  body.review-active .review-grid > article,
  body.review-active .review-grid > aside {
    min-height: 0;
    padding: 20px 24px;
  }

  body.review-active .review-list {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  body.review-active .review-list .queue {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
  }

  body.review-active .queue-item {
    padding-block: 10px;
  }
}
.word-mastery strong {
  white-space: nowrap;
}
.review-grid > .review-list {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.review-list .section-heading {
  margin-bottom: 14px;
}
.queue {
  display: grid;
  gap: 10px;
}
.queue-item {
  grid-template-columns:
    minmax(90px, max-content) minmax(120px, 1fr) minmax(140px, 170px)
    auto;
  gap: 16px;
  padding: 15px 18px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 16px;
}
.queue-progress {
  min-width: 0;
  text-align: right;
}
.queue-item > span {
  line-height: 1.35;
}
.queue-item > div {
  min-width: 0;
}
.queue-item strong,
.queue-item small {
  display: block;
}
.queue-item small {
  overflow-wrap: anywhere;
}
.queue-item button {
  white-space: nowrap;
}
@media (max-width: 1050px) {
  .queue-item {
    grid-template-columns: minmax(72px, max-content) minmax(0, 1fr);
    gap: 12px 16px;
  }
  .queue-progress {
    grid-column: 1/-1;
    text-align: left;
  }
  .queue-item button {
    grid-column: 1/-1;
    justify-self: end;
  }
}
@media (max-width: 520px) {
  .queue-item {
    grid-template-columns: minmax(72px, max-content) minmax(0, 1fr);
    padding: 14px;
  }
  .queue-item button {
    grid-column: 2;
    justify-self: start;
    padding: 8px 0;
  }
}
.answer {
  display: flex;
  align-items: center;
  gap: 12px;
}
.answer kbd {
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
  color: var(--muted);
  font:
    800 0.75rem Inter,
    ui-sans-serif,
    system-ui,
    sans-serif;
  box-shadow: 0 2px 0 var(--line);
}
.answer.correct kbd {
  border-color: var(--accent);
  background: var(--panel);
  color: var(--accent);
}
.context-word.focus-word {
  cursor: default;
  background: transparent;
  color: var(--ink);
  border-bottom-color: var(--gold);
  font-weight: 700;
}
.preview-gloss strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  line-height: 1.35;
}
.challenge-chip {
  width: max-content;
  margin: 0 auto 12px;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--accent-2);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 850;
}
.learn-gloss {
  grid-column: 1/-1;
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 22px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  text-align: center;
}
.learn-gloss > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}
.learn-gloss > strong {
  font-size: 1.45rem;
  color: var(--accent);
}
.learn-gloss details {
  max-width: 520px;
  color: var(--muted);
  font-size: 0.85rem;
}
.learn-gloss summary {
  cursor: pointer;
}
.learn-gloss .primary-button {
  margin-top: 8px;
  min-height: 46px;
}
.progress-dashboard {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  margin-top: 34px;
}
.progress-dashboard > article {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px;
}
.daily-card {
  display: flex;
  align-items: center;
  gap: 28px;
}
.daily-card h3 {
  margin: 8px 0;
  font-size: 1.5rem;
}
.daily-card p:not(.overline) {
  color: var(--muted);
}
.daily-card .primary-button {
  min-height: 46px;
}
.daily-ring {
  --goal: 0%;
  width: 150px;
  aspect-ratio: 1;
  flex: 0 0 150px;
  border-radius: 50%;
  display: grid;
  place-content: center;
  text-align: center;
  background:
    radial-gradient(circle, var(--panel) 57%, transparent 59%),
    conic-gradient(var(--accent) var(--goal), var(--line) 0);
}
.daily-ring strong {
  font-size: 2.5rem;
}
.daily-ring span {
  color: var(--muted);
  font-size: 0.78rem;
}
.language-level {
  margin-top: 22px;
}
.language-level > span {
  color: var(--muted);
}
.language-level > strong {
  float: right;
}
.language-level small {
  display: block;
  color: var(--muted);
  margin-top: 8px;
}
.milestone-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}
.milestone {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px;
  border: 2px solid var(--line);
  border-radius: 13px;
  color: var(--muted);
}
.milestone > span {
  font-size: 1.3rem;
}
.milestone strong,
.milestone small {
  display: block;
}
.milestone.earned {
  background: var(--accent-2);
  border-color: #bcebd5;
  color: var(--accent);
}
.weekly-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 18px;
}
.weekly-stats div {
  text-align: center;
  padding: 18px 8px;
  border-radius: 14px;
  background: var(--paper);
}
.weekly-stats strong,
.weekly-stats span {
  display: block;
}
.current-lesson-card {
  margin-top: 1.25rem;
  padding: 1.25rem;
  border: 2px solid var(--line);
  border-radius: 1.4rem;
  background: var(--paper);
  box-shadow: 0 8px 0 var(--shadow);
  display: block;
}
.current-lesson-card[hidden] {
  display: none;
}
.current-lesson-card p {
  margin: 0.2rem 0;
}
.recent-lessons-list {
  margin-top: 0.7rem;
}
.recent-lesson-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}
.recent-lesson-row strong,
.recent-lesson-row small {
  display: block;
}
.recent-lesson-row small {
  margin-top: 0.25rem;
  color: var(--muted);
}
.leaderboard {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.leaderboard-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.leaderboard-heading h3,
.leaderboard-heading p {
  margin: 0;
}
.leaderboard ol {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0.65rem;
}
.leaderboard li {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.65rem 0;
  border-top: 1px solid var(--line);
}
.leaderboard li.is-you {
  color: var(--green);
  font-weight: 700;
}
.leaderboard li span small {
  margin-left: 0.4rem;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: var(--soft);
  font-style: normal;
}
.leaderboard li em {
  font-style: normal;
  white-space: nowrap;
}
.leaderboard-setting {
  width: min(100%, 16rem);
  display: grid;
  gap: 0.55rem;
}
.leaderboard-setting input[type="text"],
.leaderboard-setting > input {
  width: 100%;
}
.leaderboard-choice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
}
@media (max-width: 700px) {
  .current-lesson-card {
    padding: 1rem;
  }
  .recent-lesson-row {
    align-items: stretch;
    flex-direction: column;
  }
  .recent-lesson-row button {
    width: 100%;
  }
}
.weekly-stats strong {
  font-size: 1.8rem;
  color: var(--accent);
}
.weekly-stats span {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 5px;
}
@media (max-width: 850px) {
  .progress-dashboard {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 560px) {
  .daily-card {
    align-items: flex-start;
    flex-direction: column;
  }
  .daily-ring {
    width: 125px;
    flex-basis: 125px;
  }
  .weekly-stats {
    grid-template-columns: 1fr;
  }
}
.general-panel {
  display: grid;
  grid-template-columns: minmax(0, 760px);
  gap: 24px;
  margin-top: 34px;
}
.general-panel > div {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: clamp(24px, 4vw, 38px);
}
.general-panel h3 {
  font-size: 1.55rem;
  margin: 9px 0 20px;
}
.general-panel .language-switch {
  flex-wrap: wrap;
  margin: 0 0 20px;
}
.general-panel > div > p:last-of-type {
  color: var(--muted);
  line-height: 1.55;
}
.general-panel .primary-button {
  min-height: 48px;
  margin-top: 8px;
}
@media (max-width: 760px) {
  .general-panel {
    grid-template-columns: 1fr;
  }
}
.account-panel {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin: 22px 0;
  padding: 20px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
}
.account-panel > div:first-child {
  display: grid;
  gap: 4px;
}
.account-panel small,
.account-panel span {
  color: var(--muted);
}
.account-panel > div:last-child {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.account-panel a {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.danger-button {
  border: 2px solid #d7695e;
  border-radius: 10px;
  background: transparent;
  color: #b7463c;
  padding: 9px 12px;
  font-weight: 750;
}
@media (max-width: 650px) {
  .account-panel {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
  }
  .account-panel > div:last-child {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .account-panel > div:last-child > * {
    justify-content: center;
    min-height: 44px;
    text-align: center;
  }
  .account-panel #export-data {
    grid-column: 1 / -1;
  }
}
.user-management {
  margin: 30px 0 20px;
}
.user-management h3 {
  margin: 5px 0;
  font-size: 1.45rem;
}
.management-note {
  max-width: 720px;
  color: var(--muted);
  line-height: 1.55;
}
.managed-users {
  display: grid;
  gap: 10px;
}
.managed-user {
  display: grid;
  grid-template-columns: minmax(170px, 1.4fr) 70px 70px minmax(140px, 0.8fr) minmax(260px, 1.3fr);
  gap: 14px;
  align-items: center;
  padding: 15px;
  border: 2px solid var(--line);
  border-radius: 15px;
  background: var(--paper);
}
.managed-user strong,
.managed-user small {
  display: block;
}
.managed-user small {
  color: var(--muted);
  overflow-wrap: anywhere;
}
.status-active {
  color: var(--accent);
  text-transform: capitalize;
}
.status-suspended {
  color: #b7463c;
  text-transform: capitalize;
}
.user-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}
.user-actions a {
  text-decoration: none;
}
.user-actions .quiet-button,
.user-actions .danger-button {
  font-size: 0.75rem;
  padding: 7px 9px;
}
@media (max-width: 900px) {
  .managed-user {
    grid-template-columns: 1fr repeat(2, 70px);
  }
  .managed-user > div:nth-child(4) {
    grid-column: 1/2;
  }
  .user-actions {
    grid-column: 2/4;
    justify-content: flex-start;
  }
}
@media (max-width: 600px) {
  .managed-user {
    grid-template-columns: 1fr 1fr;
  }
  .managed-user > div:first-child,
  .managed-user > div:nth-child(4),
  .user-actions {
    grid-column: 1/-1;
  }
}
.access-blocked {
  max-width: 520px;
  margin: 12vh auto;
  padding: 34px;
  border: 2px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: center;
}
.access-blocked p {
  color: var(--muted);
  margin-bottom: 24px;
}
.access-blocked a {
  text-decoration: none;
}
.challenge-chip,
.word-meta,
.context-label {
  display: none;
}
.lesson-complete {
  grid-column: 1/-1;
  width: min(100%, 520px);
  box-sizing: border-box;
  margin-inline: auto;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}
.top-sign-in {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 15px;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
}
.account-panel > .primary-button {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
@media (max-width: 600px) {
  .top-actions {
    gap: 8px;
  }
  .top-sign-in {
    padding-inline: 10px;
  }
  .game-stats span:nth-child(n + 2) {
    display: none;
  }
}

/* Scripture reader */
.reader-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin-bottom: 26px;
}
.reader-header h2 {
  margin: 8px 0 6px;
  font:
    500 clamp(2rem, 4vw, 3.4rem) Georgia,
    serif;
}
.reader-header > div > p:last-child {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}
.reader-discovery-count {
  display: grid;
  min-width: 155px;
  padding: 14px 18px;
  border-radius: 16px;
  background: var(--accent-2);
  color: var(--accent);
  text-align: center;
}
.reader-discovery-count strong {
  font-size: 1.55rem;
}
.reader-discovery-count span {
  font-size: 0.74rem;
  font-weight: 750;
}
.reader-toolbar {
  display: grid;
  grid-template-columns: minmax(290px, 1fr) minmax(180px, 0.7fr) minmax(110px, 0.35fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}
.reader-language-switch {
  display: flex;
  gap: 7px;
}
.reader-language-switch button,
.reader-toolbar select {
  min-height: 46px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 750;
}
.reader-language-switch button {
  flex: 1;
  padding: 10px 14px;
}
.reader-language-switch button.active {
  border-color: var(--accent);
  background: var(--accent-2);
  color: var(--accent);
}
.reader-toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
}
.reader-toolbar select {
  width: 100%;
  padding: 8px 36px 8px 12px;
}
.reader-toolbar button:focus-visible,
.reader-toolbar select:focus-visible,
.reader-token:focus-visible,
.reader-english-toggle:focus-visible,
.reader-chapter-nav:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 28%, transparent);
  outline-offset: 2px;
}
.reader-surface {
  position: relative;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.reader-reference-bar {
  display: grid;
  grid-template-columns: 120px 1fr 120px;
  gap: 16px;
  align-items: center;
  min-height: 86px;
  padding: 18px clamp(18px, 4vw, 42px);
  border-bottom: 1px solid var(--line);
  text-align: center;
}
.reader-reference-bar h3 {
  margin: 4px 0 0;
  font:
    500 1.35rem Georgia,
    serif;
}
.reader-chapter-nav {
  min-height: 42px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 750;
}
.reader-chapter-nav:disabled {
  cursor: default;
  color: var(--muted);
  opacity: 0.45;
}
.reader-instruction {
  margin: 0;
  padding: 14px clamp(20px, 5vw, 64px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent-2) 45%, var(--panel));
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}
.reader-text {
  display: grid;
  gap: 8px;
  width: min(100%, 980px);
  min-height: 270px;
  margin: auto;
  padding: clamp(28px, 5vw, 58px);
}
.reader-loading,
.reader-error {
  display: grid;
  min-height: 220px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}
.reader-error {
  color: var(--danger);
}
.reader-verse {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 13px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}
.reader-verse:last-child {
  border-bottom: 0;
}
.reader-verse-number {
  padding-top: 8px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
}
.reader-words {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 5px;
  align-items: flex-start;
  min-width: 0;
}
.reader-words[dir="rtl"] {
  justify-content: flex-start;
}
.reader-token {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  min-height: 42px;
  max-width: 100%;
  flex-direction: column;
  justify-content: flex-start;
  gap: 2px;
  padding: 5px 5px 4px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: center;
}
.reader-token:hover {
  background: color-mix(in srgb, var(--accent-2) 52%, transparent);
}
.reader-token.revealed {
  border-bottom-color: var(--accent);
  background: var(--accent-2);
}
.reader-form {
  font:
    500 1.42rem/1.25 Georgia,
    serif;
  white-space: nowrap;
}
.reader-gloss {
  display: none;
  direction: ltr;
  color: var(--accent);
  font:
    750 0.72rem/1.25 Inter,
    ui-sans-serif,
    system-ui,
    sans-serif;
  overflow-wrap: anywhere;
}
.reader-token.revealed .reader-gloss {
  display: block;
}
.reader-english-toggle {
  min-width: 54px;
  min-height: 36px;
  margin-top: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
}
.reader-english-toggle[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
}
.reader-english {
  grid-column: 2 / -1;
  margin: 2px 0 6px;
  padding: 12px 15px;
  border-left: 3px solid var(--gold);
  background: var(--paper);
  color: var(--muted);
  font:
    0.92rem/1.55 Georgia,
    serif;
}
.reader-finish {
  display: flex;
  justify-content: center;
  padding: 0 24px 38px;
}
.reader-finish .primary-button {
  min-height: 46px;
}
.reader-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin: 0 clamp(18px, 4vw, 42px) 38px;
  padding: 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 16px;
  background: var(--accent-2);
}
.reader-summary[hidden],
.reader-word-panel[hidden] {
  display: none;
}
.reader-summary-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}
.reader-summary h3 {
  margin: 4px 0;
  font:
    500 1.15rem Georgia,
    serif;
}
.reader-summary p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}
.reader-summary-actions {
  display: flex;
  gap: 8px;
}
.reader-word-panel {
  position: sticky;
  z-index: 12;
  bottom: 14px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  width: min(100% - 24px, 900px);
  margin: 14px auto 0;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel);
  box-shadow: 0 16px 50px rgba(10, 30, 22, 0.2);
}
.reader-panel-form {
  min-width: 74px;
  font:
    600 1.4rem Georgia,
    serif;
  text-align: center;
}
.reader-word-panel > div:nth-child(2) {
  display: grid;
  gap: 3px;
}
.reader-word-panel span {
  color: var(--muted);
  font-size: 0.78rem;
}
.reader-panel-close {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
}
.reader-panel-close:hover {
  background: var(--paper);
}
[data-theme="dark"] .reader-instruction,
[data-theme="dark"] .reader-token.revealed {
  background: color-mix(in srgb, var(--accent-2) 70%, var(--panel));
}

@media (max-width: 1050px) {
  .reader-toolbar {
    grid-template-columns: 1fr 1fr;
  }
  .reader-language-switch {
    grid-column: 1 / -1;
  }
  .reader-summary {
    grid-template-columns: auto 1fr;
  }
  .reader-summary-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}
@media (max-width: 600px) {
  #view-read {
    padding-inline: 12px;
  }
  .reader-header {
    flex-direction: column;
    align-items: start;
    gap: 12px;
    margin-bottom: 20px;
  }
  .reader-header h2 {
    font-size: 2rem;
  }
  .reader-header > div > p:last-child {
    font-size: 0.9rem;
  }
  .reader-discovery-count {
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: baseline;
    justify-content: flex-start;
    gap: 8px;
    padding: 10px 12px;
    text-align: left;
  }
  .reader-discovery-count strong {
    font-size: 1.25rem;
  }
  .reader-discovery-count span {
    font-size: 0.8125rem;
    line-height: 1.2;
  }
  .reader-toolbar {
    grid-template-columns: minmax(0, 1fr) 105px;
  }
  .reader-language-switch button {
    padding-inline: 8px;
    font-size: 0.78rem;
  }
  .reader-reference-bar {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 8px;
    padding-inline: 10px;
  }
  .reader-reference-bar > div {
    min-width: 0;
  }
  .reader-reference-bar .overline,
  .reader-reference-bar h3 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .reader-reference-bar .overline {
    font-size: 0.625rem;
    letter-spacing: 0.08em;
  }
  .reader-chapter-nav {
    min-width: 44px;
    padding: 0;
    font-size: 0;
  }
  #reader-previous::before,
  #reader-next::before {
    font-size: 1.5rem;
    line-height: 1;
  }
  #reader-previous::before {
    content: "‹";
  }
  #reader-next::before {
    content: "›";
  }
  .reader-text {
    padding: 22px 14px 34px;
  }
  .reader-verse {
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 5px;
  }
  .reader-english-toggle {
    grid-column: 2;
    grid-row: 2;
    min-width: 44px;
    min-height: 44px;
    justify-self: start;
    padding-inline: 12px;
    font-size: 0.8125rem;
  }
  .reader-english {
    grid-column: 2;
    grid-row: 3;
  }
  .reader-words {
    gap: 7px 2px;
  }
  .reader-token {
    min-height: 40px;
    padding-inline: 4px;
  }
  .reader-form {
    font-size: 1.3rem;
  }
  .reader-summary {
    grid-template-columns: 1fr;
    margin-inline: 12px;
    text-align: center;
  }
  .reader-summary-mark {
    margin: auto;
  }
  .reader-summary-actions {
    grid-column: auto;
    display: grid;
    width: min(100%, 300px);
    margin-inline: auto;
    justify-content: stretch;
  }
  .reader-summary-actions button {
    width: 100%;
  }
  .reader-word-panel {
    position: fixed;
    right: 12px;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 12px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    width: auto;
    max-height: calc(100dvh - 24px);
    margin: 0;
    padding: 12px;
    overflow: auto;
  }
  .reader-panel-form {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    justify-self: start;
    text-align: left;
  }
  .reader-word-panel > div:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
  }
  .reader-word-panel strong,
  .reader-word-panel span {
    overflow-wrap: anywhere;
  }
  .reader-word-panel .quiet-button {
    grid-column: 1 / -1;
    grid-row: 3;
    min-height: 44px;
  }
  .reader-panel-close {
    grid-column: 2;
    grid-row: 1;
  }
  #view-read:has(.reader-word-panel:not([hidden])) {
    padding-bottom: 190px;
  }
}
@media (max-width: 400px) {
  .reader-language-switch {
    display: grid;
    grid-template-columns: 1fr;
  }
}
