/* frappe — the Vocadex (js/game/vocadex.js, classes dx-) and the grimoire + lessons (js/game/grimoire.js,
   classes gr-). Built on game-base.css (.g-*) and the theme tokens. The only fixed colours are the two
   gender hues (always paired with a « le / la » text label) — every layout works at 360 px wide.
   Text colours (ARCHITECTURE.md §1): every English gloss, translation, label, count and explanation uses
   --g-gloss (≥ 5:1); --sub is only for decoration (the #0001 numbers, arrows), placeholders and empty stars. */

.dx-page,
.dx-modal {
  --dx-m: #4f9fe0; /* masculine: blue */
  --dx-f: #e2607e; /* feminine: pink-red */
}
.dx-st0 {
  --dx-sc: var(--sub);
}
.dx-st1 {
  --dx-sc: var(--g-st1);
}
.dx-st2 {
  --dx-sc: var(--g-st2);
}
.dx-st3 {
  --dx-sc: var(--g-st3);
}
.dx-st4 {
  --dx-sc: var(--g-st4);
}

/* visually hidden text for screen readers */
.dx-sr,
.gr-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.dx-page button:focus-visible,
.dx-modal button:focus-visible,
.gr-page button:focus-visible,
.dx-select:focus-visible,
.gr-table-wrap:focus-visible {
  outline: 2px solid var(--main);
  outline-offset: 2px;
}

/* ================================================================ Vocadex: header */

.dx-head {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.dx-head-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.dx-big {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-variant-numeric: tabular-nums;
}
.dx-big b {
  font-size: 2.2rem;
  font-weight: 400;
  color: var(--main);
  line-height: 1;
}
.dx-big span {
  color: var(--g-gloss);
  font-size: 1rem;
}
.dx-big-txt {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.95rem;
}
.dx-big-txt b {
  color: var(--main);
  font-weight: 400;
}

/* stacked stage bar: mastered | trained | caught | seen */
.dx-stack {
  display: flex;
  width: 100%;
  height: 0.55rem;
  border-radius: 1rem;
  background: var(--bg);
  overflow: hidden;
}
.dx-stack.lg {
  height: 0.8rem;
}
.dx-stack.sm {
  height: 0.4rem;
}
.dx-stack > i {
  display: block;
  height: 100%;
  flex: none;
  transition: width 0.4s ease;
}
.dx-stack > .dx-s1,
.dx-dot.dx-s1 {
  background: var(--g-st1);
}
.dx-stack > .dx-s2,
.dx-dot.dx-s2 {
  background: var(--g-st2);
}
.dx-stack > .dx-s3,
.dx-dot.dx-s3 {
  background: var(--g-st3);
}
.dx-stack > .dx-s4,
.dx-dot.dx-s4 {
  background: var(--g-st4);
}
.dx-dot {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  flex: none;
  vertical-align: -0.05em;
  margin-right: 0.3rem;
}
.dx-dot.dx-s0 {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--sub);
}

.dx-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.dx-leg {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  padding: 0.25rem 0.65rem;
  border-radius: 2rem;
  background: var(--bg);
  color: var(--g-gloss);
  font-size: 0.8rem;
  border: 2px solid transparent;
  transition: color 0.12s, border-color 0.12s;
}
.dx-leg b {
  color: var(--text);
  font-weight: 400;
  margin-left: 0.3rem;
  font-variant-numeric: tabular-nums;
}
.dx-leg:hover {
  color: var(--text);
}
.dx-leg.on {
  border-color: var(--main);
  color: var(--text);
}

/* level tiles (also the level filter) */
.dx-lvs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
}
.dx-lvt {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border-radius: 0.7rem;
  background: var(--sub-alt);
  color: var(--text);
  text-align: left;
  border: 2px solid transparent;
  transition: border-color 0.12s, transform 0.12s;
}
.dx-lvt:hover {
  border-color: color-mix(in srgb, var(--sub) 50%, transparent);
}
.dx-lvt.on {
  border-color: var(--main);
  background: color-mix(in srgb, var(--main) 10%, var(--sub-alt));
}
.dx-lvt-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.dx-lvt-name {
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dx-lvt-ic {
  font-size: 1rem;
}
.dx-lvt-num {
  font-size: 0.72rem;
  color: var(--g-gloss);
  font-variant-numeric: tabular-nums;
}
/* the selected tile is tinted: --g-gloss would drop under 4.5:1 on the light themes */
.dx-lvt.on .dx-lvt-num {
  color: var(--text);
}
.dx-lvt-all {
  justify-content: space-between;
}

/* tabs + tools */
.dx-tabs .g-tab {
  font-size: 0.95rem;
}
.dx-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.dx-tools[hidden] {
  display: none;
}
.dx-search {
  flex: 1 1 14rem;
  min-width: 0;
  position: relative;
}
.dx-q.g-input {
  font-size: 0.95rem;
  padding: 0.55rem 0.8rem;
}
.dx-sel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}
/* a select is as wide as its longest option unless given a width: keep it from widening the page */
.dx-select {
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--sub-alt);
  border: 2px solid transparent;
  border-radius: 0.55rem;
  padding: 0.45rem 0.55rem;
  width: 9.5rem;
  flex: 1 1 auto;
  min-width: 0;
  cursor: pointer;
  text-overflow: ellipsis;
}
.dx-select:hover {
  border-color: color-mix(in srgb, var(--sub) 50%, transparent);
}
.dx-select option,
.dx-select optgroup {
  background: var(--bg);
  color: var(--text);
}
.dx-select[data-dx-sel="theme"] {
  width: 12rem;
  flex-grow: 3;
}
.dx-weak.on,
.gr-weakb.on {
  background: var(--main);
  color: var(--bg);
}

/* ================================================================ Vocadex: grid */

.dx-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.dx-count {
  margin: 0;
}
.dx-count b {
  color: var(--text);
  font-weight: 400;
}
.dx-empty div {
  margin-top: 0.8rem;
}
.dx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.6rem, 1fr));
  gap: 0.6rem;
}
.dx-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
  padding: 0.4rem 0.4rem 0.55rem;
  border-radius: 0.75rem;
  border: 2px solid transparent;
  background: var(--sub-alt);
  color: var(--text);
  text-align: center;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
  content-visibility: auto;
  contain-intrinsic-size: auto 9.4rem;
}
.dx-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--g-shadow);
  border-color: color-mix(in srgb, var(--dx-sc) 70%, transparent);
}
.dx-card.dx-st2,
.dx-card.dx-st3 {
  border-color: color-mix(in srgb, var(--dx-sc) 35%, transparent);
}
.dx-card.dx-st4 {
  border-color: color-mix(in srgb, var(--dx-sc) 55%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--g-st4) 16%, var(--sub-alt)), var(--sub-alt) 70%);
}
.dx-num {
  align-self: flex-start;
  font-size: 0.66rem;
  color: var(--sub);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.dx-spr {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-top: -0.1rem;
}
.dx-card.dx-st0 .dx-spr {
  opacity: 0.7;
}
.dx-name {
  font-family: "Lexend Deca", sans-serif;
  font-size: 0.8rem;
  line-height: 1.2;
  min-height: 2.4em;
  width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.dx-name.dx-unk {
  color: var(--sub);
  letter-spacing: 0.2em;
}
.dx-stars {
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  line-height: 1;
  color: color-mix(in srgb, var(--sub) 40%, transparent);
}
.dx-stars i {
  font-style: normal;
}
.dx-stars .on.dx-s1 {
  color: var(--g-st1);
}
.dx-stars .on.dx-s2 {
  color: var(--g-st2);
}
.dx-stars .on.dx-s3 {
  color: var(--g-st3);
}
.dx-stars .on.dx-s4 {
  color: var(--g-st4);
}
.dx-r {
  width: 78%;
  height: 4px;
  border-radius: 4px;
  background: var(--bg);
  overflow: hidden;
}
.dx-r.none {
  visibility: hidden;
}
.dx-r i {
  display: block;
  height: 100%;
  background: var(--g-hp);
}
.dx-r i.mid {
  background: var(--g-hp-mid);
}
.dx-r i.low {
  background: var(--g-hp-low);
}
.dx-nospr {
  display: grid;
  place-items: center;
  width: var(--dx-sz, 72px);
  height: var(--dx-sz, 72px);
  font-size: calc(var(--dx-sz, 72px) * 0.45);
  color: var(--sub);
}
.dx-more-row {
  display: flex;
  justify-content: center;
}
.dx-more-row:empty {
  display: none;
}
.dx-sentinel {
  height: 1px;
}

/* ================================================================ Vocadex: zones */

.dx-zl {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-bottom: 0.8rem;
}
.dx-h3 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text);
}
.dx-h3-n {
  margin-left: auto;
}
.dx-zones {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 0.6rem;
}
.dx-zone {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.8rem 0.9rem;
}
.dx-zone.done {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--g-st4) 60%, transparent);
}
.dx-zone-top {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}
.dx-zone-ic {
  font-size: 1.6rem;
  line-height: 1;
}
.dx-zone-t {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.dx-zone-t b {
  font-weight: 400;
}
.dx-medal {
  font-size: 1.2rem;
}
.dx-zone-num {
  font-variant-numeric: tabular-nums;
}
.dx-zone-btns {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: auto;
}

/* ================================================================ Vocadex: entry dialog */

.dx-modal .dx-entry {
  max-width: 38rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  outline: none;
}
.dx-e-top {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.dx-e-top .g-spacer {
  flex: 1;
}
.dx-e-top .g-btn {
  min-width: 2.2rem;
  justify-content: center;
  font-size: 1rem;
}
.dx-e-num {
  font-size: 0.95rem;
  color: var(--sub);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.dx-e-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.dx-e-spr {
  flex: none;
  display: grid;
  place-items: center;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 56%, color-mix(in srgb, var(--dx-sc) 34%, transparent) 0 42%, transparent 70%);
}
.dx-e-id {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}
.dx-e-kind {
  font-size: 0.8rem;
  color: var(--g-gloss);
}
.dx-e-stage {
  color: var(--text);
}
.dx-e-wordrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.dx-e-word {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 400;
  line-height: 1.2;
  color: var(--text);
  overflow-wrap: anywhere;
  border-bottom: 3px solid transparent;
}
.dx-e-word.dx-g-m {
  border-bottom-color: var(--dx-m);
}
.dx-e-word.dx-g-f {
  border-bottom-color: var(--dx-f);
}
.dx-e-en {
  margin: 0;
  font-size: 1.05rem;
}
.dx-e-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.dx-e-tags .g-pill b {
  font-weight: 400;
}
.dx-gender {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.65rem;
  border-radius: 2rem;
  font-size: 0.8rem;
  color: var(--text);
  background: color-mix(in srgb, var(--dx-gc) 22%, var(--sub-alt));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--dx-gc) 65%, transparent);
}
.dx-gender b {
  font-weight: 500;
  color: var(--text);
}
.dx-gender.dx-g-m {
  --dx-gc: var(--dx-m);
}
.dx-gender.dx-g-f {
  --dx-gc: var(--dx-f);
}
.dx-core {
  color: var(--g-coin);
}
.dx-say,
.gr-say {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: var(--sub-alt);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.12s, transform 0.08s;
}
.dx-say:hover,
.gr-say:hover {
  background: var(--main);
}
.dx-say:active,
.gr-say:active {
  transform: scale(0.94);
}
.dx-e-where {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.dx-theme-chip {
  cursor: pointer;
}
.dx-theme-chip:hover {
  background: var(--text);
  color: var(--bg);
}
.dx-e-sec {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.dx-h4 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--g-gloss);
  text-transform: lowercase;
  letter-spacing: 0.04em;
}
.dx-ex {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.6rem 0.75rem;
  border-radius: 0.65rem;
  background: var(--sub-alt);
}
.dx-ex p {
  margin: 0;
}
.dx-ex-fr {
  font-size: 1.02rem;
}
.dx-ex-en {
  color: var(--g-gloss);
  font-size: 0.85rem;
  margin-top: 0.15rem !important;
}

/* evolution chain */
.dx-evo {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
}
.dx-evo-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.4rem 0.2rem 0.45rem;
  border-radius: 0.65rem;
  background: var(--sub-alt);
  text-align: center;
  min-width: 0;
}
.dx-evo-step + .dx-evo-step::before {
  content: "›";
  position: absolute;
  left: -0.42rem;
  top: 1.6rem;
  color: var(--sub);
  font-size: 1rem;
  line-height: 1;
}
.dx-evo-step.cur {
  background: color-mix(in srgb, var(--main) 14%, var(--sub-alt));
  box-shadow: inset 0 0 0 2px var(--main);
}
.dx-evo-step.future .dx-evo-spr .fx-sp,
.dx-evo-step.future .dx-evo-spr .dx-nospr {
  filter: brightness(0) invert(0.55);
  opacity: 0.45;
}
.dx-evo-spr {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
}
.dx-evo-name {
  font-size: 0.75rem;
  color: var(--text);
  white-space: nowrap;
}
.dx-evo-step.future .dx-evo-name {
  color: var(--g-gloss);
}
.dx-evo-req {
  font-size: 0.64rem;
  color: var(--g-gloss);
  line-height: 1.2;
}
/* on the tinted current step --g-gloss drops under 4.5:1 on the light themes */
.dx-evo-step.cur .dx-evo-req {
  color: var(--text);
}
.dx-evo-next {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
}
.dx-evo-next b {
  color: var(--main);
  font-weight: 400;
}
.dx-evo-bar {
  display: block;
  margin-top: 0.35rem;
}

/* memory */
.dx-mem {
  display: grid;
  grid-template-columns: minmax(8rem, 11rem) 1fr;
  gap: 0.6rem 1rem;
  align-items: start;
}
.dx-mem-r {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.65rem;
  background: var(--sub-alt);
}
.dx-mem-k {
  font-size: 0.75rem;
  color: var(--g-gloss);
}
.dx-mem-v {
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.dx-mem-r .g-bar {
  display: block;
}
.dx-stats {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.45rem 0.8rem;
}
.dx-stats div {
  min-width: 0;
}
.dx-stats dt {
  font-size: 0.72rem;
  color: var(--g-gloss);
}
.dx-stats dd {
  margin: 0.05rem 0 0;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
.dx-leech {
  margin: 0;
  padding: 0.5rem 0.7rem;
  border-radius: 0.6rem;
  font-size: 0.85rem;
  background: color-mix(in srgb, var(--error) 14%, var(--sub-alt));
}
/* sticky action bar. A sticky offset counts from inside the scroller's padding (.g-dialog: 1.5rem), so
   bottom: -1.5rem pins the bar to the dialog's real bottom edge — bottom: 0 left a strip under it where the
   content scrolled by. Solid background; the short fade above lets text slide under instead of being cut
   (at the end of the scroll it only covers the flex gap above the bar). */
.dx-e-actions {
  display: flex;
  gap: 0.5rem;
  position: sticky;
  bottom: -1.5rem;
  z-index: 1;
  margin: 0 -1.5rem -1.5rem;
  padding: 0.7rem 1.5rem 1rem;
  background: var(--bg);
}
/* both actions on one row, the English gloss under the French label: a low bar that hides little */
.dx-e-actions .g-btn {
  flex: 1 1 0;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 0.1rem;
  padding: 0.55rem 0.8rem;
  line-height: 1.25;
  text-align: center;
}
.dx-e-actions::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 0.9rem;
  background: linear-gradient(180deg, transparent, var(--bg));
  pointer-events: none;
}

/* ================================================================ grimoire */

.gr-page {
  --gr-lc: var(--sub);
}
.gr-head {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.gr-head-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.gr-big {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-variant-numeric: tabular-nums;
}
.gr-big b {
  font-size: 2.2rem;
  font-weight: 400;
  color: var(--main);
  line-height: 1;
}
.gr-big span {
  color: var(--g-gloss);
}
.gr-big-txt {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.gr-prog {
  display: flex;
  height: 0.6rem;
  border-radius: 1rem;
  background: var(--bg);
  overflow: hidden;
}
.gr-prog i {
  display: block;
  height: 100%;
  flex: none;
}
.gr-prog .k {
  background: var(--main);
}
.gr-prog .l {
  background: color-mix(in srgb, var(--main) 38%, transparent);
}
.gr-hint {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  padding: 0.55rem 0.75rem;
  border-radius: 0.65rem;
  background: var(--bg);
}
.gr-hint-next {
  box-shadow: inset 3px 0 0 var(--main);
}
.gr-hint-weak {
  box-shadow: inset 3px 0 0 var(--error);
}
.gr-hint-txt {
  flex: 1;
  min-width: 11rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.gr-hint-txt b {
  font-weight: 400;
}

.gr-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.gr-lvs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.gr-lvb {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 2rem;
  border: 2px solid transparent;
  background: var(--sub-alt);
  color: var(--text);
  font-size: 0.85rem;
  transition: border-color 0.12s;
}
.gr-lvb:hover {
  border-color: color-mix(in srgb, var(--sub) 50%, transparent);
}
.gr-lvb.on {
  border-color: var(--main);
  background: color-mix(in srgb, var(--main) 10%, var(--sub-alt));
}
.gr-lvn {
  color: var(--g-gloss);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.gr-body {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}
.gr-lv {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.gr-h3 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--text);
}
.gr-lv > .gr-h3 {
  margin: 0;
  font-size: 1.15rem;
  padding-bottom: 0.45rem;
  border-bottom: 2px solid var(--gr-lc);
}
.gr-h3-n {
  margin-left: auto;
}
.gr-h4 {
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--g-gloss);
}
.gr-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: 0.6rem;
}
.gr-card {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  width: 100%;
  min-width: 0;
  padding: 0.7rem 0.8rem;
  border-radius: 0.75rem;
  border: 2px solid transparent;
  background: var(--sub-alt);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  box-shadow: inset 4px 0 0 var(--gr-lc);
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.gr-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--sub) 45%, transparent);
}
.gr-card.advised {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--sub) 35%, transparent);
}
.gr-card.next {
  border-style: solid;
  border-color: var(--main);
}
.gr-card.weakest {
  border-style: solid;
  border-color: var(--error);
  box-shadow: inset 4px 0 0 var(--gr-lc), 0 0 0 3px color-mix(in srgb, var(--error) 22%, transparent);
}
.gr-card.new .gr-card-em {
  opacity: 0.85;
}
.gr-card-em {
  flex: none;
  display: grid;
  place-items: center;
}
.gr-card-txt {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.gr-card-t {
  font-size: 0.95rem;
  line-height: 1.3;
}
.gr-card-en {
  font-size: 0.78rem;
  color: var(--g-gloss);
  line-height: 1.35;
}
.gr-card-m {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.gr-stars {
  display: inline-flex;
  gap: 0.05rem;
  font-size: 0.85rem;
  line-height: 1;
  color: color-mix(in srgb, var(--sub) 40%, transparent);
}
.gr-stars i {
  font-style: normal;
}
.gr-stars i.on {
  color: var(--g-coin);
}
.gr-mlabel {
  font-size: 0.75rem;
  color: var(--g-gloss);
  font-weight: 400;
}
.gr-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.15rem;
}
.gr-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.7rem;
  line-height: 1.4;
  background: var(--bg);
  color: var(--g-gloss);
}
.gr-badge.due {
  color: var(--text);
  background: color-mix(in srgb, var(--g-hp-mid) 24%, var(--bg));
}
.gr-badge.weak {
  color: var(--text);
  background: color-mix(in srgb, var(--error) 22%, var(--bg));
}
.gr-badge.next {
  color: var(--text);
  background: color-mix(in srgb, var(--main) 24%, var(--bg));
}
.gr-noem {
  display: grid;
  place-items: center;
  width: var(--gr-sz, 56px);
  height: var(--gr-sz, 56px);
  font-size: calc(var(--gr-sz, 56px) * 0.5);
}

/* ================================================================ lesson (view "gp") */

.gr-ltop .g-btn[data-gr-open] {
  min-width: 2.2rem;
  justify-content: center;
  font-size: 1rem;
}
.gr-pos {
  font-variant-numeric: tabular-nums;
}
.gr-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  box-shadow: inset 4px 0 0 var(--gr-lc);
}
.gr-hero-em {
  display: grid;
  place-items: center;
}
.gr-hero-txt {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}
.gr-hero-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.gr-title {
  font-size: 1.5rem;
  line-height: 1.25;
}
.gr-sub-en {
  margin: 0;
  color: var(--g-gloss);
  font-size: 0.95rem;
}
.gr-mastery {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.gr-mastery .gr-stars {
  font-size: 1.1rem;
}
.gr-mastery .gr-mlabel {
  color: var(--text);
  font-size: 0.9rem;
}
.gr-callout {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.7rem;
  padding: 0.75rem 0.95rem;
  border-radius: var(--g-radius);
  background: color-mix(in srgb, var(--main) 10%, var(--sub-alt));
  color: var(--text);
}
.gr-callout > div {
  flex: 1;
  min-width: 12rem;
}
.gr-callout b {
  font-weight: 500;
}
.gr-callout.gr-due {
  background: color-mix(in srgb, var(--g-hp-mid) 15%, var(--sub-alt));
}
.gr-callout-ic {
  font-size: 1.3rem;
  line-height: 1;
}
.gr-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.45rem;
}
.gr-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  min-width: 0;
  text-align: left;
  padding: 0.2rem 0.75rem 0.2rem 0.25rem;
  border-radius: 1.2rem;
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.12s;
}
.gr-chip:hover {
  border-color: var(--main);
}
.gr-chip-t {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.25;
  padding: 0.15rem 0;
}
.gr-chip .gr-stars {
  font-size: 0.62rem;
  flex: none;
}
.gr-links .gr-chips {
  margin-top: 0;
}
.gr-sec {
  padding: 1rem 1.2rem 1.1rem;
}

/* the explanation is trusted content HTML: p, b, i, ul/li, table, small */
.gr-explain {
  line-height: 1.7;
  font-size: 0.97rem;
}
.gr-explain > :first-child {
  margin-top: 0;
}
.gr-explain > :last-child {
  margin-bottom: 0;
}
.gr-explain p {
  margin: 0.55rem 0;
}
.gr-explain ul,
.gr-explain ol {
  margin: 0.4rem 0;
  padding-left: 1.3rem;
}
.gr-explain li {
  margin: 0.2rem 0;
}
.gr-explain b,
.gr-explain strong {
  color: var(--main);
  font-weight: 500;
}
.gr-explain small {
  color: var(--g-gloss);
}
.gr-explain table,
.gr-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.93rem;
  line-height: 1.45;
}
/* wide tables scroll sideways instead of widening the page (width 0 + min-width 100%: no intrinsic push) */
.gr-explain table {
  display: block;
  overflow-x: auto;
  margin: 0.6rem 0;
  width: 0;
  min-width: 100%;
}
.gr-explain th,
.gr-explain td,
.gr-table th,
.gr-table td {
  padding: 0.4rem 0.7rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid color-mix(in srgb, var(--sub) 25%, transparent);
}
.gr-explain th,
.gr-table th {
  font-weight: 500;
  color: var(--main);
}
.gr-table tr:nth-child(odd) {
  background: color-mix(in srgb, var(--bg) 50%, transparent);
}
.gr-table td,
.gr-table th {
  font-family: "Lexend Deca", sans-serif;
}
.gr-table-wrap {
  overflow-x: auto;
  border-radius: 0.5rem;
  width: 0;
  min-width: 100%;
}
/* the form table hugs its content, so « je » and « suis » read across instead of sitting a card-width apart */
.gr-table {
  width: auto;
  min-width: min(100%, 16rem);
}
/* 🔊 column: one button per row that has French to say (no % width: it would stretch the auto-width table) */
.gr-table .gr-tsay {
  padding: 0.25rem 0 0.25rem 0.35rem;
}
.gr-tsay .gr-say {
  width: 1.9rem;
  height: 1.9rem;
  font-size: 0.85rem;
  background: var(--bg);
}
.gr-tsay .gr-say:hover {
  background: var(--main);
}

.gr-exs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.gr-exs li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}
.gr-exs .gr-say {
  background: var(--bg);
}
.gr-exs .gr-say:hover {
  background: var(--main);
}
.gr-ex-fr {
  margin: 0;
  font-size: 1.03rem;
}
.gr-ex-en {
  margin: 0.1rem 0 0;
  color: var(--g-gloss);
  font-size: 0.85rem;
}
.gr-sayall {
  margin-top: 0.7rem;
}

.gr-errs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.gr-err {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.55rem;
  padding: 0.55rem 0.8rem;
  border-radius: 0.6rem;
  background: var(--bg);
  line-height: 1.5;
}
.gr-bad {
  color: var(--error);
}
.gr-bad s {
  text-decoration-thickness: 2px;
}
.gr-good {
  color: color-mix(in srgb, var(--g-ok) 70%, var(--text));
}
.gr-mk {
  font-weight: 700;
}
.gr-mk.bad {
  color: var(--error);
}
.gr-mk.good {
  color: color-mix(in srgb, var(--g-ok) 70%, var(--text));
}
.gr-arrow {
  color: var(--sub);
}
.gr-note {
  flex-basis: 100%;
  color: var(--g-gloss);
  font-size: 0.83rem;
}
.gr-err-plain {
  display: block;
  font-size: 0.93rem;
}

.gr-tip {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: color-mix(in srgb, var(--g-coin) 13%, var(--sub-alt));
}
.gr-tip b {
  font-weight: 500;
}
.gr-tip p {
  margin: 0.3rem 0 0;
  line-height: 1.6;
}
.gr-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 0.9rem;
}
.gr-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7rem;
  margin-top: 0.4rem;
}
.gr-nextb {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  max-width: 100%;
}
.gr-nextb small {
  font-size: 0.75rem;
  opacity: 0.8;
  max-width: 18rem;
  text-align: left;
  overflow-wrap: anywhere;
}

/* ================================================================ small screens */

@media (max-width: 760px) {
  .dx-lvs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dx-lvt-all {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
  }
}
@media (max-width: 640px) {
  .gr-hero {
    grid-template-columns: auto 1fr;
  }
  .gr-hero-act {
    grid-column: 1 / -1;
  }
  .gr-hero-act .g-btn {
    width: 100%;
    justify-content: center;
  }
  .gr-hero-em .fx-sp {
    width: 72px;
    height: 72px;
  }
  .gr-title {
    font-size: 1.25rem;
  }
  .dx-mem {
    grid-template-columns: 1fr;
  }
  /* .g-dialog padding is 1rem here */
  .dx-e-actions {
    bottom: -1rem;
    margin: 0 -1rem -1rem;
    padding: 0.6rem 1rem 0.85rem;
  }
  .dx-e-actions .g-btn {
    padding: 0.5rem 0.5rem;
    font-size: 0.88rem;
    line-height: 1.2;
  }
}
@media (max-width: 480px) {
  .dx-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
  }
  .dx-card {
    padding: 0.35rem 0.25rem 0.5rem;
  }
  .dx-spr,
  .dx-spr .fx-sp {
    width: 64px;
    height: 64px;
  }
  .dx-e-hero {
    flex-direction: column;
    text-align: center;
    gap: 0.4rem;
  }
  .dx-e-id {
    align-items: center;
  }
  .dx-e-wordrow,
  .dx-e-tags {
    justify-content: center;
  }
  .dx-e-spr {
    width: 140px;
    height: 140px;
  }
  .dx-e-spr .fx-sp {
    width: 128px;
    height: 128px;
  }
  .dx-e-word {
    font-size: 1.45rem;
  }
  .dx-evo-spr,
  .dx-evo-spr .fx-sp {
    width: 44px;
    height: 44px;
  }
  .dx-evo-req {
    display: none;
  }
  .dx-evo-name {
    white-space: normal;
    font-size: 0.68rem;
    line-height: 1.2;
  }
  .dx-evo-name .dx-dot {
    display: none;
  }
  .dx-evo-step + .dx-evo-step::before {
    top: 1.2rem;
  }
  .dx-select[data-dx-sel="theme"],
  .dx-select[data-dx-sel="stage"] {
    width: 8rem;
    flex: 1 1 100%;
  }
  .gr-card {
    padding: 0.6rem 0.65rem;
  }
  .gr-card-em .fx-sp {
    width: 48px;
    height: 48px;
  }
}

/* ================================================================ motion */

.dx-still *,
.gr-still *,
.dx-modal.dx-still * {
  transition: none !important;
  animation: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .dx-card,
  .dx-lvt,
  .dx-stack > i,
  .gr-card,
  .gr-chip {
    transition: none;
  }
  .dx-card:hover,
  .gr-card:hover {
    transform: none;
  }
}
