/* ------------------------------------------------------------------
   Theme tokens. Bootstrap 5.3 switches its own variables through
   data-bs-theme on <html>; these cover the site's own colours.
   ------------------------------------------------------------------ */
:root,
html[data-bs-theme="light"] {
  --brand: #5e81a8;
  --brand-strong: #2b587a;
  --brand-contrast: #ffffff;
  --navbar-bg: #597da3;
  --navbar-border: #4b6f95;
  --surface: #ffffff;
  --surface-muted: #f7f8fa;
  --border-soft: #dae1e8;
  --heading-color: #45688e;
  --muted-text: #7a8a9a;
  --accent-text: #6383a8;
  --answer-color: #2a7f62;
  --menu-hover: #e1e7ed;
  --button-secondary-bg: #dfe6ed;
  --button-secondary-text: #55677d;
  --bs-body-bg: #ffffff;
  --bs-body-color: #222222;
  --bs-link-color: #2b587a;
  --bs-link-color-rgb: 43, 88, 122;
  --bs-link-hover-color: #1f4566;
  --bs-link-hover-color-rgb: 31, 69, 102;
}

html[data-bs-theme="dark"] {
  --brand: #4a76a8;
  --brand-strong: #8fb4dc;
  --brand-contrast: #ffffff;
  --navbar-bg: #26364a;
  --navbar-border: #1b2838;
  --surface: #1d242c;
  --surface-muted: #1a2027;
  --border-soft: #2f3a46;
  --heading-color: #b3cbe4;
  --muted-text: #8d9aa8;
  --accent-text: #8fb4dc;
  --answer-color: #6fd1a8;
  --menu-hover: #26313d;
  --button-secondary-bg: #2c3744;
  --button-secondary-text: #c3d0dd;
  --bs-body-bg: #141a20;
  --bs-body-color: #d7dee5;
  --bs-link-color: #8fb4dc;
  --bs-link-color-rgb: 143, 180, 220;
  --bs-link-hover-color: #b6cfea;
  --bs-link-hover-color-rgb: 182, 207, 234;
}

/* Keep room for the scrollbar on every page, so the menu and the content
   stay in the same place whether or not a page is long enough to scroll. */
html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  padding-top: 44px;
  font-family: Tahoma, Verdana, "Segoe UI", Arial, sans-serif;
  font-size: .875rem;
  line-height: 1.5;
  transition: background-color .2s ease, color .2s ease;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--heading-color);
}

/* ---------- Navbar ---------- */
.app-navbar {
  background-color: var(--navbar-bg);
  box-shadow: 0 1px 6px rgba(0, 0, 0, .15);
}

.app-navbar .navbar-brand {
  color: #fff;
  letter-spacing: .01em;
}

.app-navbar .nav-link {
  color: rgba(255, 255, 255, .82);
  border-radius: .375rem;
  padding-left: .7rem !important;
  padding-right: .7rem !important;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus {
  color: #fff;
  background-color: rgba(255, 255, 255, .12);
}

.app-navbar .nav-link.active {
  color: #fff;
  font-weight: 600;
  background-color: rgba(255, 255, 255, .18);
}

.app-navbar .navbar-toggler {
  border-color: rgba(255, 255, 255, .45);
}

.theme-toggle,
.lang-toggle {
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .45);
  line-height: 1;
  padding: .45rem .55rem;
}

.lang-toggle {
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .03em;
  min-width: 2.4rem;
  padding: .5rem .5rem;
}

.theme-toggle:hover,
.theme-toggle:focus,
.lang-toggle:hover,
.lang-toggle:focus {
  color: #fff;
  background-color: rgba(255, 255, 255, .15);
}

.theme-toggle .icon-sun { display: none; }
html[data-bs-theme="dark"] .theme-toggle .icon-sun { display: inline; }
html[data-bs-theme="dark"] .theme-toggle .icon-moon { display: none; }

@media (max-width: 991.98px) {
  .app-navbar .navbar-collapse {
    padding: .5rem 0 .75rem;
  }
  .app-navbar .navbar-nav + .navbar-nav {
    border-top: 1px solid rgba(255, 255, 255, .2);
    margin-top: .35rem;
    padding-top: .35rem;
  }
  .app-navbar .nav-link {
    padding-top: .6rem;
    padding-bottom: .6rem;
  }
}

/* ---------- Generic blocks ---------- */
.content-section {
  background: var(--surface);
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-soft);
  border-radius: .5rem;
  margin-bottom: 1.25rem;
}

.card {
  --bs-card-bg: var(--surface);
  --bs-card-border-color: var(--border-soft);
}

.article-title {
  color: var(--heading-color);
  visibility: visible;
  display: block;
}

a.article-title:hover {
  color: var(--brand-strong);
  text-decoration: none;
}

.article-content {
  white-space: pre-line;
}

.article-img {
  height: 65px;
  width: 65px;
  margin-right: 16px;
}

.article-metadata {
  padding-bottom: 1px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-soft);
}

.article-metadata a:hover {
  color: var(--bs-body-color);
  text-decoration: none;
}

.article-svg {
  width: 25px;
  height: 25px;
  vertical-align: middle;
}

.account-img {
  height: 125px;
  width: 125px;
  margin-right: 20px;
  margin-bottom: 16px;
}

.account-heading {
  font-size: 2.5rem;
}

.media-body#truncating {
  width: 100%;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

@media (max-width: 413px) {
  .media-body#truncating {
    -webkit-line-clamp: 5;
  }
}

@media (max-width: 1200px) {
  .media.content-section .row {
    flex-direction: column;
    align-items: center;
  }
  .media.content-section .col-md-2 {
    text-align: center;
    margin-bottom: 10px;
  }
  main .content-section {
    margin-top: 15px;
  }
  .media.content-section .col-md-10,
  .media.content-section .media-body {
    text-align: center;
  }
  .media.content-section .d-flex {
    flex-direction: column;
    align-items: center;
  }
}

/* ---------- Buttons ---------- */
.btn-outline-link {
  position: relative;
  transition: background-color .2s, color .2s;
}

.btn-outline-link:hover {
  background-color: var(--brand);
  color: var(--brand-contrast);
  text-decoration: none;
}

.btn-outline-info {
  --bs-btn-color: var(--brand-contrast);
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-color: var(--brand-strong);
  --bs-btn-hover-bg: transparent;
  --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-color: var(--brand-contrast);
  --bs-btn-active-bg: var(--brand-strong);
  --bs-btn-active-border-color: var(--brand-strong);
  transition: background-color .2s, color .2s;
}

.btn-outline-info.active-btn {
  color: var(--brand-contrast);
  background-color: var(--brand);
  border-color: var(--brand);
}

/* ---------- Footer ---------- */
.site-footer {
  font-size: .9em;
  border-top: 1px solid var(--border-soft);
  background: var(--surface-muted);
}

/* ---------- Home page ---------- */
.hero {
  text-align: center;
  padding: 2.5rem 1rem 2rem;
}

.hero h1 {
  font-weight: 700;
  font-size: clamp(1.9rem, 5vw, 3rem);
}

.hero .lead {
  color: var(--muted-text);
}

.feature-card {
  display: block;
  height: 100%;
  padding: 1.25rem;
  border: 1px solid var(--border-soft);
  border-radius: .75rem;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.feature-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
  color: inherit;
}

.feature-card .feature-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.feature-card h3 {
  font-size: 1.15rem;
  margin: .6rem 0 .35rem;
}

.feature-card p {
  color: var(--muted-text);
  margin-bottom: .5rem;
}

.feature-card .feature-count {
  font-size: .85rem;
  font-weight: 600;
  color: var(--brand-strong);
}

/* ---------- Tables ---------- */
.table {
  --bs-table-bg: transparent;
}

.row-known td {
  color: var(--muted-text);
}

/* Conjugator */
.conjugator .mood-section {
  margin-top: 1.75rem;
}

.conjugator .mood-section h3 {
  font-size: 1.25rem;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 0.35rem;
  margin-bottom: 1rem;
}

.conjugator .tense-card {
  margin-bottom: 1.25rem;
}

.conjugator .tense-card h4 {
  font-size: 0.95rem;
  color: var(--heading-color);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.4rem;
}

.conjugator .conjugation-table {
  margin-bottom: 0;
}

.conjugator .conjugation-table td,
.conjugator .conjugation-table th {
  padding: 0.25rem 0.5rem;
  border-color: var(--border-soft);
}

.conjugator .person-cell {
  width: 7.5rem;
  font-weight: 400;
  color: var(--muted-text);
  font-size: 0.85rem;
}

.verb-example {
  text-decoration: none;
}

.verb-example:hover {
  text-decoration: underline;
}

/* Dictionary */
.dictionary .word-card {
  border: 1px solid var(--border-soft);
  border-radius: 0.35rem;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.85rem;
  background: var(--surface);
}

.dictionary .word-term {
  font-size: 1.1rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--heading-color);
}

.dictionary .word-term:hover {
  color: var(--brand-strong);
}

.dictionary .word-translation {
  color: var(--bs-body-color);
}

/* Meanings of a word, numbered. */
.dictionary .word-senses {
  margin: 0 0 .5rem;
  padding-left: 1.4rem;
  font-weight: 400;
}

.dictionary .word-senses li + li {
  margin-top: .2rem;
}

.dictionary .word-sense-hint {
  font-size: .8em;
  color: var(--bs-secondary-color);
}

.dictionary .word-meta {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted-text);
}

.dictionary .word-meta span:not(:last-child)::after {
  content: " · ";
}

.dictionary .word-example {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted-text);
}

/* Translation block on the conjugator page */
.conjugator .verb-translation {
  border-left: 3px solid var(--brand);
  padding: 0.5rem 0 0.5rem 0.85rem;
  margin: 0.5rem 0 1rem;
}

/* Grammar course */
.grammar .grammar-section {
  margin-bottom: 1.75rem;
}

.grammar .grammar-section h3 {
  font-size: 1.15rem;
  color: var(--heading-color);
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 0.3rem;
}

.grammar .unit-number,
.grammar-unit .unit-number-big {
  display: inline-block;
  color: var(--accent-text);
  font-weight: 600;
}

.grammar .unit-number {
  min-width: 2rem;
}

.grammar-unit .unit-number-big {
  font-size: 1.6rem;
}

.grammar-unit .explanation ul {
  margin-bottom: 0.6rem;
}

.grammar-unit .explanation p {
  margin-bottom: 0.6rem;
}

.grammar-unit .grammar-heading {
  margin-top: 1.75rem;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted-text);
}

.grammar-unit .examples-table .ca-cell {
  width: 50%;
}

.grammar-unit .exercise-block {
  margin-bottom: 1.1rem;
}

.grammar-unit .exercise-instruction {
  margin-bottom: 0.3rem;
  font-weight: 500;
}

.grammar-unit .exercise-items li {
  margin-bottom: 0.2rem;
}

.grammar-unit .exercise-answer {
  color: var(--answer-color);
}

.grammar .unit-section {
  color: var(--accent-text);
}

/* Word cards are tappable on small screens */
@media (max-width: 575.98px) {
  body {
    padding-top: 44px;
  }
  .content-section {
    padding: .85rem .9rem;
  }
  .dictionary .word-card {
    padding: .7rem .75rem;
  }
  .grammar-unit .examples-table .ca-cell {
    width: auto;
  }
  .conjugator .person-cell {
    width: 5.5rem;
  }
}

/* ---------- Listen buttons ---------- */
.btn-speak {
  border: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--brand-strong);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  padding: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  flex-shrink: 0;
}

.btn-speak:hover,
.btn-speak.speaking {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--brand-contrast);
}

.btn-speak-sm {
  width: 1.6rem;
  height: 1.6rem;
}

.speak-hint {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  max-width: 40rem;
  margin: 0 auto;
  z-index: 1080;
  font-size: .9rem;
}

/* ---------- Phonetics ---------- */
.ipa {
  font-family: "Charis SIL", "Doulos SIL", "Gentium Plus", "Noto Sans", "Segoe UI", "DejaVu Sans", sans-serif;
  color: var(--accent-text);
  white-space: nowrap;
}

.phonetics .sounds-table .spelling {
  font-weight: 700;
  font-size: 1.1rem;
  white-space: nowrap;
}

.phonetics .practice-word {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .75rem;
  border: 1px solid var(--border-soft);
  border-radius: .5rem;
  background: var(--surface);
  height: 100%;
}

.phonetics .practice-word .ca {
  font-weight: 600;
}

.phonetics .practice-word .uk {
  color: var(--muted-text);
  font-size: .85rem;
}

/* On phones every sound becomes a small card instead of a table row. */
@media (max-width: 575.98px) {
  .phonetics .sounds-table thead {
    display: none;
  }
  .phonetics .sounds-table,
  .phonetics .sounds-table tbody {
    display: block;
    width: 100%;
  }
  .phonetics .sounds-table tr {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: baseline;
    gap: .3rem .75rem;
    padding: .65rem 0;
    border-bottom: 1px solid var(--border-soft);
  }
  .phonetics .sounds-table td {
    display: block;
    border: 0;
    padding: 0;
  }
  .phonetics .sounds-table .spelling {
    white-space: normal;
  }
  .phonetics .sounds-table .sound-example,
  .phonetics .sounds-table .sound-how {
    grid-column: 1 / -1;
  }
  .phonetics .ipa {
    white-space: normal;
  }
}

/* ---------- Pronunciation trainer (/phonetics/trainer) ---------- */
.trainer-grid {
  display: grid;
  grid-template-columns: minmax(0, 18rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.trainer-units .list-group-item {
  display: flex;
  align-items: baseline;
  gap: .4rem;
  text-align: left;
  font-size: .92rem;
  background: transparent;
}

.trainer-units .list-group-item.active {
  background: var(--menu-hover);
  color: inherit;
  border-color: var(--border-soft);
  font-weight: 600;
}

.trainer-best {
  margin-left: auto;
  font-size: .78rem;
  color: var(--answer-color);
  font-variant-numeric: tabular-nums;
}

.trainer-main {
  min-height: 16rem;
}

.trainer-title {
  font-weight: 600;
  color: var(--heading-color);
}

.trainer-bar {
  height: 6px;
  border-radius: 99px;
  background: var(--border-soft);
  overflow: hidden;
  margin: .4rem 0 1rem;
}

.trainer-bar i {
  display: block;
  height: 100%;
  background: var(--brand);
  transition: width .3s;
}

.trainer-prompt {
  font-weight: 600;
  margin-bottom: .5rem;
}

.trainer-target {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
  font-size: 1.6rem;
  margin-bottom: 1rem;
}

.trainer-target .ca {
  font-family: Georgia, 'Times New Roman', serif;
}

.trainer-target .ipa {
  white-space: normal;
}

.trainer-meaning {
  font-size: .95rem;
  color: var(--muted-text);
}

.trainer-mark {
  background: var(--bs-warning-bg-subtle);
  color: inherit;
  padding: 0 .1em;
  border-radius: 3px;
  text-decoration: underline;
}

.trainer-options,
.trainer-syllables {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 9rem), 1fr));
  gap: .5rem;
}

.trainer-syllables {
  display: flex;
  flex-wrap: wrap;
}

.trainer-option,
.trainer-syllable {
  border: 1px solid var(--border-soft);
  background: var(--surface-muted);
  color: inherit;
  border-radius: 8px;
  padding: .55rem .8rem;
  min-height: 2.75rem;
  font-size: 1.1rem;
}

.trainer-syllable {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.4rem;
  min-width: 3.2rem;
}

.trainer-option:hover:not(:disabled),
.trainer-syllable:hover:not(:disabled) {
  border-color: var(--brand);
}

.trainer-option.is-right,
.trainer-syllable.is-right {
  border-color: var(--answer-color);
  background: var(--bs-success-bg-subtle);
}

.trainer-option.is-wrong,
.trainer-syllable.is-wrong {
  border-color: var(--bs-danger);
  background: var(--bs-danger-bg-subtle);
}

.trainer-input-row {
  display: flex;
  align-items: center;
  gap: .4rem;
}

.trainer-input-row .form-control {
  font-size: 1.3rem;
  min-width: 0;
}

.trainer-input-row .ipa-input {
  font-family: "Charis SIL", "Doulos SIL", "Gentium Plus", "Noto Sans", "Segoe UI", "DejaVu Sans", sans-serif;
}

.trainer-bracket {
  font-size: 1.4rem;
  color: var(--muted-text);
}

.trainer-keys {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.6rem, 1fr));
  gap: .3rem;
  margin-top: .6rem;
}

.trainer-key {
  border: 1px solid var(--border-soft);
  background: var(--surface-muted);
  color: inherit;
  border-radius: 7px;
  height: 2.6rem;
  font-size: 1.15rem;
  white-space: nowrap;
}

.trainer-key:hover {
  border-color: var(--brand);
}

.trainer-key-wide {
  grid-column: span 2;
}

.trainer-feedback {
  margin-top: 1rem;
  padding: .7rem .9rem;
  border-radius: 8px;
  border-left: 3px solid;
}

.trainer-feedback.is-ok {
  background: var(--bs-success-bg-subtle);
  border-color: var(--answer-color);
}

.trainer-feedback.is-no {
  background: var(--bs-danger-bg-subtle);
  border-color: var(--bs-danger);
}

.trainer-feedback.is-half {
  background: var(--bs-warning-bg-subtle);
  border-color: var(--bs-warning);
}

.trainer-answer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  margin: .4rem 0;
  font-size: 1.15rem;
}

.trainer-done {
  text-align: center;
  padding: 1rem 0;
}

.trainer-big {
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--heading-color);
  line-height: 1.1;
}

.trainer-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .9rem;
}

.btn-speak-lg {
  width: auto;
  height: auto;
  border-radius: 999px;
  padding: .4rem 1rem;
  font-size: 1rem;
}

.trainer-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

@media (max-width: 767.98px) {
  .trainer-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .trainer-units {
    order: 2;
  }
}

/* ---------- C1/C2 course (/c1) ---------- */
.course-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.course-card {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  text-decoration: none;
  color: inherit;
}

.course-card:hover,
.course-card:focus-visible {
  border-color: var(--brand);
}

.course-card-title {
  font-weight: 700;
  color: var(--heading-color);
}

.course-card-meta {
  font-size: .8rem;
  color: var(--answer-color);
}

.course-topic {
  background: transparent;
}

.course-links {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .9rem;
  margin-top: .25rem;
  font-size: .9rem;
}

.course-links .unit-number {
  margin-right: .3rem;
}

.course-page-link {
  font-weight: 600;
}

.course-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 20rem);
  gap: 1rem;
  align-items: start;
}

.course-editor {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.05rem;
  line-height: 1.6;
}

.course-counter {
  margin-top: .4rem;
  font-size: .9rem;
  color: var(--muted-text);
  font-variant-numeric: tabular-nums;
}

.course-counter.is-good {
  color: var(--answer-color);
  font-weight: 600;
}

.course-counter.is-long {
  color: var(--bs-warning-text-emphasis);
  font-weight: 600;
}

.course-report p {
  font-size: .95rem;
}

.course-repeat {
  display: inline-block;
  padding: .05rem .45rem;
  margin: .1rem 0;
  border-radius: 999px;
  background: var(--bs-warning-bg-subtle);
  font-size: .85rem;
}

.course-connector-group + .course-connector-group {
  margin-top: .6rem;
}

.course-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-top: .25rem;
}

.course-chip {
  border: 1px solid var(--border-soft);
  background: var(--surface-muted);
  color: inherit;
  border-radius: 999px;
  padding: .15rem .6rem;
  font-size: .85rem;
}

button.course-chip:hover {
  border-color: var(--brand);
}

.course-select {
  flex: 1 1 14rem;
  width: auto;
}

.course-card-topic {
  border-left: 3px solid var(--brand);
  padding: .3rem .9rem;
  margin-bottom: 1rem;
}

.course-card-topic-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.3rem;
}

.course-card-topic ul {
  margin: .3rem 0 0;
  padding-left: 1.1rem;
}

.course-timer {
  text-align: center;
  margin: 1rem 0;
}

.course-timer-phase {
  font-weight: 600;
  color: var(--heading-color);
}

.course-timer-clock {
  font-size: 3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.course-timer-clock.is-ending {
  color: var(--bs-danger);
}

.course-recording audio {
  width: 100%;
}

.course-checklist {
  display: grid;
  gap: .4rem;
  font-size: .9rem;
}

.course-checklist label {
  display: flex;
  gap: .5rem;
  align-items: flex-start;
}

.course-checklist input {
  margin-top: .2rem;
  flex: 0 0 auto;
}

.course-phrase-tools {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: center;
}

.course-phrase-tools .form-control,
.course-phrase-tools .form-select {
  flex: 1 1 12rem;
  width: auto;
}

.course-theme {
  margin-top: 1.25rem;
}

.course-phrase {
  border-bottom: 1px solid var(--border-soft);
  padding: .6rem 0;
}

.course-phrase-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}

.course-phrase-head .ca {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.1rem;
}

.course-phrase-meaning {
  margin-top: .2rem;
}

.course-phrase-example {
  display: flex;
  flex-direction: column;
  margin-top: .2rem;
}

.course-phrase-example [lang="ca"] {
  font-style: italic;
}

.course-grid aside h2,
.course-grid aside .h6 {
  font-size: 1rem;
  font-weight: 700;
}

#phrase-quiz .trainer-options {
  grid-template-columns: minmax(0, 1fr);
}

#phrase-quiz .trainer-option {
  text-align: left;
  font-size: 1rem;
}

.course-quiz-target {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.4rem;
  margin: .3rem 0 1rem;
}

@media (max-width: 991.98px) {
  .course-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Words that are not Central Catalan ---------- */
.variety-badge {
  background: var(--bs-warning-bg-subtle);
  color: var(--bs-warning-text-emphasis);
  border: 1px solid var(--bs-warning-border-subtle);
  font-weight: 500;
  vertical-align: middle;
}

.dictionary .word-card.word-regional {
  border-style: dashed;
}


/* ======================================================================
   Frame: blue header with search, menu on the left
   ====================================================================== */
.lc-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 12px;
}

.lc-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 44px;
  z-index: 1030;
  background: var(--navbar-bg);
  border-bottom: 1px solid var(--navbar-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

.lc-header-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 100%;
}

.lc-logo {
  flex-shrink: 0;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .01em;
  text-decoration: none;
  white-space: nowrap;
}

.lc-logo:hover {
  color: #fff;
  text-decoration: none;
}

@media (min-width: 992px) {
  .lc-logo {
    width: 176px;  /* lines the search box up with the content column */
  }
}

.lc-search {
  flex: 1 1 auto;
  max-width: 300px;
  min-width: 0;
  margin: 0;
}

.lc-search-input {
  width: 100%;
  height: 28px;
  padding: 3px 10px 3px 28px;
  font: inherit;
  font-size: 13px;
  color: #fff;
  background: rgba(255, 255, 255, .16) no-repeat 9px center / 13px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0'/%3E%3C/svg%3E");
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 14px;
  outline: none;
  transition: background-color .15s ease;
}

.lc-search-input::placeholder {
  color: rgba(255, 255, 255, .75);
}

.lc-search-input:focus {
  color: #222;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%237a8a9a'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0'/%3E%3C/svg%3E");
  border-color: #fff;
}

.lc-search-input:focus::placeholder {
  color: #9aa7b4;
}

.lc-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.lc-header-link {
  color: rgba(255, 255, 255, .92);
  font-weight: 700;
  text-decoration: none;
  padding: 4px 6px;
  border-radius: 3px;
}

.lc-header-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, .12);
  text-decoration: none;
}

.lc-header .theme-toggle,
.lc-header .lang-toggle {
  border-color: rgba(255, 255, 255, .3);
  border-radius: 3px;
  padding: .3rem .45rem;
  font-size: 11px;
}

.lc-burger {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  width: 30px;
  height: 30px;
  padding: 0 6px;
  border: 0;
  border-radius: 3px;
  background: transparent;
}

.lc-burger span {
  display: block;
  height: 2px;
  background: #fff;
  border-radius: 1px;
}

.lc-burger:hover {
  background: rgba(255, 255, 255, .12);
}

/* ---------- Page: menu + content ---------- */
.lc-page {
  width: 100%;  /* body is a flex column: without this short pages shrink and the menu moves */
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 24px;
}

.lc-main {
  flex: 1 1 auto;
  min-width: 0;
}

@media (min-width: 992px) {
  .lc-side {
    flex: 0 0 160px;
    position: sticky;
    top: 58px;
  }
}

.lc-side .offcanvas-body {
  padding: 0;
}

@media (max-width: 991.98px) {
  .lc-side.offcanvas-lg {
    width: 260px;
    background: var(--surface);
    /* As tall as the visible screen: Safari on iPhone lays its toolbar over
       whatever reaches the very bottom (bottom: 0). */
    bottom: auto;
    height: 100vh;
    height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .lc-side .offcanvas-body {
    padding: 4px 10px 16px;
  }
}

.lc-side-title {
  font-weight: 700;
  color: var(--heading-color);
}

.lc-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;  /* the offcanvas body is a flex box: do not shrink to the text */
}

/* Menu icons belong to the modern design (modern.css). */
.lc-menu-icon {
  display: none;
}

.lc-menu-link {
  display: block;
  padding: 5px 8px;
  color: var(--bs-link-color);
  text-decoration: none;
  border-radius: 3px;
  line-height: 1.35;
}

.lc-menu-link:hover,
.lc-menu-link:focus {
  background: var(--menu-hover);
  color: var(--bs-link-color);
  text-decoration: none;
}

.lc-menu-link.active {
  background: var(--menu-hover);
  font-weight: 700;
}

.lc-menu-minor {
  color: var(--muted-text);
}

.lc-menu-sep {
  height: 0;
  margin: 6px 8px;
  border-top: 1px solid var(--border-soft);
}

/* ---------- Content proportions ---------- */
.lc-main h1 {
  font-size: 1.45rem;
  font-weight: 700;
}

.lc-main h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.lc-main h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.lc-main .lead {
  font-size: 1rem;
}

.btn {
  --bs-btn-border-radius: 3px;
}

.btn-outline-info {
  --bs-btn-color: var(--brand-contrast);
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-color: var(--brand-contrast);
  --bs-btn-hover-bg: #6d8cb0;
  --bs-btn-hover-border-color: #6d8cb0;
  --bs-btn-active-bg: #55779e;
  --bs-btn-active-border-color: #55779e;
}

.btn-outline-secondary {
  --bs-btn-color: var(--button-secondary-text);
  --bs-btn-bg: var(--button-secondary-bg);
  --bs-btn-border-color: var(--button-secondary-bg);
  --bs-btn-hover-color: var(--button-secondary-text);
  --bs-btn-hover-bg: var(--menu-hover);
  --bs-btn-hover-border-color: var(--menu-hover);
}

.content-section,
.feature-card,
.dictionary .word-card,
.phonetics .practice-word {
  border-radius: 4px;
}

.list-group {
  --bs-list-group-border-color: var(--border-soft);
  --bs-list-group-bg: var(--surface);
}

.site-footer {
  border-top: 1px solid var(--border-soft);
  background: transparent;
  font-size: 12px;
}

.hero {
  padding: 1.25rem .5rem 1.5rem;
}

.hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  color: var(--heading-color);
}

@media (max-width: 575.98px) {
  .lc-search {
    max-width: none;
  }
  .lc-logo {
    font-size: 14px;
  }
}


.btn-info {
  --bs-btn-color: var(--brand-contrast);
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-color: var(--brand-contrast);
  --bs-btn-hover-bg: #6d8cb0;
  --bs-btn-hover-border-color: #6d8cb0;
  --bs-btn-active-color: var(--brand-contrast);
  --bs-btn-active-bg: #55779e;
  --bs-btn-active-border-color: #55779e;
}

.search-summary {
  color: var(--muted-text);
}

.search-summary strong {
  color: var(--bs-body-color);
}

@media (max-width: 575.98px) {
  /* On phones the search box gets the room; the name is in the side menu. */
  .lc-logo {
    display: none;
  }
}

/* ---------- FAQ ---------- */
.faq {
  max-width: 760px;
}

.faq-lead {
  color: var(--muted-text);
}

.faq-filter {
  width: 100%;
  max-width: 420px;
  margin-bottom: 1.25rem;
  padding: .4rem .75rem;
  font: inherit;
  color: var(--bs-body-color);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
}

.faq-toc {
  margin-bottom: 1.5rem;
}

.faq-toc-section + .faq-toc-section {
  margin-top: .9rem;
}

.lc-main .faq-toc-title {
  font-size: 1rem;
  margin-bottom: .35rem;
}

.faq-toc-title a {
  color: inherit;
  text-decoration: none;
}

.faq-toc ul {
  margin: 0;
  padding-left: 1.1rem;
}

.faq-toc li {
  margin-bottom: .2rem;
}

.faq-section {
  padding-top: .5rem;
}

.lc-main .faq-section-title {
  font-size: 1.3rem;
  margin: 1.5rem 0 .5rem;
}

.faq-question {
  position: relative;
  padding: .6rem 0;
}

.lc-main .faq-question h3 {
  font-size: 1.02rem;
  margin-bottom: .45rem;
}

.faq-section,
.faq-question {
  scroll-margin-top: 70px;  /* clear the fixed header after a #link */
}

.faq-anchor {
  position: absolute;
  left: -1.1rem;
  color: var(--muted-text);
  text-decoration: none;
  opacity: 0;
  transition: opacity .15s ease;
}

.faq-question:hover .faq-anchor,
.faq-anchor:focus {
  opacity: 1;
}

.faq-answer > :last-child {
  margin-bottom: 0;
}

.faq-answer li {
  margin-bottom: .35rem;
}

.faq-answer ul,
.faq-answer ol {
  padding-left: 1.3rem;
}

.faq-answer li > ul {
  margin-top: .35rem;
}

.faq-top {
  margin: .4rem 0 0;
  font-size: .85rem;
}

.faq-top a {
  color: var(--muted-text);
}

/* ---------- Forms (partials/forms.html) ---------- */
.lc-icon {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}

.lc-field {
  margin-bottom: 1rem;
}

.lc-field .form-label {
  font-weight: 600;
  margin-bottom: .35rem;
}

.lc-password {
  position: relative;
}

.lc-password .form-control {
  padding-right: 2.75rem;
}

.lc-password-toggle {
  position: absolute;
  top: 50%;
  right: .4rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted-text);
}

.lc-password-toggle:hover,
.lc-password-toggle.active {
  color: var(--brand-strong);
}

.lc-password .form-control.is-invalid {
  background-image: none;
}

/* ---------- Log in, sign up, password reset ---------- */
.auth {
  max-width: 420px;
  margin: 1.5rem auto 0;
}

.auth-card {
  padding: 1.75rem 1.5rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
}

.auth-badge {
  display: none;  /* the icon belongs to the modern design */
}

.lc-main .auth-title {
  font-size: 1.5rem;
  margin-bottom: .35rem;
  text-align: center;
}

.auth-subtitle {
  margin-bottom: 1.5rem;
  color: var(--muted-text);
  text-align: center;
}

.auth-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin: -.25rem 0 1.25rem;
}

.auth-submit {
  padding-top: .55rem;
  padding-bottom: .55rem;
}

.auth-switch {
  margin-top: 1rem;
  text-align: center;
  color: var(--muted-text);
}

/* ---------- My account ---------- */
.account {
  max-width: 760px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
}

.lc-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: var(--size, 40px);
  height: var(--size, 40px);
  border-radius: 50%;
  object-fit: cover;
}

.lc-avatar-letter {
  background: var(--brand);
  color: var(--brand-contrast);
  font-size: calc(var(--size, 40px) * .45);
  font-weight: 700;
  line-height: 1;
}

.lc-header-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px 3px 3px;
  border-radius: 20px;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.lc-header-user:hover {
  color: #fff;
  background: rgba(255, 255, 255, .12);
}

.lc-header-user .lc-avatar {
  border: 1px solid rgba(255, 255, 255, .5);
}

@media (max-width: 767.98px) {
  .lc-header-user-name {
    display: none;
  }
  .lc-header-user {
    padding-right: 3px;
  }
}

.profile-info {
  flex: 1 1 auto;
  min-width: 0;
}

.lc-main .profile-name {
  margin-bottom: .1rem;
  font-size: 1.5rem;
  overflow-wrap: anywhere;
}

.profile-email {
  margin-bottom: .35rem;
  color: var(--muted-text);
  overflow-wrap: anywhere;
}

.profile-role {
  background: var(--brand);
  color: var(--brand-contrast);
}

.profile-logout {
  flex-shrink: 0;
  align-self: flex-start;
}

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  padding: .9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
}

.stat-tile:hover {
  color: inherit;
  border-color: var(--brand);
}

.stat-number {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--accent-text);
}

.stat-known .stat-number {
  color: var(--answer-color);
}

.stat-label {
  color: var(--muted-text);
  font-size: .85rem;
}

.lc-main .settings-title {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.file-picker {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .8rem;
  border: 1px dashed var(--border-soft);
  border-radius: 6px;
  color: var(--muted-text);
  cursor: pointer;
}

.file-picker:hover {
  border-color: var(--brand);
  color: var(--brand-strong);
}

.file-picker-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-picker-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* ---------- My dictionary ---------- */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1rem;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-bottom: 1rem;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
}

.segmented-item {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .85rem;
  border-radius: 4px;
  color: var(--muted-text);
  font-weight: 600;
  text-decoration: none;
}

.segmented-item:hover {
  color: var(--bs-body-color);
  background: var(--menu-hover);
}

.segmented-item.active {
  background: var(--brand);
  color: var(--brand-contrast);
}

.segmented-count {
  padding: 0 .45rem;
  border-radius: 999px;
  background: var(--menu-hover);
  color: var(--bs-body-color);
  font-size: .8rem;
}

.segmented-item.active .segmented-count {
  background: rgba(255, 255, 255, .25);
  color: inherit;
}

.add-word > summary {
  font-weight: 700;
  color: var(--heading-color);
  cursor: pointer;
}

.add-word[open] > summary {
  margin-bottom: .75rem;
}

.my-words {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
}

.my-word {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: .5rem 1rem;
  padding: .7rem 1rem;
}

.my-word + .my-word {
  border-top: 1px solid var(--border-soft);
}

.my-word-term {
  font-weight: 700;
  font-size: 1.02rem;
}

.my-word-term a {
  text-decoration: none;
}

.my-word-translation {
  color: var(--muted-text);
}

.my-word.is-known .my-word-term a,
.my-word.is-known .my-word-term {
  color: var(--muted-text);
}

.my-word-badge {
  margin-left: .35rem;
  background: var(--bs-success-bg-subtle);
  color: var(--bs-success-text-emphasis);
  font-weight: 600;
  vertical-align: middle;
}

.my-word-note {
  display: flex;
  align-items: center;
  gap: .25rem;
}

.my-word-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .35rem;
  min-width: 6.5rem;  /* the same column on every row */
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted-text);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.icon-button:hover {
  background: var(--menu-hover);
  color: var(--brand-strong);
}

.icon-button-danger:hover {
  color: var(--bs-danger);
}

.empty-state {
  padding: 2.5rem 1rem;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
}

.empty-state-icon {
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: .75rem;
}

@media (max-width: 767.98px) {
  .my-word {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .my-word-text {
    grid-column: 1;
  }
  .my-word-actions {
    grid-column: 2;
    grid-row: 1;
  }
  .my-word-note {
    grid-column: 1 / -1;
  }
  .stat-tiles {
    gap: .5rem;
  }
  .stat-tile {
    padding: .75rem;
  }
  .profile-card {
    flex-wrap: wrap;
  }
  .profile-avatar {
    --size: 64px !important;
  }
}

/* ---------- Copyright at the bottom of the side menu ---------- */
.lc-side .offcanvas-body {
  display: flex;
  flex-direction: column;
}

.lc-side-footer {
  margin: 1rem 8px 0;
  padding-top: .75rem;
  border-top: 1px solid var(--border-soft);
  color: var(--muted-text);
  font-size: 11px;
  line-height: 1.5;
}

/* ---------- Developers page ---------- */
.docs-code {
  padding: .85rem 1rem;
  border-radius: 6px;
  background: var(--surface-muted);
  border: 1px solid var(--border-soft);
  font-size: .85rem;
  white-space: pre;
  overflow-x: auto;
}

.docs-table td:first-child {
  white-space: nowrap;
}

.lc-side-footer a {
  color: inherit;
}

/* ---------- Language menu in the header ---------- */
.lang-menu .dropdown-menu {
  --bs-dropdown-min-width: 9rem;
  --bs-dropdown-link-active-bg: var(--brand);
  --bs-dropdown-bg: var(--surface);
  --bs-dropdown-border-color: var(--border-soft);
  font-size: .9rem;
}

/* ---------- Translation platform (/translate) ---------- */
.translate-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: .75rem 1.25rem;
  margin: 0 0 .75rem;
  padding-left: 1.2rem;
}

.translate-steps li strong {
  display: block;
  color: var(--heading-color);
}

.translate-steps li span {
  font-size: .9rem;
  color: var(--muted-text);
}

.translate-languages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.translate-languages .translate-language {
  margin-bottom: 0;
}

.translate-language-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .5rem;
  margin-bottom: .75rem;
}

.translate-badge-suggest {
  background: var(--brand);
  color: var(--brand-contrast);
  text-decoration: none;
}

.translate-progress-label {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  margin-top: .5rem;
  font-size: .85rem;
}

.translate-progress-label span {
  color: var(--muted-text);
}

.translate-progress {
  display: flex;
  height: 6px;
  margin-top: .3rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--border-soft);
}

.translate-progress-note {
  margin-top: .25rem;
  font-size: .78rem;
  color: var(--muted-text);
}

.translate-dot-draft {
  display: inline-block;
  width: .55rem;
  height: .55rem;
  margin-right: .25rem;
  border-radius: 50%;
  background: #e0a526;
}

.translate-progress-checked {
  background: #1f9d55;
}

.translate-progress-draft {
  background: #e0a526;
}

.translate-recent {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: .9rem;
}

.translate-recent li + li {
  margin-top: .3rem;
}

.translate-lang {
  display: inline-block;
  min-width: 1.9rem;
  padding: 0 .3rem;
  border-radius: 4px;
  background: var(--border-soft);
  color: var(--muted-text);
  font-size: .72rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

.translate-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem 1rem;
}

.translate-search {
  flex: 0 1 260px;
  margin-bottom: 1rem;
}

.translate-card {
  padding-top: .75rem;
  padding-bottom: .75rem;
}

.translate-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .5rem;
  margin-bottom: .25rem;
}

.translate-term {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--heading-color);
  text-decoration: none;
}

.translate-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: .35rem 1rem;
  padding: .6rem 0;
  border-top: 1px solid var(--border-soft);
}

.translate-card-head + .translate-row,
.translate-card > .translate-row:first-child {
  border-top: 0;
}

.translate-ref {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  min-width: 0;
  font-size: .92rem;
  overflow-wrap: anywhere;
}

.translate-ref-numbered {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr);
}

.translate-ref-numbered .translate-ref-line {
  grid-column: 2;
}

.translate-num {
  grid-row: 1 / span 3;
  font-weight: 700;
  color: var(--muted-text);
}

.translate-edit {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  min-width: 0;
}

.translate-form {
  display: flex;
  flex: 1;
  align-items: flex-start;
  gap: .4rem;
  min-width: 0;
}

.translate-form .form-control {
  flex: 1;
  min-width: 0;
}

.translate-chip {
  flex: none;
  min-width: 5.6rem;
  text-align: center;
  margin-top: .3rem;
  padding: .05rem .45rem;
  border-radius: 999px;
  background: var(--border-soft);
  color: var(--muted-text);
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}

.translate-chip-missing {
  background: rgba(220, 53, 69, .12);
  color: #c0392b;
}

.translate-chip-draft {
  background: rgba(224, 165, 38, .18);
  color: #a86b00;
}

.translate-chip-done {
  background: rgba(31, 157, 85, .14);
  color: #1b7f46;
}

[data-bs-theme="dark"] .translate-chip-missing { color: #ff8a80; }
[data-bs-theme="dark"] .translate-chip-draft { color: #f5c46b; }
[data-bs-theme="dark"] .translate-chip-done { color: #6fdc9c; }

.translate-suggestions {
  grid-column: 1 / -1;
  margin: 0;
  padding: .4rem .6rem;
  list-style: none;
  border-left: 3px solid var(--brand);
  border-radius: 4px;
  background: var(--menu-hover);
}

.translate-suggestions li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem .6rem;
}

.translate-suggestions li + li {
  margin-top: .35rem;
}

.translate-suggestion-text {
  font-weight: 600;
}

.translate-diff {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem .75rem;
  overflow-wrap: anywhere;
}

.translate-diff del {
  color: var(--muted-text);
}

.translate-diff ins {
  text-decoration: none;
  font-weight: 600;
}

.translate-diff form {
  margin-left: auto;
}

.translate-pages {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  margin: 1rem 0;
}

@media (max-width: 767.98px) {
  .translate-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .translate-search {
    flex: 1 1 100%;
  }
}

/* No speech synthesis in this browser: hide every listen button. */
.no-speech .btn-speak {
  display: none !important;
}

/* ---------- Reading (/reading) ---------- */
.reading-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.reading-card {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  color: inherit;
  text-decoration: none;
  border-left: 4px solid var(--brand);
  transition: border-color .15s, transform .15s;
}

.reading-card:hover,
.reading-card:focus-visible {
  transform: translateY(-2px);
  color: inherit;
}

.reading-card-author {
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted-text);
}

.reading-card-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.35rem;
  color: var(--heading-color);
}

.reading-card-meta {
  font-size: .85rem;
  color: var(--muted-text);
}

.reading-cover {
  text-align: center;
}

.reading-cover-title {
  font-family: Georgia, 'Times New Roman', serif;
  margin: .25rem 0 .5rem;
}

.reading-cover p {
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
}

.reading-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.reading-act {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.05rem;
  margin: 1rem 0 .35rem;
}

.reading-toc {
  list-style: none;
  padding: 0;
  margin: 0;
}

.reading-toc li {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .75rem;
  align-items: baseline;
  padding: .35rem 0;
  border-bottom: 1px solid var(--border-soft);
}

.reading-toc-setting {
  flex: 1;
  font-style: italic;
  color: var(--muted-text);
}

.reading-toc-words {
  font-size: .8rem;
  color: var(--muted-text);
}

.reading-cast {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .25rem .75rem;
  margin: 0;
}

.reading-cast dt {
  font-size: .85rem;
  letter-spacing: .05em;
}

.reading-cast dd {
  margin: 0;
  color: var(--muted-text);
}

.play-head {
  text-align: center;
  margin-bottom: 1.25rem;
}

.play-act {
  margin: 0;
  font-size: .8rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted-text);
}

.play-scene {
  font-family: Georgia, 'Times New Roman', serif;
  margin: .1rem 0;
}

.play-setting {
  margin: 0;
  font-style: italic;
  color: var(--muted-text);
}

.reader-text.play {
  white-space: normal;
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1.75;
}

.play-speech {
  margin-bottom: .9rem;
}

.reader-text.prose {
  white-space: normal;
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1.75;
}

.reader-text.prose p {
  margin: 0 0 .9rem;
  text-indent: 1.5em;
  hyphens: auto;
}

.reading-toc-chapters {
  columns: 2;
  column-gap: 1.5rem;
}

.reading-toc-chapters li {
  break-inside: avoid;
}

.play-speaker {
  font-family: var(--bs-body-font-family);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--heading-color);
}

.play-line {
  display: block;
  padding-left: 1rem;
  text-indent: -1rem;
}

.play-stage {
  margin: .5rem 0 .9rem;
  font-style: italic;
  color: var(--muted-text);
  text-align: center;
}

.reading-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  margin: 1rem 0;
}

.reader-chip.is-static:hover {
  border-color: var(--border-soft);
}

@media (max-width: 767.98px) {
  .reading-columns {
    grid-template-columns: 1fr;
  }

  .reading-pager .btn {
    font-size: .85rem;
  }
}

/* ---------- Text page (/text) ---------- */
.reader-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.reader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  margin-top: .75rem;
}

.reader-toolbar {
  margin-top: 0;
  margin-bottom: .75rem;
}

.reader-text {
  font-size: 1.1rem;
  line-height: 1.9;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  outline: none;
}

.reader-text:focus-visible {
  box-shadow: 0 0 0 2px var(--brand);
  border-radius: 4px;
}

.reader-word {
  border-radius: 3px;
  cursor: pointer;
}

.reader-word:hover {
  background: var(--menu-hover);
}

.reader-word.is-active {
  background: var(--brand);
  box-shadow: 0 0 0 2px var(--brand);
  color: var(--brand-contrast);
}

.reader-word.is-preview {
  background: rgba(224, 165, 38, .25);
  color: inherit;
  text-decoration: underline dotted;
}

.reader-panel {
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
}

.reader-panel-close {
  display: none;
  position: absolute;
  top: .35rem;
  right: .6rem;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted-text);
  font-size: 1.6rem;
  line-height: 1;
}

.reader-panel-close:hover,
.reader-panel-close:focus-visible {
  background: var(--border-soft);
  color: var(--bs-body-color);
}

.reader-panel-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .5rem;
}

.reader-panel-word {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--heading-color);
}

.reader-panel-sound {
  margin: -.25rem 0 .5rem;
  color: var(--muted-text);
}

/* Word page: [ˈkazə] ка́зə */
.word-sound {
  color: var(--muted-text);
}

.word-sound-uk {
  margin-left: .5rem;
}

.reader-reading {
  padding: .5rem 0;
  border-top: 1px solid var(--border-soft);
}

.reader-reading-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .4rem;
}

.reader-reading-form {
  font-size: .85rem;
  color: var(--muted-text);
}

.reader-reading-translation {
  margin-top: .15rem;
}

.reader-reading-links {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .4rem;
}

.reader-panel-title {
  margin: .9rem 0 .4rem;
  font-size: .85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted-text);
}

.reader-group + .reader-group {
  margin-top: .65rem;
  padding-top: .65rem;
  border-top: 1px dashed var(--border-soft);
}

.reader-group-label {
  margin-bottom: .25rem;
  font-size: .8rem;
  color: var(--muted-text);
}

.reader-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.reader-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  padding: .25rem .55rem;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--surface);
  color: var(--bs-body-color);
  text-align: left;
  line-height: 1.25;
}

.reader-chip:hover,
.reader-chip:focus-visible {
  border-color: var(--brand);
  outline: none;
}

.reader-chip-text {
  font-weight: 600;
}

.reader-chip-register,
.reader-chip-translation {
  font-size: .72rem;
  color: var(--muted-text);
}

.reader-chip-register {
  font-style: italic;
}

.reader-history {
  margin: 0;
  padding-left: 1.2rem;
}

.reader-history li + li {
  margin-top: .2rem;
}

.reader-history del {
  color: var(--muted-text);
}

.reader-history ins {
  text-decoration: none;
  font-weight: 600;
}

.reader-history-back {
  padding: 0 .4rem;
  font-size: .8rem;
}

@media (max-width: 991.98px) {
  .reader-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Phones and tablets: the word panel is a sheet that slides up from the
     bottom when a word is tapped, instead of sitting under the whole text. */
  .reader-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 1040;
    max-height: 55vh;
    margin: 0;
    padding-top: 1.75rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -8px 30px rgba(15, 30, 50, .18);
    transform: translateY(105%);
    transition: transform .22s ease;
    overscroll-behavior: contain;
  }

  .reader-panel::before {
    content: '';
    position: absolute;
    top: .6rem;
    left: 50%;
    width: 40px;
    height: 4px;
    margin-left: -20px;
    border-radius: 2px;
    background: var(--border-soft);
  }

  .reader-panel.is-open {
    transform: none;
  }

  .reader-panel #reader-panel-empty {
    display: none;
  }

  .reader-panel-close {
    display: block;
  }

  /* Room under the text so its last lines can be scrolled above the sheet. */
  body.reader-sheet-open .reader-main {
    margin-bottom: 55vh;
  }
}

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

/* "Beta" label on new features (the Text page). */
.beta-badge {
  display: inline-block;
  margin-left: .45rem;
  padding: .05rem .4rem;
  border-radius: 999px;
  background: rgba(224, 165, 38, .2);
  color: #a86b00;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .03em;
  line-height: 1.4;
  text-transform: uppercase;
  vertical-align: middle;
}

[data-bs-theme="dark"] .beta-badge {
  color: #f5c46b;
}

.lc-menu-link.active .beta-badge {
  background: rgba(255, 255, 255, .25);
  color: inherit;
}

.beta-badge-lg {
  font-size: .8rem;
  vertical-align: .3em;
}

/* Tables in grammar explanations (verb endings, irregular forms). */
.explanation .table-responsive {
  margin: .75rem 0 1rem;
}

.grammar-table {
  width: auto;
  min-width: 60%;
  margin-bottom: 0;
  --bs-table-bg: transparent;
  font-size: .95rem;
}

.grammar-table th,
.grammar-table td {
  padding: .35rem .75rem;
  white-space: nowrap;
  border-color: var(--border-soft);
}

.grammar-table thead th {
  font-size: .8rem;
  font-weight: 600;
  color: var(--heading-color);
  border-bottom-width: 2px;
}

.grammar-table tbody th {
  font-weight: 500;
  color: var(--muted-text);
}

.grammar-table strong {
  color: var(--heading-color);
}

.explanation h3 {
  font-size: 1.05rem;
  margin: 1.25rem 0 .5rem;
}

/* ---------- Translator (/translator) ---------- */
.translator-langs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: .5rem;
  margin-bottom: .75rem;
}

.translator-swap {
  font-size: 1.1rem;
  line-height: 1;
}

.translator-result {
  margin-top: 1.25rem;
}

.translator-sentence {
  padding: .75rem 0;
  border-top: 1px solid var(--border-soft);
}

.translator-sentence-head {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: baseline;
  justify-content: space-between;
  color: var(--muted-text);
  font-size: .9rem;
}

.translator-badge {
  font-size: .72rem;
  font-weight: 600;
  padding: .1rem .5rem;
  border-radius: 999px;
  white-space: nowrap;
}

.translator-badge.is-memory {
  background: rgba(25, 135, 84, .12);
  color: #198754;
}

.translator-badge.is-words {
  background: rgba(255, 193, 7, .18);
  color: #8a6100;
}

[data-bs-theme="dark"] .translator-badge.is-words {
  color: #f0c050;
}

[data-bs-theme="dark"] .translator-badge.is-memory {
  color: #6fcf97;
}

.translator-target-text {
  font-size: 1.15rem;
  margin: .25rem 0;
}

.translator-gloss {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted var(--border-soft);
}

a.translator-gloss:hover {
  border-bottom-color: var(--brand);
}

.translator-gloss.is-unknown {
  background: rgba(220, 53, 69, .1);
  border-bottom: 1px dashed #dc3545;
}

.translator-gloss.is-guess {
  border-bottom-style: dashed;
}

.translator-similar {
  font-size: .85rem;
  margin-top: .25rem;
}

.translator-improve {
  margin-top: .35rem;
}

.translator-catalan {
  margin-top: 1rem;
  padding-top: .75rem;
  border-top: 2px solid var(--border-soft);
  white-space: normal;
}

.translator-catalan-line {
  margin-bottom: .35rem;
}

.translator-history {
  list-style: none;
  padding: 0;
  margin: .5rem 0 0;
}

.translator-history-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
  gap: .75rem;
  width: 100%;
  padding: .4rem 0;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  background: none;
  color: inherit;
  text-align: left;
  font-size: .9rem;
}

.translator-history-langs {
  color: var(--muted-text);
  font-size: .8rem;
}

.translator-history-text,
.translator-history-result {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.translator-history-result {
  color: var(--muted-text);
}

@media (max-width: 575.98px) {
  .translator-history-item {
    grid-template-columns: minmax(0, 1fr);
    gap: .1rem;
  }
}

/* Entries of the open DACCO dictionary on a word page. */
.dictionary .dacco-senses,
.dictionary .dacco-expressions {
  padding-left: 1.4rem;
  margin-bottom: .75rem;
}

.dictionary .dacco-senses li + li,
.dictionary .dacco-expressions li + li {
  margin-top: .3rem;
}

.dictionary .dacco-tag {
  display: inline-block;
  font-size: .75em;
  padding: 0 .35em;
  margin-right: .25em;
  border-radius: .25rem;
  background: var(--bs-secondary-bg);
  color: var(--bs-secondary-color);
}

/* ---------- "Learning" and "I know" pickers in the header ---------- */
.lc-header .lang-pick-toggle {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
  line-height: 1.1;
  text-align: left;
}

.lang-pick-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .75;
}

.lang-pick-value {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.lang-pick-short { display: none; }

.lang-pick .dropdown-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.lang-pick-name {
  font-size: .8em;
  opacity: .7;
}

.lc-menu-heading {
  display: flex;
  flex-direction: column;
  padding: 2px 8px 8px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--heading-color);
}

.lc-menu-heading-name {
  font-size: .78rem;
  font-weight: 500;
  color: var(--muted-text);
}

@media (max-width: 767.98px) {
  .lang-pick-long { display: none; }
  .lang-pick-short { display: inline; }
}

.lang-picks {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* On phones the pickers move from the header to the top of the menu. */
.lang-picks-side { display: none; }

.lang-picks-side .lang-pick {
  flex: 1 1 0;
  min-width: 0;
}

.lang-picks-side .lang-pick-toggle {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 6px 12px;
  color: var(--bs-body-color);
  background: var(--bs-tertiary-bg);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  line-height: 1.15;
  text-align: left;
}

.lang-picks-side .lang-pick-toggle:hover,
.lang-picks-side .lang-pick-toggle:focus {
  color: var(--bs-body-color);
  background: var(--bs-secondary-bg);
}

.lang-picks-side .lang-pick-value { font-size: 14px; }
.lang-picks-side .lang-pick-long { display: inline; }
.lang-picks-side .lang-pick-short { display: none; }

@media (max-width: 575.98px) {
  .lang-picks-header { display: none; }
  .lang-picks-side {
    display: flex;
    margin: 0 4px 12px;
  }
}
