/* ============================================================================
   SomsanithTech Enterprise — Dictionary / Word Detail Page
   ============================================================================
   Location: assets/css/dictionary.css
   Served at: /assets/css/dictionary.css

   EYE-COMFORT DESIGN (long-read safe)
   ----------------------------------------------------------------------------
   Design principles for hours of comfortable reading:
     1. Warm off-white canvas (never pure #ffffff) — reduces glare
     2. Warm dark text (never pure black) — reduces harsh contrast
     3. Contrast ~8–10:1, not 21:1 — restful but still very readable
     4. Amber / honey accents instead of blue-violet — no blue-light strain
     5. Larger body text (17px), longer line-height (1.85) — easier tracking
     6. Warm-toned reading highlight — visible but never glaring
     7. Soft shadows, no harsh edges, muted hover transitions
     8. Optional warm-night mode via prefers-color-scheme

   EMOJI-SAFE (this revision)
   ----------------------------------------------------------------------------
     · No gradient-text clipping anywhere — every heading uses a solid fill
     · Full color-emoji font stack appended to every text font-family
     · font-feature-settings stripped from headings (preserves flag ligatures)
     · Result: 🇬🇧 🌍 📖 🌱 and every emoji renders in full native color
   ============================================================================ */

/* ----------------------------------------------------------------------------
   1. Design tokens — warm, low-strain palette
   ---------------------------------------------------------------------------- */
:root {
    /* ---- Warm brand family (amber / terracotta) -------------------------- */
    --primary:        #b45309;                 /* warm amber  */
    --primary-dark:   #92400e;
    --primary-soft:   #d97706;
    --primary-light:  #fef3e2;
    --primary-glow:   rgba(180, 83, 9, 0.14);
    --accent:         #a16207;                 /* deeper honey */
    --accent-warm:    #c2410c;                 /* terracotta   */
    --accent-rose:    #9f1239;                 /* muted rose (logo) */

    /* ---- Text — warm darks, never pure black ----------------------------- */
    --text:    #2d2a26;                        /* warm charcoal */
    --text-2:  #3f3a34;
    --muted:   #6b6259;
    --faint:   #9c9187;

    /* ---- Surfaces — warm off-whites, never pure white -------------------- */
    --background:     #faf6ef;                 /* warm cream   */
    --background-2:   #f4ecdf;
    --white:          #fffdf8;                 /* cream-white  */
    --surface-soft:   #f5efe5;
    --surface-hover:  #efe6d6;

    /* ---- Borders & lines — soft warm greys ------------------------------- */
    --border:        #e8ddcc;
    --border-soft:   #f0e8da;
    --border-strong: #d4c5ad;

    /* ---- Semantic -------------------------------------------------------- */
    --success:      #4d7c0f;                   /* warm olive */
    --success-soft: #65a30d;
    --danger:       #b91c1c;
    --warning:      #b45309;

    /* ---- Structure ------------------------------------------------------- */
    --radius:    20px;
    --radius-sm: 14px;
    --radius-xs: 10px;
    --shadow-sm: 0 1px 2px rgba(90, 70, 40, 0.05);
    --shadow:    0 8px 30px rgba(90, 70, 40, 0.07);
    --shadow-lg: 0 20px 50px -12px rgba(90, 70, 40, 0.15);
    --shadow-xl: 0 25px 60px -15px rgba(180, 83, 9, 0.14);

    /* ---- Reading highlight — warm honey, low strobe --------------------- */
    --read-sentence-bg:      rgba(253, 224, 71, 0.42);   /* warm honey      */
    --read-sentence-outline: rgba(217, 119, 6, 0.55);    /* amber outline   */
    --read-sentence-glow:    rgba(217, 119, 6, 0.14);    /* soft halo       */

    --read-word-bg:          rgba(250, 204, 21, 0.58);   /* deeper honey    */
    --read-word-outline:     rgba(180, 83, 9, 0.65);
    --read-word-glow:        rgba(180, 83, 9, 0.20);

    --read-active-bg:        rgba(180, 83, 9, 0.14);     /* amber tint      */
    --read-active-outline:   rgba(180, 83, 9, 0.42);

    /* ---- Reading rhythm -------------------------------------------------- */
    --reading-size:    17px;
    --reading-leading: 1.85;
    --reading-tracking: 0.005em;

    /* ---- Emoji-safe font stack (NEW) ------------------------------------- */
    /*  Appended to every text font-family so emoji glyphs pick a color font
        instead of falling back to the ambient text color. */
    --emoji-font:
        "Apple Color Emoji",       /* macOS / iOS   */
        "Segoe UI Emoji",          /* Windows 10+   */
        "Segoe UI Symbol",         /* Windows 7–8   */
        "Noto Color Emoji",        /* Linux/Android */
        "Twemoji Mozilla",         /* Firefox       */
        "EmojiOne Color",          /* legacy        */
        sans-serif;
}

/* ----------------------------------------------------------------------------
   2. Reset & base
   ---------------------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

@supports (overflow: clip) {
    html,
    body { overflow-x: clip; }
}

body {
    font-family:
        'Inter',
        -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, Arial, sans-serif,
        var(--emoji-font);          /* ← emoji fallback added */
    color: var(--text);
    background-color: var(--background);
    background-image:
        radial-gradient(at 0% 0%,
            rgba(217, 119, 6, 0.045) 0px, transparent 45%),
        radial-gradient(at 100% 100%,
            rgba(159, 18, 57, 0.030) 0px, transparent 45%);
    background-attachment: fixed;
    line-height: var(--reading-leading);
    letter-spacing: var(--reading-tracking);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    /* font-feature-settings removed — Inter's "ss01" alternate could
       prevent flag emojis from combining into the proper glyph. */
}

button {
    border: 0;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover { color: var(--primary-dark); }

img, svg { max-width: 100%; display: block; }

::selection {
    background: rgba(253, 224, 71, 0.45);
    color: var(--text);
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ============================================================================
   2b. EMOJI SAFETY NET (NEW)
   ============================================================================
   Guarantees every title-like element renders emojis in full color.
   Companion to the emoji-safe font stack in :root and body.
   ============================================================================ */

h1, h2, h3, h4, h5, h6,
.card h2,
.hero h1,
.language-title,
.native-word,
.badge,
.logo,
.section-label {
    /* Real fill — never a transparent gradient cut-out */
    -webkit-text-fill-color: currentColor;
            text-fill-color: currentColor;
    -webkit-background-clip: border-box;
            background-clip: border-box;

    /* Let color-emoji fonts win */
    font-family:
        'Inter',
        -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, Arial, sans-serif,
        var(--emoji-font);

    /* Reset inherited ligatures so flags compose correctly */
    font-feature-settings: normal;
    font-variant-ligatures: normal;
}

/* ============================================================================
   3. READING HIGHLIGHT — warm honey, long-read safe
   ============================================================================ */

/* ---- Sentence mode (soft, wide range) --------------------------------- */
mark,
.highlight,
.reading-highlight,
.tts-sentence-active,
.tts-sentence,
.tts-highlight,
.sentence-active,
.sentence-highlight,
.reader-active,
[data-tts-sentence],
[data-tts-active],
[class*="tts"][class*="sentence"],
[class*="sentence"][class*="active"] {
    background-color: var(--read-sentence-bg);
    color: inherit;                              /* ← keeps text color */
    border-radius: 4px;
    padding: 0.08em 0.18em;
    box-shadow:
        0 0 0 1px var(--read-sentence-outline),
        0 0 10px var(--read-sentence-glow);
    text-decoration: none;
    transition:
        background-color 0.25s ease,
        box-shadow 0.25s ease,
        color 0.25s ease;
}

/* ---- Word mode (slightly stronger, still soft) ------------------------ */
.tts-word-active,
.tts-word,
.tts-speaking,
.word-active,
.word-highlight,
.highlighted-word,
.reading-word,
[data-tts-word],
[class*="tts"][class*="word"],
[class*="word"][class*="active"] {
    background-color: var(--read-word-bg);
    color: inherit;
    border-radius: 3px;
    padding: 0.03em 0.12em;
    box-shadow:
        0 0 0 1.5px var(--read-word-outline),
        0 0 12px var(--read-word-glow);
    text-decoration: none;
}

/* ---- Current reading position (cursor / next-up) ---------------------- */
.reading-current,
.reader-current,
[data-tts-current] {
    background-color: var(--read-active-bg);
    color: inherit;
    border-radius: 4px;
    padding: 0.08em 0.18em;
    box-shadow: 0 0 0 1px var(--read-active-outline);
}

/* ---- Catch inline styles injected by TTS scripts ---------------------- */
.post-content span[style*="background"],
.post-container span[style*="background"],
article span[style*="background"],
.definition-box span[style*="background"],
.example span[style*="background"],
.translation-example span[style*="background"] {
    background-color: var(--read-sentence-bg) !important;
    color: inherit !important;
    border-radius: 4px;
    padding: 0.08em 0.18em;
    box-shadow: 0 0 0 1px var(--read-sentence-outline);
}

/* ---- Highlight inside dark/saturated blocks --------------------------- */
.hero mark,
.hero .highlight,
.hero .reading-highlight,
.hero .tts-sentence-active,
.hero .tts-word-active {
    background-color: rgba(253, 224, 71, 0.55) !important;
    box-shadow: 0 0 0 1px rgba(255, 253, 248, 0.55) !important;
}

/* ============================================================================
   4. Header
   ============================================================================ */
.app-header {
    width: 100%;
    margin: 0;
    padding: 1rem 1.5rem;
    background: rgba(255, 253, 248, 0.92);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.logo span {
    color: var(--accent-rose);
}

.search {
    width: min(380px, 100%);
    padding: 0.75rem 1.15rem;
    border: 1px solid var(--border);
    border-radius: 30px;
    outline: none;
    background: var(--surface-soft);
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.25s ease, box-shadow 0.25s ease,
                background-color 0.25s ease;
}

.search::placeholder { color: var(--faint); }

.search:focus {
    background: var(--white);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

/* ============================================================================
   5. Page shell
   ============================================================================ */
.page {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}

/* ============================================================================
   6. Breadcrumb
   ============================================================================ */
.breadcrumb {
    width: 100%;
    margin: 0;
    padding: 1rem 1.5rem;
    color: var(--muted);
    font-size: 0.9rem;
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.breadcrumb a {
    color: var(--muted);
    font-weight: 600;
}

.breadcrumb a:hover { color: var(--primary); }

/* ============================================================================
   7. Hero — warm gradient (emojis now render in full color)
   ============================================================================ */
.hero {
    width: 100%;
    margin: 0;
    padding: clamp(2.5rem, 5vw, 5rem) clamp(1.5rem, 5vw, 5rem);
    border-radius: 0;
    background:
        radial-gradient(circle at 88% 15%,
            rgba(255, 237, 213, 0.22), transparent 40%),
        radial-gradient(circle at 12% 92%,
            rgba(159, 18, 57, 0.14), transparent 45%),
        linear-gradient(135deg, #7c2d12 0%, #9a3412 45%, #a16207 100%);
    color: #fffdf8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    overflow: hidden;
    position: relative;
    isolation: isolate;
}

.hero::after {
    content: "";
    position: absolute;
    inset: auto -6rem -10rem auto;
    width: 26rem;
    height: 26rem;
    border-radius: 50%;
    background: rgba(255, 237, 213, 0.06);
    z-index: -1;
    pointer-events: none;
}

/* Solid fill — no gradient clipping, no transparent text.
   Emojis render in full native color. */
.hero h1 {
    margin: 0;
    font-size: clamp(2.75rem, 8vw, 6.25rem);
    font-weight: 850;
    letter-spacing: -0.045em;
    line-height: 1;
    color: #fffdf8;
    -webkit-text-fill-color: #fffdf8;
            text-fill-color: #fffdf8;
    -webkit-background-clip: border-box;
            background-clip: border-box;
    background: none;
}

.hero p {
    max-width: 700px;
    font-size: 1.05rem;
    color: rgba(255, 253, 248, 0.88);
    margin-top: 1rem;
    line-height: 1.75;
}

.hero-word {
    font-size: clamp(5.5rem, 15vw, 12rem);
    font-weight: 900;
    opacity: 0.14;
    color: #fffdf8;
    line-height: 1;
    letter-spacing: -0.04em;
    user-select: none;
    flex-shrink: 0;
}

.badge {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    border-radius: 30px;
    background: rgba(255, 253, 248, 0.16);
    border: 1px solid rgba(255, 253, 248, 0.28);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #fffdf8;
}

/* ============================================================================
   8. Full-width content grid
   ============================================================================ */
.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 1.75rem;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 1.75rem;
    align-items: start;
}

.content-grid > * {
    min-width: 0;
}

/* ============================================================================
   9. Cards — warm paper surfaces
   ============================================================================ */
.card {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0 0 1.5rem;
    padding: 2rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--text);
    font-size: var(--reading-size);
    transition:
        box-shadow 0.25s ease,
        border-color 0.25s ease;
}

.card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg);
}

.card h2 {
    margin: 0 0 1rem;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.3;
    -webkit-text-fill-color: var(--text);
            text-fill-color: var(--text);
    -webkit-background-clip: border-box;
            background-clip: border-box;
}

/* ============================================================================
   10. Definition
   ============================================================================ */
.section-label {
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    -webkit-text-fill-color: var(--primary);
            text-fill-color: var(--primary);
}

.definition-box {
    width: 100%;
    margin: 1.15rem 0;
    padding: 1.5rem 1.6rem;
    border-left: 4px solid var(--primary);
    border-radius: 14px;
    background: linear-gradient(135deg,
        #fef3e2 0%,
        #fef9e7 60%,
        #fff7ed 100%);
    color: var(--text);
    font-size: calc(var(--reading-size) + 0.05rem);
    line-height: var(--reading-leading);
    box-shadow: inset 0 1px 0 rgba(255, 253, 248, 0.7);
}

/* ============================================================================
   11. Information grid
   ============================================================================ */
.info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 1rem;
}

.info-item {
    min-width: 0;
    padding: 1.15rem 1.25rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.info-item:hover {
    background: var(--white);
    border-color: var(--border);
}

.info-item strong {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.info-item span {
    font-weight: 700;
    color: var(--text);
    overflow-wrap: anywhere;
    font-size: 0.95rem;
}

/* ============================================================================
   12. Examples
   ============================================================================ */
.example {
    width: 100%;
    margin: 0.75rem 0;
    padding: 1.15rem 1.35rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    color: var(--text-2);
    font-size: 0.98rem;
    line-height: var(--reading-leading);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.example:hover {
    background: var(--white);
    border-color: var(--border);
}

.example em {
    color: var(--muted);
    font-style: italic;
}

/* ============================================================================
   13. Translation grid
   ============================================================================ */
.translation-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 1.25rem;
}

.language-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--white);
    color: var(--text);
    position: relative;
    overflow: hidden;
    transition:
        border-color 0.25s ease,
        box-shadow 0.25s ease;
}

.language-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg,
        var(--primary) 0%,
        var(--accent-warm) 50%,
        var(--accent-rose) 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.language-card:hover {
    border-color: rgba(180, 83, 9, 0.28);
    box-shadow: var(--shadow-xl);
}

.language-card:hover::before {
    opacity: 1;
}

.language-title {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    -webkit-text-fill-color: var(--muted);
            text-fill-color: var(--muted);
}

.native-word {
    margin: 0.9rem 0 0.15rem;
    color: var(--primary);
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    overflow-wrap: anywhere;
    -webkit-text-fill-color: var(--primary);
            text-fill-color: var(--primary);
}

.reading {
    margin-bottom: 0.9rem;
    color: var(--muted);
    font-size: 0.875rem;
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    letter-spacing: 0.01em;
}

.translation-example {
    flex: 1;
    padding: 1rem 1.15rem;
    border-radius: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--border-soft);
    color: var(--text-2);
    font-size: 0.94rem;
    line-height: var(--reading-leading);
    overflow-wrap: anywhere;
}

.audio-button {
    width: 100%;
    margin-top: 1.15rem;
    padding: 0.8rem 1.15rem;
    border-radius: 11px;
    background: linear-gradient(135deg, #b45309 0%, #d97706 100%);
    color: #fffdf8;
    font-weight: 700;
    font-size: 0.92rem;
    box-shadow: 0 4px 14px rgba(180, 83, 9, 0.22);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

.audio-button:hover {
    background: linear-gradient(135deg, #d97706 0%, #ea580c 100%);
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(180, 83, 9, 0.30);
}

.audio-button:active {
    transform: translateY(0);
    box-shadow: 0 3px 10px rgba(180, 83, 9, 0.24);
}

/* ============================================================================
   14. Sidebar
   ============================================================================ */
.sidebar {
    min-width: 0;
}

.sidebar .card {
    position: sticky;
    top: 90px;
}

/* ============================================================================
   15. Pills
   ============================================================================ */
.pill {
    display: inline-block;
    margin: 4px;
    padding: 0.45rem 0.9rem;
    border: 1px solid rgba(180, 83, 9, 0.18);
    border-radius: 20px;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 0.85rem;
    font-weight: 600;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

.pill:hover {
    background: rgba(217, 119, 6, 0.14);
    border-color: rgba(180, 83, 9, 0.32);
    color: var(--primary);
}

/* ============================================================================
   16. Progress
   ============================================================================ */
.progress {
    height: 10px;
    border-radius: 20px;
    background: var(--border);
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(90, 70, 40, 0.06);
}

.progress-bar {
    width: 35%;
    height: 100%;
    border-radius: 20px;
    background: linear-gradient(90deg, #4d7c0f, #65a30d);
    transition: width 0.5s cubic-bezier(.2, .8, .2, 1);
}

/* ============================================================================
   17. Action button
   ============================================================================ */
.action {
    margin-top: 0.75rem;
    padding: 0.85rem 1.35rem;
    border-radius: 11px;
    background: linear-gradient(135deg, #b45309 0%, #d97706 100%);
    color: #fffdf8;
    font-weight: 700;
    font-size: 0.92rem;
    box-shadow: 0 4px 14px rgba(180, 83, 9, 0.22);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

.action:hover {
    background: linear-gradient(135deg, #92400e 0%, #b45309 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(180, 83, 9, 0.30);
}

.action:active {
    transform: translateY(0);
}

/* ============================================================================
   18. Steps
   ============================================================================ */
.steps {
    padding-left: 1.5rem;
    color: var(--text-2);
    line-height: var(--reading-leading);
}

.steps li {
    margin: 0.75rem 0;
    padding-left: 0.25rem;
}

.steps li::marker {
    color: var(--primary);
    font-weight: 800;
}

/* ============================================================================
   19. Footer
   ============================================================================ */
footer {
    width: 100%;
    margin: 0;
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--muted);
    background: var(--white);
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
}

footer a {
    color: var(--primary);
    font-weight: 600;
}

footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ============================================================================
   20. Night mode — for late-evening reading
   ============================================================================ */
@media (prefers-color-scheme: dark) {
    :root {
        --primary:        #fbbf24;
        --primary-dark:   #f59e0b;
        --primary-soft:   #fcd34d;
        --primary-light:  rgba(251, 191, 36, 0.12);
        --primary-glow:   rgba(251, 191, 36, 0.20);
        --accent:         #facc15;
        --accent-warm:    #fb923c;
        --accent-rose:    #fb7185;

        --text:    #efe6d6;
        --text-2:  #d6cbb6;
        --muted:   #a99f8c;
        --faint:   #7c7466;

        --background:     #1c1915;
        --background-2:   #221e19;
        --white:          #262019;
        --surface-soft:   #2a231b;
        --surface-hover:  #332a20;

        --border:        rgba(239, 230, 214, 0.10);
        --border-soft:   rgba(239, 230, 214, 0.06);
        --border-strong: rgba(239, 230, 214, 0.20);

        --read-sentence-bg:      rgba(253, 224, 71, 0.28);
        --read-sentence-outline: rgba(251, 191, 36, 0.55);
        --read-sentence-glow:    rgba(251, 191, 36, 0.14);

        --read-word-bg:          rgba(250, 204, 21, 0.42);
        --read-word-outline:     rgba(251, 191, 36, 0.65);
        --read-word-glow:        rgba(251, 191, 36, 0.20);
    }

    body {
        background-image:
            radial-gradient(at 0% 0%,
                rgba(251, 191, 36, 0.05) 0px, transparent 45%),
            radial-gradient(at 100% 100%,
                rgba(251, 113, 133, 0.03) 0px, transparent 45%);
    }

    .app-header {
        background: rgba(28, 25, 21, 0.92);
    }

    .search:focus {
        background: var(--surface-soft);
    }

    .hero {
        background:
            radial-gradient(circle at 88% 15%,
                rgba(251, 191, 36, 0.14), transparent 40%),
            linear-gradient(135deg, #3d1e0a 0%, #5a2a12 45%, #7c2d12 100%);
    }

    .definition-box {
        background: linear-gradient(135deg,
            rgba(251, 191, 36, 0.10) 0%,
            rgba(251, 146, 60, 0.06) 100%);
    }

    .info-item,
    .example,
    .translation-example {
        background: var(--surface-soft);
    }

    .info-item:hover,
    .example:hover {
        background: var(--surface-hover);
    }
}

/* ============================================================================
   21. Tablet
   ============================================================================ */
@media (max-width: 1100px) {
    .content-grid {
        grid-template-columns: minmax(0, 1fr) 280px;
        padding: 1.25rem;
        gap: 1.25rem;
    }

    .translation-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ============================================================================
   22. Mobile
   ============================================================================ */
@media (max-width: 850px) {
    .content-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1rem;
    }

    .sidebar .card {
        position: static;
    }

    .hero {
        padding: 2.25rem 1.5rem;
    }

    .hero-word {
        display: none;
    }
}

@media (max-width: 650px) {
    :root {
        --reading-size: 16px;
        --reading-leading: 1.75;
    }

    .app-header {
        flex-direction: column;
        align-items: stretch;
        padding: 0.85rem 1rem;
    }

    .breadcrumb {
        padding: 0.85rem 1rem;
    }

    .hero {
        padding: 1.75rem 1.25rem;
    }

    .hero h1 {
        font-size: 2.75rem;
        letter-spacing: -0.03em;
    }

    .content-grid {
        padding: 0.75rem;
        gap: 0.85rem;
    }

    .card {
        padding: 1.35rem;
        border-radius: 16px;
    }

    .info-grid,
    .translation-grid {
        grid-template-columns: 1fr;
    }

    .language-card {
        padding: 1.25rem;
    }

    .native-word {
        font-size: 1.75rem;
    }
}

/* ============================================================================
   23. Small mobile
   ============================================================================ */
@media (max-width: 400px) {
    .hero h1 {
        font-size: 2.25rem;
    }

    .content-grid {
        padding: 0.5rem;
    }

    .card {
        padding: 1.1rem;
    }

    .native-word {
        font-size: 1.5rem;
    }
}

/* ============================================================================
   24. Print — preserve the highlight on paper
   ============================================================================ */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }

    .app-header,
    footer,
    .audio-button,
    .action,
    .search {
        display: none !important;
    }

    .card,
    .language-card {
        background: #ffffff !important;
        border: 1px solid #cccccc !important;
        box-shadow: none !important;
        color: #000000 !important;
    }

    .hero {
        background: #ffffff !important;
        color: #000000 !important;
        border-bottom: 2px solid #000000;
    }

    .hero h1 {
        -webkit-text-fill-color: #000000 !important;
                text-fill-color: #000000 !important;
        color: #000000 !important;
        background: none !important;
    }

    mark,
    .highlight,
    .reading-highlight,
    .tts-sentence-active,
    .tts-word-active {
        background: #fff3b0 !important;
        color: #000000 !important;
        box-shadow: none !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ============================================================================
   25. Reduced motion
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}