:root {
  --ink: #10233f;
  --ink-2: #1b365d;
  --gold: #e5b857;
  --gold-pale: #fff3cf;
  --paper: #f7f8f5;
  --white: #ffffff;
  --muted: #697487;
  --line: #dfe4e8;
  --success: #1d7a58;
  --danger: #b8493f;
  --shadow: 0 22px 70px rgba(16, 35, 63, 0.12);
  --radius: 22px;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 2%, rgba(229,184,87,.20), transparent 26rem),
    linear-gradient(180deg, #edf2f3 0, var(--paper) 32rem);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.loading-screen {
  min-height: 100vh; display: grid; place-content: center; place-items: center; gap: 1rem;
  color: var(--ink); letter-spacing: .02em;
}

.loading-screen[hidden] { display: none; }

.loading-mark, .brand-mark {
  display: grid; place-items: center; color: var(--gold); background: var(--ink);
  font: 700 1.1rem/1 Georgia, serif; border-radius: 12px;
}

.loading-mark { width: 54px; height: 54px; animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(.94); opacity: .75; } }

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

.topbar {
  width: min(1180px, calc(100% - 40px)); margin: 0 auto; min-height: 92px;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}

.brand { display: flex; align-items: center; gap: .75rem; color: inherit; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; }
.brand strong { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 1.15rem; }
.brand-title { display: flex; align-items: baseline; gap: .4rem; flex-wrap: wrap; }
.app-version { color: #a5abb1; font-size: .5625rem; font-weight: 400; line-height: 1.2; white-space: nowrap; }
:root[data-theme="green"] .app-version { color: #a4ac9f; }
.brand small { display: block; color: var(--muted); margin-top: .12rem; font-size: .75rem; letter-spacing: .13em; text-transform: uppercase; }
.top-actions { display: flex; align-items: center; gap: .9rem; }
.day-streak { color: var(--muted); font-size: .9rem; }
.day-streak span { color: #c58b19; }

main { padding: 18px 20px 56px; }
.workspace { width: min(1180px, 100%); margin: 0 auto; display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 22px; align-items: start; }

.lookup-panel, .practice-card {
  background: rgba(255,255,255,.92); border: 1px solid rgba(16,35,63,.08); box-shadow: var(--shadow);
}
.lookup-panel { border-radius: var(--radius); padding: 24px; position: sticky; top: 18px; }
.practice-card { min-height: 670px; border-radius: 28px; overflow: hidden; position: relative; }
.practice-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--gold); }

.eyebrow { margin: 0 0 .45rem; color: #87651d; font-weight: 800; font-size: .73rem; letter-spacing: .14em; text-transform: uppercase; }
label { display: block; font-weight: 700; font-size: .83rem; }
input, select, textarea { width: 100%; color: var(--ink); background: #fbfcfb; border: 1px solid var(--line); border-radius: 11px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: #6380a8; box-shadow: 0 0 0 3px rgba(72,105,149,.13); }
input, select { min-height: 44px; padding: 0 .8rem; margin-top: .45rem; }

.search-row { display: grid; grid-template-columns: minmax(0,1fr) 44px; gap: 7px; }
.search-row .icon-button { margin-top: .45rem; }
.icon-button { width: 44px; height: 44px; border: 0; border-radius: 11px; background: var(--ink); color: #fff; cursor: pointer; font-size: 1.2rem; }
.field-help { min-height: 1.2em; margin: .5rem 0 0; color: var(--muted); font-size: .76rem; }
.field-help.error { color: var(--danger); }
.divider { display: flex; align-items: center; gap: .7rem; margin: 1.2rem 0; color: #8b939f; font-size: .75rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.browse-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: .8rem; }

.primary-button, .secondary-button, .quiet-button, .save-button, .text-button {
  border: 0; cursor: pointer; font-weight: 800; border-radius: 11px; transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.primary-button { min-height: 45px; padding: .7rem 1rem; color: #fff; background: var(--ink); box-shadow: 0 7px 16px rgba(16,35,63,.16); }
.primary-button:hover, .icon-button:hover { background: var(--ink-2); }
.primary-button:active, .secondary-button:active, .save-button:active { transform: translateY(1px); }
.full { width: 100%; margin-top: .9rem; }
.secondary-button { min-height: 42px; padding: .65rem .95rem; background: #eef2f4; }
.secondary-button:hover { background: #e3e9ed; }
.quiet-button { min-height: 40px; padding: .5rem .75rem; background: transparent; }
.quiet-button:hover { background: rgba(255,255,255,.65); }
.text-button { padding: .4rem; color: var(--ink); background: transparent; text-decoration: underline; text-underline-offset: 3px; }
.count-pill { display: inline-grid; place-items: center; min-width: 23px; height: 23px; margin-left: .3rem; padding: 0 .4rem; border-radius: 999px; color: #fff; background: var(--ink); font-size: .73rem; }

.review-card { margin-top: 1.25rem; padding: 1rem; border-radius: 14px; display: flex; align-items: center; justify-content: space-between; gap: .5rem; background: var(--gold-pale); }
.review-card strong { font-size: .95rem; }

.passage-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 34px 38px 22px 42px; }
.passage-header h1 { margin: 0; font: 700 clamp(2rem, 4vw, 3.35rem)/1.05 Georgia, "Times New Roman", serif; letter-spacing: -.035em; }
.save-button { display: flex; align-items: center; gap: .35rem; min-height: 40px; padding: .55rem .8rem; background: var(--gold-pale); color: #755516; white-space: nowrap; }
.save-button[aria-pressed="true"] { background: #e1efe9; color: var(--success); }

.mode-tabs { display: flex; gap: 5px; padding: 0 38px 16px 42px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.mode-tabs::-webkit-scrollbar { display: none; }
.mode-tab { min-height: 38px; padding: .5rem .8rem; border: 0; border-radius: 999px; cursor: pointer; color: var(--muted); background: transparent; font-weight: 750; white-space: nowrap; }
.mode-tab.active { color: var(--ink); background: #e9eef2; }
.mode-panel { padding: 38px 42px 26px; }
.verse-display { min-height: 250px; font: 400 clamp(1.42rem, 2.55vw, 2.05rem)/1.62 Georgia, "Times New Roman", serif; color: #17253b; }
.verse-line { display: block; margin-bottom: .85rem; }
.verse-number { margin-right: .42rem; color: #9b772d; font: 800 .72em/1 ui-sans-serif, system-ui, sans-serif; vertical-align: super; }
.verse-covered { display: grid; place-items: center; min-height: 250px; border-radius: 16px; color: var(--muted); background: repeating-linear-gradient(-45deg,#f6f8f8,#f6f8f8 8px,#f1f4f5 8px,#f1f4f5 16px); font: 600 1rem/1.5 ui-sans-serif, system-ui, sans-serif; }
.study-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; margin-top: 1.25rem; }
.verse-navigation { display: inline-flex; gap: .45rem; }
.verse-arrow { display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem; min-height: 2.75rem; flex: 0 0 2.75rem; padding: 0; border-radius: 50%; font-size: 1.25rem; line-height: 1; }
.verse-navigation[hidden], .verse-arrow[hidden] { display: none; }
.verse-arrow:disabled { opacity: .45; cursor: default; }
.practice-tip { margin: 1.2rem 0 0; padding-top: 1.1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .86rem; line-height: 1.7; }
.practice-tip span { display: inline-grid; place-items: center; width: 21px; height: 21px; margin: 0 .22rem 0 .4rem; border-radius: 50%; color: #fff; background: var(--ink); font-size: .68rem; font-weight: 800; }
.practice-tip span:first-child { margin-left: 0; }

textarea { min-height: 245px; resize: vertical; padding: 1.15rem; font: 400 1.15rem/1.7 Georgia, "Times New Roman", serif; }
.typing-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .9rem; }
.check-option { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-weight: 600; }
.check-option input { width: 18px; min-height: 18px; margin: 0; accent-color: var(--ink); }
.result-box { margin-top: 1rem; padding: 1rem; border-radius: 13px; background: #f1f4f5; }
.result-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .7rem; }
.score { font-size: 1.45rem; font-weight: 900; color: var(--success); }
.diff-text { line-height: 1.75; }
.diff-good { color: var(--success); }
.diff-missed { color: var(--danger); text-decoration: underline; text-decoration-style: wavy; text-underline-offset: 3px; }

.cue-instruction { margin: 0 0 1.3rem; color: var(--muted); }
.initial-cues, .missing-words { min-height: 230px; margin-bottom: 1.25rem; font: 400 clamp(1.2rem, 2.2vw, 1.7rem)/1.8 Georgia, "Times New Roman", serif; }
.cue-verse { display: block; margin-bottom: .9rem; }
.cue-letter { display: inline-block; min-width: .8em; margin-right: .18em; }
.blank-word { display: inline-block; width: 2.5em; height: 1em; margin: 0 .08em; border-bottom: 2px solid #a7b0ba; }
.missing-controls { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; margin-bottom: .8rem; }
.missing-controls label { display: grid; gap: .4rem; font-size: 1rem; }
.missing-controls select { min-height: 44px; min-width: 160px; font: inherit; padding: .6rem; border: 1px solid #a7b0ba; border-radius: .5rem; background: white; color: #10233f; }
.missing-controls button { min-height: 44px; }
.shown-word { display: inline-block; margin-right: .22em; }

.passage-footer { display: flex; justify-content: space-between; gap: 1rem; margin: 0 42px; padding: 18px 0 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: .76rem; }

.library-dialog { width: min(650px, calc(100% - 28px)); max-height: min(760px, calc(100vh - 40px)); padding: 0; border: 0; border-radius: 22px; color: var(--ink); box-shadow: 0 30px 90px rgba(6,19,37,.3); }
.library-dialog::backdrop { background: rgba(7,20,38,.55); backdrop-filter: blur(5px); }
.collection-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; padding: 18px 26px 6px; }
.collection-toolbar strong { flex: 1 1 120px; overflow-wrap: anywhere; }
.collection-form { display: flex; gap: .6rem; padding: 12px 26px; }
.collection-form input { min-width: 0; flex: 1; }
.collection-form button { flex-shrink: 0; }
.collection-form[hidden], .collection-toolbar [hidden], .collection-practice[hidden] { display: none; }
.reorder-help { margin: 4px 26px 12px; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.collection-all, .collection-open { text-align: left; border: 0; color: var(--ink); cursor: pointer; }
.collection-all { display: flex; justify-content: space-between; gap: 12px; width: 100%; padding: 16px; border-radius: 12px; background: var(--gold-pale); font-weight: 700; }
.collection-row { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding: 12px 0; }
.collection-open { display: flex; flex: 1; flex-direction: column; gap: 6px; padding: 12px 4px; min-width: 0; background: transparent; overflow-wrap: anywhere; }
.collection-open span, .collection-passage p { color: var(--muted); font-size: .875rem; }
.collection-passage { min-width: 0; flex: 1; }
.collection-passage h3 { margin: 0 0 5px; font: 700 1.2rem Georgia, serif; }
.collection-passage p { margin: 0 0 10px; }
.collection-row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.reorder-handle { flex: 0 0 36px; min-height: 44px; border: 0; background: transparent; color: var(--muted); font-size: 1.5rem; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.reorder-handle:active { cursor: grabbing; }
.collection-row.dragging { opacity: .55; }
.collection-row.drop-target { box-shadow: inset 0 -3px var(--ink); background: var(--gold-pale); }
.collection-picker { width: min(510px, calc(100% - 28px)); }
.picker-choices { padding: 4px 26px; }
.picker-option { display: flex; align-items: center; gap: 12px; min-height: 48px; overflow-wrap: anywhere; }
.picker-option input { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--ink); }
.picker-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 26px 24px; }
.picker-footer span { color: var(--muted); font-size: .875rem; }
.collection-practice { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 16px 26px; border-bottom: 1px solid var(--line); }
.collection-practice span { flex: 1; font-size: .875rem; overflow-wrap: anywhere; }
.collection-practice button:disabled { opacity: .45; cursor: default; }
@media (max-width: 420px) { .collection-form { flex-wrap: wrap; } .collection-form input { flex-basis: 100%; } }
.dialog-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 24px 26px 18px; background: #fff; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font: 700 2rem/1 Georgia, serif; }
.close-button { background: #edf1f3; color: var(--ink); }
.library-summary { padding: 16px 26px; color: var(--muted); background: #f7f9f9; font-size: .9rem; }
.saved-list { padding: 10px 26px 28px; }
.saved-item { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 1rem; padding: 17px 0; border-bottom: 1px solid var(--line); }
.saved-item:last-child { border-bottom: 0; }
.saved-item h3 { margin: 0 0 .3rem; font: 700 1.2rem/1.2 Georgia, serif; }
.saved-item p { margin: 0; color: var(--muted); font-size: .82rem; }
.saved-actions { display: flex; align-items: center; gap: .35rem; }
.mini-button { border: 0; border-radius: 9px; padding: .5rem .65rem; cursor: pointer; background: #edf1f3; font-weight: 750; }
.mini-button.remove { color: var(--danger); background: #fff0ee; }
.empty-state { padding: 3rem 1rem; text-align: center; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 20; transform: translate(-50%, 20px); padding: .75rem 1rem; border-radius: 11px; color: #fff; background: var(--ink); box-shadow: 0 12px 35px rgba(8,26,48,.28); opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.feedback-launcher { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 15; display: grid; place-items: center; width: 4.25rem; height: 1.25rem; border: 1px solid var(--line); border-radius: 999px; padding: 0; color: #fff; background: var(--ink); box-shadow: none; font-size: .75rem; line-height: 1; font-weight: 500; cursor: pointer; }
/* Keep the small visual control easy to tap without adding visible bulk. */
.feedback-launcher::before { content: ""; position: absolute; inset: -12px 0; }
main { padding-bottom: 100px; }
.feedback-dialog { width: min(480px, calc(100% - 24px)); max-height: calc(100dvh - 32px); margin: auto; padding: 24px; border: 1px solid var(--line); border-radius: 22px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
.feedback-dialog::backdrop { background: rgba(6,20,30,.28); }
.feedback-head, .feedback-board-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.feedback-head h2 { margin: 0; font: 700 1.8rem Georgia, serif; }
.feedback-board-head { margin-top: 24px; }
.feedback-board-head h3 { margin: 0; font-size: 1.05rem; }
.feedback-dialog p { line-height: 1.5; }
.telegram-link { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--gold-pale); text-decoration: none; font-weight: 700; }
.telegram-link small { display: block; margin-top: 5px; font-size: .875rem; font-weight: 400; }
.feedback-note { color: var(--muted); font-size: .875rem; font-weight: 400; }
.suggestion-messages { max-height: 280px; overflow-y: auto; overscroll-behavior: contain; }
.suggestion-bubble { margin: 12px 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px 14px 14px 3px; background: rgba(255,255,255,.6); overflow-wrap: anywhere; }
.suggestion-bubble header { display: flex; justify-content: space-between; gap: 12px; font-size: .875rem; }
.suggestion-bubble time { color: var(--muted); white-space: nowrap; }
.suggestion-bubble p { margin-bottom: 0; white-space: pre-wrap; line-height: 1.6; }
#suggestionForm label { margin-top: 12px; font-size: .875rem; }
#suggestionMessage { min-height: 100px; margin-top: 7px; font: inherit; }
#suggestionSubmit, #adminSetup button { margin-top: 12px; }
.feedback-status { font-size: .875rem; line-height: 1.5; }
.feedback-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.feedback-foot { border-top: 1px solid var(--line); text-align: right; }
.admin-link { display: inline-block; padding: 12px 4px; font-size: .75rem; color: var(--muted); text-underline-offset: 3px; }
.admin-shell { width: min(760px, 100%); margin: 30px auto; padding: 24px; }
.admin-shell a { color: var(--ink); }
.admin-shell h1 { font-family: Georgia, serif; }
.admin-shell select { max-width: 280px; }
button:disabled { opacity: .55; cursor: wait; }
.feedback-dialog :focus-visible, .feedback-launcher:focus-visible, .admin-shell :focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* The original navy theme remains the default. */
.appearance-toggle { display: inline-flex; align-items: center; height: 44px; border: 1px solid var(--line); background: #e9edf1; border-radius: 24px; padding: 4px; }
.appearance-toggle button { display: grid; place-items: center; width: 44px; height: 34px; border: 0; border-radius: 22px; padding: 8px 14px; color: var(--muted); background: transparent; cursor: pointer; }
.appearance-toggle button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 2px 5px #1232; }
.appearance-toggle button:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
:root[data-theme="green"] .appearance-toggle { background: #e1ecc5; }
.topbar, .top-actions { flex-wrap: wrap; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  min-height: 44px; padding: .5rem .65rem; border: 1px solid var(--line);
  border-radius: 999px; background: rgba(255,255,255,.6); color: var(--ink);
  font-size: .875rem; font-weight: 700; cursor: pointer;
}
.theme-toggle:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.theme-switch-track {
  display: flex; align-items: center; width: 34px; height: 21px; padding: 3px;
  flex-shrink: 0; border-radius: 999px; background: #697487;
}
.theme-switch-track > span {
  width: 15px; height: 15px; border-radius: 50%; background: #fff;
  transition: transform .18s ease;
}
.theme-toggle[aria-checked="true"] .theme-switch-track { background: #17482c; }
.theme-toggle[aria-checked="true"] .theme-switch-track > span { transform: translateX(13px); }

/* John Tribe Green: Nightly Woods, Zucchini, and Green Eggs from the supplied palette. */
:root[data-theme="green"] {
  --ink: #06311d;
  --ink-2: #17482c;
  --gold: #17482c;
  --gold-pale: rgba(225,236,197,.6);
  --paper: #f5f8ee;
  --muted: #47614f;
  --line: rgba(23,72,44,.18);
  --success: #17482c;
  --shadow: 0 22px 70px rgba(6,49,29,.1);
}
:root[data-theme="green"] body { background: var(--paper); isolation: isolate; }
:root[data-theme="green"] body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: url("./assets/john-tribe-background.png") center 58% / min(1400px, 140vw) auto no-repeat;
  opacity: .12;
}
:root[data-theme="green"] :is(.lookup-panel, .practice-card) {
  background: transparent;
  border: 1px solid rgba(255,255,255,.72);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.65);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
:root[data-theme="green"] :is(.loading-mark, .brand-mark) { color: #e1ecc5; }
:root[data-theme="green"] :is(.eyebrow, .verse-number, .day-streak span, .divider) { color: #17482c; }
:root[data-theme="green"] .verse-display { color: var(--ink); }
:root[data-theme="green"] :is(input, select, textarea, .missing-controls select) {
  color: var(--ink); border-color: var(--line); background: rgba(255,255,255,.5);
}
:root[data-theme="green"] select option { color: #06311d; background: #f5f8ee; }
:root[data-theme="green"] :is(input, select, textarea):focus {
  border-color: #17482c; box-shadow: 0 0 0 3px rgba(23,72,44,.12);
}
:root[data-theme="green"] .primary-button { box-shadow: 0 7px 16px rgba(6,49,29,.14); }
:root[data-theme="green"] :is(.secondary-button, .mode-tab.active, .close-button, .mini-button) {
  color: var(--ink); background: rgba(225,236,197,.65);
}
:root[data-theme="green"] :is(.secondary-button, .close-button, .mini-button):hover { background: #e1ecc5; }
:root[data-theme="green"] .save-button { color: #17482c; }
:root[data-theme="green"] .save-button[aria-pressed="true"] { background: #e1ecc5; }
:root[data-theme="green"] .verse-covered { background: rgba(225,236,197,.45); }
:root[data-theme="green"] .result-box { background: transparent; }
:root[data-theme="green"] :is(.library-dialog, .dialog-head) { background: var(--paper); }
:root[data-theme="green"] .library-summary { background: #e1ecc5; }
:root[data-theme="green"] .blank-word { border-color: #17482c; }
:root[data-theme="green"] .mini-button.remove { color: var(--danger); background: rgba(255,240,238,.7); }
:root[data-theme="green"] .library-dialog::backdrop { background: rgba(6,49,29,.55); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
:root[data-theme="green"] .toast { box-shadow: 0 12px 35px rgba(6,49,29,.2); }

@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; }
  .lookup-panel { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
  .lookup-panel > .eyebrow, .lookup-panel > .divider, .review-card { grid-column: 1 / -1; }
  .lookup-panel .full { align-self: end; }
  .review-card { margin-top: 1rem; }
}

@media (max-width: 620px) {
  .topbar { width: calc(100% - 28px); min-height: 76px; padding: 16px 0; gap: .75rem; }
  .top-actions { width: 100%; justify-content: space-between; gap: .5rem; }
  .day-streak { display: none; }
  main { padding: 6px 12px 36px; }
  .lookup-panel { display: block; padding: 20px; }
  .practice-card { min-height: 620px; border-radius: 20px; }
  .passage-header { padding: 26px 20px 18px 25px; }
  .passage-header h1 { font-size: 2.15rem; }
  .save-button span:last-child { display: none; }
  .mode-tabs { padding: 0 16px 14px 25px; }
  .mode-panel { padding: 28px 20px 22px 25px; }
  .verse-display { font-size: 1.36rem; line-height: 1.58; }
  .typing-footer { align-items: stretch; flex-direction: column; }
  .passage-footer { margin: 0 20px 0 25px; }
  .practice-tip span { margin-left: .15rem; }
}

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

/* Dark navy surfaces, warm gold accents, and opaque dialogs. */
:root[data-theme="dark"] { color-scheme: dark; --ink: #e5edf8; --ink-2: #cadcf2; --paper: #0c1523; --white: #142238; --muted: #a7b6ca; --line: #304159; --gold: #e5b857; --gold-pale: #342e20; --success: #90d5b1; --danger: #ffaba1; --shadow: 0 22px 70px rgba(0,0,0,.25); }
:root[data-theme="dark"] body { background: var(--paper); isolation: isolate; }
:root[data-theme="dark"] body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: url("./assets/s-light-background.png") center / contain no-repeat;
  opacity: .12;
}
:root[data-theme="dark"] :is(.lookup-panel,.practice-card,.library-dialog,.dialog-head,.feedback-dialog) { background: #142238; border-color: var(--line); }
:root[data-theme="dark"] :is(input,select,textarea,.missing-controls select) { color: var(--ink); background: #101c2e; border-color: var(--line); }
:root[data-theme="dark"] :is(input,textarea)::placeholder { color: #92a3ba; }
:root[data-theme="dark"] select option { background: #101c2e; color: var(--ink); }
:root[data-theme="dark"] :is(.verse-display,.initial-cues,.missing-words) { color: var(--ink); }
:root[data-theme="dark"] :is(.eyebrow,.verse-number,.day-streak span) { color: #e5c47f; }
:root[data-theme="dark"] :is(.primary-button,.icon-button,.count-pill,.practice-tip span,.toast,.feedback-launcher) { background: #c5d7ed; color: #10233f; }
:root[data-theme="dark"] :is(.primary-button,.icon-button):hover { background: #deebfa; }
:root[data-theme="dark"] :is(.loading-mark,.brand-mark) { background: #243b59; color: #f2ce85; }
:root[data-theme="dark"] :is(.secondary-button,.mini-button,.close-button,.mode-tab.active,.library-summary,.result-box,.appearance-toggle) { background: #24344b; color: var(--ink); }
:root[data-theme="dark"] :is(.secondary-button,.mini-button,.close-button,.quiet-button):hover { background: #30455f; }
:root[data-theme="dark"] .save-button { color: #f2ce85; }
:root[data-theme="dark"] .save-button[aria-pressed="true"] { background: #183b30; color: #a6e3c3; }
:root[data-theme="dark"] .verse-covered { background: repeating-linear-gradient(-45deg,#17263c,#17263c 8px,#1b2c43 8px,#1b2c43 16px); }
:root[data-theme="dark"] .blank-word { border-color: #a7b6ca; }
:root[data-theme="dark"] .theme-toggle { background: #142238; }
:root[data-theme="dark"] .appearance-toggle button[aria-pressed="true"] { background: #3b506b; color: #f2ce85; }
:root[data-theme="dark"] .suggestion-bubble { background: #1b2c43; }
:root[data-theme="dark"] .mini-button.remove { color: var(--danger); background: #452b32; }
:root[data-theme="dark"] .app-version { color: #8897aa; }
:root[data-theme="dark"] :is(.library-dialog,.feedback-dialog)::backdrop { background: rgba(0,0,0,.65); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }

/* Keep the complete dark-mode artwork visible through the main practice panels. */
:root[data-theme="dark"] :is(.lookup-panel, .practice-card, .result-box) {
  background: rgba(20, 34, 56, .11);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
