:root {
  --bg: #f7f3ea;
  --card: #fffdf8;
  --ink: #201c16;
  --dim: #7a7264;
  --line: #e4dccb;
  --accent: #2f5d50;
  --accent-ink: #ffffff;
  --mark: #ffe28a;
  --mark-ink: #201c16;
  --bold: #1d4d8f;
  --danger: #a33a2a;
  --ok: #1f7a46;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14120f;
    --card: #1d1a15;
    --ink: #ece6d8;
    --dim: #9a9283;
    --line: #2e2a22;
    --accent: #6fb59f;
    --accent-ink: #0d1a16;
    --mark: #6b5514;
    --mark-ink: #fff4cc;
    --bold: #8db7ff;
    --danger: #e08a78;
    --ok: #6fcf97;
  }
}

:root[data-theme="dark"] {
  --bg: #14120f;
  --card: #1d1a15;
  --ink: #ece6d8;
  --dim: #9a9283;
  --line: #2e2a22;
  --accent: #6fb59f;
  --accent-ink: #0d1a16;
  --mark: #6b5514;
  --mark-ink: #fff4cc;
  --bold: #8db7ff;
  --danger: #e08a78;
  --ok: #6fcf97;
  color-scheme: dark;
}

:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 720px;
  margin: 0 auto;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap; /* the update bar takes its own row under the title */
}

/* "New version available": a row in the sticky header, so it never covers the tab bar or the Cards action bar */
.update-bar {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding: 6px 6px 6px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 0.92rem;
}
.update-bar[hidden] { display: none; }
/* "Get reminders?" (public/notify.js) looks like the update bar, with a quiet Not now next to Set up */
.notify-bar .bar-actions { display: flex; gap: 6px; }
.update-bar button.bar-ghost { background: none; color: var(--dim); font-weight: 600; padding: 6px 10px; }
.update-bar button {
  border: 0;
  border-radius: 999px;
  padding: 6px 16px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
}

.top h1 { margin: 0; font-size: 1.25rem; letter-spacing: 0.02em; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 30px; height: 30px; border-radius: 8px; display: block; }

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

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

button { cursor: pointer; -webkit-tap-highlight-color: transparent; }

.pill {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 600;
}

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.06);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  /* own graphics layer: stops iOS Safari letting the fixed bar drift up */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}
/* keyboard up: hide the bar, so iOS cannot leave it stuck mid-screen when the keyboard closes */
@media (max-width: 899px) { body.typing .tabs { display: none; } }

.tabs button {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: 0;
  background: none;
  padding: 2px 0;
  color: var(--dim);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.tab-ico {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 30px;
  border-radius: 15px;
  transition: background 0.15s, color 0.15s;
}

.tabs button[aria-current="page"] { color: var(--accent); }
.tabs button[aria-current="page"] .tab-ico { background: var(--line); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.tabs button:active .tab-ico { background: var(--line); }

.badge {
  position: absolute;
  top: -2px;
  right: 2px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}
.badge[hidden] { display: none; }
.top-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 50%;
  color: var(--dim);
}
.icon-btn[aria-pressed="true"] { color: var(--accent); }

.setting { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.setting .row { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.setting input[type="range"] { flex: 1; accent-color: var(--accent); }
.setting .step { font-weight: 700; color: var(--dim); }
.setting .preview { font-family: ui-serif, "Iowan Old Style", Georgia, "Times New Roman", serif; line-height: 1.8; margin: 8px 0 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(94px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 14px;
  align-items: center;
  max-width: calc(100% - 32px);
  background: var(--ink);
  color: var(--bg);
  border-radius: 12px;
  padding: 10px 16px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.toast[hidden] { display: none; }

.toast button {
  border: 0;
  background: none;
  color: var(--mark);
  font-weight: 700;
  padding: 0;
}

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }

.text-select {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 9px 10px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 8px 14px;
  white-space: nowrap;
  font-weight: 600;
}

.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.hint { color: var(--dim); margin: 0 0 12px; }
.dim { color: var(--dim); }

.topic { font-size: 1.05rem; color: var(--dim); font-weight: 600; margin: 4px 0 10px; }

.text {
  font-family: ui-serif, "Iowan Old Style", Georgia, "Times New Roman", serif;
  font-size: var(--text-size, 1.2rem);
  line-height: 1.8;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

.text p { margin: 0 0 1.1em; }

.w {
  border-radius: 4px;
  padding: 2px 1px;
  -webkit-tap-highlight-color: transparent;
}

.w.bold { font-weight: 700; color: var(--bold); }
.w.saved { background: var(--mark); color: var(--mark-ink); }
.w.known {
  text-decoration: underline dotted;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
  text-decoration-color: var(--accent);
}

/* iOS only sends taps on empty areas to document-level click listeners when the page looks clickable */
@media (hover: none) { body { cursor: pointer; } }

.pop {
  position: absolute;
  z-index: 9;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.28);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.4;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.pop-word { font-size: 1.15rem; color: var(--bold); }
.cands { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; }
.cands strong { color: var(--bold); }
.pop-tag { margin-top: 8px; font-size: 0.78rem; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; }
.w.pstart { outline: 2px solid var(--accent); }

.words h2 { font-size: 1rem; margin: 0 0 10px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; }
.glossary ul, .words ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.glossary li { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.glossary strong { color: var(--bold); font-size: 1.05rem; }
.colloc { color: var(--dim); font-size: 0.92rem; margin-top: 2px; }

.primary {
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  padding: 14px 16px;
}

.primary:disabled { opacity: 0.5; }

.secondary {
  width: 100%;
  margin-top: 10px;
  border: 2px solid var(--accent);
  border-radius: 12px;
  background: none;
  color: var(--accent);
  font-weight: 700;
  padding: 12px 16px;
}

.secondary:disabled { opacity: 0.5; }

.ghost {
  border: 1px solid var(--line);
  background: none;
  border-radius: 8px;
  padding: 6px 12px;
}

.ghost.danger { color: var(--danger); }

.empty { text-align: center; padding: 48px 8px; }
/* the Google sign-in button is a link styled as .primary */
a.primary { display: block; box-sizing: border-box; text-align: center; text-decoration: none; }
.signin .primary { margin-top: 16px; }

.summary { font-size: 1.1rem; margin-bottom: 12px; }
.summary strong { font-size: 1.6rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.card.removable { position: relative; }
.card.removable > .card-top { padding-right: 50px; } /* long words wrap before the trash icon */
.card.removable > .remove-btn { position: absolute; top: 2px; right: 2px; width: 42px; height: 42px; border-color: transparent; background: transparent; color: #a33a2a; } /* same red in light and dark */
/* wrong-meaning flag: same size and style as the trash icon, just left of it, grey (red stays for delete) */
.card.removable > .flag-btn { position: absolute; top: 2px; right: 44px; width: 42px; height: 42px; border-color: transparent; background: transparent; color: var(--dim); }
.card.removable.flaggable > .card-top { padding-right: 92px; } /* long words wrap before both icons */
.card.removable > .card-top .lemma { min-width: 0; overflow-wrap: anywhere; } /* a very long word breaks instead of pushing the card wider than the screen */
.card-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.lemma { font-weight: 700; font-size: 1.1rem; }
.pos, .partner { color: var(--dim); font-size: 0.85rem; }
.partner { font-weight: 600; color: var(--bold); }
.meaning { margin-top: 2px; }
.forms { color: var(--dim); font-size: 0.9rem; }
.sentence { color: var(--dim); font-style: italic; font-size: 0.9rem; margin-top: 6px; }
.sentence strong { color: var(--ink); font-style: normal; font-weight: 700; }
.card-actions { display: flex; gap: 8px; margin-top: 10px; }
/* Library progress dots: at the right end of the word line, left of the trash icon (the line is taller than the dots, so
   the card keeps its height; the button row has no room on a 360 px phone); filled = accent, empty = a ring, both from
   theme colours so light and dark work */
.dots { margin-left: auto; align-self: center; display: inline-flex; gap: 4px; flex-shrink: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--dim); box-sizing: border-box; }
.dot.on { background: var(--accent); border-color: var(--accent); }

.words .top-panel { margin-bottom: 14px; }
.top-panel .summary { margin-bottom: 12px; }
.top-panel .primary { width: 100%; }
/* Words: "Get words from extension" (extension inbox) sits at the very top of the panel */
.top-panel .ext-pull { margin: 0 0 12px; padding: 9px 16px; font-size: 0.9rem; }
.words details { margin-top: 14px; }
.words summary { color: var(--dim); cursor: pointer; margin-bottom: 10px; }

.form label.field { display: block; font-weight: 600; margin: 16px 0 6px; }
.form input[type="text"], .form textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 1rem;
}

.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 14px; }
.pick.on { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.pick input { position: absolute; opacity: 0; pointer-events: none; }

.count-line { color: var(--dim); margin: 10px 0 14px; }
.error { color: var(--danger); margin: 10px 0; font-weight: 600; }

.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 8px;
  vertical-align: -0.15em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.bank input[type="search"] {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: inherit;
  padding-right: 48px;
}
.bank input[type="search"]::-webkit-search-cancel-button { display: none; } /* our own clear button below */
.search-wrap { position: relative; margin-bottom: 12px; }
.search-clear { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; background: transparent; color: var(--dim); }
.search-clear[hidden] { display: none; }
.bank .picks { margin-bottom: 10px; }

.speak { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }

.flash { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 30px 16px 14px; text-align: center; margin: 0 0 10px; min-height: 0; display: flex; flex-direction: column; } /* height is set by fitCard() in app.js */
.flash-count { position: absolute; top: 15px; left: 14px; font-size: 1rem; font-weight: 600; color: var(--dim); }
.flash-dir { position: absolute; top: 15px; left: 50%; transform: translateX(-50%); font-size: 1rem; font-weight: 600; color: var(--dim); white-space: nowrap; } /* which direction this session practises */
.flash-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; }
.flash-word { font-size: 1.7rem; font-weight: 700; }
.cards .card-actions { justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.cards > button.primary { width: 100%; }

/* settings drawer (slides in from the right) */
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.4); }
.scrim[hidden] { display: none; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 21;
  width: min(380px, 92vw);
  background: var(--bg);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 28px rgba(0, 0, 0, 0.2);
  transform: translateX(105%);
  visibility: hidden;
  transition: transform 0.22s ease, visibility 0s linear 0.22s;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
.drawer.open { transform: none; visibility: visible; transition: transform 0.22s ease; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 1.15rem; }
.drawer-body { overflow-y: auto; padding: 16px; flex: 1; -webkit-overflow-scrolling: touch; }
.drawer-head { gap: 8px; }
.drawer-head h2 { margin-right: auto; }
.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
}
.theme-btn .ico[hidden] { display: none; }
.drawer-head .icon-btn { width: 32px; height: 32px; }

/* drawer content: compact sections divided by thin lines, smaller type */
.drawer-body { font-size: 0.92rem; padding: 4px 16px 16px; }
.drawer .setting { background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 14px 0; margin: 0; }
.drawer .setting:last-child { border-bottom: 0; }
.set-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.drawer .setting h3 { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); margin: 0; }
.info-btn {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 50%;
  color: var(--dim);
  font: italic 700 0.72rem ui-serif, Georgia, serif;
  line-height: 1;
}
.seg { display: flex; gap: 2px; padding: 3px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.seg .chip { flex: 1; min-width: 0; border: 0; background: none; border-radius: 9px; padding: 7px 2px; font-size: 0.82rem; color: var(--dim); white-space: nowrap; }
.seg .chip.on { background: var(--accent); color: var(--accent-ink); }
.prof-row { display: flex; align-items: center; gap: 10px; }
.prof-row .pname { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prof-row .ghost, .drawer .export .ghost { font-size: 0.82rem; padding: 5px 12px; border-radius: 999px; }
.avatar.small { width: 28px; height: 28px; font-size: 0.85rem; }
.drawer .export summary { color: var(--dim); font-size: 0.85rem; cursor: pointer; }
.drawer .export ul { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.drawer .export .card.ex-row { display: flex; align-items: center; gap: 10px; margin: 0; padding: 9px 12px; background: var(--card); }
.ex-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.ex-text .lemma { font-size: 0.9rem; }
.ex-hint { color: var(--dim); font-size: 0.78rem; }
/* Settings > Your data > Extension: the code (dots until Show) and Show / Copy / New code */
.ext-box { display: grid; gap: 8px; }
.ext-code { display: block; padding: 8px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.85rem; word-break: break-all; user-select: all; -webkit-user-select: all; }
.ext-code.masked { color: var(--dim); letter-spacing: 2px; user-select: none; -webkit-user-select: none; }
.ext-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ext-actions .ghost { font-size: 0.82rem; padding: 5px 12px; border-radius: 999px; }
/* Settings > Texts > My topics */
.mt-box { display: grid; gap: 8px; }
.mt-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mt-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.mt-text { flex: 1; min-width: 0; display: grid; overflow-wrap: anywhere; }
.mt-text .dim { font-size: 0.82rem; }
.mt-x { flex: none; width: 32px; height: 32px; }
.mt-none { margin: 0; }
.mt-add { display: grid; gap: 8px; }
.mt-in { width: 100%; min-width: 0; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; }
.mt-add .ghost { justify-self: start; }
/* Settings > Notifications (public/notify.js): this device, one switch per type, reminder time */
.ntf-line { margin: 0 0 8px; font-size: 0.9rem; line-height: 1.45; }
.ntf-steps { margin: 0 0 8px; padding-left: 20px; font-size: 0.9rem; line-height: 1.5; }
.ntf-test { font-size: 0.82rem; padding: 5px 12px; border-radius: 999px; }
/* a row with its name on the left and an on/off switch on the right */
.ntf-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; cursor: pointer; }
.ntf-name { flex: 1; min-width: 0; display: grid; gap: 2px; font-weight: 600; overflow-wrap: anywhere; }
.ntf-name small { font-weight: 400; font-size: 0.8rem; line-height: 1.35; }
.ntf-quiet { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; } /* Save lines up with the time boxes */
.ntf-quiet .ntf-time { margin-bottom: 0; }
.seg.ntf-onoff { max-width: 220px; margin: 2px 0 12px; } /* Admin > quiet hours per person: On / Off */
/* a reminder's schedule under its switch: weekday chips, time chips with x, add a time, quick fills */
.ntf-type + .ntf-type { border-top: 1px dashed var(--line); }
.ntf-sched { margin: 0 0 12px; padding: 10px 12px; display: grid; gap: 6px; background: var(--bg); border-radius: 12px; }
.ntf-label { margin: 4px 0 0; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--dim); }
.seg.ntf-days .chip { padding: 6px 0; font-size: 0.78rem; }
.ntf-times { display: flex; flex-wrap: wrap; gap: 6px; }
.ntf-timechip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; font-size: 0.85rem; }
.ntf-x { color: var(--dim); font-size: 1rem; line-height: 1; }
.ntf-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ntf-add .ntf-time { margin-bottom: 0; }
.ntf-add .ghost, .ntf-sched .ext-actions .ghost { font-size: 0.82rem; padding: 5px 12px; border-radius: 999px; }
/* Admin > Notifications > Reminder check: one line per reminder type and why */
.check-why { font-size: 0.85rem; }
.check-out .alist-row strong { margin-top: 4px; font-size: 0.9rem; }
/* Admin > Notifications > Who gets what and Recent notifications */
.ov-type { display: grid; gap: 1px; margin-top: 8px; font-size: 0.88rem; }
.ov-type .dim { font-size: 0.82rem; }
.hist-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.hist-filters select { flex: 1 1 140px; min-width: 0; }
.alist.hist .alist-row { font-size: 0.88rem; }
.ntf-quiet label { display: grid; gap: 4px; font-size: 0.82rem; color: var(--dim); }
.ntf-time { font: inherit; font-size: 1rem; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); margin-bottom: 8px; }

/* small explanation popup opened by the (i) buttons */
.hint-wrap { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 24px; background: rgba(0, 0, 0, 0.35); }
.hint-card { width: min(320px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; box-shadow: 0 12px 36px rgba(0, 0, 0, 0.3); font-size: 0.9rem; }
.hint-card h4 { margin: 0 0 8px; font-size: 1rem; }
.hint-card p { margin: 0 0 8px; color: var(--ink); }
.hint-card .ghost { display: block; margin: 12px 0 0 auto; border-radius: 999px; padding: 6px 16px; }

.meta-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 14px; }
.tag { display: inline-block; font-size: 0.8rem; font-weight: 600; color: var(--dim); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.tag:empty { display: none; }
.size-controls { display: flex; gap: 6px; margin-left: auto; }
.size-btn { width: 40px; height: 36px; border: 1px solid var(--line); background: var(--card); border-radius: 10px; font-family: ui-serif, Georgia, serif; font-weight: 700; color: var(--ink); line-height: 1; }
.size-btn.small { font-size: 0.9rem; }
.size-btn.big { font-size: 1.35rem; }
.size-btn:disabled { opacity: 0.35; }
.speaker { width: 44px; height: 44px; margin: 0; color: var(--accent); }

/* profiles */
.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--pc, var(--accent));
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
}
.avatar[hidden] { display: none; }
.avatar.big { width: 96px; height: 96px; font-size: 2.4rem; }
.picker {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: var(--bg);
  display: grid;
  place-items: center;
  padding: 24px 16px;
  overflow-y: auto;
}
.picker[hidden] { display: none; }
.picker-inner { width: min(420px, 100%); text-align: center; }
.picker-inner h2 { font-size: 1.5rem; margin: 0 0 28px; }
.picker-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px; }
.profile-card { display: grid; justify-items: center; gap: 10px; border: 0; background: none; padding: 6px; min-width: 120px; }
.profile-card .pname { font-weight: 700; font-size: 1.1rem; }
.profile-card.current .avatar { box-shadow: 0 0 0 4px var(--bg), 0 0 0 7px var(--pc); }
.picker-actions { display: flex; justify-content: center; gap: 10px; margin-top: 32px; }
/* first visit of a signed-in user: name and colour */
.welcome input[type="text"] { max-width: 320px; margin: 12px auto 0; display: block; }
.color-dots { display: flex; justify-content: center; gap: 12px; margin: 18px 0 22px; }
.color-dot { cursor: pointer; }
.color-dot.on { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--pc); }
/* languages: chip rows on the welcome and language screens, and in Settings > Languages */
.lang-pick { max-width: 320px; margin: 0 auto 14px; text-align: left; }
.lang-label { font-size: 0.85rem; margin: 0 0 6px; }
.lang-note { max-width: 320px; margin: 4px auto 18px; font-size: 0.85rem; }
.lang-line { margin: 0 0 6px; }
.setting .lang-label { margin-top: 10px; }

/* New text: topic list folds to about three lines */
.field .chosen { color: var(--accent); font-weight: 700; }
.topics { position: relative; overflow: hidden; max-height: 9.6rem; transition: max-height 0.3s ease; }
.topics::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3.2rem; pointer-events: none; background: linear-gradient(to bottom, transparent, var(--bg) 85%); transition: opacity 0.25s; }
.topics.open::after { opacity: 0; }
.topics .picks { gap: 6px; }
.topics-bar { position: relative; z-index: 1; display: flex; justify-content: center; margin-top: -1.5rem; transition: margin-top 0.3s ease; }
.topics-toggle { width: 46px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--card); border-radius: 15px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12); }
.chev { width: 9px; height: 9px; border-right: 2px solid var(--dim); border-bottom: 2px solid var(--dim); transform: translateY(-2px) rotate(45deg); transition: transform 0.25s; }
.topics-toggle.open .chev { transform: translateY(2px) rotate(-135deg); }
.topics.open + .topics-bar { margin-top: 10px; }

.topic-group + .topic-group { margin-top: 10px; }
.group-name { margin: 0 0 5px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); }

/* New text: every step is a panel with a numbered title */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 14px 16px; margin: 0 0 14px; --fade: var(--card); }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.step { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 0.8rem; font-weight: 700; }
.panel-title { margin: 0; font-size: 1.05rem; font-weight: 700; }
.panel-title .chosen { margin-left: 4px; color: var(--accent); }
.form .sub { display: block; margin: 14px 0 6px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); }
.form .topics-bar + .sub { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.panel .chip, .panel .pick, .panel input[type="text"], .panel textarea { background: var(--bg); }
.panel .chip.on, .panel .pick.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.panel .dim, .panel .count-line { margin: 10px 0 0; font-size: 0.9rem; }
.topics::after { background: linear-gradient(to bottom, transparent, var(--fade, var(--bg)) 85%); }

.panel .chip, .panel .pick { padding: 6px 12px; font-size: 0.9rem; line-height: 1.3; } /* topic, word and review buttons share one size */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-btn { color: var(--ink); }

/* panels on every tab */
.reading { padding: 8px 16px 6px; }
.panel .card { background: var(--bg); }
.panel > .card-actions { margin-top: 12px; }
.panel details > summary { color: var(--dim); font-weight: 600; }
.panel details ul { margin-top: 10px; }
.panel .bank input, .bank .panel input { background: var(--bg); }
.panel > p:last-child { margin-bottom: 0; }
.panel .primary { margin-top: 4px; }
.words details.panel > summary { margin-bottom: 0; }
.words details.panel[open] > summary { margin-bottom: 10px; }
/* flashcard answers: one even row of three buttons */
.cards .card-actions { display: grid; grid-template-columns: 1fr 1.25fr 1fr; gap: 8px; }
.cards .card-actions button { width: 100%; margin: 0; padding: 12px 6px; font-size: 0.92rem; border-radius: 12px; }

/* flashcards: sentence hint and test answers */
.zone { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; } /* every zone keeps its place; auto margins centre short content but keep long content reachable when it scrolls */
.zone > * { margin: auto 0; }
.zone-word { flex: 1 1 0; }
.zone-sentence { flex: 1.2 1 0; }
.zone-answer { flex: 0.9 1 0; border-top: 1px solid transparent; }
.zone-answer.on { border-top-color: var(--line); }
/* auto margins centre short content but keep the top of a long sentence reachable when it scrolls */
.flash-sentence { text-align: left; margin: auto 0; }
.bar-strip { height: 48px; display: grid; place-items: center; }
.bar-strip .hint-btn { background: var(--card); width: auto; height: 44px; padding: 0 32px; font-size: 0.95rem; }
.choices { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 6px; margin: 0; }
.choice { width: 100%; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); text-align: center; display: flex; align-items: center; justify-content: center; background: var(--card); color: var(--ink, inherit); font: inherit; font-size: 0.92rem; line-height: 1.3; overflow-wrap: anywhere; }
.choice:disabled { opacity: 1; }
.choice.right { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.choice.wrong { border-color: var(--danger); background: var(--danger); color: #fff; }
.cards .card-actions.solo { grid-template-columns: 1fr; }

.result { margin: 0; font-weight: 600; text-align: center; }
.result .ok { color: var(--ok); }
.result .bad { color: var(--danger); }
.choice.right { border-color: var(--ok); background: var(--ok); color: #fff; }
:root[data-theme="dark"] .choice.right, :root[data-theme="dark"] .choice.wrong { color: #0d1a16; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .choice.right, :root:not([data-theme="light"]) .choice.wrong { color: #0d1a16; } }

/* on/off switch (Settings > Notifications): a real checkbox drawn as a pill; the knob slides to the right when on */
.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 46px;
  height: 28px;
  margin: 0;
  border-radius: 999px;
  background: var(--line);
  cursor: pointer;
  transition: background 0.2s ease;
}
.switch::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
}
.switch:checked { background: var(--accent); }
.switch:checked::before { transform: translateX(18px); }
.switch:disabled { opacity: 0.5; cursor: default; }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.set-head .switch { margin-left: auto; } /* Quiet hours: the switch at the right end of the title row */

/* settings groups: cards that fold open and shut (toggleSet in app.js), one open at a time */
.set-group { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 0 16px; margin: 12px 0; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 14px rgba(0, 0, 0, 0.04); }
.set-group-head { display: grid; grid-template-columns: 1fr auto 28px; align-items: center; }
.set-group-head h2 { grid-area: 1 / 1 / 2 / 4; min-width: 0; font-size: 1rem; margin: 0; } /* the fold button spans the whole row */
.set-group-head > :not(h2) { grid-area: 1 / 2; position: relative; z-index: 1; } /* Admin sits on top of it, left of the arrow */
.set-toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 54px; padding: 0; border: 0; background: none; font-weight: 700; text-align: left; }
.set-chev { display: inline-flex; color: var(--dim); transition: transform 0.25s ease; }
.set-group.open .set-chev { transform: rotate(180deg); }
.set-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.25s ease; }
.set-group.open .set-body { grid-template-rows: 1fr; }
.set-inner { min-height: 0; overflow: hidden; }
.set-group.open .set-inner { border-top: 1px solid var(--line); }
@media (prefers-reduced-motion: reduce) { .set-body, .set-chev, .switch, .switch::before { transition: none; } }
.set-for { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); }
.drawer .set-group .setting:last-child { border-bottom: 0; }
.admin-link { display: inline-flex; align-items: center; gap: 5px; width: auto; margin: 0; padding: 4px 12px; border-width: 1.5px; border-radius: 999px; font-size: 0.82rem; }
.admin-link svg { width: 14px; height: 14px; }
/* Drill 🎯 on Read and Words: one main-style button, half a row wide (10px gap), never shrinks; on Read it sits at the
   right end of the title row (the title wraps instead), on Words it sits next to Create text in .words-actions.
   Selectors start with .panel so they beat .panel .primary (margin-top) and .top-panel .primary (width 100%). */
.panel .drill-btn, .panel .words-actions > .primary { flex: none; width: calc(50% - 5px); margin: 0; padding-left: 8px; padding-right: 8px; white-space: nowrap; }
.panel .drill-btn { margin-left: auto; }
.words-actions { display: flex; gap: 10px; }
.drill-src { margin: 8px 0 0; font-size: 0.9rem; } /* source and progress under Resume drill */
.admin-ico { display: inline-flex; }

/* admin screen */
.admin-screen { position: fixed; inset: 0; z-index: 60; background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: env(safe-area-inset-bottom); }
.admin-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--card); border-bottom: 1px solid var(--line); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04); }
.admin-head h2 { margin: 0; font-size: 1.2rem; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.admin-crumb { font-size: 0.9rem; font-weight: 600; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-head-btns { display: flex; align-items: center; gap: 8px; }
.admin-head .x { font-size: 1.5rem; line-height: 1; }
.admin-body { max-width: 640px; margin: 0 auto; padding: 14px 16px 40px; }
.admin-screen.with-nav .admin-body { padding-bottom: calc(96px + env(safe-area-inset-bottom)); } /* room for the bar, so it never hides the last button */
.admin-body > .panel { margin-bottom: 0; } /* spacing comes from .admin-body > * + * */
.admin-body .panel-head { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.admin-body > * + * { margin-top: 12px; }
.admin-body .pin { font-size: 1.3rem; letter-spacing: 0.3em; text-align: center; }
.admin-body input[type="text"], .admin-body input[type="search"], .admin-body input[type="password"], .admin-body textarea { width: 100%; margin: 0 0 8px; }
.astats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.astat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 6px 10px; text-align: center; min-width: 0; }
.astat-n { font-size: 1.35rem; font-weight: 700; color: var(--accent); overflow-wrap: anywhere; }
.astat-l { font-size: 0.7rem; color: var(--dim); }
.atable { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.atable th, .atable td { text-align: right; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.atable th:first-child, .atable td:first-child { text-align: left; }
.atable th { color: var(--dim); font-weight: 600; font-size: 0.75rem; }
.atable-wrap { overflow-x: auto; } /* many users: the table scrolls inside its card, the page never scrolls sideways */
.atable td.abar { background: linear-gradient(to left, color-mix(in srgb, var(--accent) 22%, transparent) var(--w), transparent var(--w)); } /* bar behind the count, from the right like the numbers */
.alist { list-style: none; margin: 0 0 10px; padding: 0; }
.alist-row { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 10px 12px; margin-bottom: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; font: inherit; color: var(--ink); text-align: left; }
.alist-name { font-weight: 700; }
/* Admin > Inbox (feedback): keep the line breaks people typed, never wider than the screen */
.fb-list { margin-top: 12px; }
.fb-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.fb-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.fb-bin-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.fb-bin-head p { margin: 0; }
.items { list-style: none; margin: 8px 0 0; padding: 0; }
.items .card.item input { width: 100%; margin-bottom: 6px; }
.admin-body .sub { font-size: 0.78rem; font-weight: 700; color: var(--dim); margin: 10px 0 6px; }
.solo-row { display: flex; gap: 8px; }
.seg.period { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.seg.period .chip { white-space: normal; padding: 8px 4px; line-height: 1.2; }
/* Admin sections: a bar at the bottom on a phone (like the app's tabs), a menu on the left on a wide screen */
.admin-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; display: flex; background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.06); padding: 6px 2px calc(6px + env(safe-area-inset-bottom)); -webkit-transform: translateZ(0); transform: translateZ(0); }
.admin-nav-btn { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; border: 0; background: none; padding: 2px 0; color: var(--dim); font-size: 0.7rem; font-weight: 600; }
.admin-nav-ico { display: grid; place-items: center; width: 50px; max-width: 100%; height: 30px; border-radius: 15px; transition: background 0.15s; }
.admin-nav-label { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-nav-btn[aria-current="page"] { color: var(--accent); }
.admin-nav-btn[aria-current="page"] .admin-nav-ico { background: var(--line); background: color-mix(in srgb, var(--accent) 16%, transparent); }
@media (max-width: 899px) { .admin-screen.typing .admin-nav { display: none; } } /* keyboard up: the bar never covers the box you type in */
/* fold-open cards in Admin (Users, Notifications): one open at a time */
.panel.fold { padding: 0; }
.fold-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 14px; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; }
.fold-chev { display: grid; color: var(--dim); transition: transform 0.25s; }
.panel.fold.open .fold-chev { transform: rotate(180deg); }
.fold-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.25s; }
.panel.fold.open .fold-body { grid-template-rows: 1fr; }
.fold-inner { min-height: 0; overflow: hidden; padding: 0 14px; }
.panel.fold.open .fold-inner { padding-bottom: 16px; border-top: 1px solid var(--line); padding-top: 4px; }
/* Admin > Settings: limits per person */
.limit-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.limit-label { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.limit-label .dim { margin: 0; font-size: 0.82rem; }
.limit-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.limit-ctl .ghost { margin: 0; }
.limit-in { width: 6.5em; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
/* Admin > Settings > Topics: one card per topic button */
.tp-list { display: grid; gap: 8px; margin: 8px 0 12px; }
.tp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.tp-row .tp-group, .tp-row .tp-nl, .tp-row .tp-x { grid-column: 1 / -1; }
.tp-row .tp-x { justify-self: end; margin: 0; font-size: 0.82rem; padding: 4px 12px; }
.admin-body .tp-row input[type="text"], .tp-row select { width: 100%; min-width: 0; margin: 0; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; }
@media (min-width: 900px) {
  .admin-screen.with-nav { padding-left: 210px; }
  .admin-nav { top: 0; right: auto; width: 210px; flex-direction: column; gap: 4px; padding: calc(16px + env(safe-area-inset-top)) 12px 16px; border-top: 0; border-right: 1px solid var(--line); box-shadow: none; }
  .admin-nav-btn { flex: 0 0 auto; flex-direction: row; gap: 10px; padding: 4px 6px; border-radius: 12px; font-size: 0.95rem; }
  .admin-nav-btn:hover { background: var(--bg); }
  .admin-nav-ico { width: 40px; }
  .admin-screen.with-nav .admin-body { max-width: 1000px; padding: 20px 24px 48px; }
  .astats { grid-template-columns: repeat(6, 1fr); }
  .admin-body.tab-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
  .admin-body.tab-settings > * + * { margin-top: 0; }
}
/* choices with long labels (Admin > Notifications urgency): the text wraps inside its own button */
.seg.two-line .chip { white-space: normal; line-height: 1.25; padding: 7px 6px; }
.date-row { display: flex; gap: 8px; margin-top: 8px; }
.date-row[hidden] { display: none; }
.date-row label { flex: 1; font-size: 0.78rem; font-weight: 700; color: var(--dim); }
.date-row input { display: block; width: 100%; margin-top: 4px; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 7px 8px; }
.user-picks { gap: 6px; margin-bottom: 8px; }
.user-picks .chip { white-space: normal; text-align: left; }
.view-btn { border-radius: 999px; padding: 6px 18px; }
.admin-results > * + * { margin-top: 12px; }
.seg.dir-tabs { margin: 0 0 14px; }
.seg.dir-tabs .chip { padding: 9px 2px; font-size: 0.9rem; }
.seg.card-style { margin: 0 0 14px; }
.seg.dir-tabs.locked .chip, .seg.card-style.locked .chip { opacity: 0.55; cursor: default; } /* during a session: same size, only dimmed */

/* flashcards: action bar always in reach, just above the bottom tabs */
.cards { padding-bottom: 0; } /* the card ends above the bar (fitCard), so the page does not scroll */
.flash-stop { position: absolute; top: 5px; right: 6px; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 1.5px solid var(--danger); border-radius: 50%; background: none; color: var(--danger); } /* round red button, 44px tap area, the icon is 24px */
.hint-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 12px; }
/* wrong-meaning popup (flagMeaning in app.js) and Settings > Feedback */
.flag-card .flag-word { overflow-wrap: anywhere; }
.flag-card .flag-label { display: block; margin: 4px 0 4px; color: var(--dim); font-size: 0.8rem; font-weight: 600; }
.flag-note, .fb-text { display: block; box-sizing: border-box; width: 100%; resize: vertical; }
.flag-card .hint-actions { flex-wrap: wrap; }
.fb-box { display: grid; gap: 8px; margin-top: 10px; }
.fb-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.fb-send { width: auto; padding: 8px 20px; }
.fb-thanks { margin: 0; color: var(--accent); font-weight: 600; }
.hint-card .hint-actions button { box-sizing: border-box; width: auto; height: 38px; margin: 0; padding: 0 18px; border-radius: 999px; font-weight: 600; } /* more specific than .hint-card .ghost (margin) and .primary (padding), so both buttons are exactly the same size */
.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(66px + env(safe-area-inset-bottom));
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg);
  border-top: 1px solid var(--line);
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}
.action-bar .bar-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } /* row 1: I know this + Hint; row 2: Show answer (full width), then Again + Got it */
.action-bar .bar-row .wide { grid-column: span 2; }
.action-bar .hint-btn.on { background: var(--line); border-color: var(--accent); color: var(--accent); } /* Hint is on: the sentence is shown */
.action-bar .hint-btn:disabled { opacity: 0.5; }
.emo { font-size: 0.9em; margin-left: 0.4em; } /* small emoji after a Cards button label */
.action-bar > button, .action-bar .bar-row button { height: 50px; padding: 0 6px; } /* ghost and primary buttons are exactly the same height, so swapping them never moves anything */
.action-bar button { width: 100%; margin: 0; padding: 13px 6px; font-size: 0.95rem; border-radius: 12px; }

/* Cards Drill: the size strip in the Drill box; the progress bar on the top edge of the card (absolutely positioned
   like "N left", so it takes no room and nothing in the card moves) */
.seg.drill-size { margin: 4px 0 10px; }
.seg.drill-size .chip { white-space: normal; line-height: 1.25; padding: 6px 2px; }
.chip-sub { font-size: 0.75rem; opacity: 0.8; }
.drill-bar { position: absolute; top: 0; left: 16px; right: 16px; height: 4px; border-radius: 0 0 3px 3px; background: var(--line); overflow: hidden; }
.drill-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.25s; }

/* Again (after a flip, sessions and drills): red, so it clearly reads as "I didn't know it" next to the green Got it.
   Only colours change; size, border width and padding stay those of .ghost, so the bar never moves */
.again-btn { border-color: var(--danger); color: var(--danger); font-weight: 600; background: transparent; background: color-mix(in srgb, var(--danger) 14%, transparent); }
