/* Vocabulary: word bank, add flow, word page. */

/* ---------- small control variants ---------- */
.select--auto { width: auto; min-width: 0; padding-right: 28px; }
.input--sm, .textarea--sm { min-height: 32px; font-size: var(--text-sm); }
.textarea--sm { min-height: 64px; }
.btn--sm { min-height: 28px; padding: 0 8px; font-size: var(--text-xs); }
.btn--xs { min-height: 26px; padding: 0 8px; font-size: var(--text-xs); }
.btn--sm.btn--icon { width: 28px; padding: 0; }
@media (pointer: coarse) { .btn--sm, .btn--xs { min-height: 40px; } .btn--sm.btn--icon { width: 40px; } }
.ml-auto { margin-left: auto; }
.text-danger { color: var(--danger); }
.h-small { font-size: var(--text-md); font-weight: 600; margin-bottom: var(--s-2); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--s-3); }
.chip--xs { height: 18px; padding: 0 5px; font-size: 11px; }
.badge--on-accent { background: color-mix(in srgb, var(--accent-ink) 22%, transparent); color: var(--accent-ink); }
/* Part of speech: UI face, upright, tinted tag, so "v" never reads as an IPA symbol. */
.pos-tag { display: inline-block; font-family: var(--font-ui); font-style: normal; font-size: 11px; font-weight: 600; line-height: 18px; padding: 0 5px; border-radius: var(--radius-sm); background: var(--wash-strong); color: var(--ink-muted); margin-left: 6px; vertical-align: 2px; }
@media (max-width: 767px) { .hide-sm { display: none; } }
/* A table follows its own width, not the screen's: next to the sidebar (tablet, narrow
   window) it gets the phone columns instead of scrolling sideways. */
@container (max-width: 640px) { .table-wrap .hide-sm { display: none; } }

/* Level filter chips inside the database bar */
.levels { display: inline-flex; gap: 4px; border: 0; padding: 0; margin: 0; }
.filter-chip--sm { height: 26px; padding: 0 8px; font-size: var(--text-xs); position: relative; font-variant-numeric: tabular-nums; }
.seg__opt { position: relative; display: inline-flex; align-items: center; min-height: 28px; padding: 0 8px; border-radius: var(--radius-sm); color: var(--ink-muted); cursor: pointer; }
.seg__opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg__opt:has(input:checked) { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.seg__opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- word bank table ---------- */
.word-link { font-weight: 600; text-decoration: none; font-size: var(--text-md); }
.word-link:hover { text-decoration: underline; }
.meaning-cell { max-width: 34ch; color: var(--ink); }
/* A word with several senses: one line per part of speech, the tag leading each line. */
.pos-meanings { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.pos-meanings li { display: flex; align-items: baseline; gap: 6px; }
.pos-meanings .pos-tag { flex: none; margin-left: 0; vertical-align: 0; }
.title-cell .pos-tag + .pos-tag { margin-left: 4px; }
/* Narrow table (phone): the level badge moves up beside the part of speech, the word
   column keeps only the width it needs, and the meaning takes the rest of the row. */
.cefr-inline { display: none; margin-left: 4px; }
.cefr-inline .chip { height: 18px; padding: 0 5px; font-size: 11px; vertical-align: 2px; }
@container (max-width: 640px) {
  .words-table .col-level { display: none; }
  .words-table .cefr-inline { display: inline; }
  .words-table .title-cell { width: 1%; }
  /* Word on its own line, its tags (part of speech, level, senses) on the next: every row alike. */
  .words-table .title-cell .word-link { display: block; }
  .words-table .title-cell .pos-tag, .words-table .cefr-inline { margin: 0 4px 0 0; }
  .words-table .title-cell .pos-tag + .pos-tag { margin-left: 0; }
  .words-table .meaning-cell { max-width: none; }
  /* One long pronunciation (a phrase, or a malformed AI one) must not widen the word column
     for every row: cap it and end with "…" (the word's page has it in full). It stays on one
     line, since browsers break before the stress mark ˈ. */
  .words-table .title-cell__sound .ipa { display: inline-block; max-width: 10em; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
  .words-table .col-actions { padding-inline: 2px; }
}
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--ink-muted); white-space: nowrap; }
.status-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); }
.status-dot[data-status="learning"]::before { background: var(--warning); }
.status-dot[data-status="known"]::before { background: var(--success); }
.pager { display: flex; align-items: center; justify-content: center; gap: var(--s-3); padding: var(--s-5) 0; }

/* gallery */
.gcard-wrap { position: relative; }
.gcard__check { position: absolute; top: 8px; left: 8px; z-index: 2; display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius); background: color-mix(in srgb, var(--paper) 85%, transparent); opacity: 0; }
.gcard-wrap:hover .gcard__check, .gcard__check:has(input:checked), .gcard__check:has(input:focus-visible) { opacity: 1; }
@media (pointer: coarse) { .gcard__check { opacity: 1; } }
.gcard__check input { accent-color: var(--accent); width: 16px; height: 16px; }
.gcard__speak { position: absolute; top: 8px; right: 8px; z-index: 2; border-radius: var(--radius); background: color-mix(in srgb, var(--paper) 85%, transparent); opacity: 0; }
.gcard-wrap:hover .gcard__speak, .gcard__speak:focus-within { opacity: 1; }
@media (pointer: coarse) { .gcard__speak { opacity: 1; } }
.title-cell__sound { display: flex; flex-wrap: wrap; align-items: center; gap: 0 2px; margin-top: 1px; font-weight: 400; }
.title-cell__sound .ipa { white-space: nowrap; }
.title-cell__sound .speak { margin: -6px 0; }
.gcard { height: 100%; }
.gcard__img { display: grid; place-items: center; }
.gcard__letter { font-family: var(--font-read); font-style: italic; font-size: 3rem; color: var(--ink-faint); }

/* ---------- add flow ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule); margin-bottom: var(--s-5); overflow-x: auto; }
.tabs__item { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--ink-muted); text-decoration: none; font-size: var(--text-sm); font-weight: 500; white-space: nowrap; }
.tabs__item:hover { color: var(--ink); }
.tabs__item[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.lookup-form { display: flex; gap: var(--s-2); }
.search--lg { flex: 1; }
.search--lg .input { min-height: 44px; font-size: var(--text-lg); padding-left: 38px; }
.search--lg .icon { left: 12px; }
.pick { display: flex; align-items: flex-start; gap: var(--s-3); flex: 1; min-width: 0; cursor: pointer; padding: 2px 0; }
.pick input { margin-top: 5px; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.pick--done { cursor: default; color: var(--ink-muted); }
.pick--done .icon { margin-top: 4px; color: var(--success); }
.row__meta { display: block; }
.row__meaning { display: block; color: var(--ink); font-size: var(--text-sm); }
.row__nuance { display: block; }
.pick-actions { position: sticky; bottom: var(--s-4); display: flex; justify-content: flex-end; padding-top: var(--s-3); }
@media (max-width: 767px) { .pick-actions { bottom: calc(var(--tabbar-h) + var(--s-3)); } .lookup-form { flex-direction: column; } }

/* text filter */
.textarea--reading { font-family: var(--font-read); font-size: var(--text-md); line-height: 1.7; min-height: 220px; }
.context-line { font-family: var(--font-read); font-style: normal; line-height: 1.55; }
mark { background: var(--accent-wash); color: inherit; padding: 0 2px; border-radius: 3px; font-weight: 600; }
.text-picks .row { align-items: flex-start; }
.text-picks .chip { margin-top: 3px; }
.filter-chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-wash); }

/* ---------- word hover preview ---------- */
.hover-card {
  position: fixed; z-index: 75; width: min(440px, calc(100vw - 16px)); max-height: min(620px, 80vh); overflow: auto; overscroll-behavior: contain;
  padding: var(--s-3) var(--s-4); border: 1px solid var(--rule); border-radius: var(--radius-lg);
  background: var(--paper); box-shadow: var(--shadow-pop); font-size: var(--text-sm);
  animation: hover-card-in 140ms var(--ease-out);
}
@keyframes hover-card-in { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .hover-card { animation: none; } }
.hover-card__body { display: grid; gap: var(--s-2); }
.hover-card__body p { margin: 0; }
.hover-card__top { display: flex; gap: var(--s-3); align-items: flex-start; }
.hover-card__titles { display: grid; gap: 2px; flex: 1; min-width: 0; }
.hover-card__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.hover-card__word { font: 600 var(--text-xl)/1.2 var(--font-read); }
.hover-card__sound { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--s-1); }
.hover-card__img { width: 64px; height: 64px; flex: none; object-fit: cover; border-radius: var(--radius); }
.hover-card__meaning { font-weight: 600; font-size: var(--text-md); }
.hover-card__block { display: grid; gap: 4px; padding-top: var(--s-2); border-top: 1px solid var(--rule); }
.hover-card__label { margin: 0; font-size: var(--text-xs); font-weight: 600; color: var(--ink-muted); }
.hover-card__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hover-card__list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; }
.hover-card__list li > .hover-card__sub { flex-basis: 100%; }
.hover-card__list li.hover-card__stack { display: grid; gap: 2px; }
.hover-card__sub { font-size: var(--text-xs); color: var(--ink-muted); }
.hover-card__inline { display: flex; flex-wrap: wrap; gap: 4px var(--s-3); }
.hover-card__inline > span { display: inline-flex; align-items: center; gap: 4px; }
.hover-card__wrong { color: var(--danger); text-decoration: line-through; }
.hover-card__right { color: var(--success); font-weight: 600; }
.hover-card__list .icon { align-self: center; color: var(--ink-faint); }
.hover-card__note { white-space: normal; }
.hover-card mark { background: none; color: inherit; font-weight: 600; }
.hover-card__foot { position: sticky; bottom: calc(-1 * var(--s-3)); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2);
  margin: 0 calc(-1 * var(--s-4)) calc(-1 * var(--s-3)); padding: var(--s-2) var(--s-4) var(--s-3); border-top: 1px solid var(--rule); background: var(--paper); }

/* ---------- select-to-translate ---------- */
.select-chip {
  position: fixed; z-index: 80; display: inline-flex; align-items: center; gap: 4px;
  min-height: 28px; padding: 0 10px; border: 0; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink); font: 600 var(--text-xs)/1 var(--font-ui);
  box-shadow: var(--shadow-pop); cursor: pointer;
}
.select-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.select-card {
  position: fixed; z-index: 85; width: min(340px, calc(100vw - 16px)); max-height: min(420px, 70vh); overflow: auto;
  padding: var(--s-3) var(--s-4); border: 1px solid var(--rule); border-radius: var(--radius-lg);
  background: var(--paper); box-shadow: var(--shadow-pop);
}
.select-card:focus { outline: none; }
.select-card__close { position: absolute; top: 6px; right: 6px; }
.select-card__body { display: grid; gap: var(--s-2); padding-right: 24px; }
.select-card__body p { margin: 0; }
.select-card__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.select-card__word { font: 600 var(--text-xl)/1.2 var(--font-read); }
.select-card__sound { gap: var(--s-2); }
.select-card__meaning { font-weight: 500; }
.select-card__translation { font-size: var(--text-md); line-height: 1.6; }
.select-card__source { font-style: italic; }
.select-card__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); padding-top: var(--s-1); }
.select-card__phrases { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.select-card__phrases li { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); font-size: var(--text-sm); }
.select-card__loading { margin: 0; padding-right: 24px; }
.select-card__senses { display: grid; gap: 2px; }
.select-card__senses ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: var(--text-sm); }
.select-card__senses li { display: flex; align-items: baseline; gap: 6px; }
.sense-check { display: grid; gap: var(--s-1); padding: var(--s-2) var(--s-3); border-radius: var(--radius); background: var(--wash); }
.sense-check--new { background: var(--accent-wash); }
.sense-check p, .sense-check form { margin: 0; }
.sense-check form { padding-top: 2px; }
@media (max-width: 767px) {
  .select-chip { left: 50%; bottom: calc(var(--tabbar-h) + var(--s-3) + env(safe-area-inset-bottom)); transform: translateX(-50%); min-height: 40px; padding: 0 16px; font-size: var(--text-sm); }
  .select-card {
    left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); width: auto; max-height: 55vh;
    border-radius: 16px 16px 0 0; border-bottom: 0; padding: var(--s-4);
  }
}

/* ---------- switch ---------- */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: var(--text-sm); color: var(--ink-muted); padding: 0 6px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track { position: relative; width: 30px; height: 18px; border-radius: 999px; background: var(--rule-strong); transition: background var(--dur) var(--ease-out); }
.switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--paper); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform var(--dur) var(--ease-out); }
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(12px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 767px) { .switch__label { display: none; } }

/* ---------- word page ---------- */
.cover-slot { min-height: 0; }
.cover { margin: 0; }
.cover-empty { height: 72px; }
.cover-empty__inner { display: flex; gap: var(--s-2); align-items: flex-end; height: 100%; padding-top: var(--s-4); padding-bottom: 0; opacity: 0; transition: opacity var(--dur); }
.cover-slot:hover .cover-empty__inner, .cover-empty__inner:focus-within { opacity: 1; }
@media (pointer: coarse) { .cover-empty__inner { opacity: 1; } }
.word__page { padding-top: 0; }
.word .page-icon { font-size: 1.375rem; }
.word__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-2) var(--s-4); margin-bottom: var(--s-3); }
.word__speak { gap: 2px; }
.speak { color: var(--ink-muted); font-size: var(--text-xs); letter-spacing: 0.02em; }
.speak:hover { color: var(--accent); }
.seg--status button { min-height: 28px; font-size: var(--text-sm); }
.status-hint { margin: var(--s-1) 0 0; max-width: 60ch; }
.meaning { font-weight: 500; }
.context { font-family: var(--font-read); font-style: italic; color: var(--ink-muted); quotes: "“" "”"; }
.prop__label .icon { color: var(--ink-faint); }

.blocks { display: grid; gap: 2px; margin-top: var(--s-2); }
.toggle__title { font-size: var(--text-lg); }
.toggle .refine { padding: 0 0 var(--s-2) 26px; }
.section-tools { display: flex; flex-wrap: wrap; gap: 4px; margin-top: var(--s-2); opacity: 0.0; transition: opacity var(--dur); }
.toggle__body:hover .section-tools, .section-tools:focus-within { opacity: 1; }
@media (pointer: coarse) { .section-tools { opacity: 1; } }

.senses { margin: 0; padding-left: 1.4em; display: grid; gap: var(--s-3); }
.senses li::marker { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.sense { display: grid; gap: 2px; }
.sense p { margin: 0; max-width: 72ch; }
.sense__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sense.is-match { margin-left: -6px; padding: 4px 6px; border-radius: var(--radius); background: var(--accent-wash); }
.contexts { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-1); }
.contexts mark { background: none; color: var(--ink); font-weight: 600; }
.contexts__more summary { cursor: pointer; margin-top: var(--s-1); }
.sense-chip { font-size: var(--text-xs); color: var(--ink-muted); white-space: nowrap; }
.examples { margin: 0; padding-left: 1.2em; display: grid; gap: var(--s-3); }
.examples li::marker { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.examples p { margin: 0; max-width: 72ch; }
.pairs { margin: 0; display: grid; gap: var(--s-3); }
.pair { display: grid; grid-template-columns: minmax(110px, 180px) minmax(0, 1fr); gap: var(--s-3); }
.pair dt { font-weight: 600; display: flex; align-items: flex-start; justify-content: space-between; gap: 4px; }
.bank-add { flex: none; margin: -4px 0; }
.bank-add .btn, .btn.bank-add { color: var(--ink-muted); }
.bank-add .btn:hover { color: var(--accent); }
.btn.bank-add.text-success, .bank-add .text-success { color: var(--success); }
.pair dd { margin: 0; display: grid; gap: 2px; }
.pairs--compact { gap: var(--s-2); }
@media (max-width: 540px) { .pair { grid-template-columns: minmax(0, 1fr); gap: 2px; } }
.register { display: grid; gap: var(--s-2); justify-items: start; }
.register p { margin: 0; }
.mistakes { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.mistake p { margin: 0; }
.mistake__pair { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mistake__pair .icon { color: var(--ink-faint); }
.mistake__wrong { color: var(--danger); text-decoration: line-through; text-decoration-thickness: 1px; }
.mistake__right { color: var(--success); font-weight: 600; }

/* inline section editor */
.section-form { display: grid; gap: var(--s-3); }
.edit-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 var(--s-3); margin: 0; padding: var(--s-3); border: 1px solid var(--rule); border-radius: var(--radius); }
.edit-row .field { margin-bottom: var(--s-2); }
.edit-row__remove { justify-self: start; }

/* AI proposal: current vs proposed */
.compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); margin: var(--s-3) 0; }
.compare__col { padding: var(--s-3); border-radius: var(--radius); background: var(--wash); min-width: 0; }
.compare__col--new { background: var(--accent-wash); }
.compare__title { font-size: var(--text-xs); font-weight: 600; color: var(--ink-muted); margin-bottom: var(--s-2); }
@media (max-width: 767px) { .compare { grid-template-columns: minmax(0, 1fr); } }

/* note */
.note { min-height: 44px; padding: var(--s-2) var(--s-3); margin: 0 calc(-1 * var(--s-3)); border-radius: var(--radius); cursor: text; }
.note:hover { background: var(--wash); }
.note--editing { cursor: auto; }
.note--editing:hover { background: none; }
.note .empty { color: var(--ink-placeholder); }
.word__foot { margin-top: var(--s-7); padding-top: var(--s-4); border-top: 1px solid var(--rule); }

/* topics picker + swatches */
.topics-form { flex-direction: column; align-items: stretch; gap: var(--s-2); }
.chip--pick { cursor: pointer; position: relative; padding-left: 4px; }
.chip--pick input { width: 13px; height: 13px; margin: 0 3px 0 0; accent-color: currentColor; }
.swatches { display: inline-flex; gap: 4px; border: 0; margin: 0; padding: 0; }
.swatch { position: relative; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; background: var(--tag-gray-bg); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tag-gray) 35%, transparent); }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch:has(input:checked) { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--accent); }
.swatch:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.swatch[data-color="brown"] { background: var(--tag-brown-bg); box-shadow: inset 0 0 0 1px var(--tag-brown); }
.swatch[data-color="orange"] { background: var(--tag-orange-bg); box-shadow: inset 0 0 0 1px var(--tag-orange); }
.swatch[data-color="yellow"] { background: var(--tag-yellow-bg); box-shadow: inset 0 0 0 1px var(--tag-yellow); }
.swatch[data-color="green"] { background: var(--tag-green-bg); box-shadow: inset 0 0 0 1px var(--tag-green); }
.swatch[data-color="blue"] { background: var(--tag-blue-bg); box-shadow: inset 0 0 0 1px var(--tag-blue); }
.swatch[data-color="purple"] { background: var(--tag-purple-bg); box-shadow: inset 0 0 0 1px var(--tag-purple); }
.swatch[data-color="pink"] { background: var(--tag-pink-bg); box-shadow: inset 0 0 0 1px var(--tag-pink); }
.swatch[data-color="red"] { background: var(--tag-red-bg); box-shadow: inset 0 0 0 1px var(--tag-red); }
.swatch:has(input:checked)[data-color] { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--accent); }

/* cover picker */
.cover-draw { display: grid; gap: 6px; padding-bottom: var(--s-4); border-bottom: 1px solid var(--rule); }
.cover-draw p { margin: 0; }
.cover-draw__row { display: flex; gap: var(--s-2); }
.cover-draw__row .input { flex: 1; min-width: 0; }
.cover-draw__row .btn { flex: none; }
.cover-draw__busy { display: none; }
.cover-draw.htmx-request .cover-draw__idle { display: none; }
.cover-draw.htmx-request .cover-draw__busy { display: inline; }
.picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); }
.picker__item { display: block; width: 100%; aspect-ratio: 3 / 2; padding: 0; border: 0; border-radius: var(--radius); overflow: hidden; cursor: pointer; background: var(--wash); }
.picker__item img { width: 100%; height: 100%; object-fit: cover; transition: transform 300ms var(--ease-out); }
.picker__item:hover img { transform: scale(1.04); }
@media (max-width: 540px) { .picker { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Vietnamese-explanation switch: spaced apart from the VI/EN interface control */
.switch { margin-right: var(--s-3); }
.switch .icon { color: var(--ink-muted); }
.mistake__fix { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; max-width: 100%; }
.mistake__fix .mistake__right { white-space: normal; }

/* ---------- Words by week (list "Theo tuần", shared page) ---------- */
.week-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--s-3); margin: 0; font: inherit; }
.week-head__title { font-weight: 650; color: var(--ink); }
.week-head__count { color: var(--ink-muted); font-size: var(--text-sm); }
.week-head__link { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-muted); }
.week-head__link:hover { color: var(--accent); }
/* In the table: a heading row that opens each week's rows. */
.dbtable .week-row th { padding: var(--s-4) 8px 6px; border-bottom: 1px solid var(--rule-strong); background: none; color: var(--ink); font-size: var(--text-sm); white-space: normal; }
.dbtable .week-group:first-of-type .week-row th { padding-top: var(--s-2); }
.dbtable tr.week-row:hover th { background: none; }
/* In the gallery: a full-width heading before each week's cards. */
.week-head--gallery { grid-column: 1 / -1; padding: var(--s-3) 0 2px; border-bottom: 1px solid var(--rule-strong); }
.week-head--gallery:first-child { padding-top: 0; }

/* Share dialog (word list) */
.share-panel { display: grid; gap: var(--s-3); }
.share-panel p { margin: 0; }
.share-panel__link { display: flex; gap: var(--s-2); }
.share-panel__link .input { flex: 1; min-width: 0; font-size: var(--text-sm); color: var(--ink-muted); }
.share-panel__link .btn { flex: none; }

/* The shared word list (public page, no app shell) */
.shared { min-height: 100dvh; }
.shared .page { padding-bottom: var(--s-8); }
.shared__head { margin-bottom: var(--s-5); }
.shared__brand { margin: 0 0 var(--s-3); font-family: var(--font-read); font-size: 1.5rem; font-weight: 650; letter-spacing: -0.03em; line-height: 1; }
.shared__brand span { color: var(--accent); }
.shared-week { margin-top: var(--s-6); }
.shared-week:first-of-type { margin-top: 0; }
.shared-week .week-head { padding: 0 0 var(--s-2); border-bottom: 1px solid var(--rule-strong); font-size: var(--text-lg); }
.shared-table td { vertical-align: top; }
/* Every week is its own table: fixed column widths keep the columns lined up from week to week. */
.shared-table { table-layout: fixed; }
.shared-table th:first-child { width: 34%; }
.shared-table .col-level { width: 84px; }
.shared-table th.col-topics { width: 22%; }
/* Narrow: the word list's phone layout (level beside the word, word column as narrow as it can be). */
@container (max-width: 640px) {
  .shared-table { table-layout: auto; }
  .shared-table th:first-child, .shared-table th.col-topics { width: auto; }
  .shared-table td.col-topics { max-width: 9em; }
}
.shared-table .word-link { font-weight: 600; }
/* The shared page's word opens its card (hover, focus or tap): a button that reads as the word. */
button.word-link { padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 600; font-size: var(--text-md);
  text-align: left; cursor: pointer; }
button.word-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
@media (max-width: 767px) { .shared .page { padding-bottom: var(--s-7); } }
