/* ====================================================================
   English Learning Project - unified stylesheet
   - Shared base (typography, color palette, mobile breakpoints)
   - Per-section overrides namespaced by body.english / body.d / body.v
   ==================================================================== */

:root {
  --bg: #ece8db; /* darker page background (better card contrast) */
  --card-bg: #fff;
  --text: #222;
  --muted: #555;
  --soft: #888;
  --soft-bg: #f0ece0; /* serial chip / score box bg */
  --border: #d8dde3;
  --border-soft: #eee;
  --shadow: 0 1px 3px rgba(40, 40, 40, 0.07), 0 1px 1px rgba(40, 40, 40, 0.03);

  --accent: #1d4d7c; /* primary blue (titles, links) */
  --accent-soft: #3a7a9f; /* lighter blue (Ex: prefix, stress underline) */
  --accent-text: #2c5e7a; /* example body text */
  --nav-accent: #c41230; /* top navigation / search accent */
  --nav-accent-glow: rgba(196, 18, 48, 0.22);

  --ok: #6aa84f; /* green = correct */
  --bad: #cc4125; /* red = incorrect */
  --note: #6b5400; /* amber = teacher note */
  --note-bg: #fff8d6;
  --note-border: #e0b020;
  --ins-text: #2c7a2c;
  --ins-bg: #e6f4d7;
  --content-width: 820px;
  --page-pad: 1.2em;
  --page-pad-total: 2.4em;
  --mobile-page-pad: 0.8em;
  --nav-button-height: calc(2.2em + 2px);
}

/* ====================================================================
   Shared base
   ==================================================================== */

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background: var(--bg);
  max-width: var(--content-width);
  margin: 2em auto;
  padding: 0 var(--page-pad);
  line-height: 1.6;
  font-size: 17px;
  word-wrap: break-word;
}

.top-nav {
  position: fixed;
  top: 0.8em;
  left: 50%;
  right: auto;
  width: min(var(--content-width), calc(100vw - var(--page-pad-total)));
  transform: translateX(-50%);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.4em;
  z-index: 100;
}
.top-nav a,
.top-nav a:visited,
body.v .batch-nav a,
body.v .batch-nav a:visited,
body.srs .srs-menu summary {
  display: flex;
  height: var(--nav-button-height);
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  font-size: 0.85em;
  line-height: 1.6;
  color: var(--nav-accent);
  text-decoration: none;
  background: var(--card-bg);
  padding: 0.3em 0.7em;
  border-radius: 4px;
  border: 1px solid var(--nav-accent);
  box-shadow:
    0 0 0 1px var(--nav-accent-glow),
    var(--shadow);
  font-family: Georgia, "Times New Roman", serif;
}
.top-nav a:hover,
.top-nav a:focus-visible,
body.v .batch-nav a:hover,
body.v .batch-nav a:focus-visible,
body.srs .srs-menu summary:hover,
body.srs .srs-menu summary:focus-visible {
  color: var(--nav-accent);
  border-color: var(--nav-accent);
  box-shadow:
    0 0 0 2px var(--nav-accent-glow),
    var(--shadow);
  outline: none;
}

h1 {
  font-size: 1.6em;
  margin: 0 0 0.2em 0;
  color: var(--accent);
}

h2 {
  font-size: 1.2em;
  color: var(--accent);
}

.meta {
  color: var(--soft);
  font-size: 0.92em;
  margin: 0 0 1.5em 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition:
    color 0.12s ease,
    border-color 0.12s ease;
}
a:visited {
  color: var(--accent);
}
a:hover {
  color: var(--accent-soft);
  border-bottom-color: var(--accent-soft);
}

@media (max-width: 600px) {
  body {
    margin: 1em auto;
    padding: 2.6em var(--mobile-page-pad) 0;
    font-size: 16px;
    line-height: 1.55;
  }
  h1 {
    font-size: 1.4em;
  }
  h2 {
    font-size: 1.1em;
  }
}

/* ====================================================================
   body.english -landing page
   ==================================================================== */

body.english .section {
  display: block;
  padding: 1.2em 1.4em;
  margin: 1em 0;
  background: var(--card-bg);
  border-left: 4px solid var(--border);
  border-radius: 0 4px 4px 0;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}
body.english .section:hover {
  background: #f5f3ec;
  border-left-color: var(--accent);
}
body.english .section h2 {
  font-size: 1.3em;
  margin: 0 0 0.3em 0;
  border: none;
  padding: 0;
}
body.english .section .stat {
  color: var(--muted);
  font-size: 0.95em;
}
body.english .section .desc {
  color: var(--soft);
  font-size: 0.85em;
  margin-top: 0.4em;
  line-height: 1.4;
}

@media (max-width: 600px) {
  body.english .section {
    padding: 1em 1.1em;
  }
}

/* ====================================================================
   body.d -dictation reviews
   (base body styles already match d's design; only review-specific
   selectors below.)
   ==================================================================== */

body.d h2 {
  margin-top: 2em;
  color: var(--text);
}

body.d .review-list {
  display: block;
  margin: 0;
  padding: 0;
}
body.d .review-card {
  display: block;
  margin: 0.6em 0;
  padding: 0.7em 1em;
  background: var(--card-bg);
  border-left: 4px solid var(--border);
  border-radius: 0 4px 4px 0;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}
body.d .review-card:hover {
  background: #f5f3ec;
  border-left-color: var(--accent);
}
body.d .review-title {
  font-weight: bold;
  color: var(--accent);
}
body.d .review-meta {
  color: var(--soft);
  font-size: 0.9em;
  margin-left: 0.6em;
}

body.d .line {
  margin: 0.9em 0;
  padding: 0.6em 0.8em;
  border-left: 4px solid var(--border);
  background: var(--card-bg);
  box-shadow: var(--shadow);
  border-radius: 0 4px 4px 0;
}
body.d .line.ok {
  border-left-color: var(--ok);
}
body.d .line.bad {
  border-left-color: var(--bad);
}

body.d .line-num {
  display: inline-block;
  color: #999;
  font-size: 0.85em;
  width: 2.5em;
}
body.d .speaker {
  font-weight: bold;
  color: var(--muted);
}
body.d .check {
  color: var(--ok);
  font-weight: bold;
  margin-left: 0.5em;
}

body.d del {
  color: var(--bad);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}
body.d ins {
  color: var(--ins-text);
  text-decoration: none;
  background: var(--ins-bg);
  padding: 0 3px;
  border-radius: 2px;
}

body.d .note {
  display: block;
  margin-top: 0.4em;
  padding: 0.4em 0.7em;
  background: var(--note-bg);
  border-left: 4px solid var(--note-border);
  font-family: "Comic Sans MS", "Marker Felt", cursive;
  font-size: 0.92em;
  color: var(--note);
}

body.d .score-box {
  background: var(--soft-bg);
  padding: 0.8em 1em;
  border: 1px solid var(--border);
  border-radius: 3px;
  margin: 2em 0;
  box-shadow: var(--shadow);
}
body.d .score-box ul {
  padding-left: 1.4em;
}
body.d .score-box li {
  margin: 0.3em 0;
}

@media (max-width: 600px) {
  body.d .line {
    padding: 0.5em 0.65em;
  }
  body.d .line-num {
    width: auto;
    margin-right: 0.4em;
  }
  body.d .note {
    font-size: 0.95em;
    padding: 0.5em 0.65em;
  }
}

/* ====================================================================
   body.v -vocabulary
   (base body styles match d's design; only vocab-specific selectors below.)
   ==================================================================== */

body.v-batch {
  padding-bottom: 3.2em;
}

body.v .v-search {
  position: relative;
  width: 16em;
  max-width: calc(100vw - 11em);
  margin: 0;
  z-index: 100;
}

body.v .v-search-box {
  position: relative;
}

body.v .v-search-input {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: var(--nav-button-height);
  box-sizing: border-box;
  border: 1px solid var(--nav-accent);
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--text);
  box-shadow:
    0 0 0 1px var(--nav-accent-glow),
    var(--shadow);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.85em;
  line-height: 1.6;
  padding: 0.3em 0.7em;
}

body.v .v-search-input::placeholder {
  font: inherit;
}

body.v .v-search-input:focus {
  outline: 2px solid var(--nav-accent-glow);
  border-color: var(--nav-accent);
}

body.v .v-search-results {
  position: absolute;
  z-index: 80;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 18em;
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(40, 40, 40, 0.14);
  font-size: 0.9em;
}

body.v .v-search-result {
  display: block;
  padding: 0.52em 0.65em;
  color: var(--text);
  border: none;
  border-bottom: 1px solid var(--border-soft);
  border-radius: 0;
  box-shadow: none;
  height: auto;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  justify-content: flex-start;
}

body.v .v-search-result:last-child {
  border-bottom: 0;
}

body.v .v-search-result:hover,
body.v .v-search-result.is-active {
  background: #f5f3ec;
  color: var(--nav-accent);
}

body.v .v-search-result-title {
  display: block;
  font-weight: bold;
}

body.v .v-search-result-meta {
  display: block;
  color: var(--soft);
  font-size: 0.82em;
  line-height: 1.35;
}

body.v .batch-list,
body.v .theme-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6em;
  margin: 0;
  padding: 0;
}
body.v .batch-card,
body.v .theme-card {
  display: block;
  margin: 0;
  padding: 0.7em 1em;
  background: var(--card-bg);
  border-left: 4px solid var(--border);
  border-radius: 0 4px 4px 0;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}
body.v .batch-card:hover,
body.v .theme-card:hover {
  background: #f5f3ec;
  border-left-color: var(--accent);
}
body.v .batch-title,
body.v .theme-title {
  font-weight: bold;
  color: var(--accent);
}
body.v .batch-meta,
body.v .theme-meta {
  color: var(--soft);
  font-size: 0.9em;
  margin-left: 0.6em;
}

/* Width-driven columns: >=360px -> 3 columns (base rule above); <360px -> 2 columns */
@media (max-width: 359px) {
  body.v .batch-list,
  body.v .theme-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

body.v .batch-nav {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 0.8em;
  width: min(var(--content-width), calc(100vw - var(--page-pad-total)));
  transform: translateX(-50%);
  z-index: 100;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 0.4em;
  margin: 0;
  padding: 0;
  border: 0;
  pointer-events: none;
}

body.v .batch-nav-slot {
  display: flex;
  min-width: 0;
}

body.v .batch-nav-prev {
  justify-content: flex-start;
}

body.v .batch-nav-next {
  justify-content: flex-end;
}

body.v .batch-nav a {
  pointer-events: auto;
  white-space: nowrap;
}

body.v .entry {
  margin: 0.9em 0;
  padding: 0.6em 0.8em;
  scroll-margin-top: 4em;
  border-left: 4px solid var(--border);
  background: var(--card-bg);
  box-shadow: var(--shadow);
  border-radius: 0 4px 4px 0;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  gap: 0.8em;
}

body.v .entry-body {
  flex: 1 1 0;
  min-width: 0;
}

body.v .serial {
  float: right;
  color: var(--soft);
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.8em;
  background: var(--soft-bg);
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 0.5em;
}

body.v .entry-image {
  flex: 0 0 36%;
  order: 2;
  align-self: stretch;
  display: block;
  margin: 0;
}

body.v .entry-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: top;
  border-radius: 3px;
  background: var(--card-bg);
}

/* Image cards: title+serial on a full-width top row, image floats right in the
   body, definition text flows around and below it. */
body.v .entry.has-image {
  display: block;
}

body.v .entry.has-image .entry-header {
  overflow: hidden; /* contains the floated serial, keeps the row full width */
}

body.v .entry.has-image .entry-image,
body.v .entry.has-image .entry-images {
  float: right;
  flex: none;
  order: initial;
  align-self: auto;
  width: 34%;
  max-width: 300px;
  margin: 0 0 0.5em 1em;
}

body.v .entry.has-image .entry-image img {
  height: auto;
  object-fit: contain;
}

/* Multiple images: a vertical stack of captioned figures in the image column. */
body.v .entry-image-item {
  position: relative;
  display: block;
  margin: 0;
}
body.v .entry-image-item + .entry-image-item {
  margin-top: 0.4em;
}
body.v .entry-image-item .entry-image-link {
  display: block;
}
body.v .entry-image-item img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
  background: var(--card-bg);
}
body.v .entry-image-caption {
  position: absolute;
  top: 0;
  left: 0;
  max-width: 90%;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 0.72em;
  line-height: 1.3;
  padding: 1px 6px;
  border-radius: 3px 0 3px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

/* Sense-number badge: cross-references a right-column image to the specific
   meaning it depicts. Shown only on cards with 2+ images (where a shared term
   would otherwise make it unclear which image belongs to which sense); the
   same number appears on the image caption and before that meaning's def. */
body.v .sense-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 1.35em;
  height: 1.35em;
  padding: 0 0.2em;
  margin-right: 0.42em;
  background: var(--accent);
  color: #fff;
  font-size: 0.72em;
  font-weight: 600;
  /* half the height -> true circle for a single digit, stadium for 2 digits */
  border-radius: 0.7em;
  /* `middle` aligns to the x-height midline, which reads slightly low next to
     the text; nudge up a hair so the digit sits level with the words. */
  vertical-align: middle;
  position: relative;
  top: -0.06em;
  flex: none;
}

body.v .entry-image-caption .sense-num {
  margin-right: 0.3em;
}

/* The comparison box has its own background, so keep it clear of the floated
   image instead of letting the image overlap its corner. */
body.v .entry.has-image .comparison {
  clear: both;
}

body.v .entry .title {
  font-size: 1.35em;
  margin: 0 0 0.4em 0;
  font-weight: bold;
  color: var(--accent);
  letter-spacing: 0.2px;
}

body.v .tag {
  font-size: 0.7em;
  color: var(--soft);
  font-weight: normal;
  margin-left: 0.4em;
  text-transform: lowercase;
  letter-spacing: 0.5px;
}

body.v .theme-tag {
  display: inline-block;
  font-size: 0.5em;
  font-weight: normal;
  margin-left: 0.3em;
  padding: 0 4px;
  border-radius: 3px;
  background: var(--soft-bg);
  color: var(--accent-soft);
  text-decoration: none;
  text-transform: lowercase;
  letter-spacing: 0.3px;
  vertical-align: middle;
}

body.v .theme-tag:hover,
body.v .theme-tag:focus-visible {
  background: var(--accent-soft);
  color: #fff;
}

body.v .form {
  margin: 0.3em 0;
  padding-left: 0.6em;
  border-left: 4px solid var(--border-soft);
}

body.v .word-header {
  display: block;
  margin-bottom: 0.15em;
}

body.v .word {
  font-weight: bold;
  color: var(--text);
}

body.v .stress,
body.srs .stress {
  text-decoration: underline;
  text-decoration-color: var(--accent-soft);
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
  font-weight: inherit;
}

body.v .ipa {
  color: var(--muted);
  margin-left: 0.4em;
  font-family: "Doulos SIL", "Charis SIL", "Lucida Sans Unicode", "Arial Unicode MS", serif;
  font-size: 0.92em;
  white-space: nowrap;
  display: inline-block;
}

body.v .pos {
  color: var(--soft);
  font-style: italic;
  margin-left: 0.4em;
  font-size: 0.85em;
}

body.v .play-audio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 1.3em;
  padding: 0 0.4em 0 0.35em;
  margin-left: 0.3em;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--soft-bg);
  color: var(--accent-soft);
  cursor: pointer;
  vertical-align: middle;
}

body.v .play-audio:hover,
body.v .play-audio:focus-visible {
  background: var(--accent-soft);
  color: #fff;
}

body.v .play-icon {
  margin-left: 1px;
  flex-shrink: 0;
}

body.v .audio-locale {
  font-size: 0.62em;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  line-height: 1;
}

body.v .inflections,
body.srs .inflections {
  font-size: 0.82em;
  color: var(--muted);
  margin: 0.15em 0 0.1em;
}

body.v .inflection-row,
body.srs .inflection-row {
  line-height: 1.6;
}

body.v .inflection-label,
body.srs .inflection-label {
  color: var(--soft);
  font-style: italic;
  display: inline-block;
  min-width: 2.5em;
}

body.v .inflection-form,
body.srs .inflection-form {
  font-weight: 600;
  color: var(--text);
}

body.v .inflection-or,
body.srs .inflection-or {
  color: var(--soft);
  font-style: italic;
  margin: 0 0.15em;
}

body.v .inflection-note,
body.srs .inflection-note {
  color: var(--soft);
  font-style: italic;
  font-size: 0.92em;
}

body.v .note {
  color: var(--note);
  font-size: 0.85em;
  font-style: italic;
  margin: 0.2em 0;
}
body.v .xref {
  color: var(--accent);
  font-style: normal;
  border-bottom: 1px dotted currentColor;
}
body.v .xref:hover {
  color: var(--accent-soft);
  border-bottom-style: solid;
}

body.v ol.meanings,
body.v ul.meanings {
  margin: 0.15em 0 0.3em 1.3em;
  padding: 0;
}
body.v ul.meanings {
  list-style: disc;
}
body.v ol.meanings {
  list-style: decimal;
}
body.v .meanings li {
  margin: 0.2em 0;
  padding-left: 0.1em;
}
body.v .def {
  margin: 0;
}
body.v .example {
  margin: 0.05em 0 0 0;
  color: var(--accent-text);
  font-style: italic;
  font-size: 0.92em;
}
body.v .example::before {
  content: "Ex: ";
  font-style: normal;
  color: var(--accent-soft);
  font-weight: bold;
  font-size: 0.78em;
  letter-spacing: 0.5px;
  margin-right: 0.15em;
}

body.v .comparison {
  margin-top: 0.75em;
  padding: 0.65em 0.75em;
  border: 1px solid #e8b7bf;
  border-left: 4px solid #cf5f72;
  border-radius: 0 4px 4px 0;
  background: #fff1f2;
}
body.v .comparison-title {
  margin: 0 0 0.35em 0;
  color: #9f2f45;
  font-size: 1em;
  line-height: 1.35;
}
body.v .comparison-summary {
  margin: 0 0 0.45em 0;
  color: var(--muted);
  font-size: 0.9em;
}
body.v .comparison-items {
  margin: 0.35em 0;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 0.7em;
  row-gap: 0.25em;
}
body.v .comparison-items dt {
  font-weight: bold;
  color: var(--text);
}
body.v .comparison-items dd {
  margin: 0;
  color: var(--muted);
}
body.v .comparison-notes {
  margin: 0.45em 0 0 1.2em;
  padding: 0;
  color: var(--note);
  font-size: 0.9em;
}
body.v .comparison-notes li {
  margin: 0.2em 0;
}

@media (max-width: 600px) {
  body.v-batch {
    padding-bottom: 3.2em;
  }
  body.v .batch-card,
  body.v .theme-card {
    padding: 0.6em 0.7em;
    text-align: center;
  }
  body.v .batch-meta,
  body.v .theme-meta {
    display: none;
  }
  .top-nav {
    left: var(--mobile-page-pad);
    right: var(--mobile-page-pad);
    width: auto;
    transform: none;
    justify-content: flex-start;
  }
  body.v .batch-nav {
    left: var(--mobile-page-pad);
    right: var(--mobile-page-pad);
    bottom: 0.8em;
    width: auto;
    transform: none;
  }
  body.v .top-nav a {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  body.v .v-search {
    flex: 1 1 auto;
    width: auto;
    max-width: none;
    min-width: 0;
  }
  body.v .v-search-results {
    max-height: 14em;
  }
  body.v .entry {
    padding: 0.5em 0.65em;
    scroll-margin-top: 5.6em;
    display: block;
  }
  body.v .entry .title {
    font-size: 1.2em;
  }
  body.v .form {
    padding-left: 0.5em;
  }
  body.v ol.meanings,
  body.v ul.meanings {
    margin-left: 1.1em;
  }
  body.v .entry-image {
    float: right;
    clear: right;
    flex: none;
    order: 0;
    margin: 0.2em 0 0.4em 0.8em;
    max-width: 130px;
  }
  body.v .entry.has-image .entry-image,
  body.v .entry.has-image .entry-images {
    width: auto;
    max-width: 130px;
    margin: 0.2em 0 0.4em 0.8em;
  }
  body.v .entry-image img {
    height: auto;
    max-height: 110px;
  }
  body.v .entry-image-item {
    width: fit-content;
    max-width: 100%;
  }
  body.v .entry-image-item img {
    width: auto;
    max-width: 100%;
    max-height: 110px;
  }
}

/* ====================================================================
   body.srs -terminal-style spaced repetition review
   ==================================================================== */

body.srs {
  padding-bottom: calc(5.5em + env(safe-area-inset-bottom));
}

body.srs .srs-shell {
  margin: 0 auto;
}

body.srs .srs-menu {
  position: relative;
}

body.srs .srs-menu summary {
  flex-direction: column;
  gap: 0.2em;
  cursor: pointer;
  list-style: none;
}

body.srs .srs-menu summary::-webkit-details-marker {
  display: none;
}

body.srs .srs-menu summary::marker {
  content: "";
}

body.srs .srs-menu-line {
  display: block;
  width: 0.95em;
  height: 1px;
  background: var(--nav-accent);
}

body.srs .srs-menu-panel {
  position: absolute;
  top: calc(100% + 0.4em);
  right: 0;
  display: grid;
  gap: 0.45em;
  width: max-content;
  max-width: calc(100vw - var(--page-pad-total));
}

body.srs .srs-menu-panel button {
  width: 100%;
  height: var(--nav-button-height);
  box-sizing: border-box;
  font-size: 0.85em;
  line-height: 1.6;
  padding: 0.3em 0.7em;
  white-space: nowrap;
  text-align: left;
}

/* Themed deck selector in the menu */
body.srs .srs-deck {
  font-size: 0.68em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: -0.25em;
}

body.srs .srs-menu-panel select {
  width: 100%;
  height: var(--nav-button-height);
  box-sizing: border-box;
  font-size: 0.85em;
  padding: 0.2em 0.5em;
}

body.srs .srs-menu-panel button:not(:disabled) {
  border-color: var(--nav-accent);
  color: var(--nav-accent);
  box-shadow:
    0 0 0 1px var(--nav-accent-glow),
    var(--shadow);
}

body.srs .srs-menu-panel button:not(:disabled):hover,
body.srs .srs-menu-panel button:not(:disabled):focus-visible {
  border-color: var(--nav-accent);
  color: var(--nav-accent);
  box-shadow:
    0 0 0 2px var(--nav-accent-glow),
    var(--shadow);
}

body.srs .srs-menu summary:active,
body.srs .srs-menu-panel button:not(:disabled):active {
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 2px rgba(40, 40, 40, 0.14),
    0 0 0 1px var(--nav-accent-glow);
}

body.srs .srs-header {
  margin-bottom: 0.8em;
}

body.srs .srs-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.95em;
}

body.srs .srs-review-actions {
  display: flex;
  gap: 0.5em;
  margin: 0.8em 0;
}

body.srs .srs-secondary {
  border-top: 1px solid var(--border);
  margin-top: 1em;
  padding-top: 0.2em;
}

body.srs button {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--accent);
  box-shadow: var(--shadow);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.95em;
  line-height: 1.4;
  padding: 0.42em 0.78em;
}

body.srs button:focus-visible {
  outline: 2px solid var(--nav-accent-glow);
  outline-offset: 2px;
}

body.srs button:disabled {
  border-color: var(--border);
  color: var(--soft);
  background: var(--soft-bg);
}

body.srs .srs-levels {
  color: var(--soft);
  font-size: 0.88em;
  line-height: 1.35;
  margin: 0.75em 0 0;
  text-align: center;
}

body.srs .srs-card {
  min-height: 8.5em;
  margin: 1em 0 0.8em;
  padding: 1em 1.1em;
  background: var(--card-bg);
  border-left: 4px solid var(--accent);
  border-radius: 0 4px 4px 0;
  box-shadow: var(--shadow);
}

body.srs .srs-front {
  display: grid;
  min-height: 5em;
  place-items: center;
  text-align: center;
}

body.srs .srs-term {
  color: var(--text);
  font-size: 2em;
  font-weight: bold;
  line-height: 1.2;
}

body.srs .srs-card-meta,
body.srs .srs-entry-meta {
  color: var(--soft);
  font-size: 0.88em;
}

body.srs .srs-back {
  margin-top: 0;
}

/* Only used when a card bundles more than one sense sharing the same term
   (e.g. "retail" noun + adjective, "calf" cattle + leg-muscle) - visually
   separates each sense, mirroring .form on the main vocabulary site. */
body.srs .srs-sense {
  margin: 0.3em 0;
  padding-left: 0.6em;
  border-left: 4px solid var(--border-soft);
}
body.srs .srs-sense + .srs-sense {
  margin-top: 0.6em;
}

body.srs .srs-word-header {
  display: block;
  margin-bottom: 0.2em;
}

body.srs .srs-word {
  font-weight: bold;
}

body.srs .srs-ipa {
  color: var(--muted);
  margin-left: 0.4em;
  font-family: "Doulos SIL", "Charis SIL", "Lucida Sans Unicode", "Arial Unicode MS", serif;
  font-size: 0.92em;
}

body.srs .srs-pos {
  color: var(--soft);
  font-style: italic;
  margin-left: 0.4em;
  font-size: 0.88em;
}

body.srs .play-audio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 1.3em;
  padding: 0 0.4em 0 0.35em;
  margin-left: 0.3em;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--soft-bg);
  color: var(--accent-soft);
  cursor: pointer;
  vertical-align: middle;
}

body.srs .play-audio:hover,
body.srs .play-audio:focus-visible {
  background: var(--accent-soft);
  color: #fff;
}

body.srs .play-icon {
  margin-left: 1px;
  flex-shrink: 0;
}

body.srs .audio-locale {
  font-size: 0.62em;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  line-height: 1;
}

body.srs .srs-card-image {
  margin: 0 0 0.7em;
  text-align: center;
}

body.srs .srs-card-image img {
  max-width: 100%;
  max-height: 11em;
  border-radius: 4px;
}

/* Meaning-level images sit inline under their definition, slightly smaller
   and left-aligned so they read as belonging to that specific sense. */
body.srs .srs-meaning-image {
  text-align: left;
  margin: 0.4em 0 0.2em;
}

body.srs .srs-meaning-image img {
  max-height: 8em;
}

/* Comparison overlay on the card back (confusable-word contrast). */
body.srs .srs-comparison {
  margin-top: 1em;
  padding-left: 0.75em;
  border-left: 3px solid var(--accent);
}

body.srs .srs-comparison-title {
  margin: 0 0 0.3em;
  font-size: 0.95em;
  color: var(--accent);
}

body.srs .srs-comparison-summary {
  margin: 0 0 0.5em;
  font-size: 0.9em;
}

body.srs .srs-comparison-items {
  margin: 0;
}

body.srs .srs-comparison-items dt {
  font-weight: 600;
  font-size: 0.9em;
  margin-top: 0.45em;
}

body.srs .srs-comparison-items dd {
  margin: 0.05em 0 0;
  font-size: 0.9em;
}

body.srs .srs-comparison-notes {
  margin: 0.55em 0 0 1.1em;
  padding: 0;
  font-size: 0.86em;
  color: var(--note);
}

body.srs .srs-note {
  color: var(--note);
  font-size: 0.9em;
  font-style: italic;
  margin: 0.35em 0;
}

body.srs .srs-meanings {
  margin: 0.6em 0 0 1.25em;
  padding: 0;
}

body.srs .srs-meanings li {
  margin: 0.35em 0;
}

body.srs .srs-def,
body.srs .srs-example {
  margin: 0;
}

body.srs .srs-example {
  color: var(--accent-text);
  font-style: italic;
  font-size: 0.92em;
}

body.srs .srs-example::before {
  content: "Ex: ";
  font-style: normal;
  color: var(--accent-soft);
  font-weight: bold;
  font-size: 0.78em;
  letter-spacing: 0.5px;
  margin-right: 0.15em;
}

body.srs .srs-review-actions {
  position: fixed;
  bottom: calc(0.8em + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 110;
  width: min(var(--content-width), calc(100vw - var(--page-pad-total)));
  margin: 0;
  transform: translateX(-50%);
}

body.srs .srs-review-actions button {
  flex: 1 1 0;
  min-width: 0;
}

body.srs .srs-review-actions button:not(:disabled) {
  border-color: var(--nav-accent);
  color: var(--nav-accent);
  box-shadow:
    0 0 0 1px var(--nav-accent-glow),
    var(--shadow);
}

body.srs .srs-review-actions button:not(:disabled):hover,
body.srs .srs-review-actions button:not(:disabled):focus-visible {
  border-color: var(--nav-accent);
  color: var(--nav-accent);
  box-shadow:
    0 0 0 2px var(--nav-accent-glow),
    var(--shadow);
}

@media (max-width: 600px) {
  body.srs .top-nav {
    left: var(--mobile-page-pad);
    right: var(--mobile-page-pad);
    width: auto;
    transform: none;
    justify-content: flex-end;
  }
  body.srs .srs-review-actions {
    left: var(--mobile-page-pad);
    right: var(--mobile-page-pad);
    width: auto;
    transform: none;
  }
  body.srs button {
    padding: 0.52em 0.35em;
    font-size: 0.92em;
  }
  body.srs .srs-levels {
    font-size: 0.78em;
  }
  body.srs .srs-card {
    min-height: 7em;
    padding: 0.85em 0.9em;
  }
  body.srs .srs-front {
    min-height: 4.5em;
  }
  body.srs .srs-term {
    font-size: 1.65em;
  }
}
