/* Jengo Words Hub — A3 Progressive.
   All colors route through a --wh-* token layer that references the global
   semantic tokens (see style.css :root + [data-theme=...]). A future
   [data-theme="dark"] only needs to override the globals — nothing here. */

#tab-words.tab-content { padding: 0; }

.wh {
  --wh-surface: var(--color-surface);
  --wh-bg: var(--color-bg);
  --wh-border: var(--color-border);
  --wh-border-light: var(--color-border-light);
  --wh-text: var(--color-text-primary);
  --wh-text-2: var(--color-text-secondary);
  --wh-text-3: var(--color-text-muted);
  --wh-brand: var(--brand);
  --wh-danger: var(--color-danger);
  /* state colors */
  --wh-new: var(--color-accent-new);
  --wh-learning: var(--orange);
  --wh-review: var(--green);
  --wh-due: var(--brand);
  --wh-suspended: var(--color-text-muted);
  --wh-leech: var(--color-danger);

  max-width: 560px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  color: var(--wh-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

/* ── Screen header ─────────────────────────────────────────────── */
.wh-head {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.85rem 1rem 0.7rem;
  position: sticky; top: 0; z-index: 5;
  background: var(--wh-bg);
}
.wh-head.is-select { background: var(--wh-text); color: var(--wh-bg); }
.wh-head-btn {
  width: 34px; height: 34px; flex-shrink: 0;
  display: grid; place-items: center;
  background: none; border: none; cursor: pointer;
  color: inherit; border-radius: 8px; padding: 0;
}
.wh-head-btn:hover { background: var(--wh-surface); }
.wh-head.is-select .wh-head-btn:hover { background: rgba(255,255,255,0.12); }
.wh-head-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wh-title { font-size: 1.25rem; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh-count { font-size: 0.85rem; color: var(--wh-text-3); flex-shrink: 0; }
.wh-head.is-select .wh-count { color: rgba(255,255,255,0.85); }
.wh-head-link { background: none; border: none; cursor: pointer; color: inherit; font-size: 0.9rem; padding: 0.25rem 0.4rem; }

/* ── Body / scroll region ─────────────────────────────────────── */
.wh-body { flex: 1; padding: 0 1rem 1.5rem; }

/* ── Search input ─────────────────────────────────────────────── */
.wh-search-row { display: flex; gap: 0.5rem; padding: 0 1rem 0.5rem; }
/* When the search row leads a screen (no .wh-head above it), give it the same
   top breathing room a header would, so it clears the green app bar. */
.wh-search-row--lead { padding-top: 0.85rem; }
.wh-search {
  flex: 1; display: flex; align-items: center; gap: 0.5rem;
  background: var(--wh-surface); border: 1px solid transparent;
  border-radius: 10px; padding: 0.55rem 0.75rem;
}
.wh-search:focus-within { border-color: var(--wh-brand); }
.wh-search svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: var(--wh-text-3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wh-search input { flex: 1; border: none; background: none; font-size: 0.95rem; color: var(--wh-text); outline: none; min-width: 0; }
.wh-search input::placeholder { color: var(--wh-text-3); }

/* Trailing filter button, lives inside the search field */
.wh-search-filter {
  flex-shrink: 0; position: relative; margin: -0.55rem -0.4rem -0.55rem 0.3rem;
  padding: 0 0.5rem 0 0.6rem; align-self: stretch;
  display: grid; place-items: center; cursor: pointer;
  background: none; border: none; border-left: 1px solid var(--wh-border-light);
  color: var(--wh-text-2); border-radius: 0 10px 10px 0;
}
.wh-search-filter:hover { color: var(--wh-text); }
.wh-search-filter.is-active { color: var(--wh-brand); }
.wh-search-filter svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wh-search-filter svg circle { fill: currentColor; stroke: none; }
.wh-fdot {
  position: absolute; top: -3px; right: -2px;
  min-width: 15px; height: 15px; padding: 0 3px; border-radius: 999px;
  background: var(--wh-brand); color: #fff; font-size: 0.62rem; font-weight: 700;
  display: grid; place-items: center; line-height: 1;
  box-shadow: 0 0 0 2px var(--wh-bg);
}

/* ── Root choice cards ────────────────────────────────────────── */
.wh-choices { display: flex; flex-direction: column; gap: 0.85rem; padding: 0.25rem 0; }
.wh-choice {
  -webkit-appearance: none;
  text-align: left; width: 100%; cursor: pointer;
  color: var(--wh-text);
  border: 1px solid var(--wh-border-light); border-radius: 14px;
  padding: 1.15rem 1.1rem; background: var(--wh-bg);
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  transition: border-color 0.15s, transform 0.1s;
}
.wh-choice:hover { border-color: var(--wh-brand); }
.wh-choice:active { transform: scale(0.99); }
.wh-choice.is-reading { background: color-mix(in srgb, var(--orange) 7%, var(--wh-bg)); --wh-choice-accent: var(--orange); }
.wh-choice.is-cards { background: color-mix(in srgb, var(--wh-brand) 7%, var(--wh-bg)); --wh-choice-accent: var(--wh-brand); }
/* Single primary line: [icon] Reading Words — the old kicker duplicated this. */
.wh-choice-title { font-size: 1.3rem; font-weight: 700; color: var(--wh-text); display: flex; align-items: center; gap: 0.55rem; margin: 0 0 0.3rem; }
.wh-choice-title svg { width: 22px; height: 22px; flex: none; fill: none; stroke: var(--wh-choice-accent, currentColor); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wh-choice-sub { font-size: 0.85rem; color: var(--wh-text-2); }
.wh-choice-chev { color: var(--wh-text-3); }
.wh-choice-chev svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Collection chooser rows ──────────────────────────────────── */
.wh-section-title { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--wh-text-3); padding: 1rem 0.25rem 0.4rem; }
.wh-coll {
  display: grid; grid-template-columns: auto 1fr auto; gap: 0.8rem; align-items: center;
  padding: 0.8rem 0.5rem; width: 100%; text-align: left; cursor: pointer;
  background: none; border: none; border-bottom: 1px solid var(--wh-border-light);
}
.wh-coll:hover { background: var(--wh-surface); }
.wh-glyph {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--wh-surface); color: var(--wh-text-2);
}
.wh-glyph svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wh-glyph.is-reading { background: color-mix(in srgb, var(--orange) 16%, var(--wh-bg)); color: var(--orange); }
.wh-glyph.is-deck { background: color-mix(in srgb, var(--wh-brand) 16%, var(--wh-bg)); color: var(--wh-brand); }
.wh-glyph.is-empty { background: none; border: 1.5px dashed var(--wh-text-3); color: var(--wh-text-3); }
.wh-coll-name { font-size: 1rem; font-weight: 600; color: var(--wh-text); }
.wh-coll-name.is-muted { color: var(--wh-text-3); font-weight: 500; }
.wh-coll-sub { font-size: 0.8rem; color: var(--wh-text-3); margin-top: 1px; }
.wh-coll-chev { color: var(--wh-text-3); }
.wh-coll-chev svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.wh-newbtn {
  width: 100%; margin: 1.1rem 0 0.25rem; cursor: pointer;
  border: 1.5px dashed var(--wh-brand); color: var(--wh-brand);
  border-radius: 10px; padding: 0.8rem; text-align: center; font-weight: 600;
  background: none; font-size: 0.95rem;
}
.wh-newbtn:hover { background: color-mix(in srgb, var(--wh-brand) 8%, var(--wh-bg)); }

/* ── Word / card rows ─────────────────────────────────────────── */
.wh-subhead { font-size: 0.82rem; color: var(--wh-text-3); padding: 0.4rem 0.5rem 0.6rem; }
.wh-list { display: flex; flex-direction: column; }
.wh-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 0.7rem; align-items: center;
  padding: 0.7rem 0.5rem; width: 100%; text-align: left; cursor: pointer;
  background: none; border: none; border-bottom: 1px solid var(--wh-border-light);
}
.wh-row:hover { background: var(--wh-surface); }
.wh-row.is-checked { background: color-mix(in srgb, var(--wh-brand) 8%, var(--wh-bg)); }
.wh-row.is-suspended .wh-lemma, .wh-row.is-suspended .wh-furi, .wh-row.is-suspended .wh-gloss { opacity: 0.5; }
.wh-meta { display: flex; flex-direction: column; min-width: 0; }
.wh-furi { font-size: 0.72rem; color: var(--wh-text-3); line-height: 1.2; }
.wh-lemma { font-size: 1.15rem; font-weight: 700; line-height: 1.2; color: var(--wh-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh-gloss { font-size: 0.8rem; color: var(--wh-text-2); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh-rowchev { color: var(--wh-text-3); display: grid; place-items: center; }
.wh-rowchev svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wh-checkdot { width: 22px; height: 22px; border-radius: 999px; border: 2px solid var(--wh-text-3); display: grid; place-items: center; }
.wh-checkdot.on { border-color: var(--wh-brand); background: var(--wh-brand); }
.wh-checkdot.on svg { width: 13px; height: 13px; stroke: #fff; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ── Status pills ─────────────────────────────────────────────── */
.wh-pill {
  font-size: 0.72rem; font-weight: 600; padding: 0.18rem 0.55rem; border-radius: 999px;
  background: var(--wh-surface); color: var(--wh-text-2); white-space: nowrap;
}
.wh-pill.is-new { background: color-mix(in srgb, var(--wh-new) 16%, var(--wh-bg)); color: var(--wh-new); }
.wh-pill.is-due { background: color-mix(in srgb, var(--wh-due) 18%, var(--wh-bg)); color: var(--wh-due); }
.wh-pill.is-review { background: color-mix(in srgb, var(--wh-review) 16%, var(--wh-bg)); color: var(--wh-review); }
.wh-pill.is-learning { background: color-mix(in srgb, var(--wh-learning) 18%, var(--wh-bg)); color: var(--wh-learning); }
.wh-pill.is-suspended { background: var(--wh-surface); color: var(--wh-text-3); }
.wh-pill.is-leech { background: color-mix(in srgb, var(--wh-leech) 14%, var(--wh-bg)); color: var(--wh-leech); }

/* ── Multi-select filter options (filter sheet) ───────────────── */
.wh-filter-head { display: flex; align-items: center; gap: 0.5rem; min-height: 1.5rem; margin-bottom: 0.85rem; }
.wh-filter-head h4 { margin: 0; font-size: 1.05rem; font-weight: 700; flex: 1; text-align: center; }
.wh-filter-clearbtn {
  background: none; border: none; cursor: pointer;
  color: var(--wh-danger); font-size: 0.82rem; font-weight: 600; padding: 0.2rem 0.1rem;
  white-space: nowrap; flex-shrink: 0;
}
.wh-filter-clearbtn:disabled { color: var(--wh-text-3); opacity: 0.55; cursor: default; }
.wh-fgroup { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.wh-fopt {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.45rem 0.8rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--wh-border); background: var(--wh-bg);
  color: var(--wh-text-2); font-size: 0.85rem; font-weight: 500;
  text-transform: capitalize; transition: background 0.13s ease, border-color 0.13s ease, color 0.13s ease;
}
.wh-fopt:hover { border-color: var(--wh-text-3); }
.wh-fopt.on {
  background: color-mix(in srgb, var(--wh-brand) 12%, var(--wh-bg));
  color: var(--wh-brand); border-color: color-mix(in srgb, var(--wh-brand) 42%, var(--wh-bg)); font-weight: 600;
}
.wh-fcheck { display: grid; place-items: center; margin-left: -0.1rem; }
.wh-fcheck svg { width: 13px; height: 13px; fill: none; stroke: var(--wh-brand); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* ── Segmented control (single-select pickers) ────────────────── */
.wh-seg {
  display: flex; flex-wrap: wrap; gap: 3px;
  background: var(--wh-surface); border-radius: 11px; padding: 3px;
}
.wh-seg-btn {
  flex: 1 1 27%; min-width: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.32rem;
  padding: 0.42rem 0.55rem; border: none; background: transparent;
  color: var(--wh-text-2); border-radius: 8px; cursor: pointer;
  font-size: 0.8rem; font-weight: 500; white-space: nowrap;
  text-transform: capitalize; transition: background 0.13s ease, color 0.13s ease;
}
.wh-seg-btn:hover { color: var(--wh-text); }
.wh-seg-btn.on {
  background: var(--wh-bg); color: var(--wh-text); font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1), 0 0 0 0.5px rgba(0,0,0,0.04);
}
.wh-seg-count { font-size: 0.7rem; font-weight: 600; color: var(--wh-text-3); }
.wh-seg-btn.on .wh-seg-count { color: var(--wh-brand); }

/* ── Card detail content blocks ───────────────────────────────── */
.wh-detail-block { margin: 0.2rem 0 0.45rem; }
.wh-deflist { margin: 0.25rem 0 0; padding-left: 1.15rem; font-size: 0.9rem; color: var(--wh-text); line-height: 1.5; }
.wh-deflist li { margin: 0.12rem 0; }
.wh-deflist li::marker { color: var(--wh-text-3); font-size: 0.8em; }
.wh-ex-item { margin-top: 0.4rem; }
.wh-ex-item:first-child { margin-top: 0; }
.wh-ex-jp { font-size: 0.98rem; color: var(--wh-text); line-height: 1.55; }
.wh-ex-en { font-size: 0.85rem; color: var(--wh-text-2); margin-top: 0.15rem; line-height: 1.45; }

/* ── FAB ──────────────────────────────────────────────────────── */
.wh-fab {
  position: fixed; right: 1.1rem; bottom: calc(var(--nav-h) + var(--sab) + 1rem);
  width: 52px; height: 52px; border-radius: 50%; z-index: 380;
  background: var(--wh-brand); color: #fff; border: none; cursor: pointer;
  display: grid; place-items: center; box-shadow: 0 3px 12px rgba(0,0,0,0.22);
}
.wh-fab svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 768px) {
  .wh-fab { bottom: 1.75rem; right: 2rem; }
}

/* ── Bottom sheet / backdrop ──────────────────────────────────── */
.wh-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 600; animation: wh-fade 0.18s ease; }
.wh-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 601;
  margin: 0 auto; max-width: 560px;
  background: var(--wh-bg); border-radius: 18px 18px 0 0;
  padding: 0.75rem 1.25rem calc(1.25rem + var(--sab) + var(--nav-h));
  box-shadow: 0 -10px 30px rgba(0,0,0,0.18);
  animation: wh-slide-up 0.24s cubic-bezier(0.4,0,0.2,1);
  max-height: 85vh; overflow-y: auto; overflow-x: hidden;
}
.wh-sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: var(--wh-border); margin: 0 auto 0.75rem; }
.wh-sheet-close {
  position: absolute; top: 0.6rem; right: 0.85rem; z-index: 2;
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0;
  background: none; border: none; border-radius: 8px;
  color: var(--wh-text-2); cursor: pointer;
}
.wh-sheet-close:hover { background: var(--wh-border-light); color: var(--wh-text); }
.wh-sheet-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wh-sheet h4 { margin: 0 0 0.3rem; font-size: 1.05rem; font-weight: 700; }
.wh-sheet-sub { font-size: 0.85rem; color: var(--wh-text-2); margin: 0 0 0.85rem; }
.wh-sheet-row { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.65rem 0; border-bottom: 1px solid var(--wh-border-light); font-size: 0.9rem; }
.wh-sheet-row:last-of-type { border-bottom: none; }
.wh-sheet-row .v { color: var(--wh-text-2); text-align: right; }
.wh-sheet-row .v button { background: none; border: none; color: var(--wh-brand); cursor: pointer; font-size: 0.9rem; }

@keyframes wh-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes wh-slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .wh-backdrop, .wh-sheet { animation: none; }
}

/* ── Sheet action grids ───────────────────────────────────────── */
.wh-acts { display: grid; gap: 0.5rem; margin-top: 0.9rem; }
.wh-act {
  text-align: center; font-size: 0.8rem; padding: 0.7rem 0.4rem;
  border: 1px solid var(--wh-border-light); border-radius: 10px;
  background: var(--wh-bg); color: var(--wh-text-2); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
}
.wh-act:hover { background: var(--wh-surface); }
.wh-act svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wh-act.danger { color: var(--wh-danger); border-color: var(--color-danger-border); }
.wh-act.danger:hover { background: var(--color-danger-bg); }
.wh-act.forgot { color: var(--orange); border-color: color-mix(in srgb, var(--orange) 32%, var(--wh-bg)); font-weight: 600; }
.wh-act.forgot:hover { background: color-mix(in srgb, var(--orange) 10%, var(--wh-bg)); }
.wh-act.knew { color: var(--wh-brand); border-color: color-mix(in srgb, var(--wh-brand) 32%, var(--wh-bg)); font-weight: 600; }
.wh-act.knew:hover { background: color-mix(in srgb, var(--wh-brand) 10%, var(--wh-bg)); }
/* full-width horizontal sheet action (icon + label on one line) */
.wh-act-wide { flex-direction: row; justify-content: center; gap: 0.5rem; width: 100%; font-size: 0.9rem; }

/* ── Add-to-deck picker (deck list expands above the toggle) ───── */
.wh-deckpick { margin-top: 0.9rem; }
.wh-deckpick-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.5rem; animation: wh-fade 0.16s ease; }
.wh-deckpick-msg { font-size: 0.85rem; color: var(--wh-text-3); padding: 0.4rem 0 0.6rem; }
.wh-deckpick-opt {
  display: flex; align-items: center; gap: 0.6rem; width: 100%;
  padding: 0.65rem 0.7rem; border: 1px solid var(--wh-border); border-radius: 10px;
  background: var(--wh-bg); color: var(--wh-text); cursor: pointer;
  font-size: 0.92rem; text-align: left; transition: background 0.12s ease, border-color 0.12s ease;
}
.wh-deckpick-opt:hover { background: var(--wh-surface); }
.wh-deckpick-opt.is-on { border-color: color-mix(in srgb, var(--wh-brand) 45%, var(--wh-bg)); background: color-mix(in srgb, var(--wh-brand) 9%, var(--wh-bg)); }
.wh-deckpick-name { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wh-deckpick-dir {
  flex-shrink: 0; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.03em;
  padding: 2px 6px; border-radius: 5px;
  background: var(--wh-surface); color: var(--wh-text-2); border: 1px solid var(--wh-border);
}
.wh-deckpick-dir.is-comprehension { color: var(--green); background: color-mix(in srgb, var(--green) 14%, var(--wh-bg)); border-color: color-mix(in srgb, var(--green) 30%, var(--wh-bg)); }
.wh-deckpick-dir.is-production { color: var(--orange); background: color-mix(in srgb, var(--orange) 14%, var(--wh-bg)); border-color: color-mix(in srgb, var(--orange) 30%, var(--wh-bg)); }
.wh-deckpick-dir.is-kanji { color: var(--wh-brand); background: color-mix(in srgb, var(--wh-brand) 12%, var(--wh-bg)); border-color: color-mix(in srgb, var(--wh-brand) 28%, var(--wh-bg)); }
.wh-deckpick-check { flex-shrink: 0; display: inline-flex; color: var(--wh-brand); }
.wh-deckpick-check svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.wh-deckpick-add { flex-shrink: 0; display: inline-flex; color: var(--wh-text-3); }
.wh-deckpick-add svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wh-deckpick-toggle.is-on { color: var(--wh-brand); border-color: color-mix(in srgb, var(--wh-brand) 32%, var(--wh-bg)); }

/* ── Inputs / textareas inside sheets ─────────────────────────── */
.wh-input, .wh-textarea {
  width: 100%; border: 1px solid var(--wh-border); border-radius: 8px;
  padding: 0.6rem 0.7rem; font-size: 0.95rem; font-family: inherit;
  background: var(--wh-bg); color: var(--wh-text); box-sizing: border-box;
}
.wh-input:focus, .wh-textarea:focus { outline: none; border-color: var(--wh-brand); }
.wh-textarea { resize: vertical; min-height: 64px; }
.wh-field-label { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--wh-text-3); margin: 0.85rem 0 0.35rem; }

.wh-btn-primary {
  width: 100%; background: var(--wh-brand); color: #fff; border: none;
  border-radius: 10px; padding: 0.75rem; font-size: 0.95rem; font-weight: 600;
  cursor: pointer; margin-top: 1rem;
}
.wh-btn-primary:disabled { opacity: 0.5; cursor: default; }
.wh-jlpt-list { display: flex; flex-direction: column; gap: 0.45rem; }
.wh-jlpt-opt {
  display: flex; align-items: center; gap: 0.7rem; width: 100%;
  padding: 0.55rem 0.7rem; border: 1px solid var(--wh-border); border-radius: 12px;
  background: var(--wh-bg); color: var(--wh-text); cursor: pointer; text-align: left;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.wh-jlpt-opt:hover { background: var(--wh-surface); }
.wh-jlpt-opt.is-sel { border-color: var(--wh-brand); background: color-mix(in srgb, var(--wh-brand) 8%, var(--wh-bg)); }
.wh-jlpt-check { margin-left: auto; flex-shrink: 0; display: inline-flex; color: var(--wh-brand); }
.wh-jlpt-check svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.wh-filebtn { width: 100%; border: 1.5px dashed var(--wh-text-3); border-radius: 10px; padding: 0.7rem; text-align: center; color: var(--wh-text-2); background: none; cursor: pointer; font-size: 0.88rem; }

/* ── Word-set marketplace ─────────────────────────────────────── */
.wh-cat-group { margin-bottom: 1.4rem; }
/* Group header — storefront aisle label, distinct from the muted section title. */
.wh-cat-group-head { display: flex; flex-direction: column; gap: 0.15rem; padding-left: 0.65rem; margin: 0 0.1rem 0.7rem; border-left: 3px solid var(--wh-brand); }
.wh-cat-group-title { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.01em; color: var(--wh-text); margin: 0; line-height: 1.1; }
.wh-cat-blurb { font-size: 0.85rem; color: var(--wh-text-3); margin: 0; line-height: 1.4; }
/* One bordered container per group; levels are hairline-divided rows. */
.wh-cat-box { border: 1px solid var(--wh-border-light); border-radius: 14px; overflow: hidden; }
.wh-cat-row {
  display: flex; align-items: center; gap: 0.8rem; width: 100%; text-align: left; cursor: pointer;
  padding: 0.7rem 0.85rem; background: var(--wh-bg); color: var(--wh-text);
  border: none; border-top: 1px solid var(--wh-border-light); transition: background 0.12s;
}
.wh-cat-row:first-child { border-top: none; }
.wh-cat-row:hover { background: var(--wh-surface); }
.wh-cat-row:active { background: var(--wh-surface-hover, var(--wh-surface)); }
.wh-cat-card-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.12rem; }
.wh-cat-card-name { font-size: 1.02rem; font-weight: 700; color: var(--wh-text); }
.wh-cat-card-meta { font-size: 0.8rem; color: var(--wh-text-3); }
.wh-cat-card-chev { flex-shrink: 0; color: var(--wh-text-3); display: grid; place-items: center; }
.wh-cat-card-chev svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.zero-hero-badge {
  color: var(--wh-brand);
  background: color-mix(in oklab, var(--wh-brand) 12%, var(--wh-bg));
  border: 1px solid color-mix(in oklab, var(--wh-brand) 28%, var(--wh-bg));
}
.zero-hero-badge svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* Rainbow "browse" glyph — signals variety, not just another deck. */
.wh-glyph.is-catalog { background: var(--wh-surface); }
.wh-glyph.is-catalog svg rect { stroke: none; }
.wh-glyph.is-catalog svg rect:nth-of-type(1) { fill: var(--blue); }
.wh-glyph.is-catalog svg rect:nth-of-type(2) { fill: var(--green); }
.wh-glyph.is-catalog svg rect:nth-of-type(3) { fill: var(--orange); }
.wh-glyph.is-catalog svg rect:nth-of-type(4) { fill: var(--violet); }

/* Set detail screen */
.wh-set-meta { display: flex; align-items: center; gap: 0.55rem; font-size: 0.85rem; color: var(--wh-text-2); margin: 0.1rem 0.25rem 0.7rem; }
.wh-set-preview-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0.25rem 0.5rem; }
.wh-set-shuffle { display: inline-flex; align-items: center; gap: 0.35rem; background: none; border: none; cursor: pointer; font-size: 0.82rem; color: var(--wh-brand); padding: 0.2rem; }
.wh-set-shuffle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wh-set-add { margin-top: 1rem; }

/* Preview carousel — index-based (no overflow-x), reuses .card-back from flashcard.css.
   Stage is a fixed height so varying example/def lengths never reflow the arrows or
   the add button below it. Card content is clamped to fit that height. */
.wh-carousel { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.3rem; }
.wh-carousel-stage { min-width: 0; height: 440px; }
.wh-carousel-stage .card-back {
  height: 100%; box-sizing: border-box;
  border: 1px solid var(--wh-border-light); border-radius: 14px; padding: 1.1rem 0.9rem; background: var(--wh-bg);
}
.wh-carousel-nav { flex-shrink: 0; background: none; border: none; cursor: pointer; color: var(--wh-text-3); display: grid; place-items: center; padding: 0.25rem; border-radius: 999px; }
.wh-carousel-nav:hover { color: var(--wh-text); background: var(--wh-surface); }
.wh-carousel-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wh-carousel-dots { grid-column: 2; display: flex; justify-content: center; gap: 0.3rem; margin-top: 0.6rem; }
.wh-carousel-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--wh-border-light); transition: background 0.15s; }
.wh-carousel-dot.is-on { background: var(--wh-brand); }

/* Create-new-deck row inside the set sheet */
.wh-deckpick-new { border-style: dashed; border-color: color-mix(in srgb, var(--wh-brand) 40%, var(--wh-bg)); }
.wh-deckpick-new .wh-deckpick-add { color: var(--wh-brand); }
.wh-deckpick-dir.is-new { color: var(--wh-brand); background: color-mix(in srgb, var(--wh-brand) 12%, var(--wh-bg)); border-color: color-mix(in srgb, var(--wh-brand) 28%, var(--wh-bg)); }

/* ── Multi-select action bar ──────────────────────────────────── */
.wh-selbar {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--sab)); z-index: 595;
  margin: 0 auto; max-width: 560px;
  background: var(--wh-text); color: var(--wh-bg);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: 0.25rem; padding: 0.65rem 0.5rem;
}
@media (min-width: 768px) { .wh-selbar { bottom: 0; } }
.wh-selbar button { background: none; border: none; color: inherit; cursor: pointer; font-size: 0.7rem; display: flex; flex-direction: column; align-items: center; gap: 0.25rem; padding: 0.2rem; }
.wh-selbar button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wh-selbar button.danger { color: color-mix(in srgb, var(--wh-leech) 55%, #fff); }

/* ── Dropdown menu (⋯) ────────────────────────────────────────── */
.wh-menu {
  position: fixed; z-index: 605; top: calc(var(--header-h) + 0.6rem); right: 0.8rem;
  width: 220px; background: var(--wh-bg); border: 1px solid var(--wh-border-light);
  border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.18); overflow: hidden;
}
.wh-menu button { display: block; width: 100%; text-align: left; padding: 0.7rem 0.9rem; background: none; border: none; border-bottom: 1px solid var(--wh-border-light); cursor: pointer; font-size: 0.92rem; color: var(--wh-text); }
.wh-menu button:last-child { border-bottom: none; }
.wh-menu button:hover { background: var(--wh-surface); }
.wh-menu button.danger { color: var(--wh-danger); }

/* ── Confirm dialog ───────────────────────────────────────────── */
.wh-confirm-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 9998; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.wh-confirm { background: var(--wh-bg); border-radius: 12px; padding: 1.5rem; width: 360px; max-width: 92vw; box-shadow: 0 8px 32px rgba(0,0,0,0.18); }
.wh-confirm h3 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.wh-confirm p { margin: 0 0 1.25rem; font-size: 0.9rem; color: var(--wh-text-2); line-height: 1.45; }
.wh-confirm-btns { display: flex; justify-content: flex-end; gap: 0.5rem; }
.wh-confirm-btns button { border-radius: 6px; padding: 0.5rem 1rem; font-size: 0.9rem; cursor: pointer; border: 1px solid var(--wh-border); background: var(--wh-bg); color: var(--wh-text-2); }
.wh-confirm-btns button.primary { background: var(--wh-brand); color: #fff; border-color: var(--wh-brand); }
.wh-confirm-btns button.danger { background: var(--wh-danger); color: #fff; border-color: var(--wh-danger); }

/* ── Empty / loading states ───────────────────────────────────── */
.wh-empty { text-align: center; color: var(--wh-text-3); padding: 3rem 1.5rem; font-size: 0.9rem; }
.wh-empty svg { width: 40px; height: 40px; margin-bottom: 0.75rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0.6; }
.wh-spinner { display: block; width: 26px; height: 26px; margin: 3rem auto; border: 3px solid var(--wh-border); border-top-color: var(--wh-brand); border-radius: 50%; animation: wh-spin 0.7s linear infinite; }
@keyframes wh-spin { to { transform: rotate(360deg); } }

/* ── Toast ────────────────────────────────────────────────────── */
.wh-toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + var(--sab) + 1rem); z-index: 700;
  background: var(--wh-text); color: var(--wh-bg);
  padding: 0.6rem 1rem; border-radius: 999px; font-size: 0.85rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.22); animation: wh-fade 0.18s ease;
}

/* ── Deck card (deck chooser meta) ────────────────────────────── */
.wh-deck-counts { display: flex; gap: 0.35rem; margin-top: 0.35rem; flex-wrap: wrap; }
.wh-dirchip { font-size: 0.7rem; padding: 0.1rem 0.45rem; border-radius: 999px; border: 1px solid var(--wh-border); color: var(--wh-text-2); }

/* ── Card viewer (full-screen .card-modal reusing flashcard.css) ── */
.wh-viewer-foot {
  flex-shrink: 0; padding: 0.25rem 1rem calc(0.75rem + var(--sab, 0px));
  border-top: 1px solid var(--wh-border-light); background: var(--wh-bg);
}
.wh-viewer-details {
  width: 100%; display: flex; justify-content: center; align-items: center; gap: 0.4rem;
  background: var(--wh-surface); border: 1px solid var(--wh-border); border-radius: 10px;
  cursor: pointer; padding: 0.7rem 1rem;
  font-size: 0.9rem; font-weight: 600; color: var(--wh-text);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.wh-viewer-details:hover {
  background: color-mix(in srgb, var(--wh-brand) 8%, var(--wh-surface));
  border-color: color-mix(in srgb, var(--wh-brand) 40%, var(--wh-border));
  color: var(--wh-brand);
}
.wh-viewer-details[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--wh-brand) 45%, var(--wh-border)); color: var(--wh-brand);
}
.wh-viewer-details .wh-rowchev { color: currentColor; }
.wh-viewer-details .wh-rowchev svg { transition: transform 0.15s ease; }
.wh-viewer-details .wh-rowchev.is-open svg { transform: rotate(90deg); }
.wh-viewer-detail-rows { margin-top: 0.5rem; }

/* Full-screen host for the shared flashcard DeckSettingsScreen (.fc-app is a
   flex child in the overlay; standalone it needs the column + bg itself). */
.wh-fc-screen {
  display: flex; flex-direction: column; background: var(--color-bg);
  padding-top: env(safe-area-inset-top, 0px);
}
.wh-fc-screen .fc-app { height: 100%; }

/* Deck row gear (replaces the old "N due" badge) */
.wh-coll-gear {
  background: none; border: none; cursor: pointer; padding: 0.45rem;
  color: var(--wh-text-3); border-radius: 8px; display: grid; place-items: center;
}
.wh-coll-gear:hover { background: var(--wh-surface); color: var(--wh-text); }
.wh-coll-gear svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.wh-empty-ctas { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1rem; }
.wh-empty-ctas .wh-newbtn { margin-top: 0; }
.wh-trainmark { color: var(--orange); display: grid; place-items: center; }
.wh-trainmark svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.wh-pillwrap { display: inline-flex; align-items: center; gap: 0.45rem; }
