/* DM Sans and GFS Didot, served from fonts/ (SIL Open Font License; see fonts/OFL-*.txt). */
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/dm-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/dm-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "GFS Didot";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/gfs-didot-greek-ext.woff2") format("woff2");
  unicode-range: U+1F00-1FFF;
}

@font-face {
  font-family: "GFS Didot";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/gfs-didot-greek.woff2") format("woff2");
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

@font-face {
  font-family: "GFS Didot";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/gfs-didot-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  --canvas: #0c1211;
  --paper: #111a19;
  --paper-strong: #172321;
  --ink: #e8efed;
  --muted: #a2b0ad;
  --faint: #73847f;
  --line: #283835;
  --line-strong: #405550;
  --teal: #55b8ab;
  --teal-dark: #8bd7cd;
  --teal-soft: #173733;
  --gold: #d2a052;
  --gold-soft: #352a1b;
  --rose: #db7e84;
  --rose-soft: #392326;
  --blue-soft: #202d36;
  --accent-ink: #071311;
  --header-bg: rgb(17 26 25 / 90%);
  --header-line: rgb(64 85 80 / 78%);
  --card-bg: rgb(17 26 25 / 88%);
  --footer-bg: rgb(17 26 25 / 94%);
  --mobile-nav-bg: rgb(17 26 25 / 97%);
  --surface-muted: #0e1716;
  --surface-input: #0d1615;
  --surface-quote: #101817;
  --grid-overlay: rgb(14 23 22 / 92%);
  --teal-line: #28524c;
  --gold-line: #5b482d;
  --gold-ink: #e4bd7d;
  --focus-ring: rgb(85 184 171 / 38%);
  --canvas-glow: rgb(210 160 82 / 7%);
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 28%), 0 5px 18px rgb(0 0 0 / 18%);
  --shadow-lg: 0 24px 65px rgb(0 0 0 / 42%);
  --sans: "DM Sans", Inter, ui-sans-serif, system-ui, sans-serif;
  --greek: "GFS Didot", "Noto Serif", "New Athena Unicode", Palatino, serif;
}

.app-shell.light-theme {
  color-scheme: light;
  --canvas: #f1eee7;
  --paper: #fbfaf6;
  --paper-strong: #ffffff;
  --ink: #1c2928;
  --muted: #687371;
  --faint: #929a97;
  --line: #d8d8d0;
  --line-strong: #b9bdb7;
  --teal: #176b62;
  --teal-dark: #0e514a;
  --teal-soft: #e4f1ee;
  --gold: #c48632;
  --gold-soft: #f5ead8;
  --rose: #a85055;
  --rose-soft: #f6e8e7;
  --blue-soft: #e9eef4;
  --accent-ink: #ffffff;
  --header-bg: rgb(251 250 246 / 90%);
  --header-line: rgb(216 216 208 / 88%);
  --card-bg: rgb(251 250 246 / 84%);
  --footer-bg: rgb(251 250 246 / 92%);
  --mobile-nav-bg: rgb(251 250 246 / 96%);
  --surface-muted: #f5f3ed;
  --surface-input: #faf9f5;
  --surface-quote: #f7f5ef;
  --grid-overlay: rgb(249 248 244 / 91%);
  --teal-line: #c9dfda;
  --gold-line: #e3d3bb;
  --gold-ink: #79511d;
  --focus-ring: rgb(23 107 98 / 25%);
  --canvas-glow: rgb(196 134 50 / 8%);
  --shadow-sm: 0 1px 2px rgb(18 42 39 / 6%), 0 5px 18px rgb(18 42 39 / 4%);
  --shadow-lg: 0 24px 65px rgb(20 41 38 / 13%);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 0%, var(--canvas-glow), transparent 30rem),
    var(--canvas);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
}

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

button {
  min-height: 42px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.app-shell {
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 0%, var(--canvas-glow), transparent 30rem),
    var(--canvas);
}

.app-header {
  position: sticky;
  z-index: 50;
  top: 0;
  display: grid;
  min-height: 66px;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--header-line);
  background: var(--header-bg);
  backdrop-filter: blur(18px);
}

.brand-button,
.theme-button,
.settings-button,
.global-nav-button,
.icon-button,
.text-button,
.back-link,
.rail-link,
.close-workbench,
.skip-module,
.uncertain-button,
.disagree-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.brand-button {
  display: flex;
  align-items: center;
  justify-self: start;
  gap: 10px;
  padding: 0;
  font-family: var(--greek);
  font-size: 1.16rem;
  font-weight: 700;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #fff;
  background: var(--teal);
  font-size: 1.08rem;
  box-shadow: 0 5px 12px rgb(23 107 98 / 20%);
  place-items: center;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 8px;
}

.theme-button,
.settings-button {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  font-size: 0.76rem;
  font-weight: 650;
}

.theme-button:hover,
.settings-button:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.theme-button > span:first-child {
  font-size: 1rem;
  line-height: 1;
}

/* Lyceum account (shown only when config.json names an account API) */
.account-button {
  display: flex;
  min-height: 38px;
  max-width: 14rem;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: var(--paper);
  font-size: 0.76rem;
  font-weight: 650;
  text-decoration: none;
  white-space: pre;
}

.account-button:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.account-handle {
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin: 0 0 18px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-strong);
}

.account-panel p {
  margin: 0;
}

.account-panel .primary-button,
.account-panel .secondary-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.global-nav {
  display: flex;
  align-items: center;
  align-self: stretch;
  gap: 3px;
}

.global-nav-button {
  position: relative;
  padding: 0 15px;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 0.79rem;
  font-weight: 650;
}

.global-nav-button::after {
  position: absolute;
  right: 14px;
  bottom: -1px;
  left: 14px;
  height: 2px;
  background: transparent;
  content: "";
}

.global-nav-button:hover,
.global-nav-button.is-active {
  color: var(--teal-dark);
}

.global-nav-button.is-active::after {
  background: var(--teal);
}

.notice {
  position: fixed;
  z-index: 80;
  top: 76px;
  left: 50%;
  display: flex;
  width: min(calc(100% - 28px), 620px);
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 9px 10px 9px 16px;
  border: 1px solid rgb(23 107 98 / 28%);
  border-radius: 11px;
  background: var(--paper-strong);
  box-shadow: var(--shadow-lg);
  color: var(--teal-dark);
  font-size: 0.8rem;
  font-weight: 600;
  transform: translateX(-50%);
}

.notice button {
  width: 32px;
  min-height: 32px;
  border: 0;
  border-radius: 7px;
  background: var(--teal-soft);
  cursor: pointer;
  font-size: 1.2rem;
}

.page {
  width: min(100% - 40px, 1160px);
  margin: 0 auto;
  padding: 58px 0 100px;
}

.eyebrow,
.pack-language,
.rail-label,
.column-label,
.compare-label {
  margin-bottom: 6px;
  color: var(--teal);
  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: 0.105em;
  text-transform: uppercase;
}

.lead {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.muted {
  color: var(--muted);
}

.primary-button,
.secondary-button,
.checkpoint-button {
  min-height: 44px;
  padding: 0 17px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.77rem;
  font-weight: 700;
}

.primary-button,
.checkpoint-button {
  border: 1px solid var(--teal);
  color: #fff;
  background: var(--teal);
}

.primary-button:hover,
.checkpoint-button:hover {
  border-color: var(--teal-dark);
  background: var(--teal-dark);
}

.brand-mark,
.primary-button,
.checkpoint-button,
.is-selected .preset-check,
.reread-icon,
.is-active .chip-icon,
.comparison-check,
.feature-result,
.compare-attempts-button > span:first-child {
  color: var(--accent-ink);
}

.secondary-button {
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: var(--paper-strong);
}

.secondary-button:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.text-button {
  min-height: 36px;
  padding: 0 5px;
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 700;
}

.button-row {
  display: flex;
  gap: 9px;
}

/* Library */

.library-page {
  max-width: 1100px;
}

.settings-intro h1,
.history-intro h1,
.comparison-intro h1 {
  max-width: 760px;
  margin-bottom: 16px;
  font-family: var(--greek);
  font-size: clamp(2.5rem, 6vw, 4.7rem);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1.02;
}

.pack-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.pack-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
}

.featured-pack {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 116px 1fr;
  overflow: hidden;
}

.pack-accent {
  display: grid;
  color: #e9d8bd;
  background:
    linear-gradient(rgb(18 70 65 / 76%), rgb(18 70 65 / 92%)),
    repeating-linear-gradient(120deg, transparent 0 18px, rgb(255 255 255 / 7%) 19px 20px);
  font-family: var(--greek);
  font-size: 3.4rem;
  place-items: center;
}

.pack-body,
.compact-pack {
  padding: 26px;
}

.pack-heading,
.pack-footer,
.module-title-line,
.settings-intro,
.setting-heading,
.module-section-heading,
.passage-heading,
.activity-heading,
.workbench-heading,
.series-heading,
.attempt-topline,
.comparison-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.pack-language {
  margin-bottom: 7px;
}

.pack-heading h2 {
  margin-bottom: 2px;
  font-family: var(--greek);
  font-size: 1.65rem;
  font-weight: 500;
}

.greek-subtitle {
  margin-bottom: 0;
  color: var(--muted);
  font-family: var(--greek);
  font-size: 0.95rem;
}

.availability,
.required-badge,
.coverage-badge,
.scope-pill,
.attempt-preset,
.immutable-badge,
.version-badge,
.neutral-badge {
  flex: none;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--canvas);
  font-size: 0.61rem;
  font-weight: 700;
}

.availability.good {
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.pack-description {
  max-width: 690px;
  margin: 22px 0;
  color: var(--muted);
}

.capability-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 26px;
}

.capability-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid var(--teal-line);
  border-radius: 7px;
  color: var(--teal-dark);
  background: var(--teal-soft);
  font-size: 0.65rem;
  font-weight: 650;
}

.capability-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
}

.capability-pill.is-limited {
  border-color: var(--gold-line);
  color: var(--gold-ink);
  background: var(--gold-soft);
}

.capability-pill.is-limited .capability-dot {
  background: var(--gold);
}

.pack-footer {
  align-items: end;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.pack-progress {
  display: grid;
  width: min(370px, 46%);
  gap: 7px;
  color: var(--muted);
  font-size: 0.67rem;
}

.progress-track {
  height: 4px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--line);
}

.progress-fill {
  display: block;
  width: 28%;
  height: 100%;
  background: var(--gold);
}

.compact-pack {
  display: flex;
  min-height: 250px;
  flex-direction: column;
}

.compact-capabilities {
  display: grid;
  gap: 7px;
  margin: auto 0 22px;
  color: var(--muted);
  font-size: 0.7rem;
}

.limited-capability {
  color: var(--gold-ink);
}

.compact-pack .pack-footer {
  align-items: center;
}

/* Settings */

.settings-page {
  max-width: 1040px;
}

.settings-intro {
  align-items: end;
  margin-bottom: 44px;
}

.settings-intro h1 {
  font-size: clamp(2.25rem, 5vw, 4rem);
}

.open-workspace-button {
  flex: none;
}

.setting-block,
.module-settings {
  margin-bottom: 24px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}

.setting-heading,
.module-section-heading {
  align-items: end;
  margin-bottom: 23px;
}

.setting-heading h2,
.module-section-heading h2 {
  margin-bottom: 0;
  font-family: var(--greek);
  font-size: 1.65rem;
  font-weight: 500;
}

.scope-control {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.scope-control button {
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  background: var(--paper-strong);
  cursor: pointer;
  font-size: 0.65rem;
  font-weight: 650;
}

.scope-control button:last-child {
  border-right: 0;
}

.scope-control button.is-active {
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}

.preset-card {
  position: relative;
  display: flex;
  min-height: 176px;
  align-items: flex-start;
  flex-direction: column;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
  background: var(--paper-strong);
  cursor: pointer;
}

.preset-card:hover {
  border-color: var(--teal);
}

.preset-card.is-selected {
  border-color: var(--teal);
  background: linear-gradient(145deg, var(--teal-soft), var(--paper-strong));
  box-shadow: 0 0 0 1px var(--teal) inset;
}

.preset-check {
  position: absolute;
  top: 13px;
  right: 13px;
  display: grid;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: #fff;
  font-size: 0.67rem;
  place-items: center;
}

.is-selected .preset-check {
  border-color: var(--teal);
  background: var(--teal);
}

.preset-title {
  margin-bottom: 8px;
  font-family: var(--greek);
  font-size: 1.35rem;
}

.preset-description {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.55;
}

.preset-budget {
  margin-top: auto;
  padding-top: 14px;
  color: var(--teal);
  font-size: 0.62rem;
  font-weight: 700;
}

.coverage-key {
  color: var(--muted);
  font-size: 0.64rem;
}

.module-row {
  display: grid;
  min-height: 98px;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 14px 8px;
  border-top: 1px solid var(--line);
}

.module-row:last-child {
  border-bottom: 1px solid var(--line);
}

.module-row.is-enabled {
  box-shadow: 3px 0 0 var(--teal) inset;
}

.module-toggle-wrap {
  display: grid;
  place-items: center;
}

.module-toggle-wrap input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
  cursor: pointer;
}

.module-copy h3 {
  margin-bottom: 0;
  font-size: 0.86rem;
}

.module-copy p {
  margin: 5px 0 3px;
  color: var(--muted);
  font-size: 0.69rem;
}

.module-title-line {
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.required-badge {
  color: var(--gold-ink);
  background: var(--gold-soft);
}

.coverage-badge {
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.provenance {
  color: var(--faint);
  font-size: 0.61rem;
}

.module-mode {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--teal-dark);
  background: var(--paper-strong);
  cursor: pointer;
  font-size: 0.66rem;
  font-weight: 700;
}

.module-mode.is-off,
.fixed-mode {
  display: grid;
  align-items: center;
  color: var(--muted);
  text-align: center;
  background: var(--canvas);
}

.unavailable-module {
  opacity: 0.67;
}

.unavailable-badge {
  color: var(--muted);
  background: var(--canvas);
}

.settings-footer {
  position: sticky;
  z-index: 20;
  bottom: 15px;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 11px 13px 11px 20px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--footer-bg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(14px);
  font-size: 0.72rem;
}

/* Workspace shell */

.workspace-page {
  min-height: calc(100vh - 66px);
  padding-bottom: 92px;
  background: var(--paper);
}

.work-context-bar {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.context-title,
.context-actions,
.autosave-status {
  display: flex;
  align-items: center;
}

.context-title {
  gap: 12px;
}

.icon-button {
  width: 36px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.icon-button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.context-title > div {
  display: flex;
  flex-direction: column;
}

.context-work {
  font-family: var(--greek);
  font-size: 0.96rem;
  font-weight: 600;
}

.context-division {
  color: var(--muted);
  font-size: 0.64rem;
}

.context-actions {
  gap: 17px;
}

.chapter-jump {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 650;
}

.chapter-jump select {
  min-height: 32px;
  padding: 0 24px 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper-strong);
  font-size: 0.68rem;
}

.autosave-status {
  gap: 6px;
  color: var(--muted);
  font-size: 0.65rem;
}

.save-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
}

.workspace-grid {
  display: grid;
  min-height: calc(100vh - 190px);
  grid-template-columns: minmax(0, 1fr);
  background: var(--paper);
}

.workspace-grid > .reading-stage {
  width: 100%;
  max-width: 60rem;
  margin: 0 auto;
  border-right: 0;
}

.workspace-grid.has-workbench {
  grid-template-columns: minmax(460px, 1.6fr) minmax(330px, 0.9fr);
}

.workspace-grid.has-workbench > .reading-stage {
  max-width: none;
  border-right: 1px solid var(--line);
}

.source-rail {
  padding: 31px 23px 40px;
  border-right: 1px solid var(--line);
  background: var(--surface-muted);
}

.rail-section {
  padding-bottom: 25px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 23px;
}

.rail-label {
  color: var(--faint);
  font-size: 0.58rem;
}

.source-rail h2 {
  margin-bottom: 3px;
  font-family: var(--greek);
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.35;
}

.source-rail .muted {
  margin-bottom: 0;
  font-size: 0.65rem;
}

.rail-stat {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 9px 0;
  color: var(--muted);
  font-size: 0.66rem;
}

.rail-stat strong {
  color: var(--ink);
}

.rail-link {
  min-height: 32px;
  padding: 0;
  color: var(--teal);
  font-size: 0.65rem;
  font-weight: 700;
}

.greek-context {
  margin-bottom: 8px;
  color: var(--muted);
  font-family: var(--greek);
  font-size: 0.9rem;
  line-height: 1.55;
}

.context-note {
  margin-bottom: 0;
  color: var(--faint);
  font-size: 0.6rem;
  line-height: 1.5;
}

.pack-provenance {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--ink);
  font-size: 0.61rem;
}

.provenance-icon {
  display: grid;
  width: 17px;
  height: 17px;
  flex: none;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  font-family: var(--greek);
  place-items: center;
}

.reading-stage {
  min-width: 0;
  padding: clamp(34px, 5vw, 68px) clamp(28px, 5vw, 74px) 60px;
  border-right: 1px solid var(--line);
}

.passage-heading {
  align-items: center;
}

.passage-heading h1 {
  margin-bottom: 0;
  font-family: var(--greek);
  font-size: clamp(1.75rem, 3vw, 2.4rem);
  font-weight: 400;
}

.phase-badge {
  flex: none;
  padding: 6px 9px;
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  color: var(--gold-ink);
  background: var(--gold-soft);
  font-size: 0.61rem;
  font-weight: 700;
}

.phase-badge.is-compared {
  border-color: var(--teal-line);
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.phase-badge.is-reread {
  border-color: var(--line);
  color: var(--ink);
  background: var(--canvas);
}

.reading-instruction {
  margin: 25px 0 30px;
  color: var(--muted);
  font-size: 0.73rem;
}

.reading-instruction span {
  color: var(--ink);
  font-weight: 600;
}

.greek-passage {
  padding: clamp(32px, 5vw, 55px) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: var(--greek);
  font-size: clamp(1.9rem, 3.1vw, 2.65rem);
  line-height: 1.65;
}

.greek-token {
  display: inline;
  min-height: 0;
  margin: 0 0.17em 0 0;
  padding: 0.02em 0.055em 0.07em;
  border: 0;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  line-height: inherit;
}

.greek-token:hover,
.greek-token.is-selected {
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.greek-token.no-space-after {
  margin-right: 0;
}

.greek-token:disabled {
  color: inherit;
  background: transparent;
  opacity: 1;
  cursor: default;
}

.source-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  color: var(--faint);
  font-size: 0.58rem;
}

.activity-area {
  margin-top: 48px;
}

.activity-heading {
  align-items: end;
  margin-bottom: 13px;
}

.activity-heading h2 {
  margin-bottom: 0;
  font-family: var(--greek);
  font-size: 1.25rem;
  font-weight: 500;
}

.tray-help {
  color: var(--faint);
  font-size: 0.6rem;
}

.activity-tray {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.activity-chip {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: left;
  background: var(--paper-strong);
  cursor: pointer;
}

.activity-chip:hover,
.activity-chip.is-active {
  border-color: var(--teal);
}

.activity-chip.is-active {
  background: var(--teal-soft);
  box-shadow: 0 0 0 1px var(--teal) inset;
}

.activity-chip.is-skipped {
  opacity: 0.62;
}

.chip-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 7px;
  color: var(--teal-dark);
  background: var(--teal-soft);
  font-family: var(--greek);
  font-size: 0.75rem;
  font-weight: 700;
  place-items: center;
}

.is-active .chip-icon {
  color: #fff;
  background: var(--teal);
}

.chip-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.chip-name {
  overflow: hidden;
  font-size: 0.68rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-status {
  color: var(--muted);
  font-size: 0.56rem;
}

.read-only-state {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 13px;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 11px;
  background: var(--surface-muted);
}

.read-only-mark {
  display: grid;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--gold-ink);
  background: var(--gold-soft);
  font-family: var(--greek);
  place-items: center;
}

.read-only-state p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.64rem;
}

.reread-instruction {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 24px 0 30px;
  padding: 13px;
  border: 1px solid var(--teal-line);
  border-radius: 10px;
  background: var(--teal-soft);
}

.reread-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  color: #fff;
  background: var(--teal);
  place-items: center;
}

.reread-instruction p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.67rem;
}

.clean-passage {
  padding-top: clamp(60px, 9vw, 120px);
  padding-bottom: clamp(60px, 9vw, 120px);
  font-size: clamp(2.25rem, 5vw, 3.7rem);
  line-height: 1.9;
}

.reread-space {
  min-height: 100px;
}

/* Workbench */

.workbench {
  min-width: 0;
  padding: 31px 24px 120px;
  background: var(--surface-muted);
}

.workbench-heading {
  align-items: center;
}

.workbench-heading h2,
.checkpoint-summary h2 {
  margin-bottom: 0;
  font-family: var(--greek);
  font-size: 1.38rem;
  font-weight: 500;
  line-height: 1.2;
}

.close-workbench {
  width: 34px;
  min-height: 34px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 1.25rem;
}

.close-workbench:hover {
  background: var(--line);
}

.workbench-purpose {
  margin: 16px 0 23px;
  color: var(--muted);
  font-size: 0.69rem;
  line-height: 1.55;
}

.form-stack {
  display: grid;
  gap: 9px;
}

.gloss-field,
.select-field,
.translation-editor {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.63rem;
  font-weight: 650;
}

.gloss-field {
  grid-template-columns: 96px 1fr;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper-strong);
}

.field-token,
.target-token,
.tree-token {
  font-family: var(--greek);
}

.field-token {
  color: var(--ink);
  font-size: 1rem;
}

.gloss-field input {
  width: 100%;
  min-height: 36px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-input);
  font-size: 0.72rem;
}

.field-note {
  margin: 5px 0 0;
  color: var(--faint);
  font-size: 0.59rem;
  line-height: 1.55;
}

.target-token-card {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 18px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-strong);
}

.token-index {
  display: grid;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: var(--muted);
  background: var(--canvas);
  font-size: 0.63rem;
  place-items: center;
}

.target-token-card > div {
  display: flex;
  flex-direction: column;
}

.target-token {
  font-size: 1.35rem;
}

.target-lemma {
  color: var(--faint);
  font-size: 0.58rem;
}

.structured-fields,
.dependency-fields {
  display: grid;
  gap: 10px;
}

.select-field select {
  width: 100%;
  min-height: 41px;
  padding: 0 32px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-strong);
  font-size: 0.72rem;
}

.uncertain-button,
.disagree-button {
  width: 100%;
  min-height: 38px;
  margin-top: 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.63rem;
}

.uncertain-button:hover,
.disagree-button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.task-scope {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.61rem;
}

.scope-pill {
  color: var(--gold-ink);
  background: var(--gold-soft);
}

.mini-tree {
  position: relative;
  min-height: 190px;
  margin-bottom: 17px;
  padding: 16px 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(var(--grid-overlay), var(--grid-overlay)),
    repeating-linear-gradient(0deg, transparent 0 23px, var(--line) 24px),
    repeating-linear-gradient(90deg, transparent 0 23px, var(--line) 24px);
}

.tree-draft-heading {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
  color: var(--faint);
  font-size: 0.54rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tree-empty {
  display: grid;
  width: 132px;
  min-height: 52px;
  margin: 0 auto;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--faint);
  background: var(--paper-strong);
  font-size: 0.58rem;
  place-items: center;
}

.tree-draft-tokens {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 20px;
}

.tree-draft .tree-node {
  min-height: 38px;
  justify-content: center;
}

.tree-draft .tree-node::before {
  display: none;
}

.tree-empty-note {
  margin: 16px 0 0;
  color: var(--faint);
  font-size: 0.56rem;
  text-align: center;
}

.draft-edge-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  padding: 7px 9px;
  border-radius: 7px;
  color: var(--muted);
  background: var(--teal-soft);
  font-size: 0.55rem;
}

.draft-edge-preview strong {
  color: var(--teal-dark);
  font-family: var(--greek);
  font-size: 0.7rem;
}

.tree-root,
.tree-node {
  display: flex;
  align-items: center;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--paper-strong);
}

.tree-root {
  position: relative;
  z-index: 2;
  width: 110px;
  margin: 0 auto;
  padding: 8px;
  border-color: var(--gold);
}

.tree-stem {
  width: 1px;
  height: 27px;
  margin: 0 auto;
  background: var(--line-strong);
}

.tree-children {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.tree-children.single-edge {
  display: flex;
  justify-content: center;
}

.tree-children.single-edge .tree-node {
  width: min(150px, 80%);
}

.tree-children.single-edge::before {
  right: 50%;
  left: 50%;
}

.tree-children::before {
  position: absolute;
  top: -1px;
  right: 16%;
  left: 16%;
  height: 1px;
  background: var(--line-strong);
  content: "";
}

.tree-node {
  position: relative;
  padding: 6px 3px;
}

.tree-node::before {
  position: absolute;
  top: -7px;
  width: 1px;
  height: 6px;
  background: var(--line-strong);
  content: "";
}

.answer-node {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.tree-relation {
  color: var(--muted);
  font-size: 0.48rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tree-token {
  overflow: hidden;
  max-width: 100%;
  font-size: 0.8rem;
  text-overflow: ellipsis;
}

.edge-builder {
  display: grid;
  grid-template-columns: auto 20px 1fr;
  align-items: end;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper-strong);
}

.edge-dependent {
  align-self: center;
  font-family: var(--greek);
  font-size: 1rem;
}

.edge-arrow {
  align-self: center;
  color: var(--teal);
}

.translation-editor textarea {
  width: 100%;
  min-height: 190px;
  padding: 13px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper-strong);
  font-family: var(--greek);
  font-size: 0.85rem;
  line-height: 1.65;
}

.editor-status {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  color: var(--faint);
  font-size: 0.56rem;
}

.reveal-button {
  display: flex;
  width: 100%;
  min-height: 56px;
  align-items: center;
  gap: 10px;
  margin-top: 19px;
  padding: 8px 11px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.reveal-button > span:first-child {
  color: var(--faint);
}

.reveal-button > span:last-child {
  display: flex;
  flex-direction: column;
  font-size: 0.65rem;
}

.reveal-button > span:last-child span {
  color: var(--faint);
  font-size: 0.55rem;
  font-weight: 400;
}

.reveal-button:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
}

.no-reference-panel {
  margin-top: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--canvas);
  font-size: 0.62rem;
}

.no-reference-panel p {
  margin: 4px 0 0;
  font-size: 0.58rem;
  line-height: 1.5;
}

.early-reference {
  margin-top: 18px;
  padding: 12px;
  border-left: 3px solid var(--gold);
  border-radius: 3px 8px 8px 3px;
  background: var(--gold-soft);
}

.assisted-label {
  color: var(--gold-ink);
  font-size: 0.56rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.early-reference p {
  margin: 5px 0 0;
  font-size: 0.68rem;
}

.workbench-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 26px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.58rem;
}

.skip-module {
  min-height: 32px;
  padding: 0;
  color: var(--muted);
  font-size: 0.59rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.checkpoint-summary {
  padding: 24px 2px;
}

.summary-symbol {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: 20px;
  border-radius: 12px;
  color: var(--teal);
  background: var(--teal-soft);
  font-size: 1rem;
  place-items: center;
}

.checkpoint-summary > p:not(.eyebrow) {
  color: var(--muted);
  font-size: 0.7rem;
}

.summary-list {
  display: grid;
  margin-top: 22px;
  border-top: 1px solid var(--line);
}

.summary-list > div {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.64rem;
}

.summary-list strong {
  color: var(--ink);
}

/* Comparisons */

.comparison-stack {
  display: grid;
  gap: 10px;
}

.comparison-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
  padding: 11px;
  border: 1px solid var(--teal-line);
  border-radius: 9px;
  background: var(--teal-soft);
}

.comparison-check {
  display: grid;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  color: #fff;
  background: var(--teal);
  font-size: 0.7rem;
  place-items: center;
}

.comparison-banner > div {
  display: flex;
  flex-direction: column;
  font-size: 0.65rem;
}

.comparison-banner > div span {
  color: var(--muted);
  font-size: 0.56rem;
}

.gloss-comparison {
  display: grid;
  grid-template-columns: 70px 1fr 1fr auto;
  align-items: center;
  gap: 7px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-strong);
}

.gloss-comparison > div {
  display: flex;
  flex-direction: column;
  font-size: 0.62rem;
}

.compare-label {
  margin-bottom: 1px;
  color: var(--faint);
  font-size: 0.48rem;
}

.match-mark {
  padding: 3px 6px;
  border-radius: 999px;
  color: var(--teal-dark);
  background: var(--teal-soft);
  font-size: 0.5rem;
  font-weight: 700;
}

.match-mark.is-different {
  color: var(--gold-ink);
  background: var(--gold-soft);
}

.feature-comparison {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr 20px;
  align-items: center;
  gap: 7px;
  min-height: 39px;
  padding: 5px 7px;
  border-bottom: 1px solid var(--line);
  font-size: 0.62rem;
}

.feature-name,
.reference-value {
  color: var(--muted);
}

.feature-result {
  display: grid;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: #fff;
  background: var(--teal);
  font-size: 0.55rem;
  place-items: center;
}

.feature-result.is-wrong {
  background: var(--gold);
}

.provenance-panel {
  margin: 8px 0 0;
  padding: 9px;
  border-radius: 7px;
  color: var(--faint);
  background: var(--canvas);
  font-size: 0.54rem;
}

.text-comparison {
  display: grid;
  gap: 8px;
}

.text-comparison > div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-strong);
}

.text-comparison p {
  margin: 5px 0 0;
  font-family: var(--greek);
  font-size: 0.76rem;
  line-height: 1.55;
}

.text-comparison .reference-text {
  border-left: 3px solid var(--teal);
}

.self-assessment {
  margin-top: 7px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.59rem;
}

.assessment-options {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.assessment-options button {
  min-height: 30px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-strong);
  cursor: pointer;
  font-size: 0.55rem;
}

.assessment-options button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

/* Workspace footer */

.workspace-footer {
  position: fixed;
  z-index: 40;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  min-height: 76px;
  grid-template-columns: 150px 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 10px 22px;
  border-top: 1px solid var(--line);
  background: var(--footer-bg);
  box-shadow: 0 -10px 30px rgb(18 42 39 / 7%);
  backdrop-filter: blur(18px);
}

.footer-side-button {
  justify-self: start;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 0.7rem;
}

.checkpoint-copy {
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-self: center;
  line-height: 1.35;
}

.checkpoint-copy strong {
  font-size: 0.72rem;
}

.checkpoint-copy span {
  color: var(--muted);
  font-size: 0.57rem;
}

.checkpoint-button {
  min-width: 164px;
}

.footer-button-pair {
  display: flex;
  gap: 8px;
}

/* History */

.history-page,
.attempt-comparison-page {
  max-width: 1030px;
}

.history-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 45px;
}

.history-intro h1,
.comparison-intro h1 {
  max-width: 760px;
  font-size: clamp(2.25rem, 5vw, 4rem);
}

.history-intro .primary-button {
  flex: none;
}

.history-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 42px;
}

.history-filter {
  padding-right: 22px;
  border-right: 1px solid var(--line);
}

.filter-button {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  text-align: left;
  background: transparent;
  cursor: pointer;
  font-size: 0.68rem;
}

.filter-button span {
  font-size: 0.58rem;
}

.filter-button.is-active {
  color: var(--teal-dark);
  background: var(--teal-soft);
  font-weight: 700;
}

.privacy-note {
  margin-top: 30px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  font-size: 0.64rem;
}

.privacy-note p {
  margin: 5px 0;
  color: var(--muted);
  font-size: 0.58rem;
}

.series-heading {
  align-items: center;
  margin-bottom: 20px;
}

.series-reference {
  font-weight: 700;
}

.series-greek {
  margin: 2px 0 0;
  color: var(--muted);
  font-family: var(--greek);
  font-size: 0.76rem;
}

.version-badge,
.neutral-badge {
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.history-empty {
  display: grid;
  min-height: 220px;
  padding: 30px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--muted);
  background: var(--paper);
  place-content: center;
  text-align: center;
}

.history-empty .summary-symbol {
  margin-right: auto;
  margin-left: auto;
}

.history-empty h2 {
  margin-bottom: 7px;
  color: var(--ink);
  font-family: var(--greek);
  font-size: 1.2rem;
  font-weight: 500;
}

.history-empty p {
  max-width: 420px;
  margin-bottom: 0;
  font-size: 0.65rem;
}

.attempt-card {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 15px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}

.attempt-card.is-current {
  border-color: var(--teal-line);
  box-shadow: 3px 0 0 var(--teal) inset, var(--shadow-sm);
}

.attempt-number {
  display: grid;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  color: var(--muted);
  background: var(--canvas);
  font-family: var(--greek);
  place-items: center;
}

.is-current .attempt-number {
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.attempt-main h2 {
  margin: 5px 0 2px;
  font-family: var(--greek);
  font-size: 1.05rem;
  font-weight: 500;
}

.attempt-main p,
.attempt-topline {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.61rem;
}

.attempt-topline {
  justify-content: flex-start;
  align-items: center;
}

.attempt-preset {
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.immutable-badge {
  padding-left: 18px;
  background-image: linear-gradient(90deg, transparent 0 8px, var(--line) 8px 9px, transparent 9px);
}

.attempt-link {
  display: flex;
  width: 70px;
  height: 34px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  margin-left: 4px;
  color: var(--line-strong);
  font-size: 0.58rem;
  line-height: 0.8;
}

.attempt-link span {
  margin: 1px 0;
  color: var(--faint);
  font-size: 0.48rem;
  white-space: nowrap;
}

.compare-attempts-button {
  display: grid;
  width: 100%;
  min-height: 70px;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 11px;
  margin-top: 26px;
  padding: 10px 14px;
  border: 1px solid var(--teal);
  border-radius: 11px;
  color: var(--teal-dark);
  text-align: left;
  background: var(--teal-soft);
  cursor: pointer;
}

.compare-attempts-button > span:first-child {
  display: grid;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: #fff;
  background: var(--teal);
  place-items: center;
}

.compare-attempts-button > span:nth-child(2) {
  display: flex;
  flex-direction: column;
  font-size: 0.68rem;
}

.compare-attempts-button > span:nth-child(2) span {
  color: var(--muted);
  font-size: 0.57rem;
  font-weight: 400;
}

/* Full attempt comparison */

.back-link {
  min-height: 36px;
  padding: 0;
  color: var(--teal);
  font-size: 0.68rem;
  font-weight: 700;
}

.comparison-intro {
  margin: 28px 0 40px;
}

.attempt-columns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.heading-columns {
  margin: 0 0 14px 180px;
}

.heading-columns > div {
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}

.heading-columns h2 {
  margin: 3px 0 0;
  font-family: var(--greek);
  font-size: 1.2rem;
  font-weight: 500;
}

.heading-columns p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.62rem;
}

.current-label {
  color: var(--teal);
}

.comparison-section {
  margin-bottom: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
}

.comparison-section-heading {
  align-items: center;
  margin-bottom: 14px;
}

.comparison-section-heading .eyebrow {
  margin-bottom: 0;
}

.attempt-quote {
  min-height: 120px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-quote);
}

.attempt-quote p {
  margin-bottom: 0;
  font-family: var(--greek);
  line-height: 1.7;
}

.condition-table {
  display: grid;
}

.condition-row {
  display: grid;
  min-height: 44px;
  grid-template-columns: 160px 1fr 1fr;
  align-items: center;
  gap: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.67rem;
}

.condition-row strong {
  color: var(--muted);
  font-size: 0.62rem;
}

.evidence-limit {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 24px;
  padding: 17px;
  border: 1px solid var(--gold-line);
  border-radius: 11px;
  background: var(--gold-soft);
  font-size: 0.69rem;
}

.evidence-icon {
  display: grid;
  width: 24px;
  height: 24px;
  flex: none;
  border: 1px solid #c99b5c;
  border-radius: 50%;
  font-family: var(--greek);
  place-items: center;
}

.evidence-limit p {
  margin: 3px 0 0;
  color: var(--gold-ink);
  font-size: 0.62rem;
}

@media (max-width: 1050px) {
  .workspace-grid.has-workbench {
    grid-template-columns: minmax(0, 1fr);
  }

  .workbench {
    position: fixed;
    z-index: 35;
    top: 128px;
    right: 0;
    bottom: 76px;
    width: min(390px, calc(100% - 30px));
    overflow-y: auto;
    border-left: 1px solid var(--line);
    box-shadow: -18px 0 55px rgb(20 41 38 / 15%);
  }

  .reading-stage {
    border-right: 0;
  }

  .preset-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  .app-header {
    min-height: 60px;
    grid-template-columns: 1fr auto;
    padding: 0 14px;
    background: var(--paper);
    backdrop-filter: none;
  }

  .global-nav {
    position: fixed;
    z-index: 48;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    min-height: 58px;
    /* One row whatever the number of destinations. */
    grid-auto-columns: 1fr;
    grid-auto-flow: column;
    border-top: 1px solid var(--line);
    background: var(--mobile-nav-bg);
    backdrop-filter: blur(16px);
  }

  .global-nav-button::after {
    top: -1px;
    bottom: auto;
  }

  .settings-button {
    grid-column: 2;
  }

  .page {
    width: min(100% - 26px, 1160px);
    padding-top: 38px;
    padding-bottom: 90px;
  }

  .settings-intro,
  .history-intro,
  .setting-heading,
  .module-section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 20px;
  }

  .settings-intro h1,
  .history-intro h1,
  .comparison-intro h1 {
    font-size: clamp(2.35rem, 12vw, 3.6rem);
  }

  .pack-list {
    grid-template-columns: 1fr;
  }

  .featured-pack {
    grid-template-columns: 1fr;
  }

  .pack-accent {
    min-height: 72px;
    font-size: 2rem;
  }

  .pack-body,
  .compact-pack {
    padding: 20px;
  }

  .pack-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .pack-progress {
    width: 100%;
  }

  .button-row > button {
    flex: 1;
  }

  .setting-block,
  .module-settings {
    padding: 18px 14px;
  }

  .preset-grid {
    grid-template-columns: 1fr;
  }

  .preset-card {
    min-height: 132px;
  }

  .scope-control {
    width: 100%;
  }

  .scope-control button {
    flex: 1;
  }

  .module-row {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 10px;
    padding: 16px 6px;
  }

  .module-mode {
    min-height: 32px;
    grid-column: 2;
    justify-self: start;
  }

  .module-title-line {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .settings-footer {
    bottom: 68px;
  }

  .settings-footer > div {
    display: none;
  }

  .settings-footer .primary-button {
    width: 100%;
  }

  .workspace-page {
    padding-bottom: 132px;
  }

  .work-context-bar {
    min-height: 58px;
    padding: 0 12px;
  }

  .autosave-status,
  .chapter-jump > span {
    display: none;
  }

  .workspace-grid,
  .workspace-grid.has-workbench {
    display: flex;
    flex-direction: column;
  }

  .source-rail {
    display: none;
  }

  .reading-stage {
    padding: 32px 18px 45px;
  }

  .reading-instruction {
    margin-bottom: 20px;
  }

  .greek-passage {
    padding: 34px 0;
    font-size: clamp(1.9rem, 9vw, 2.65rem);
    line-height: 1.75;
  }

  .source-line {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .activity-area {
    margin-top: 38px;
  }

  .activity-tray {
    display: flex;
    margin-right: -18px;
    padding-right: 18px;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .activity-chip {
    min-width: 142px;
  }

  .workbench.is-empty {
    display: none;
  }

  .workbench {
    top: auto;
    right: 0;
    bottom: 116px;
    left: 0;
    width: auto;
    max-height: min(68vh, 620px);
    padding: 17px 18px 35px;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -20px 55px rgb(20 41 38 / 18%);
  }

  .workbench::before {
    display: block;
    width: 38px;
    height: 4px;
    margin: 0 auto 14px;
    border-radius: 5px;
    background: var(--line-strong);
    content: "";
  }

  .workspace-footer {
    bottom: 58px;
    min-height: 58px;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 7px 10px;
  }

  .footer-side-button,
  .checkpoint-copy {
    display: none;
  }

  .checkpoint-button {
    min-width: 0;
    width: 100%;
  }

  .footer-button-pair {
    grid-column: 1 / -1;
  }

  .footer-button-pair button {
    flex: 1;
  }

  .history-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .history-filter {
    display: flex;
    padding: 0 0 12px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .history-filter .rail-label,
  .privacy-note {
    display: none;
  }

  .filter-button {
    width: auto;
    min-width: max-content;
  }

  .attempt-card {
    grid-template-columns: 38px 1fr;
    padding: 14px;
  }

  .immutable-badge {
    display: none;
  }

  .heading-columns {
    margin-left: 0;
  }

  .comparison-section {
    padding: 16px;
  }

  .condition-row {
    grid-template-columns: 105px 1fr 1fr;
    gap: 8px;
    font-size: 0.6rem;
  }
}

@media (max-width: 480px) {
  .brand-word,
  .theme-label,
  .account-label,
  .settings-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .theme-button,
  .settings-button {
    width: 40px;
    padding: 0;
    justify-content: center;
  }

  .pack-heading,
  .passage-heading,
  .series-heading {
    align-items: flex-start;
  }

  .pack-heading {
    flex-direction: column-reverse;
    gap: 10px;
  }

  .capability-strip {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .button-row {
    flex-direction: column;
  }

  .activity-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .read-only-state {
    grid-template-columns: 38px 1fr;
  }

  .read-only-state .secondary-button {
    grid-column: 1 / -1;
  }

  .gloss-comparison {
    grid-template-columns: 62px 1fr auto;
  }

  .gloss-comparison > div:nth-child(3) {
    grid-column: 2;
  }

  .gloss-comparison .match-mark {
    grid-column: 3;
    grid-row: 1 / 3;
  }

  .attempt-columns {
    grid-template-columns: 1fr;
  }

  .heading-columns {
    grid-template-columns: repeat(2, 1fr);
  }

  .condition-row {
    grid-template-columns: 1fr 1fr;
    padding: 9px 0;
  }

  .condition-row strong {
    grid-column: 1 / -1;
  }
}

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

/* Passage navigation in the study workspace */
.passage-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Clean reader: continuous Greek with help only on request */
.app-shell.is-reading {
  height: 100vh;
  overflow: hidden;
}

.reader-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.reader-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px clamp(14px, 3vw, 28px);
  border-bottom: 1px solid var(--header-line);
  background: var(--header-bg);
  opacity: 0.55;
  transition: opacity 160ms ease;
}

.reader-bar:hover,
.reader-bar:focus-within {
  opacity: 1;
}

.reader-bar-title {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.reader-position {
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.reader-scroll {
  flex: 1;
  overflow-y: auto;
}

.reader-text {
  max-width: 44rem;
  margin: 0 auto;
  padding: clamp(28px, 6vh, 64px) clamp(18px, 5vw, 32px) 40vh;
  font-family: var(--greek);
  font-size: clamp(1.35rem, 2.3vw, 1.7rem);
  line-height: 1.8;
}

.reader-sentence {
  position: relative;
  padding: 0.35em 0 0.35em 0;
  border-radius: 6px;
  transition: background 160ms ease;
}

.reader-sentence.is-current {
  background: linear-gradient(90deg, var(--teal-soft), transparent 70%);
}

.reader-marker {
  position: absolute;
  top: 0.9em;
  left: -2.6rem;
  width: 2rem;
  padding: 0;
  border: 0;
  color: var(--faint);
  background: none;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  cursor: pointer;
}

.reader-marker:hover,
.reader-marker.is-open,
.reader-sentence.is-current .reader-marker {
  color: var(--teal);
}

.reader-greek {
  margin: 0;
}

.reader-token {
  position: relative;
  display: inline;
  padding: 0;
  border: 0;
  border-radius: 3px;
  color: inherit;
  background: none;
  font: inherit;
  cursor: pointer;
}

.reader-token:hover {
  background: var(--teal-soft);
}

.reader-token.is-open {
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.reader-gloss {
  position: absolute;
  z-index: 5;
  bottom: calc(100% + 6px);
  left: 50%;
  padding: 4px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: var(--paper-strong);
  box-shadow: var(--shadow-sm);
  font-family: var(--sans);
  font-size: 0.85rem;
  line-height: 1.3;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}

.reader-translation {
  margin: 0.4em 0 0.6em;
  padding-left: 0.9em;
  border-left: 2px solid var(--teal-line);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.55;
}

.reader-translation p {
  margin: 0.2em 0;
}

.reader-literal {
  color: var(--faint);
  font-style: italic;
}

.reader-end {
  max-width: 44rem;
  margin: -30vh auto 0;
  padding: 0 clamp(18px, 5vw, 32px) 40vh;
  color: var(--faint);
  font-size: 0.85rem;
  text-align: center;
}

@media (max-width: 720px) {
  /* Two rows: back, title, theme, Study; then ‹ picker › across the full width. */
  .reader-bar {
    flex-wrap: wrap;
    gap: 8px 10px;
    opacity: 1;
  }

  .reader-bar::after {
    content: "";
    order: 4;
    flex-basis: 100%;
    height: 0;
    margin-top: -8px;
  }

  .reader-bar-title {
    order: 1;
  }

  .reader-bar-title > span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .reader-bar .reader-theme {
    order: 2;
  }

  .reader-bar .reader-study {
    order: 3;
    flex-shrink: 0;
    padding: 6px 10px;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .reader-bar .reader-prev {
    order: 5;
  }

  .reader-bar .citation-picker {
    order: 6;
    flex: 1;
    flex-wrap: nowrap;
    min-width: 0;
  }

  .reader-bar .reader-next {
    order: 7;
  }

  .reader-marker {
    position: static;
    display: block;
    width: auto;
    text-align: left;
  }
}

/* Compact page titles for tool settings */
.settings-intro.compact-intro h1 {
  font-size: clamp(1.9rem, 3.5vw, 2.6rem);
}

.activity-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

/* Study mode: word popups, deliberate reveals, and self-grading */
.study-token-wrap {
  position: relative;
  display: inline;
}

.study-token {
  display: inline;
  padding: 0 0.06em;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 4px;
  color: inherit;
  background: none;
  font: inherit;
  line-height: inherit;
  cursor: pointer;
}

.study-token:hover,
.study-token.is-open {
  background: var(--teal-soft);
}

.study-token.has-guess {
  border-bottom-color: var(--teal-line);
}

.study-token.is-revealed {
  border-bottom-color: var(--gold-line);
}

.word-popup {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: var(--popup-shift, 0px);
  width: min(360px, 86vw);
  max-height: var(--popup-max-height, none);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper-strong);
  box-shadow: var(--shadow-lg);
  font-family: var(--sans);
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: normal;
}

.word-popup.is-above {
  top: auto;
  bottom: calc(100% + 8px);
}

.popup-backdrop {
  display: none;
}

@media (min-width: 721px) {
  /* Rendered once in its natural place to be measured, then shown where it fits. */
  .word-popup.is-measuring {
    visibility: hidden;
  }
}

.popup-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 10px;
}

.popup-tab {
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: none;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.popup-tab.is-active {
  border-color: var(--teal-line);
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.popup-close {
  margin-left: auto;
  border: 0;
  color: var(--muted);
  background: none;
  font-size: 1.2rem;
  cursor: pointer;
}

.popup-form {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 8px;
  font-family: var(--greek);
  font-size: 1.3rem;
}

.popup-form .muted {
  font-size: 0.95rem;
}

.gloss-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.gloss-field .popup-form,
.gloss-field .gloss-row-form {
  grid-column: 1 / -1;
}

.gloss-list .gloss-field {
  grid-template-columns: 7.5rem minmax(0, 1fr) auto;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.gloss-list .gloss-field .gloss-row-form {
  grid-column: auto;
  font-family: var(--greek);
  font-size: 1.1rem;
}

.gloss-input,
.translation-field textarea {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface-input);
  font: inherit;
}

.reveal-button {
  padding: 6px 11px;
  border: 1px dashed var(--gold-line);
  border-radius: 6px;
  color: var(--gold-ink);
  background: none;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.reveal-button:hover {
  background: var(--gold-soft);
}

.reference-answer {
  color: var(--teal-dark);
  font-weight: 600;
}

.translation-field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.translation-field .reveal-button {
  justify-self: start;
}

.field-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.popup-sentence .translation-field textarea {
  min-height: 4.2rem;
}

.study-punctuation {
  margin-left: -0.08em;
}

.chip-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.grading-legend {
  display: flex;
  gap: 16px;
  margin: 0 0 18px;
  font-size: 0.8rem;
}

.legend-reference,
.interlinear-reference {
  color: var(--teal-dark);
}

.legend-guess,
.interlinear-guess {
  color: var(--gold-ink);
}

.legend-missed {
  color: var(--rose);
}

.interlinear {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 14px;
  padding: 18px 0 26px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.interlinear-word {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  /* Never narrower than its Greek word (min-content wins over max-width); long glosses wrap. */
  min-width: min-content;
  max-width: 11rem;
  padding: 6px 8px;
  border-radius: 8px;
}

.interlinear-word.was-missed,
.grading-card.was-missed {
  box-shadow: inset 3px 0 0 var(--rose);
  background: var(--rose-soft);
}

.interlinear-greek {
  font-family: var(--greek);
  font-size: 1.45rem;
  white-space: nowrap;
}

.interlinear-reference,
.interlinear-guess {
  font-size: 0.85rem;
  line-height: 1.3;
}

.interlinear-guess.is-empty {
  color: var(--faint);
}

.mark-buttons {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.mark-button {
  width: 30px;
  height: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  background: none;
  cursor: pointer;
}

.mark-button.is-right {
  border-color: var(--teal);
  color: var(--accent-ink);
  background: var(--teal);
}

.mark-button.is-wrong {
  border-color: var(--rose);
  color: var(--accent-ink);
  background: var(--rose);
}

.item-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.item-note {
  color: var(--faint);
  font-size: 0.7rem;
}

.missed-note {
  color: var(--rose);
}

.grading-translations {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.grading-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.grading-card h3 {
  margin: 0 0 8px;
  font-size: 0.9rem;
}

.grading-card p {
  margin: 4px 0;
}

.grading-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-settings {
  margin-top: 22px;
  padding: 22px 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card-bg);
}

.progress-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.progress-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.progress-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.progress-value {
  font-family: var(--greek);
  font-size: 1.8rem;
}

.struggle-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.struggle {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--rose);
  border-radius: 999px;
  font-family: var(--greek);
}

.struggle-count {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.72rem;
}

.clear-data {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.danger-button {
  padding: 9px 14px;
  border: 1px solid var(--rose);
  border-radius: 8px;
  color: var(--accent-ink);
  background: var(--rose);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

@media (max-width: 720px) {
  .progress-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* A bottom sheet over the checkpoint footer and the navigation bar, as tall as the visible viewport allows. */
  .word-popup,
  .word-popup.is-above {
    position: fixed;
    z-index: 70;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    padding: 14px 14px calc(16px + env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: 14px 14px 0 0;
  }

  .popup-backdrop {
    position: fixed;
    z-index: 65;
    inset: 0;
    display: block;
    background: rgb(0 0 0 / 38%);
  }
}

/* Past attempts at a passage */
.history-link {
  padding: 0;
  border: 0;
  color: var(--teal);
  background: none;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.history-link:hover {
  color: var(--teal-dark);
  text-decoration: underline;
}

.history-link + .reading-instruction {
  margin-top: 12px;
}

.history-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.history-heading h2 {
  margin: 0;
  font-size: 1.4rem;
}

.history-trend {
  display: grid;
  gap: 4px;
  margin-bottom: 20px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.85rem;
}

.history-trend p {
  margin: 0;
}

.history-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-entry {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.85rem;
}

.history-entry.is-selected {
  border-color: var(--teal-line);
}

.history-summary {
  display: flex;
  width: 100%;
  flex-wrap: wrap;
  align-content: center;
  align-items: baseline;
  gap: 4px 14px;
  padding: 0;
  border: 0;
  color: inherit;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.history-date {
  font-weight: 700;
}

.history-counts {
  display: inline-flex;
  gap: 10px;
}

.count-right {
  color: var(--teal-dark);
}

.count-wrong {
  color: var(--rose);
}

.history-change {
  color: var(--muted);
  font-size: 0.78rem;
}

.history-missed {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  margin-top: 8px;
}

.history-missed:empty {
  display: none;
}

.history-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
}

.history-chip {
  padding: 1px 8px;
  border: 1px solid var(--rose);
  border-radius: 999px;
}

.history-chips.is-recovered .history-chip {
  border-color: var(--teal);
}

.history-chip[lang="grc"] {
  font-family: var(--greek);
  font-size: 1.05rem;
}

.history-detail {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.history-item {
  display: grid;
  grid-template-columns: minmax(6rem, 1fr) minmax(0, 2fr) minmax(0, 2fr) auto;
  align-items: baseline;
  gap: 10px;
  padding: 4px 6px;
  border-radius: 6px;
}

.history-item.is-wrong {
  background: var(--rose-soft);
}

.history-item-label[lang="grc"] {
  font-family: var(--greek);
  font-size: 1.1rem;
}

.history-mark {
  display: inline-flex;
  gap: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .history-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .history-item .interlinear-reference,
  .history-item .interlinear-guess {
    grid-column: 1 / -1;
  }

  .history-item .history-mark {
    grid-row: 1;
    grid-column: 2;
  }
}

/* Swiping between passages on touch screens: the browser keeps vertical scrolling and pinch zoom, the passage
   follows the finger sideways, and springs back when released. */
.is-swipeable {
  touch-action: pan-y pinch-zoom;
  transition: transform 0.2s ease;
}

.is-swipeable.is-swiping {
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  .is-swipeable {
    transition: none;
  }
}

/* Source attribution (src/Sources.elm) */

.sources-line {
  margin: 10px 0 0;
  color: var(--faint);
  font-size: 0.62rem;
  line-height: 1.5;
}

.sources-label {
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sources-line a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 2px;
}

.sources-line a:hover {
  color: var(--muted);
}

.reader-end .sources-line {
  margin-top: 14px;
  text-align: center;
}

/* Today's review queue */
.rating-buttons {
  display: flex;
  gap: 6px;
}

.rating-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: none;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.rating-button.is-suggested {
  border-color: var(--teal);
  color: var(--accent-ink);
  background: var(--teal);
}

.rating-interval {
  font-size: 0.72rem;
  opacity: 0.8;
}

.queue-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.queue-kind {
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--teal-dark);
  background: var(--teal-soft);
  font-weight: 600;
}

.pack-counts {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.queue-counts {
  color: var(--teal-dark);
  font-size: 0.9rem;
}

.queue-done h2 {
  margin: 4px 0 12px;
  font-family: var(--greek);
  font-size: 2rem;
  font-weight: 400;
}

.queue-done .button-row {
  margin-top: 18px;
}

.new-per-day {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

@media (max-width: 720px) {
  .rating-buttons {
    width: 100%;
  }

  .rating-button {
    flex: 1;
    min-width: 0;
  }
}

/* Canonical citation picker */
.citation-picker {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.citation-go {
  width: 7.5rem;
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface-input);
  font: inherit;
  font-size: 0.85rem;
}

@media (max-width: 720px) {
  .citation-go {
    width: 5.5rem;
  }
}

@media (max-width: 720px) {
  .wide-only {
    display: none;
  }

  /* Study bar: back and title, then ‹ picker › across the full width. */
  .work-context-bar {
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 8px 12px;
  }

  .work-context-bar .context-title {
    flex: 1;
    min-width: 0;
  }

  .work-context-bar .context-title > div {
    min-width: 0;
  }

  .work-context-bar .context-work {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .work-context-bar .context-actions,
  .work-context-bar .passage-nav {
    flex-basis: 100%;
    min-width: 0;
  }

  .passage-nav .citation-picker {
    flex: 1;
    flex-wrap: nowrap;
    min-width: 0;
  }

  /* Picker controls share the row instead of overflowing it. */
  .citation-picker .chapter-jump {
    flex: none;
  }

  .citation-picker .chapter-jump select {
    padding: 0 18px 0 7px;
  }

  .citation-picker .citation-go {
    flex: 1 1 0;
    width: auto;
    min-width: 2.5rem;
  }
}

@media (max-width: 360px) {
  .reader-bar,
  .work-context-bar {
    column-gap: 6px;
  }

  .citation-picker {
    gap: 4px;
  }

  .citation-picker .chapter-jump select {
    padding: 0 14px 0 5px;
  }
}

/* Reader layers: glosses, morphology, and translation with each passage */
.reader-layers {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 8px clamp(14px, 3vw, 28px);
  border-bottom: 1px solid var(--header-line);
  background: var(--header-bg);
}

.layer-toggle {
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.layer-toggle.is-on {
  border-color: var(--teal-line);
  color: var(--ink);
  background: var(--teal-soft);
}

.reader-interlinear {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.55em 0.9em;
  padding: 0.2em 0 0.3em;
}

.reader-word {
  display: flex;
  flex-direction: column;
  min-width: min-content;
  max-width: 8.5rem;
  line-height: 1.3;
}

.reader-word-greek {
  white-space: nowrap;
}

.reader-word-gloss,
.reader-word-morph {
  min-height: 1.3em;
  font-family: var(--sans);
  overflow-wrap: break-word;
}

.reader-word-gloss {
  margin-top: 0.2em;
  color: var(--teal);
  font-size: 0.8rem;
}

.reader-word-morph {
  color: var(--faint);
  font-size: 0.68rem;
  letter-spacing: 0.01em;
}

/* Today: the home page's first panel, and the session page */
.today-panel {
  margin: 0 0 28px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-strong);
}

.today-title {
  margin: 4px 0 6px;
  font-size: 1.45rem;
  line-height: 1.25;
}

.today-summary,
.today-continue,
.session-status {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.session-status {
  margin: 0 0 14px;
  font-variant-numeric: tabular-nums;
}

.today-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

a.primary-button,
a.secondary-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.secondary-button:disabled {
  opacity: 0.45;
  cursor: default;
}

/* Words: review card and word page */
.word-review-page,
.word-page,
.stats-page,
.today-page {
  max-width: 52rem;
  margin: 0 auto;
}

.word-review-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-strong);
}

.word-context {
  margin: 0;
  color: var(--muted);
  font-family: var(--greek);
  font-size: 1.15rem;
  line-height: 1.7;
}

.context-word {
  padding: 1px 4px;
  border-radius: 4px;
  color: var(--ink);
  background: var(--teal-soft);
  box-shadow: inset 0 -2px 0 var(--teal);
}

.word-review-form {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.review-form {
  font-family: var(--greek);
  font-size: 2.2rem;
  line-height: 1.2;
}

.review-lemma,
.popup-lemma {
  color: var(--muted);
  font-family: var(--greek);
  font-size: 1rem;
}

.popup-lemma {
  margin-left: 10px;
  text-decoration: none;
}

.word-review-input {
  max-width: 24rem;
  font-size: 1rem;
}

.word-review-answer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.word-review-answer .reference-answer {
  font-size: 1.1rem;
}

.word-header {
  margin-bottom: 18px;
}

.word-header h1 {
  margin: 4px 0;
}

.word-section {
  margin: 26px 0 0;
}

.word-section h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.word-occurrences {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.word-occurrences .word-context {
  margin-top: 4px;
  font-size: 1rem;
}

/* Interlinear study: a gloss box under each word */
.study-interlinear .study-cell {
  width: 9rem;
  max-width: none;
}

.study-cell-greek {
  padding: 0;
  border: 0;
  border-radius: 4px;
  color: inherit;
  background: none;
  cursor: pointer;
  text-align: left;
}

.study-cell-greek.is-open,
.study-cell-greek:hover {
  background: var(--teal-soft);
}

.study-cell-greek.is-revealed {
  text-decoration: underline dotted var(--muted);
}

.cell-input {
  width: 100%;
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface-input);
  font: inherit;
  font-size: 0.88rem;
}

.cell-input:focus {
  border-color: var(--teal);
  outline: 2px solid var(--teal-soft);
}

.study-cell.is-repeat {
  box-shadow: inset 3px 0 0 var(--rose);
  background: var(--rose-soft);
}

.cell-previous {
  color: var(--faint);
  font-size: 0.85rem;
  line-height: 1.3;
}

.interlinear-word.is-settled .interlinear-greek {
  color: var(--muted);
}

/* Progress */
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-strong);
}

.stat-tile-label,
.stat-tile-note {
  color: var(--muted);
  font-size: 0.78rem;
}

.stat-tile-value {
  color: var(--ink);
  font-size: 1.6rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.column-chart {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-strong);
}

.chart-title {
  margin: 0;
  font-size: 0.95rem;
}

.chart-subtitle {
  margin: 2px 0 12px;
  color: var(--muted);
  font-size: 0.78rem;
}

.chart-plot {
  position: relative;
  height: 110px;
  padding-top: 16px;
  border-bottom: 1px solid var(--line);
}

.chart-tick {
  position: absolute;
  top: 0;
  left: 0;
  color: var(--faint);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.chart-columns {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 100%;
}

.chart-slot {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
  outline: none;
}

.chart-column {
  width: 100%;
  max-width: 24px;
  min-height: 0;
  border-radius: 4px 4px 0 0;
  background: var(--teal);
}

.chart-slot:hover .chart-column,
.chart-slot:focus .chart-column {
  opacity: 0.8;
}

.chart-peak {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.chart-slot:hover::after,
.chart-slot:focus::after {
  position: absolute;
  bottom: calc(100% + 4px);
  z-index: 2;
  padding: 4px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: var(--paper);
  font-size: 0.72rem;
  white-space: nowrap;
  content: attr(data-tip);
  pointer-events: none;
}

.chart-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  color: var(--faint);
  font-size: 0.7rem;
}

.chart-table {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.chart-table summary {
  cursor: pointer;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.stats-table th,
.stats-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.stats-table th {
  color: var(--muted);
  font-weight: 600;
}

.stats-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0 24px;
}

.work-progress {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.work-progress-row {
  display: grid;
  grid-template-columns: minmax(8rem, 14rem) 1fr auto;
  align-items: center;
  gap: 12px;
  font-size: 0.86rem;
}

.progress-track {
  height: 8px;
  border-radius: 4px;
  background: var(--teal-soft);
  overflow: hidden;
}

.progress-fill {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--teal);
}

.work-progress-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  .today-panel,
  .word-review-card {
    padding: 18px;
  }

  .work-progress-row {
    grid-template-columns: 1fr auto;
  }

  .progress-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

.today-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 14px;
}

.today-head .eyebrow {
  margin: 0;
}

.today-scope {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.today-scope select {
  max-width: 14rem;
  min-height: 34px;
  padding: 0 26px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface-input);
  font: inherit;
  font-size: 0.82rem;
}

/* Home: works being studied, then the searchable library */
.home-section {
  margin: 0 0 28px;
}

.home-section h2 {
  margin: 0;
  font-size: 1.05rem;
}

.home-section > h2 {
  margin-bottom: 10px;
}

.library-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.library-head h2 {
  margin-right: auto;
}

.library-search,
.library-sort {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface-input);
  font: inherit;
  font-size: 0.85rem;
}

.library-search {
  width: min(20rem, 100%);
}

.work-rows {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-strong);
}

.work-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px 16px;
  padding: 14px 16px;
}

.work-row + .work-row {
  border-top: 1px solid var(--line);
}

.work-row-main {
  flex: 1 1 10rem;
  min-width: 0;
}

.work-row-title {
  margin: 0;
  font-size: 1rem;
}

.work-row-meta {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.work-row-sources {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.75rem;
}

.work-row-sources summary {
  cursor: pointer;
}

.work-row-actions {
  display: flex;
  gap: 8px;
}

@media (max-width: 720px) {
  .library-search {
    flex: 1 1 100%;
    width: 100%;
    order: 3;
  }
}

.missed-button {
  margin-top: 2px;
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}

.missed-button:hover {
  border-color: var(--rose);
  color: var(--ink);
}
