/* tlcom lookup — minimal, readable, Thai-aware */

/* ── Design tokens ─────────────────────────────────────────────────────────
 * Every color in the stylesheet resolves through one of these tokens, so the
 * whole UI re-themes by overriding the token values. The :root values below are
 * the light theme; the dark theme (html[data-theme="dark"]) only restates the
 * values that change. The initial theme is applied to <html data-theme> by a
 * tiny blocking script in <head> (see base.html) so there is no flash, and it
 * follows the OS preference until the visitor picks a side via the nav toggle.
 *
 * White button text stays the literal `#fff` (it sits on a colored fill in both
 * themes); only surfaces, borders, and text tones flip. */
:root {
    color-scheme: light;

    /* Surfaces & body text */
    --bg: #ffffff;
    --surface: #ffffff;     /* cards, popovers, inputs */
    --surface-2: #fafafa;   /* subtle insets */
    --surface-3: #f3f4f6;   /* chips, hovers, tab strip */
    --surface-4: #f9fafb;   /* section / table panels */
    --fg: #1d1f23;
    --muted: #6b7280;
    --neutral-fg: #374151;  /* text on neutral chips */
    --line: #e5e7eb;
    --line-strong: #d1d5db; /* heavier dividers / input borders */
    --rom: #4b5563;
    --eng: #111827;
    --shadow: rgba(0, 0, 0, 0.08);

    /* Brand */
    --accent: #993366;          /* links & accent text */
    --accent-bg: #993366;       /* filled accent buttons (white text) */
    --accent-soft: #fef0f7;     /* accent-tinted hover/banner fill */
    --accent-line: #f9c8e0;     /* accent-tinted border */

    /* Tags */
    --tag-word: #e0f2fe;
    --tag-phrase: #fde68a;
    --tag-fg: #1d1f23;

    /* Romanization helpers */
    --cyr-fg: #5b7fa6;
    --cyr-sup: #7a9bbf;

    /* Telegram login button */
    --tg-bg: #2ca5e0;
    --tg-bg-hover: #1a96d1;

    /* Consonant-class coloring (beginner aid). Low class = default text color. */
    --cc-high: #c0392b;
    --cc-mid: #00ba3a;
    --cc-low: #2563eb;

    /* Status tones — soft background / text / strong text / border */
    --ok-bg: #ecfdf5;     --ok-fg: #065f46;     --ok-strong: #16a34a;     --ok-border: #86efac;
    --danger-bg: #fef2f2; --danger-fg: #991b1b; --danger-strong: #dc2626; --danger-border: #fca5a5;
    --warn-bg: #fef9c3;   --warn-fg: #92400e;   --warn-border: #fcd34d;
    --info-bg: #dbeafe;   --info-fg: #1e40af;   --info-strong: #2563eb;   --info-border: #bae6fd;
    --violet-bg: #e0e7ff; --violet-fg: #3730a3; --violet-strong: #7c3aed; --violet-border: #c7d2fe;
}

/* ── Dark theme ────────────────────────────────────────────────────────────
 * Only the tokens that differ from light are restated. Accent splits in two:
 * --accent is lifted so links stay legible on the dark background, while
 * --accent-bg keeps a saturated magenta so white button text stays readable. */
html[data-theme="dark"] {
    color-scheme: dark;

    --bg: #14161a;
    --surface: #1b1e24;
    --surface-2: #20242b;
    --surface-3: #262b33;
    --surface-4: #1b1e24;
    --fg: #e6e8ec;
    --muted: #9aa2ad;
    --neutral-fg: #c4ccd6;
    --line: #2d333d;
    --line-strong: #3a414c;
    --rom: #aeb6c1;
    --eng: #e6e8ec;
    --shadow: rgba(0, 0, 0, 0.55);

    --accent: #e889b3;
    --accent-bg: #b34a78;
    --accent-soft: #3a2330;
    --accent-line: #4a2c3a;

    --tag-word: #163049;
    --tag-phrase: #4a3a12;
    --tag-fg: #e6e8ec;

    --cyr-fg: #8fa9c7;
    --cyr-sup: #7a91ad;

    --cc-high: #ff6b5e;
    --cc-mid: #34d399;
    --cc-low: #6ea8fe;

    --ok-bg: #14352a;     --ok-fg: #6ee7b7;     --ok-strong: #34d399;     --ok-border: #235c44;
    --danger-bg: #3a1f22; --danger-fg: #fca5a5; --danger-strong: #f87171; --danger-border: #6e3a3d;
    --warn-bg: #3a2f12;   --warn-fg: #fcd34d;   --warn-border: #6e5a1f;
    --info-bg: #16263f;   --info-fg: #93c5fd;   --info-strong: #6ea8fe;   --info-border: #2e4a72;
    --violet-bg: #241f3d; --violet-fg: #c4b5fd; --violet-strong: #a78bfa; --violet-border: #463a72;
}

/* Consonant-class coloring. Spans are always present once the feature has been
 * switched on once; the colors only apply while body.cc-on is set, so toggling
 * is pure CSS. !important keeps the class color visible even inside links. */
body.cc-on .cc-h { color: var(--cc-high) !important; }
body.cc-on .cc-m { color: var(--cc-mid) !important; }
body.cc-on .cc-l { color: var(--cc-low) !important; }

/* Toggle button in the nav. */
.cc-toggle {
    background: none;
    border: 1px solid var(--line);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 4px 7px;
}
.cc-toggle[data-state="on"] {
    border-color: var(--accent);
    background: var(--accent-soft);
}

/* Light / dark theme toggle — reuses the .cc-toggle chrome. */
.theme-toggle {
    min-width: 2em;
    text-align: center;
    color: var(--fg);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font:
        16px/1.5 -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        "Helvetica Neue",
        Arial,
        sans-serif;
}

/* Thai prefers a font that has good rendering for tone marks */
.thai,
.rom,
h1,
h2 {
    font-family:
        -apple-system, "Helvetica Neue", "Sukhumvit Set", "Tahoma", sans-serif;
}

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* Inline per-word links inside Thai phrases. We want the title to read
   like a continuous string, so the link colour matches the surrounding
   text and only the underline appears on hover. */
.word-link {
    color: inherit;
    border-bottom: 1px dotted rgba(153, 51, 102, 0.35);
}
.word-link:hover {
    color: var(--accent);
    background: var(--accent-soft);
    border-bottom-color: var(--accent);
    text-decoration: none;
}

.ex-link {
    margin-left: 4px;
    color: var(--muted);
    font-size: 0.9em;
    text-decoration: none;
}
.ex-link:hover {
    color: var(--accent);
}

/* ── Compact header (all pages except homepage) ───────────────────────── */

.site-header {
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 6px rgba(0,0,0,.06);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
}

/* ── Homepage — Google-style ──────────────────────────────────────────── */

body.home {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.home main {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: none;
    margin: 0;
    padding: 0;
}

/* Minimal transparent header: nav floats top-right */
.home-header {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
    padding: 16px 24px;
    display: flex;
    justify-content: flex-end;
    background: transparent;
    border: none;
}

/* Hero: vertically centered, shifts up slightly when results appear */
.home-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 28vh;
    padding-bottom: 40px;
    gap: 20px;
    transition: padding-top 0.2s ease;
}
.home-hero--searching {
    padding-top: 12vh;
}

.home-brand {
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--fg);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: .55rem;
}
.home-brand-logo {
    height: 2.6rem;
    width: 2.6rem;
    object-fit: contain;
    flex-shrink: 0;
    margin-top: 4px;
}
.home-brand span {
    color: var(--accent);
}
.home-brand:hover {
    text-decoration: none;
}

/* Search input — rounded pill, Google-width */
.home-searchform {
    width: 100%;
    max-width: 580px;
}

.home-search-wrap {
    display: flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 10px 16px;
    background: var(--surface);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
    gap: 10px;
    transition: box-shadow 0.15s;
}
.home-search-wrap:focus-within {
    box-shadow: 0 2px 12px rgba(153, 51, 102, 0.18);
    border-color: var(--accent);
}

.home-search-icon {
    color: var(--muted);
    flex-shrink: 0;
    display: flex;
}

.home-searchform input[type="search"] {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.05rem;
    background: transparent;
    color: var(--fg);
    min-width: 0;
}
.home-searchform input[type="search"]::placeholder {
    color: var(--muted);
}
/* Hide browser's default clear button — we have our own */
.home-searchform input[type="search"]::-webkit-search-cancel-button {
    display: none;
}

.home-search-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 1rem;
    padding: 0 2px;
    flex-shrink: 0;
}
.home-search-clear:hover {
    color: var(--fg);
}

.home-results {
    width: 100%;
    max-width: 640px;
}

.home-hint {
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
    margin: 0;
}

/* Footer disclaimer stays at bottom */
body.home .site-disclaimer {
    margin-top: auto;
}

.header-nav {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.header-nav-link {
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--muted);
    white-space: nowrap;
    transition: background 0.12s, color 0.12s;
}

.header-nav-link:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.brand {
    font-weight: 700;
    letter-spacing: 1px;
    font-size: 1.2rem;
    color: var(--fg);
}
.brand span {
    color: var(--accent);
}

.searchbox {
    flex: 1;
    margin: 0;
}
.searchbox input {
    width: 100%;
    padding: 8px 12px;
    font-size: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
}
.searchbox input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
}

main {
    max-width: 880px;
    margin: 24px auto;
    padding: 0 20px 80px;
}

.hint {
    color: var(--muted);
    margin-top: 8px;
}
.hint.empty em {
    color: var(--accent);
    font-style: normal;
    font-weight: 600;
}

.result-divider {
    border: 0;
    border-top: 1px dashed var(--line);
    margin: 18px 0 6px;
}
.hint.similar {
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 8px;
}
ul.results.fuzzy {
    opacity: 0.92;
}

.site-disclaimer {
    margin-top: 60px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.6;
    text-align: center;
}
.site-disclaimer a {
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.site-disclaimer a:hover {
    color: var(--accent);
}

/* Result list ------------------------------------------------------------- */

ul.results {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}

ul.results li.result + li.result {
    border-top: 1px solid var(--line);
}

/* result-link is now the grid child, not bare <a> */

ul.results .thai {
    font-size: 1.25rem;
    color: var(--fg);
}
ul.results .rom {
    color: var(--rom);
    font-size: 0.95rem;
}
ul.results .defs {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
ul.results .def {
    font-size: 0.95rem;
}
ul.results .def.en {
    color: var(--eng);
}
ul.results .def.ru {
    color: var(--accent);
    font-style: italic;
}

.kind-tag {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 9999px;
    align-self: center;
    color: var(--tag-fg);
}
.result.word .kind-tag {
    background: var(--tag-word);
}
.result.phrase .kind-tag {
    background: var(--tag-phrase);
}

/* Entry pages ------------------------------------------------------------- */

article.entry {
    line-height: 1.5;
}

/* Sibling-entry tab strip -------------------------------------------------- */
.entry-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding-bottom: 0.9rem;
    margin-bottom: 1.1rem;
    border-bottom: 1px solid var(--line);
}

.entry-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.28rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    text-decoration: none;
    white-space: nowrap;
    background: var(--surface-3);
    color: var(--muted);
    border: 1px solid var(--line);
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.entry-tab:hover {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
}

.entry-tab.active {
    background: var(--accent-bg);
    color: #fff;
    border-color: var(--accent);
    font-weight: 600;
    pointer-events: none;
}

.entry-tab .tab-check {
    font-size: 0.65rem;
    opacity: 0.75;
}

.entry-head {
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}
.entry-head h1.thai {
    font-size: 2.6rem;
    margin: 0;
    line-height: 1.1;
}
.entry-head .rom {
    margin: 0;
    color: var(--rom);
    font-size: 1.1rem;
}
.entry-head .cyr-rom {
    margin: 0;
    color: var(--cyr-fg);
    font-size: 1rem;
    font-family: -apple-system, "Helvetica Neue", sans-serif;
}

li .rom {
    border: 1px solid var(--line-strong);
    padding: 0 5px;
}
li .cyr-rom {
    border: 1px solid var(--line-strong);
    padding: 0 5px;
}

.rom sup,
.cyr-rom sup {
    font-size: 0.6em;
    font-weight: 600;
    letter-spacing: 0.02em;
    vertical-align: super;
    margin-left: 1px;
}
.rom sup {
    color: var(--muted);
}
.cyr-rom sup {
    color: var(--cyr-sup);
}
.rom del,
.cyr-rom del {
    padding: 0 2px;
}

.entry-head .tone {
    display: inline-block;
    margin-left: 12px;
    font-size: 0.8rem;
    color: var(--muted);
    background: var(--surface-3);
    border-radius: 4px;
    padding: 2px 6px;
}
.entry-head audio {
    width: 100%;
    max-width: 360px;
    margin-top: 4px;
}

article.entry section {
    margin: 22px 0;
}
article.entry h2 {
    font-size: 1rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 8px;
}

ol.defs {
    margin: 0;
    padding-left: 20px;
}
ol.defs li {
    margin-bottom: 10px;
}
ol.defs .def-en {
}
ol.defs .def-ru {
    color: var(--accent);
    font-style: italic;
    font-size: 0.95em;
    margin-top: 2px;
}

p.phrase-def {
    margin: 0 0 6px;
}
p.phrase-def.ru {
    color: var(--accent);
    font-style: italic;
    font-size: 0.95em;
}

ul.examples .eng {
    color: var(--eng);
    margin-top: 4px;
}
ul.examples .eng.ru {
    color: var(--accent);
    font-style: italic;
    font-size: 0.95em;
    margin-top: 2px;
}
.pos {
    display: inline-block;
    font-size: 0.78rem;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 1px 6px;
    border-radius: 4px;
    margin-right: 4px;
}

ul.examples {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--line);
}
ul.examples > li {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
ul.examples .ex-line {
    display: flex;
    align-items: center;
    gap: 14px;
}
ul.examples .thai {
    font-size: 1.25rem;
}
ul.examples audio {
    height: 28px;
    max-width: 240px;
}
ul.examples .rom {
    color: var(--rom);
    margin-top: 2px;
}

ol.components {
    margin: 0;
    padding-left: 20px;
}
ol.components li {
    margin-bottom: 6px;
    display: grid;
    grid-template-columns: 130px 130px 1fr;
    gap: 12px;
    align-items: baseline;
}
ol.components .thai {
    font-size: 1.15rem;
}
ol.components .rom {
    color: var(--rom);
}
ol.components .eng {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
ol.components .eng .en {
    color: var(--eng);
}
ol.components .eng .ru {
    color: var(--accent);
    font-style: italic;
    font-size: 0.95em;
}

footer.meta {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--muted);
    border-top: 1px solid var(--line);
    padding-top: 8px;
    margin-top: 24px;
}

/* User nav ---------------------------------------------------------------- */

.user-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    font-size: 0.9rem;
}

.user-name {
    color: var(--muted);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Push bell button --------------------------------------------------------- */

.push-bell {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 2px 4px;
    border-radius: 5px;
    opacity: 0.6;
    transition: opacity 0.15s;
    line-height: 1;
}
.push-bell:hover {
    opacity: 1;
}
.push-bell[data-state="on"] {
    opacity: 1;
    filter: none;
}
.push-bell[data-state="off"] {
    opacity: 0.45;
    filter: grayscale(1);
}
.push-bell[data-state="denied"] {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-tg-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background: var(--tg-bg);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
}
.btn-tg-login:hover {
    background: var(--tg-bg-hover);
}

.tg-waiting-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    background: var(--info-bg);
    border: 1px solid var(--info-border);
    border-radius: 10px;
}
.tg-step {
    margin: 0;
    font-size: 0.95rem;
}
.tg-spinner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.btn-login {
    padding: 5px 12px;
    background: var(--accent-bg);
    color: #fff;
    border-radius: 6px;
    font-size: 0.88rem;
}
.btn-login:hover {
    opacity: 0.88;
    text-decoration: none;
}

.btn-link {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--accent);
    font-size: 0.9rem;
    padding: 0;
}
.btn-link:hover {
    text-decoration: underline;
}

.btn-primary {
    padding: 6px 14px;
    background: var(--accent-bg);
    color: #fff;
    border-radius: 6px;
    font-size: 0.9rem;
}
.btn-primary:hover {
    opacity: 0.88;
    text-decoration: none;
}

/* Auth box ---------------------------------------------------------------- */

.auth-box {
    max-width: 400px;
    margin: 48px auto;
    padding: 32px;
    border: 1px solid var(--line);
    border-radius: 12px;
}
.auth-box h1 {
    margin: 0 0 20px;
    font-size: 1.4rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.auth-form label {
    font-size: 0.88rem;
    color: var(--muted);
}
.auth-form input[type="email"],
.auth-form input[type="text"] {
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    font-size: 1rem;
}
.auth-form button[type="submit"] {
    margin-top: 6px;
    padding: 9px;
    background: var(--accent-bg);
    color: #fff;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    font-size: 1rem;
}
.auth-form button[type="submit"]:hover {
    opacity: 0.88;
}

.auth-divider {
    text-align: center;
    color: var(--muted);
    margin: 18px 0;
    position: relative;
}
.auth-divider::before,
.auth-divider::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 42%;
    height: 1px;
    background: var(--line);
}
.auth-divider::before {
    left: 0;
}
.auth-divider::after {
    right: 0;
}

.auth-msg {
    padding: 10px 14px;
    border-radius: 7px;
    margin-bottom: 14px;
    font-size: 0.93rem;
}
.auth-msg.ok {
    background: var(--ok-bg);
    color: var(--ok-fg);
}
.auth-msg.err {
    background: var(--danger-bg);
    color: var(--danger-fg);
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.radio-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: var(--fg);
}

/* Folder list ------------------------------------------------------------- */

.page-head {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 20px;
}
.page-head h1 {
    margin: 0;
    font-size: 1.5rem;
}

.folder-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}
.folder-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}
.folder-row:last-child {
    border-bottom: none;
}
.folder-name {
    font-size: 1.05rem;
    font-weight: 500;
}
.folder-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--muted);
    font-size: 0.85rem;
}

.visibility-tag {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: 999px;
}
.visibility-tag.private {
    background: var(--surface-3);
    color: var(--neutral-fg);
}
.visibility-tag.public {
    background: var(--info-bg);
    color: var(--info-fg);
}

.role-tag {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
}

.folder-words {
    list-style: none;
    margin: 0;
    padding: 0;
}
.folder-words li {
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}

/* "Group by" pill toggle above the words list */
.folder-group-toggle {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
    margin: 12px 0 14px;
}
.folder-group-toggle .group-opt {
    font-size: .85rem;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--muted);
    text-decoration: none;
    background: var(--surface);
}
.folder-group-toggle .group-opt:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}
.folder-group-toggle .group-opt.active {
    background: var(--accent-bg);
    border-color: var(--accent);
    color: #fff;
}

/* Date-group sections */
.folder-group {
    margin: 1.2rem 0 1.6rem;
}
.folder-group-head {
    font-size: .95rem;
    font-weight: 600;
    color: var(--fg);
    margin: 0 0 .35rem;
    padding-bottom: .25rem;
    border-bottom: 2px solid var(--accent-soft);
    text-transform: none;
    letter-spacing: 0;
}
.folder-group-head .muted { font-weight: 400; }
.folder-word-main {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}
.folder-word-meanings {
    margin-top: 2px;
    font-size: .88rem;
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
}
.folder-word-meanings .def.en { color: var(--eng); }
.folder-word-meanings .def.ru { color: var(--accent); font-style: italic; }
.folder-word-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.added-badge {
    color: var(--ok-fg);
    font-size: 0.85rem;
}
.muted {
    color: var(--muted);
}
.small {
    font-size: 0.85rem;
}

/* Folder picker popover --------------------------------------------------- */

.folder-picker {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 160px;
}
.picker-title {
    font-size: 0.8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 6px;
}
.picker-btn {
    text-align: left;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    cursor: pointer;
    font-size: 0.93rem;
}
.picker-btn:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
}

/* Entry-page add-to-folder widget ----------------------------------------- */

.entry-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.folder-widget {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.folder-select {
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.9rem;
    background: var(--surface-2);
    max-width: 180px;
}
.folder-select:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-add-folder {
    padding: 5px 12px;
    background: var(--accent-bg);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.88rem;
}
.btn-add-folder:hover {
    opacity: 0.85;
}

.add-result {
    font-size: 0.88rem;
    color: var(--ok-fg);
}

/* Search result save button ----------------------------------------------- */

ul.results li.result {
    display: flex;
    align-items: stretch;
}

ul.results li.result .result-link {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(140px, 1.2fr) 2.5fr auto;
    gap: 16px;
    align-items: baseline;
    padding: 10px 14px;
    color: inherit;
}
ul.results li.result .result-link:hover {
    background: var(--accent-soft);
    text-decoration: none;
}

.result-save {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 10px;
    border-left: 1px solid var(--line);
}

.save-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 1.15rem;
    line-height: 1;
    padding: 4px;
    border-radius: 4px;
}
.save-btn:hover {
    color: var(--accent);
    background: var(--accent-soft);
}

.picker-drop {
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 210;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    min-width: 160px;
}
.picker-drop:empty {
    display: none;
}

/* Folder word list with progress ------------------------------------------ */

.folder-words {
    list-style: none;
    margin: 0;
    padding: 0;
}
.folder-words li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}
.folder-words .thai {
    font-size: 1.1rem;
}
.progress-badge {
    color: var(--accent);
    font-size: 0.8rem;
    letter-spacing: -1px;
}

.btn-remove {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 0.85rem;
    padding: 2px 6px;
    border-radius: 4px;
}
.btn-remove:hover {
    color: var(--danger-strong);
    background: var(--danger-bg);
}

.btn-promote {
    background: none;
    border: 1px solid var(--ok-border);
    color: var(--ok-fg);
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
}
.btn-promote:hover {
    background: var(--ok-bg);
}

.btn-demote {
    background: none;
    border: 1px solid var(--line-strong);
    color: var(--muted);
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
}
.btn-demote:hover {
    background: var(--surface-3);
}

.role-owner {
    background: var(--warn-bg);
    color: var(--warn-fg);
}
.role-editor {
    background: var(--info-bg);
    color: var(--info-fg);
}
.role-member {
    background: var(--surface-3);
    color: var(--neutral-fg);
}

/* Training banner ---------------------------------------------------------- */

.training-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.92rem;
}

/* Folder head actions ------------------------------------------------------ */

.folder-head-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-secondary {
    padding: 5px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.88rem;
    color: var(--fg);
    background: var(--surface);
}
.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}

/* Settings page ------------------------------------------------------------ */

.settings-page {
    max-width: 560px;
}
.folder-nav {
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.settings-section {
    margin: 28px 0;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 10px;
}
.settings-section h2 {
    margin: 0 0 16px;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.settings-form label {
    font-size: 0.88rem;
    color: var(--muted);
}
.settings-form input[type="text"],
.settings-form input[type="number"] {
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.95rem;
}

.btn-save {
    align-self: flex-start;
    margin-top: 6px;
    padding: 8px 20px;
    background: var(--accent-bg);
    color: #fff;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.95rem;
}
.btn-save:hover {
    opacity: 0.88;
}

.member-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.member-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
    font-size: 0.93rem;
}
.member-name {
    flex: 1;
}

.share-link {
    padding: 8px 12px;
    background: var(--surface-4);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.85rem;
}
.share-link code {
    word-break: break-all;
    font-size: 0.82rem;
}

.danger-zone {
    border-color: var(--danger-border);
}
.danger-zone h2 {
    color: var(--danger-strong);
}
.btn-danger {
    padding: 8px 18px;
    background: var(--danger-strong);
    color: #fff;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.9rem;
}
.btn-danger:hover {
    background: var(--danger-strong);
}

/* Training form ------------------------------------------------------------ */

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
}
.toggle-label {
    font-size: 0.95rem;
    color: var(--fg);
    font-weight: 500;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    inset: 0;
    background: var(--line);
    border-radius: 24px;
    cursor: pointer;
    transition: 0.2s;
}
.slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: var(--surface);
    border-radius: 50%;
    transition: 0.2s;
}
.switch input:checked + .slider {
    background: var(--accent-bg);
}
.switch input:checked + .slider::before {
    transform: translateX(20px);
}

.number-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.number-row input {
    width: 70px;
}

.time-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}
.time-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.time-row input[type="time"] {
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.93rem;
}
.btn-add-time {
    background: none;
    border: 1px dashed var(--line);
    border-radius: 6px;
    padding: 5px 12px;
    cursor: pointer;
    color: var(--muted);
    font-size: 0.88rem;
    width: fit-content;
}
.btn-add-time:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.btn-remove-time {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 0.85rem;
    padding: 2px 6px;
}
.btn-remove-time:hover {
    color: var(--danger-strong);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: var(--fg);
}

/* Voting =================================================================== */

.vote-widget {
    display: flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 2px 4px;
    background: var(--surface);
}

.vote-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 0.8rem;
    padding: 3px 6px;
    border-radius: 5px;
    line-height: 1;
    transition:
        color 0.12s,
        background 0.12s;
}
.vote-btn:hover {
    color: var(--accent);
    background: var(--accent-soft);
}
.vote-btn.active {
    color: var(--accent);
    font-weight: 700;
}
.vote-up.active {
    color: var(--ok-strong);
}
.vote-down.active {
    color: var(--danger-strong);
}

.vote-score {
    font-size: 0.88rem;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
    color: var(--muted);
}
.vote-score.pos {
    color: var(--ok-strong);
}
.vote-score.neg {
    color: var(--danger-strong);
}

/* Relations ================================================================ */

.relations-section {
}
.rel-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.rel-type-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    min-width: 90px;
}
.rel-link {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding: 3px 10px;
    border: 1px solid var(--line);
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--fg);
    background: var(--surface-2);
}
.rel-link:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    text-decoration: none;
    color: var(--accent);
}
.rel-remove {
    font-size: 0.72rem;
    color: var(--muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 1px 3px;
}
.rel-remove:hover {
    color: var(--danger-strong);
}

/* Relations table (shown when relations carry AI descriptions) */
.relations-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 14px;
    font-size: 0.9rem;
}
.relations-table caption {
    text-align: left;
    margin-bottom: 4px;
    padding: 0;
}
.relations-table td {
    border-top: 1px solid var(--line);
    padding: 8px 10px;
    vertical-align: top;
}
.rel-thai-cell {
    white-space: nowrap;
    width: 1%;
}
.rel-thai-cell .thai {
    font-size: 1.05rem;
}
.rel-thai-cell .rom {
    color: var(--muted);
    margin-top: 2px;
}
.rel-descr-cell {
    width: 49%;
}
.rel-descr-cell .rel-tr {
    display: block;
    color: var(--fg);
}
.rel-descr-cell .rel-diff {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.85rem;
}

.add-relation-form,
.propose-form-details {
    margin-top: 10px;
    cursor: pointer;
}
.add-relation-form summary,
.propose-form-details summary {
    font-size: 0.85rem;
    list-style: none;
}
.add-relation-form summary::marker,
.add-relation-form summary::-webkit-details-marker,
.propose-form-details summary::marker,
.propose-form-details summary::-webkit-details-marker {
    display: none;
}
.propose-form-details > .propose-form { margin-top: .5rem; }

.relation-form {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    align-items: center;
}
.rel-type-select,
.rel-kind-select {
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.88rem;
}
.rel-target-input {
    flex: 1;
    min-width: 140px;
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.95rem;
}
.rel-target-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Example proposals ======================================================== */

.propose-section {
}
.propose-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}
.propose-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.propose-input {
    flex: 1;
    min-width: 160px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.93rem;
}
.propose-input:focus {
    outline: none;
    border-color: var(--accent);
}
.thai-input {
    font-size: 1.1rem !important;
}

/* Leaderboard ============================================================== */

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
}
.leaderboard-table th {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 2px solid var(--line);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    cursor: default;
}
.leaderboard-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
}
.leaderboard-table tr:last-child td {
    border-bottom: none;
}
.leaderboard-table tr:hover td {
    background: var(--accent-soft);
}
.leaderboard-table tr.me td {
    background: var(--warn-bg);
}

.rank {
    color: var(--muted);
    font-size: 0.85rem;
    width: 32px;
}
.lb-name {
    font-weight: 500;
}
.lb-stars {
    letter-spacing: -1px;
}
.lb-votes.pos {
    color: var(--ok-strong);
    font-weight: 600;
}
.lb-votes.neg {
    color: var(--danger-strong);
    font-weight: 600;
}

/* AI request / articles ==================================================== */

.no-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ai-request-prompt {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: linear-gradient(135deg, var(--violet-bg), var(--info-bg));
    border: 1px solid var(--violet-border);
    border-radius: 10px;
    flex-wrap: wrap;
}
.ai-request-prompt p {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.btn-ai-request {
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--violet-strong), var(--info-strong));
    color: #fff;
    border-radius: 7px;
    font-size: 0.9rem;
    white-space: nowrap;
}
.btn-ai-request:hover {
    opacity: 0.88;
    text-decoration: none;
}

/* Article page ------------------------------------------------------------- */

.article-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.article-pending {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 48px 24px;
    text-align: center;
    color: var(--muted);
}
.article-pending p {
    margin: 0;
}

.ai-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.article-failed {
    padding: 24px;
}

/* Analysis result rendering ------------------------------------------------ */

.analysis-head {
    border-bottom: 1px solid var(--line);
    padding-bottom: 16px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.analysis-thai {
    font-size: 2.8rem;
    margin: 0;
}
.analysis-rom {
    font-size: 1.15rem;
    color: var(--rom);
    margin: 0;
}
.analysis-ipa {
    font-size: 0.95rem;
    color: var(--muted);
    margin: 0;
    font-family: monospace;
}

/* Rom + IPA on one line in the merged article header */
.analysis-rom-line {
    margin: .25rem 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .75rem;
}

/* AI-correction line is stored on the record (admin can still see it via
   the editor) but hidden from the public view per design. */
.article-corrections { display: none; }

/* Obsolete-word banner */
.obsolete-banner {
    margin: 0 0 1rem;
    padding: .75rem 1rem;
    background: var(--warn-bg);
    border-left: 4px solid var(--warn-border);
    color: var(--warn-fg);
    border-radius: 0 6px 6px 0;
    font-size: .95rem;
}
.obsolete-banner b { color: var(--warn-fg); }
.obsolete-modern { font-size: 1.15rem; margin-left: .25rem; }
.obsolete-tag {
    font-size: .65em;
    vertical-align: middle;
    background: var(--warn-bg);
    color: var(--warn-fg);
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: .5rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* Related-words section under the analysis */
.analysis-related .related-row {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    flex-wrap: wrap;
    margin: .25rem 0;
    font-size: 1.05rem;
}
.analysis-related .related-label {
    font-size: .85rem;
    color: var(--muted, #666);
    text-transform: uppercase;
    letter-spacing: .04em;
    min-width: 7rem;
}
.analysis-related .related-link {
    color: var(--fg);
    border-bottom: 1px dotted var(--accent, var(--info-border));
    text-decoration: none;
}
.analysis-related .related-link:hover {
    color: var(--accent, var(--info-border));
}

/* ── Translation training ─────────────────────────────────────────────── */
.translate-page { max-width: 760px; margin: 0 auto; padding: 24px 16px 80px; }
.train-progress { color: var(--muted); margin-bottom: .75rem; }

.translate-card { background: var(--surface); padding: 1.5rem; border: 1px solid var(--line);
                  border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }

.translate-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .9rem; }
.translate-level-chip {
    font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
    padding: 2px 8px; border-radius: 999px;
    background: var(--accent-soft); color: var(--accent);
}
.translate-level-chip.lvl-0 { background: var(--line); color: var(--rom); }
.translate-level-chip.lvl-1 { background: var(--ok-bg); color: var(--ok-fg); }
.translate-level-chip.lvl-2 { background: var(--warn-bg); color: var(--warn-fg); }
.translate-level-chip.lvl-3 { background: var(--danger-bg); color: var(--danger-fg); }

.prompt-en { font-size: 1.1rem; margin: .3rem 0; color: var(--eng); }
.prompt-ru { font-size: 1.05rem; margin: .3rem 0 1.1rem; color: var(--rom); font-style: italic; }

.token-bank, .answer-row {
    display: flex; flex-wrap: wrap; gap: .45rem;
    padding: .6rem; border-radius: 10px;
}
.answer-row {
    background: var(--surface-4);
    border: 1px dashed var(--line);
    min-height: 3rem;
    margin-bottom: .75rem;
}
.token-bank {
    background: var(--surface);
    border: 1px solid var(--line);
}

.token-pill {
    font-family: inherit; font-size: 1.1rem;
    padding: .45rem 1rem;
    border-radius: 999px;
    background: var(--violet-bg); color: var(--violet-fg);
    border: 1px solid var(--violet-border);
    cursor: grab;
    user-select: none;
    transition: background .12s, transform .08s, opacity .12s;
}
.token-pill:hover { background: var(--violet-border); }
.token-pill:active { transform: translateY(1px); cursor: grabbing; }
.token-pill.dragging { opacity: .45; cursor: grabbing; }

.answer-row .token-pill {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: rgba(153,51,102,.35);
}

.gap-sentence {
    font-size: 1.4rem;
    line-height: 2;
    margin: .8rem 0 1rem;
    text-align: center;
    color: var(--fg);
}
.gap-input {
    display: inline-block;
    font: inherit;
    font-size: 1.3rem;
    width: 8rem;
    padding: 4px 10px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: var(--surface);
    vertical-align: baseline;
}
.gap-input:focus { outline: 2px solid var(--accent-soft); }

.translate-actions {
    display: flex; gap: .75rem; align-items: center; margin-top: 1rem;
}
.btn-translate-submit:disabled {
    opacity: .55; cursor: not-allowed; background: var(--line-strong);
}
.btn-translate-help {
    font: inherit; font-size: .9rem;
    padding: 6px 14px;
    background: transparent; border: 1px dashed var(--muted); color: var(--muted);
    border-radius: 999px; cursor: pointer;
}
.btn-translate-help:hover { background: var(--surface-3); color: var(--fg); border-color: var(--fg); }

.translate-learning .translate-thai { font-size: 2.2rem; margin: .5rem 0 .2rem; }
.translate-learning .rom { margin: 0 0 .8rem; }
.translate-learning .meaning-en { font-size: 1.05rem; margin: .15rem 0; }
.translate-learning .meaning-ru { font-size: 1.05rem; margin: .15rem 0 1rem; color: var(--rom); }

.translate-feedback {
    background: var(--surface); padding: 1.4rem; border-radius: 12px;
    border: 1px solid var(--line); text-align: center;
}
.translate-feedback.fb-correct { border-color: var(--ok-border); background: var(--ok-bg); }
.translate-feedback.fb-wrong   { border-color: var(--danger-border); background: var(--danger-bg); }
.translate-feedback .fb-result { font-size: 1.5rem; font-weight: 600; margin: 0 0 .25rem; }
.fb-correct .fb-result { color: var(--ok-fg); }
.fb-wrong   .fb-result { color: var(--danger-fg); }
.translate-feedback .thai { font-size: 1.3rem; }

/* ── Lesson preparation ─────────────────────────────────────────────── */
.prep-page { max-width: 880px; margin: 1.5rem auto; padding: 0 1rem 4rem; }
.prep-head {
    display: flex; justify-content: space-between; align-items: baseline;
    flex-wrap: wrap; gap: 1rem; margin-bottom: .25rem;
}
.prep-head h1 { font-size: 1.4rem; margin: 0; }
.prep-cta { display: flex; gap: .5rem; }

.prep-card {
    margin: 1.4rem 0;
    padding: 1rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-4);
}
.prep-card h2 { font-size: 1.05rem; margin: 0 0 .25rem; }
.prep-buttons { display: flex; gap: .6rem; margin-top: .6rem; flex-wrap: wrap; }

.prep-status .prep-summary {
    display: flex; align-items: center; flex-wrap: wrap; gap: .35rem;
    padding: .6rem .8rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
    margin: 1rem 0;
}
.prep-status .prep-done { font-weight: 700; color: var(--ok-fg); font-size: 1.1rem; }
.prep-status .prep-total { color: var(--muted); font-size: 1.1rem; }
.prep-finished-tag {
    margin-left: auto;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--ok-bg); color: var(--ok-fg);
    font-size: .8rem; font-weight: 600;
}

.prep-rows {
    list-style: none; margin: 0; padding: 0;
    border: 1px solid var(--line); border-radius: 8px;
    overflow: hidden; background: var(--surface);
}
.prep-row {
    display: flex; align-items: center; gap: .6rem;
    padding: .45rem .8rem;
    border-bottom: 1px solid var(--line);
}
.prep-row:last-child { border-bottom: none; }
.prep-row .thai { font-size: 1.05rem; flex: 1; color: var(--fg); text-decoration: none; }
.prep-row .thai:hover { color: var(--accent); }
.prep-row-done   { background: var(--ok-bg); }
.prep-row-failed { background: var(--danger-bg); }
.prep-row-pending,
.prep-row-processing { background: var(--warn-bg); }
.prep-te-tag {
    font-size: .72rem; color: var(--ok-fg);
    padding: 1px 6px; border-radius: 999px; background: var(--ok-bg);
}
.prep-err { color: var(--danger-strong); cursor: help; }

/* POS chips — used in entry/article headers and search rows */
.pos-chip-row {
    display: inline-flex;
    flex-wrap: wrap;
    gap: .3rem;
    vertical-align: middle;
    margin-left: .5rem;
    font-family: ui-sans-serif, system-ui, sans-serif;
}
.pos-chip {
    display: inline-block;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--violet-bg);
    color: var(--violet-fg);
    line-height: 1.4;
}
.pos-chip-sm {
    font-size: .62rem;
    padding: 1px 6px;
}
/* Distinct color per common POS so the eye groups them quickly */
.pos-chip:where([class~="pos-chip"]) { background: var(--violet-bg); color: var(--violet-fg); }
/* Anchor-based selectors below pick by text content via [data-pos] would be cleaner,
   but to keep templates simple we just colour-shift via the few named classes
   the AI emits today: */

/* Senses section */
.senses-section .sense-card {
    margin: .9rem 0;
    padding: .85rem 1rem;
    border: 1px solid var(--line, var(--line));
    border-left: 4px solid var(--violet-border);
    border-radius: 8px;
    background: var(--surface-4);
}
.senses-section .sense-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    margin-bottom: .4rem;
}
.senses-section .sense-meaning { margin: .15rem 0; }
.senses-section .sense-classifier .thai { font-size: 1rem; }
.senses-section .sense-examples { margin-top: .5rem; }

/* Search row: lay chips on a new line under the def so they don't push layout */
.result-pos {
    display: flex;
    gap: .25rem;
    margin-top: .15rem;
    margin-left: 0;
}

.analysis-section {
    margin: 22px 0;
}
.analysis-section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    margin: 0 0 12px;
}

/* Etymology — collapsed by default, summary styled like a section header. */
.etymology-toggle {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.etymology-toggle::-webkit-details-marker { display: none; }
.etymology-toggle::before {
    content: "▸ ";
    display: inline-block;
    transition: transform 0.15s ease;
}
.etymology-box[open] > .etymology-toggle::before {
    content: "▾ ";
}
.etymology-body {
    margin-top: 10px;
}

.component-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.component-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.comp-thai {
    font-size: 1.6rem;
}
.comp-rom {
    color: var(--rom);
    font-size: 0.9rem;
}
.comp-ipa {
    font-size: 0.82rem;
    color: var(--muted);
    font-family: monospace;
}
.comp-meaning.en {
    font-size: 0.92rem;
}
.comp-meaning.ru {
    font-size: 0.9rem;
    color: var(--accent);
    font-style: italic;
}
/* Morphology breakdown shown when a search finds no dictionary match. */
.morph-fallback { margin: 1rem 0 1.25rem; text-align: left; }
.morph-fallback .morph-rom-block {
    margin: .5rem 0 .75rem; padding: .6rem .9rem;
    background: var(--surface, var(--surface-4)); border-radius: 6px;
}
.morph-fallback .morph-rom-block .rom { font-size: 1.25rem; font-weight: 600; }
.morph-fallback .morph-rom-block .cyr-rom { font-size: 1.05rem; margin-top: .2rem; }
.component-card.unresolved {
    background: var(--surface, #f4f4f5);
    border-style: dashed;
    color: var(--muted, #555);
}
.component-card.unresolved .unresolved-text {
    color: var(--muted, #555);
    text-decoration: line-through dotted rgba(0,0,0,.3);
}
.comp-tone {
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: 2px;
}
.tone-name {
    font-weight: 600;
}

.meaning-en {
    font-size: 1rem;
    margin: 0 0 4px;
}
.meaning-ru {
    font-size: 0.96rem;
    color: var(--accent);
    font-style: italic;
    margin: 0 0 6px;
}
.grammar-note {
    margin: 6px 0 0;
}

.analysis-examples {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.analysis-examples li {
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}
.analysis-examples li:last-child {
    border-bottom: none;
}
.analysis-examples .ex-thai {
    font-size: 1.1rem;
    margin-bottom: 2px;
}
.analysis-examples .ex-en {
    font-size: 0.92rem;
    color: var(--eng);
}
.analysis-examples .ex-ru {
    font-size: 0.9rem;
    color: var(--accent);
    font-style: italic;
}

/* Status badges ------------------------------------------------------------ */

.status-badge {
    display: inline-block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 8px;
    border-radius: 999px;
}
.status-pending {
    background: var(--warn-bg);
    color: var(--warn-fg);
}
.status-processing {
    background: var(--info-bg);
    color: var(--info-fg);
}
.status-done {
    background: var(--ok-bg);
    color: var(--ok-fg);
}
.status-failed {
    background: var(--danger-bg);
    color: var(--danger-fg);
}

/* Verification badges ------------------------------------------------------ */

.verified-badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}
.verified-admin {
    background: var(--ok-bg);
    color: var(--ok-strong);
}
.verified-ai {
    background: var(--violet-bg);
    color: var(--violet-strong);
}

.unverified-disclaimer {
    margin: 12px 0;
    padding: 10px 14px;
    background: var(--warn-bg);
    border: 1px solid var(--warn-border);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--warn-fg);
}

.btn-ai-analysis {
    padding: 5px 12px;
    background: linear-gradient(135deg, var(--violet-strong), var(--info-strong));
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.88rem;
    text-decoration: none;
    display: inline-block;
}
.btn-ai-analysis:hover {
    opacity: 0.88;
    color: #fff;
    text-decoration: none;
}

.btn-reanalyze {
    padding: 5px 12px;
    background: none;
    border: 1px solid var(--violet-strong);
    color: var(--violet-strong);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.88rem;
}
.btn-reanalyze:hover {
    background: var(--violet-bg);
}

/* Inline collapse-form variant of the Reanalyze button */
.reanalyze-box {
    display: inline-block;
    vertical-align: middle;
}
.reanalyze-box > summary.btn-reanalyze {
    list-style: none;
    display: inline-block;
}
.reanalyze-box > summary.btn-reanalyze::-webkit-details-marker { display: none; }
.reanalyze-form {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    margin-top: .5rem;
    padding: .6rem .75rem;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--surface-2);
    max-width: 420px;
}
.reanalyze-form textarea {
    font: inherit;
    padding: .4rem .5rem;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    resize: vertical;
}
.btn-reanalyze-submit {
    align-self: flex-start;
    padding: 5px 12px;
    background: var(--violet-strong);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.88rem;
}
.btn-reanalyze-submit:hover { background: var(--violet-strong); }

.article-request { margin: .25rem 0; }
.article-corrections {
    margin: .25rem 0;
    padding: .25rem .55rem;
    background: var(--warn-bg);
    border-left: 3px solid var(--warn-border);
    color: var(--warn-fg);
    border-radius: 0 4px 4px 0;
    display: inline-block;
}
.article-corrections .corr-label { font-weight: 600; }

/* Tiny icon next to each Thai example sentence — opens /morphology */
.morphology-link {
    display: inline-block;
    margin-left: .35rem;
    font-size: .85rem;
    color: var(--muted, #888);
    text-decoration: none;
    vertical-align: middle;
    padding: 0 .25rem;
    border-radius: 3px;
}
.morphology-link:hover {
    color: var(--accent, var(--info-border));
    background: rgba(59,130,246,.08);
}

/* Shared 🔊 Speak button — used on /romanize and /morphology */
.tts-speak-btn {
    display: inline-block;
    font: inherit;
    font-size: .9rem;
    padding: .25rem .7rem;
    background: var(--surface-3);
    border: 1px solid var(--line-strong);
    color: var(--neutral-fg);
    border-radius: 999px;
    cursor: pointer;
    vertical-align: middle;
    margin-right: .5rem;
}
.tts-speak-btn:hover { background: var(--violet-bg); border-color: var(--violet-border); color: var(--violet-fg); }
.tts-speak-btn.tts-loading { opacity: .5; cursor: progress; }
.tts-speak-btn.tts-error  { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-fg); }
.tts-speak-btn.tts-anon {
    opacity: .55;
    cursor: help;
    background: var(--surface-3);
    color: var(--muted);
    border-style: dashed;
}
.tts-speak-btn.tts-anon::after {
    content: " — sign in";
    font-size: .75rem;
    color: var(--muted);
    margin-left: .3rem;
}
.tts-speak-btn.tts-anon.tts-inline::after { content: ""; }
.tts-speak-btn.tts-anon:hover {
    background: var(--line);
    color: var(--neutral-fg);
    border-color: var(--muted);
}

/* "gen audio" — matches .btn-ai-analysis so the two sit cleanly side by side */
.gen-audio-form { display: inline-block; }
.btn-gen-audio {
    padding: 5px 12px;
    background: linear-gradient(135deg, var(--ok-strong), var(--info-strong));
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.88rem;
    text-decoration: none;
    display: inline-block;
}
.btn-gen-audio:hover {
    opacity: 0.88;
    color: #fff;
    text-decoration: none;
}
.tts-speak-btn.tts-inline {
    padding: 0 .35rem;
    font-size: .8rem;
    margin: 0 .25rem 0 0;
    float: right;
}

/* Component link in analysis */
.comp-thai-link {
    color: var(--fg);
    border-bottom: 1px dotted var(--accent);
    text-decoration: none;
    font-size: 1.6rem;
}
.comp-thai-link:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
    text-decoration: none;
}

.btn-verify {
    padding: 5px 12px;
    background: var(--ok-strong);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.88rem;
}
.btn-verify:hover {
    background: var(--ok-fg);
}

/* File input --------------------------------------------------------------- */

input[type="file"] {
    padding: 6px 0;
    font-size: 0.93rem;
    color: var(--muted);
}

/* My requests list --------------------------------------------------------- */

.request-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}
.request-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--line);
}
.request-row:last-child {
    border-bottom: none;
}
.request-text {
    font-size: 1.15rem;
    flex: 1;
}

/* Training mode ============================================================ */

.train-page {
    max-width: 600px;
    margin: 0 auto;
    padding: 24px 20px 80px;
}

/* Progress header ---------------------------------------------------------- */

.train-header {
    margin-bottom: 24px;
}

.train-progress-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.train-counter {
    font-size: 0.88rem;
    color: var(--muted);
    white-space: nowrap;
}
.train-bar-wrap {
    flex: 1;
}
.train-bar-wrap.wide {
    width: 200px;
    flex: none;
}
.train-bar {
    height: 6px;
    background: var(--line);
    border-radius: 99px;
    overflow: hidden;
}
.train-bar-fill {
    height: 100%;
    background: var(--accent-bg);
    border-radius: 99px;
    transition: width 0.3s ease;
}
.train-bar-fill.fill-done {
    background: var(--ok-strong);
}
.train-daily {
    font-size: 0.88rem;
    color: var(--muted);
    white-space: nowrap;
}
.train-daily.daily-done {
    color: var(--ok-strong);
    font-weight: 600;
}

/* Card --------------------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

/* Front state: back is hidden */
.card[data-flipped="0"] .card-back {
    display: none;
}
/* Back state: the show-button hint is gone */
.card[data-flipped="1"] .card-front {
    display: none;
}

.card-front {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    gap: 12px;
    text-align: center;
}

.card-thai {
    font-size: 3.2rem;
    line-height: 1.2;
    font-family: -apple-system, "Sukhumvit Set", "Tahoma", sans-serif;
}

.card-rom {
    font-size: 1.2rem;
    color: var(--rom);
}

.card-rom-tones {
    font-size: 0.95rem;
    font-family: "Georgia", "Times New Roman", serif;
    color: var(--rom);
    letter-spacing: 0.02em;
}

.card-rom-db {
    font-size: 0.8rem;
    color: var(--muted);
}

.card-audio {
    display: block;
    margin: 0.6rem auto 0;
    height: 32px;
    width: 100%;
    max-width: 280px;
}

.card-tone {
    font-size: 0.85rem;
    color: var(--muted);
    background: var(--surface-3);
    padding: 2px 8px;
    border-radius: 4px;
}

.btn-show {
    margin-top: 16px;
    padding: 10px 28px;
    background: var(--accent-bg);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-show:hover {
    opacity: 0.88;
}
.btn-show kbd {
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.25);
    padding: 1px 5px;
    border-radius: 3px;
}

/* Card back --------------------------------------------------------------- */

.card-back {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px 28px;
    gap: 0;
}

.back-thai {
    font-size: 2rem;
    margin-bottom: 4px;
}

.card-defs {
    list-style: none;
    margin: 12px 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.card-defs li {
    line-height: 1.5;
}
.card-defs .def-en {
    font-size: 1rem;
}
.card-defs .def-ru {
    font-size: 0.92rem;
    color: var(--accent);
    font-style: italic;
    margin-top: 1px;
}

.card-examples {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    border-top: 1px solid var(--line);
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ex-thai {
    font-size: 1.05rem;
}
.ex-rom {
    font-size: 0.85rem;
    color: var(--rom);
}
.ex-en {
    font-size: 0.9rem;
    color: var(--eng);
}
.ex-ru {
    font-size: 0.88rem;
    color: var(--accent);
    font-style: italic;
}

/* Rating buttons ---------------------------------------------------------- */

.rating-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.rating-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    background: var(--surface);
    transition:
        background 0.12s,
        border-color 0.12s;
    position: relative;
}
.rating-btn kbd {
    position: absolute;
    top: 4px;
    right: 5px;
    font-size: 0.68rem;
    color: var(--muted);
    background: var(--surface-3);
    padding: 1px 4px;
    border-radius: 3px;
}
.rating-label {
    font-size: 0.92rem;
    font-weight: 600;
}
.rating-hint {
    font-size: 0.74rem;
    color: var(--muted);
}

.rating-again {
    border-color: var(--danger-border);
}
.rating-again:hover,
.rating-again.htmx-request {
    background: var(--danger-bg);
    border-color: var(--danger-border);
}
.rating-again .rating-label {
    color: var(--danger-strong);
}

.rating-hard:hover,
.rating-hard.htmx-request {
    background: var(--warn-bg);
    border-color: var(--warn-border);
}
.rating-hard .rating-label {
    color: var(--warn-fg);
}

.rating-good:hover,
.rating-good.htmx-request {
    background: var(--ok-bg);
    border-color: var(--ok-border);
}
.rating-good .rating-label {
    color: var(--ok-strong);
}

.rating-easy:hover,
.rating-easy.htmx-request {
    background: var(--info-bg);
    border-color: var(--info-border);
}
.rating-easy .rating-label {
    color: var(--info-strong);
}

/* Loading spinner ---------------------------------------------------------- */

.train-spinner {
    display: none;
    text-align: center;
    color: var(--muted);
    padding: 12px;
    font-size: 0.88rem;
}
.train-spinner.htmx-request {
    display: block;
}
.train-spinner::after {
    content: "Loading…";
}

/* Session-done state ------------------------------------------------------- */

.train-done {
    text-align: center;
    padding: 48px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.done-icon {
    font-size: 3rem;
}
.train-done h2 {
    margin: 0;
    font-size: 1.6rem;
}
.train-done p {
    color: var(--muted);
    margin: 0;
}

.done-day-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 0.92rem;
    color: var(--muted);
    margin: 8px 0;
}

.done-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 8px;
}

.ahead-box {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    background: linear-gradient(135deg, var(--ok-bg), var(--info-bg));
    border: 1px solid var(--ok-bg);
    border-radius: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 6px 0;
}
.ahead-box p {
    margin: 0;
    font-size: 0.93rem;
}

/* ========================================================================== */
@media (max-width: 640px) {
    ul.results li.result .result-link {
        grid-template-columns: 1fr auto;
        gap: 4px;
    }
    ul.results .rom,
    ul.results .def {
        grid-column: 1 / -1;
    }
    .kind-tag {
        grid-column: 2;
        grid-row: 1;
    }
    ol.components li {
        grid-template-columns: 1fr;
    }
    .result-save {
        display: none;
    }

    .card-thai {
        font-size: 2.4rem;
    }
    .rating-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .rating-btn kbd {
        display: none;
    }

    /* Compact header: stack user-nav on top, brand + search below.
       Non-sticky on mobile — too tall to pin. */
    .site-header {
        position: relative;
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 12px;
    }
    .site-header .user-nav {
        order: -1;
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
        white-space: normal;
        row-gap: 6px;
    }
}

.site-footer {
    margin-top: 3rem;
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 1.2rem;
    justify-content: center;
}
.site-footer a {
    font-size: 0.8rem;
    color: var(--muted);
    text-decoration: none;
}
.site-footer a:hover {
    color: var(--muted);
}

/* ── Unified train: recognition tiles, inline feedback ───────────────── */
.recognition-card {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
}
.recognition-thai {
    font-size: 2.6rem;
    margin: .6rem 0 .2rem;
}
.recognition-rom {
    color: var(--muted);
    margin: 0 0 .4rem;
}
.recognition-prompt {
    margin: 1rem 0 .6rem;
}
.recognition-tiles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .6rem;
    margin: .4rem 0 1rem;
}
.recognition-tile {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    padding: .9rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--line-strong);
    background: var(--surface-4);
    cursor: pointer;
    text-align: left;
    font-size: 1rem;
    line-height: 1.3;
    transition: background .12s ease, border-color .12s ease;
}
.recognition-tile:hover {
    background: var(--violet-bg);
    border-color: var(--violet-border);
}
.recognition-tile .tile-en { font-weight: 500; }
.recognition-tile .tile-ru { color: var(--muted); font-size: .85rem; }

@media (max-width: 540px) {
    .recognition-tiles { grid-template-columns: 1fr; }
}

/* Inline feedback banner shown above a retried translate card. */
.card-feedback {
    background: var(--warn-bg);
    border: 1px solid var(--warn-border);
    color: var(--warn-fg);
    padding: .5rem .8rem;
    border-radius: 8px;
    margin: 0 0 .8rem;
    font-weight: 500;
}

/* Reuse the existing .translate-feedback / .fb-correct / .fb-wrong palette
   for the unified .train-feedback fragment. */
.train-feedback {
    max-width: 480px;
    margin: 1.2rem auto;
    padding: 1rem;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    text-align: center;
}
.train-feedback.fb-correct { border-color: var(--ok-border); background: var(--ok-bg); }
.train-feedback.fb-wrong   { border-color: var(--danger-border); background: var(--danger-bg); }
.train-feedback .fb-result { font-size: 1.5rem; font-weight: 600; margin: 0 0 .25rem; }
.train-feedback.fb-correct .fb-result { color: var(--ok-fg); }
.train-feedback.fb-wrong   .fb-result { color: var(--danger-fg); }
.train-feedback .thai      { font-size: 1.3rem; }
