/* ================================================================
   English ⇄ Myanmar Dictionary — website styles

   A dictionary should feel calm, literary and unhurried: ink and light.
     1. No flat fills: every page sits on a gradient backdrop with two soft glows.
     2. Glass, not boxes: rounded, translucent cards with a fine light edge, no drop shadow.
     3. English words are set in a serif (Newsreader); Myanmar text in Noto Sans Myanmar; the interface is Inter.
     4. One accent per idea: the theme's primary carries action and translation, a warm gold
        marks parts of speech, tags and favourites.
     5. Readable: the colour themes below keep WCAG AA contrast (4.5:1) for text, links and buttons,
        in light and dark; worker/test/website-design.test.mjs checks every theme and mode.

   Two independent attributes on <html>:
     data-theme       = "light" | "dark"
     data-color-theme = midnight | abyss | slate | forest | paper | arctic
     data-mode        = "en" | "my"   (the search direction; set by script.js)
   ================================================================ */

html { scroll-behavior: smooth; }

/* ================================================================
   COLOUR THEMES
   ================================================================ */
/* BEGIN THEMES — the six palettes, light and dark. Kept as tokens only; change a colour here and re-run `npm test` (worker/) to re-check contrast. */
/* Bare :root is the pre-JS fallback: Midnight, light. */
:root {
  --bg: #f4f4fa;
  --surface: #fcfdfe;
  --surface-low: #f9f9fc;
  --surface-mid: #f2f3f8;
  --surface-high: #edeef5;
  --surface-top: #e8e9f3;
  --border: #d4d6e2;
  --outline: #73768c;
  --text: #141624;
  --text-2: #484c60;
  --accent: #1730d3;
  --on-accent: #ffffff;
  --accent-container: #d5dafc;
  --on-accent-container: #070f40;
  --accent-2: #336d99;
  --accent-2-container: #daeaf6;
  --gold: #915a08;
  --gold-container: #fcedcf;
  --on-gold-container: #442a04;
  --error: #b8281e;
  --error-container: #fce0de;
}

/* Midnight */
[data-color-theme="midnight"][data-theme="light"] {
  --bg: #f4f4fa;
  --surface: #fcfdfe;
  --surface-low: #f9f9fc;
  --surface-mid: #f2f3f8;
  --surface-high: #edeef5;
  --surface-top: #e8e9f3;
  --border: #d4d6e2;
  --outline: #73768c;
  --text: #141624;
  --text-2: #484c60;
  --accent: #1730d3;
  --on-accent: #ffffff;
  --accent-container: #d5dafc;
  --on-accent-container: #070f40;
  --accent-2: #336d99;
  --accent-2-container: #daeaf6;
  --gold: #915a08;
  --gold-container: #fcedcf;
  --on-gold-container: #442a04;
  --error: #b8281e;
  --error-container: #fce0de;
}
[data-color-theme="midnight"][data-theme="dark"] {
  --bg: #0d0f19;
  --surface: #131522;
  --surface-low: #161827;
  --surface-mid: #1b1e2f;
  --surface-high: #212438;
  --surface-top: #282b43;
  --border: #3f425a;
  --outline: #6e7291;
  --text: #e9eaf2;
  --text-2: #b8bbcc;
  --accent: #8896f2;
  --on-accent: #0a0e29;
  --accent-container: #232c67;
  --on-accent-container: #d8ddfd;
  --accent-2: #9cc7e8;
  --accent-2-container: #254056;
  --gold: #f5cc7a;
  --gold-container: #594522;
  --on-gold-container: #fbf0da;
  --error: #f4837b;
  --error-container: #632621;
}

/* Abyss */
[data-color-theme="abyss"][data-theme="light"] {
  --bg: #f7f4f9;
  --surface: #fdfdfd;
  --surface-low: #faf9fb;
  --surface-mid: #f5f3f7;
  --surface-high: #f1eef4;
  --surface-top: #ede9f1;
  --border: #dbd4e2;
  --outline: #7f738c;
  --text: #1b1424;
  --text-2: #534860;
  --accent: #6f17d3;
  --on-accent: #ffffff;
  --accent-container: #e7d5fc;
  --on-accent-container: #220740;
  --accent-2: #a8387f;
  --accent-2-container: #f6daec;
  --gold: #915a08;
  --gold-container: #fcedcf;
  --on-gold-container: #442a04;
  --error: #b8281e;
  --error-container: #fce0de;
}
[data-color-theme="abyss"][data-theme="dark"] {
  --bg: #08070a;
  --surface: #0c0a0e;
  --surface-low: #0e0b11;
  --surface-mid: #100d14;
  --surface-high: #141018;
  --surface-top: #18141d;
  --border: #4c3f5a;
  --outline: #7e6e91;
  --text: #ede9f2;
  --text-2: #c1b8cc;
  --accent: #b988f2;
  --on-accent: #180a29;
  --accent-container: #432367;
  --on-accent-container: #e9d8fd;
  --accent-2: #e89ccc;
  --accent-2-container: #562544;
  --gold: #f5cc7a;
  --gold-container: #594522;
  --on-gold-container: #fbf0da;
  --error: #f4837b;
  --error-container: #632621;
}

/* Slate */
[data-color-theme="slate"][data-theme="light"] {
  --bg: #f5f7f9;
  --surface: #fdfdfd;
  --surface-low: #fafafb;
  --surface-mid: #f4f5f7;
  --surface-high: #eff1f3;
  --surface-top: #eaedf0;
  --border: #d4dbe2;
  --outline: #737f8c;
  --text: #141b24;
  --text-2: #485360;
  --accent: #436d9d;
  --on-accent: #ffffff;
  --accent-container: #d5e7fc;
  --on-accent-container: #072240;
  --accent-2: #29727a;
  --accent-2-container: #daf3f6;
  --gold: #915a08;
  --gold-container: #fcedcf;
  --on-gold-container: #442a04;
  --error: #b8281e;
  --error-container: #fce0de;
}
[data-color-theme="slate"][data-theme="dark"] {
  --bg: #101316;
  --surface: #171b1f;
  --surface-low: #1a1e23;
  --surface-mid: #20252a;
  --surface-high: #262c33;
  --surface-top: #2e353d;
  --border: #3f4c5a;
  --outline: #6e7e91;
  --text: #e9edf2;
  --text-2: #b8c1cc;
  --accent: #a2bbd7;
  --on-accent: #0a1829;
  --accent-container: #344456;
  --on-accent-container: #d8e9fd;
  --accent-2: #9ce0e8;
  --accent-2-container: #255156;
  --gold: #f5cc7a;
  --gold-container: #594522;
  --on-gold-container: #fbf0da;
  --error: #f4837b;
  --error-container: #632621;
}

/* Forest */
[data-color-theme="forest"][data-theme="light"] {
  --bg: #f3faf8;
  --surface: #fcfefd;
  --surface-low: #f9fcfb;
  --surface-mid: #f2f8f6;
  --surface-high: #edf6f2;
  --surface-top: #e7f3ef;
  --border: #d4e2dd;
  --outline: #738c83;
  --text: #14241e;
  --text-2: #486057;
  --accent: #13724f;
  --on-accent: #ffffff;
  --accent-container: #d5fced;
  --on-accent-container: #07402b;
  --accent-2: #2b7482;
  --accent-2-container: #daf1f6;
  --gold: #915a08;
  --gold-container: #fcedcf;
  --on-gold-container: #442a04;
  --error: #b8281e;
  --error-container: #fce0de;
}
[data-color-theme="forest"][data-theme="dark"] {
  --bg: #0d1915;
  --surface: #13231d;
  --surface-low: #162821;
  --surface-mid: #1a3028;
  --surface-high: #203930;
  --surface-top: #274439;
  --border: #3f5a50;
  --outline: #6e9184;
  --text: #e9f2ee;
  --text-2: #b8ccc4;
  --accent: #8decc9;
  --on-accent: #0a291e;
  --accent-container: #26644d;
  --on-accent-container: #d8fdef;
  --accent-2: #9cdbe8;
  --accent-2-container: #254e56;
  --gold: #f5cc7a;
  --gold-container: #594522;
  --on-gold-container: #fbf0da;
  --error: #f4837b;
  --error-container: #632621;
}

/* Paper */
[data-color-theme="paper"][data-theme="light"] {
  --bg: #fbf6f3;
  --surface: #fefdfc;
  --surface-low: #fcfaf9;
  --surface-mid: #f9f5f1;
  --surface-high: #f7f0ec;
  --surface-top: #f4ece6;
  --border: #e2dad4;
  --outline: #8c7d73;
  --text: #241a14;
  --text-2: #605248;
  --accent: #9d5525;
  --on-accent: #ffffff;
  --accent-container: #fce4d5;
  --on-accent-container: #401e07;
  --accent-2: #a8384f;
  --accent-2-container: #f6dae0;
  --gold: #915a08;
  --gold-container: #fcedcf;
  --on-gold-container: #442a04;
  --error: #b8281e;
  --error-container: #fce0de;
}
[data-color-theme="paper"][data-theme="dark"] {
  --bg: #1b120b;
  --surface: #251911;
  --surface-low: #2a1c13;
  --surface-mid: #322218;
  --surface-high: #3c291d;
  --surface-top: #483223;
  --border: #5a4a3f;
  --outline: #917c6e;
  --text: #f2ece9;
  --text-2: #ccc0b8;
  --accent: #e6b494;
  --on-accent: #29160a;
  --accent-container: #5f402a;
  --on-accent-container: #fde7d8;
  --accent-2: #e89cab;
  --accent-2-container: #56252f;
  --gold: #f5cc7a;
  --gold-container: #594522;
  --on-gold-container: #fbf0da;
  --error: #f4837b;
  --error-container: #632621;
}

/* Arctic */
[data-color-theme="arctic"][data-theme="light"] {
  --bg: #f4f8fa;
  --surface: #fcfdfe;
  --surface-low: #f9fbfc;
  --surface-mid: #f2f7f8;
  --surface-high: #edf3f5;
  --surface-top: #e8f0f3;
  --border: #d4dfe2;
  --outline: #73858c;
  --text: #142024;
  --text-2: #485a60;
  --accent: #126f91;
  --on-accent: #ffffff;
  --accent-container: #d5f1fc;
  --on-accent-container: #073140;
  --accent-2: #4f38a8;
  --accent-2-container: #e0daf6;
  --gold: #915a08;
  --gold-container: #fcedcf;
  --on-gold-container: #442a04;
  --error: #b8281e;
  --error-container: #fce0de;
}
[data-color-theme="arctic"][data-theme="dark"] {
  --bg: #0d1619;
  --surface: #131e22;
  --surface-low: #162327;
  --surface-mid: #1b2a2f;
  --surface-high: #213238;
  --surface-top: #283c43;
  --border: #3f535a;
  --outline: #6e8891;
  --text: #e9eff2;
  --text-2: #b8c6cc;
  --accent: #89d5f0;
  --on-accent: #0a2129;
  --accent-container: #245466;
  --on-accent-container: #d8f3fd;
  --accent-2: #ab9ce8;
  --accent-2-container: #2f2556;
  --gold: #f5cc7a;
  --gold-container: #594522;
  --on-gold-container: #fbf0da;
  --error: #f4837b;
  --error-container: #632621;
}

/* Swatches in the theme picker: the theme's primary on its background, in the active mode. */
.theme-swatch-dot--midnight { background: linear-gradient(135deg, #1730d3 50%, #f4f4fa 50%); }
[data-theme="dark"] .theme-swatch-dot--midnight { background: linear-gradient(135deg, #8896f2 50%, #0d0f19 50%); }
.theme-swatch-dot--abyss { background: linear-gradient(135deg, #6f17d3 50%, #f7f4f9 50%); }
[data-theme="dark"] .theme-swatch-dot--abyss { background: linear-gradient(135deg, #b988f2 50%, #08070a 50%); }
.theme-swatch-dot--slate { background: linear-gradient(135deg, #436d9d 50%, #f5f7f9 50%); }
[data-theme="dark"] .theme-swatch-dot--slate { background: linear-gradient(135deg, #a2bbd7 50%, #101316 50%); }
.theme-swatch-dot--forest { background: linear-gradient(135deg, #13724f 50%, #f3faf8 50%); }
[data-theme="dark"] .theme-swatch-dot--forest { background: linear-gradient(135deg, #8decc9 50%, #0d1915 50%); }
.theme-swatch-dot--paper { background: linear-gradient(135deg, #9d5525 50%, #fbf6f3 50%); }
[data-theme="dark"] .theme-swatch-dot--paper { background: linear-gradient(135deg, #e6b494 50%, #1b120b 50%); }
.theme-swatch-dot--arctic { background: linear-gradient(135deg, #126f91 50%, #f4f8fa 50%); }
[data-theme="dark"] .theme-swatch-dot--arctic { background: linear-gradient(135deg, #89d5f0 50%, #0d1619 50%); }
/* END THEMES */


/* ================================================================
   MODE TOKENS — everything derived from the theme tokens above
   (the app's Backdrop.kt toArt() and Surfaces.kt cardFill()/cardEdge(), as CSS)
   ================================================================ */
:root,
[data-theme="light"] {
  /* backdrop: a vertical gradient + two glows of the theme's own colours */
  --art-top:     color-mix(in oklab, var(--bg) 50%, var(--accent-container));
  --art-mid:     color-mix(in oklab, var(--bg) 86%, var(--accent-container));
  --art-bottom:  color-mix(in oklab, var(--bg) 70%, var(--accent-2-container));
  --glow-1:      color-mix(in srgb, var(--accent) 20%, transparent);
  --glow-2:      color-mix(in srgb, var(--accent-2) 15%, transparent);

  /* glass cards (tones: glass, raised, accent, quiet) */
  --glass-a:     color-mix(in srgb, var(--surface-high) 90%, transparent);
  --glass-b:     color-mix(in srgb, var(--surface-mid) 82%, transparent);
  --raised-a:    color-mix(in srgb, var(--surface-top) 96%, transparent);
  --raised-b:    color-mix(in srgb, var(--surface-high) 92%, transparent);
  --quiet-a:     color-mix(in srgb, var(--text) 5%, transparent);
  --quiet-b:     color-mix(in srgb, var(--text) 3%, transparent);
  --edge-a:      rgba(255, 255, 255, 0.95);
  --edge-b:      color-mix(in srgb, var(--border) 55%, transparent);
  --accent-card-a: color-mix(in oklab, var(--accent-container) 90%, var(--gold-container));
  --accent-card-b: color-mix(in oklab, var(--accent-container) 30%, var(--accent-2-container));
  --scrim:       rgba(14, 16, 30, 0.45);
  --popover:     color-mix(in srgb, var(--surface-top) 96%, transparent);
  --popover-shadow: 0 16px 40px rgba(20, 24, 60, 0.18);

  /* derived tones used by older component rules */
  --bg-elevated:  var(--surface);
  --bg-subtle:    color-mix(in srgb, var(--text) 6%, transparent);
  --bg-inset:     color-mix(in srgb, var(--text) 9%, transparent);
  --border-light: color-mix(in srgb, var(--border) 60%, transparent);
  --border-focus: var(--accent);
  --text-3:       color-mix(in srgb, var(--text-2) 82%, var(--bg));
  --text-inverse: var(--on-accent);
  --accent-hover: color-mix(in srgb, var(--accent) 88%, black);
  --accent-subtle: color-mix(in srgb, var(--accent) 10%, transparent);
  --accent-muted:  color-mix(in srgb, var(--accent) 18%, transparent);
  --ring:         0 0 0 3px color-mix(in srgb, var(--accent) 26%, transparent);

  --green:        #0b7a57;
  --green-bg:     color-mix(in srgb, #0b7a57 10%, transparent);
  --orange:       var(--gold);
  --orange-bg:    var(--gold-container);
  --red:          var(--error);
  --red-bg:       var(--error-container);
  --badge-dot:    var(--gold);
}

[data-theme="dark"] {
  --art-top:     color-mix(in oklab, var(--bg) 42%, var(--accent-container));
  --art-mid:     color-mix(in oklab, var(--bg) 84%, var(--accent-container));
  --art-bottom:  color-mix(in oklab, var(--bg) 70%, black);
  --glow-1:      color-mix(in srgb, var(--accent) 30%, transparent);
  --glow-2:      color-mix(in srgb, var(--accent-2) 13%, transparent);

  --glass-a:     color-mix(in srgb, var(--surface-high) 70%, transparent);
  --glass-b:     color-mix(in srgb, var(--surface-mid) 58%, transparent);
  --raised-a:    color-mix(in srgb, var(--surface-top) 88%, transparent);
  --raised-b:    color-mix(in srgb, var(--surface-high) 80%, transparent);
  --edge-a:      color-mix(in srgb, var(--text) 20%, transparent);
  --edge-b:      color-mix(in srgb, var(--text) 5%, transparent);
  --scrim:       rgba(0, 0, 0, 0.6);
  --popover:     color-mix(in srgb, var(--surface-top) 94%, transparent);
  --popover-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);

  --bg-subtle:    color-mix(in srgb, var(--text) 7%, transparent);
  --bg-inset:     color-mix(in srgb, var(--text) 10%, transparent);
  --border-light: color-mix(in srgb, var(--border) 55%, transparent);
  --accent-hover: color-mix(in srgb, var(--accent) 88%, white);
  --accent-subtle: color-mix(in srgb, var(--accent) 14%, transparent);
  --accent-muted:  color-mix(in srgb, var(--accent) 22%, transparent);
  --ring:         0 0 0 3px color-mix(in srgb, var(--accent) 32%, transparent);
  --green:        #4cd6a2;
  --green-bg:     color-mix(in srgb, #4cd6a2 12%, transparent);
}


/* ================================================================
   SHARED TOKENS (shapes follow the app: card 24, button 24, search 28, chip 12)
   ================================================================ */
:root {
  --font:        'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans Myanmar', sans-serif;
  --font-serif:  'Newsreader', 'Iowan Old Style', Georgia, 'Times New Roman', 'Noto Sans Myanmar', serif;
  /* Myanmar (Unicode) script. Pyidaungsu / Myanmar Text are the system fonts on Windows and Android; Noto Sans Myanmar is loaded from Google Fonts. */
  --font-my:     'Noto Sans Myanmar', 'Padauk', 'Pyidaungsu', 'Myanmar Text', 'Myanmar3', sans-serif;
  --max-w:       760px;

  --r-card:      24px;
  --r-btn:       24px;
  --r-search:    28px;
  --r-chip:      12px;
  --r-sm:        8px;
  --r-full:      9999px;
  --radius-sm:   var(--r-sm);
  --radius-md:   16px;
  --radius-lg:   var(--r-card);
  --radius-full: var(--r-full);

  --nav-h:       64px;
  --pill-h:      72px;
  --transition:  0.2s cubic-bezier(0.4, 0, 0.2, 1);
}


/* ================================================================
   BASE
   ================================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-size: 16px;
  color-scheme: light dark;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* The backdrop: drawn once, fixed, never animates. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle 105vw at 10% -2%, var(--glow-1), transparent),
    radial-gradient(circle 95vw at 105% 60%, var(--glow-2), transparent),
    linear-gradient(to bottom, var(--art-top) 0%, var(--art-mid) 45%, var(--art-bottom) 100%);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, button, textarea, select { font-family: inherit; font-size: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
:focus:not(:focus-visible) { outline: none; }

::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.hidden { display: none !important; }

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

/* ── The glass edge: a fine highlight along the top-left, fading to nearly nothing ──
   (cardEdge() in the app). A masked gradient ring, so the translucent fill underneath stays clean. */
.dict-entry::before,
.info-card::before,
.stat-card::before,
.credit-card::before,
.promo-card::before,
.about-section::before,
.search-bar::before,
.bottomnav::before,
.cookie-banner::before,
.suggest-modal::before,
.theme-picker-panel::before,
.suggestions-list::before,
.browse-word::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--edge-a), var(--edge-b));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}
@supports not (mask-composite: exclude) {
  @supports not (-webkit-mask-composite: xor) {
    .dict-entry, .info-card, .stat-card, .credit-card, .promo-card, .about-section, .search-bar, .bottomnav, .cookie-banner, .suggest-modal,
    .theme-picker-panel, .suggestions-list, .browse-word { border: 1px solid var(--border); }
    .dict-entry::before, .info-card::before, .stat-card::before, .credit-card::before, .promo-card::before, .about-section::before, .search-bar::before,
    .bottomnav::before, .cookie-banner::before, .suggest-modal::before, .theme-picker-panel::before, .suggestions-list::before,
    .browse-word::before { display: none; }
  }
}

/* Section header: a short gold-to-accent dash and spaced capitals (SectionHeader in the app). */
.results-meta,
.section-label,
.recent-title,
.dict-related-title,
.dict-word-forms-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-2);
  margin-bottom: 14px;
}
.results-meta::before,
.section-label::before,
.recent-title::before,
.dict-related-title::before,
.dict-word-forms-title::before {
  content: '';
  flex: none;
  width: 16px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold), var(--accent));
}


/* ================================================================
   TOP BAR — transparent over the backdrop ;
   the translucent blurred layer is a pseudo-element so the bar does not become the
   containing block of the fixed appearance panel on phones.
   ================================================================ */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
}

.topnav::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
}

.topnav-inner {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 16px;
}

.topnav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}
.topnav-brand:hover { text-decoration: none; opacity: 0.85; }

.topnav-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--border) 80%, transparent);
}
.topnav-logo img { width: 38px; height: 38px; object-fit: contain; display: block; }

.topnav-name {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
}

.topnav-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.topnav-links { display: flex; align-items: center; gap: 4px; margin-right: 6px; }

.topnav-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  border-radius: var(--r-full);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.topnav-link:hover { background: var(--bg-subtle); color: var(--text); text-decoration: none; }
.topnav-link.active { background: var(--accent-container); color: var(--on-accent-container); font-weight: 600; }

/* Round tonal icon buttons */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--text-2);
  transition: background var(--transition), color var(--transition);
  position: relative;
}
.theme-toggle:hover { background: var(--bg-subtle); color: var(--text); }

.theme-icon-sun,
.theme-icon-moon { position: absolute; transition: opacity 0.3s, transform 0.3s; }
[data-theme="light"] .theme-icon-sun  { opacity: 0; transform: rotate(-90deg) scale(0); }
[data-theme="light"] .theme-icon-moon { opacity: 1; transform: rotate(0) scale(1); }
[data-theme="dark"]  .theme-icon-sun  { opacity: 1; transform: rotate(0) scale(1); }
[data-theme="dark"]  .theme-icon-moon { opacity: 0; transform: rotate(90deg) scale(0); }

/* Offline badge */
.offline-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 12px;
  background: var(--gold-container);
  color: var(--gold);
  border: 1px solid color-mix(in srgb, var(--gold) 30%, transparent);
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.offline-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }


/* ================================================================
   APPEARANCE PANEL — dark mode switch + the six colour themes
   ================================================================ */
.theme-picker { position: relative; }

.theme-picker-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 200;
  width: 260px;
  padding: 10px;
  border-radius: 24px;
  background: var(--popover);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  backdrop-filter: blur(20px) saturate(1.3);
  box-shadow: var(--popover-shadow);
}

.theme-picker-title {
  padding: 6px 10px 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-2);
}

.theme-mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 0 10px;
  margin-bottom: 6px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  transition: background var(--transition);
}
.theme-mode-row:hover { background: var(--bg-subtle); }

.theme-switch {
  position: relative;
  width: 46px;
  height: 28px;
  border-radius: var(--r-full);
  background: var(--bg-inset);
  box-shadow: inset 0 0 0 1px var(--border);
  flex: none;
  transition: background var(--transition);
}
.theme-switch::after {
  content: '';
  position: absolute;
  top: 4px; left: 4px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--outline);
  transition: transform var(--transition), background var(--transition);
}
[data-theme="dark"] .theme-switch { background: var(--accent); box-shadow: none; }
[data-theme="dark"] .theme-switch::after { transform: translateX(18px); background: var(--on-accent); }

.theme-swatch-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  transition: background var(--transition);
}
.theme-swatch-btn:hover { background: var(--bg-subtle); }
.theme-swatch-btn.active { background: var(--accent-container); color: var(--on-accent-container); font-weight: 600; }

.theme-swatch-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 18%, transparent);
}
.theme-swatch-check { margin-left: auto; color: currentColor; flex-shrink: 0; opacity: 0; }
.theme-swatch-btn.active .theme-swatch-check { opacity: 1; }


/* ================================================================
   BOTTOM NAVIGATION — a floating glass pill on phones 
   ================================================================ */
.bottomnav { display: none; }

.bottomnav-link {
  flex: 1;
  min-width: 0;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 2px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text-2);
  text-decoration: none;
  border-radius: 24px;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.bottomnav-link:hover { text-decoration: none; color: var(--text); }

.bottomnav-icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 30px;
  border-radius: var(--r-full);
  transition: background var(--transition), color var(--transition);
}
.bottomnav-icon svg { display: block; }

.bottomnav-link[aria-current="page"],
.bottomnav-link[aria-expanded="true"] { color: var(--accent); font-weight: 600; }
.bottomnav-link[aria-current="page"] .bottomnav-icon,
.bottomnav-link[aria-expanded="true"] .bottomnav-icon { background: var(--accent-container); color: var(--on-accent-container); }


/* ================================================================
   HOME — hero, search, direction
   ================================================================ */
.search-header { position: relative; padding: 36px 0 4px; }
.search-header .hero-ring { display: none; }

.hero-content { margin-bottom: 26px; position: relative; }

/* TagPill */
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: color-mix(in srgb, var(--gold) 14%, transparent);
  color: var(--gold);
  border: 1px solid color-mix(in srgb, var(--gold) 28%, transparent);
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.hero-badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
  animation: pulseDot 2.5s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes pulseDot { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.6; transform: scale(0.85); } }

.hero-title { display: flex; flex-direction: column; gap: 4px; }
.hero-title-text {
  font-family: var(--font-serif);
  font-size: clamp(36px, 7vw, 52px);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.025em;
  line-height: 1.08;
  text-wrap: balance;
}
.hero-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.hero-desc {
  font-size: 16px;
  color: var(--text-2);
  margin-top: 14px;
  max-width: 500px;
  line-height: 1.65;
}

.search-form { display: flex; flex-direction: column; gap: 14px; position: relative; z-index: 2; }
.search-bar-wrap { position: relative; }

.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 60px;
  border-radius: var(--r-search);
  background: linear-gradient(to bottom, var(--glass-a), var(--glass-b));
  transition: box-shadow var(--transition);
}
.search-bar:focus-within { box-shadow: var(--ring); }

.search-icon-wrap {
  display: flex; align-items: center; justify-content: center;
  padding-left: 20px;
  color: var(--text-2);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  padding: 16px 12px;
  font-size: 17px;
  font-weight: 450;
  color: var(--text);
  background: transparent;
}
.search-input::placeholder { color: var(--text-2); opacity: 0.85; }
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

.search-clear-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--bg-inset);
  color: var(--text-2);
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.search-clear-btn:hover { background: var(--accent-muted); color: var(--text); }

.search-btn {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  flex-shrink: 0;
  transition: background var(--transition), transform var(--transition);
}
.search-btn:hover { background: var(--accent-hover); }
.search-btn:active { transform: scale(0.94); }

.search-meta-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Direction toggle: two chips */
.lang-toggle { display: flex; gap: 8px; }
.lang-btn {
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-chip);
  background: var(--quiet-a);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  text-align: center;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.lang-btn:hover { background: var(--bg-inset); color: var(--text); }
.lang-btn.active {
  background: var(--accent-container);
  border-color: transparent;
  color: var(--on-accent-container);
  font-weight: 600;
}

.kbd-hint { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
kbd {
  display: inline-block;
  padding: 1px 7px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--quiet-a);
  border: 1px solid var(--border);
  border-radius: 6px;
  line-height: 1.5;
}

/* Autocomplete */
.suggestions-list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  z-index: 200;
  list-style: none;
  padding: 8px;
  border-radius: 24px;
  background: var(--popover);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  backdrop-filter: blur(20px) saturate(1.3);
  box-shadow: var(--popover-shadow);
  max-height: 320px;
  overflow-y: auto;
}
.suggestion-item {
  position: relative;
  padding: 11px 14px;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  border-radius: 14px;
  transition: background 0.1s;
}
.suggestion-item:hover,
.suggestion-item.active { background: var(--accent-container); color: var(--on-accent-container); }


/* ================================================================
   MAIN + ALERTS
   ================================================================ */
.main { flex: 1; padding: 24px 0 64px; }

.alert {
  padding: 12px 18px;
  border-radius: 16px;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
}
.alert.info         { background: var(--accent-container); color: var(--on-accent-container); }
.alert.error        { background: var(--error-container); color: var(--error); border-color: color-mix(in srgb, var(--error) 25%, transparent); }
.alert.warning,
.alert.cache-notice { background: var(--gold-container); color: var(--gold); border-color: color-mix(in srgb, var(--gold) 28%, transparent); }
.alert.cache-notice { font-size: 12.5px; }


/* ================================================================
   RESULTS — DictionaryRow: a glass card per entry
   ================================================================ */
.results-area { display: flex; flex-direction: column; gap: 12px; }

.dict-entry {
  position: relative;
  background: linear-gradient(to bottom, var(--glass-a), var(--glass-b));
  border-radius: var(--r-card);
  padding: 18px 22px;
  animation: cardFadeIn 0.3s ease both;
  transition: background var(--transition);
}
@keyframes cardFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.dict-entry-clickable { cursor: pointer; }
.dict-entry-clickable:hover { background: linear-gradient(to bottom, var(--raised-a), var(--raised-b)); }
.dict-entry-clickable:hover::before { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 55%, transparent), color-mix(in srgb, var(--accent) 12%, transparent)); }

.dict-entry-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 2px; }
.dict-header-left { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-width: 0; }

.dict-word-link {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.25;
  padding: 0;
  text-align: left;
  cursor: pointer;
  transition: color var(--transition);
  word-break: break-word;
}
.dict-word-link:hover { color: var(--accent); }

/* POS tag: gold TagPill */
.dict-pos-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.dict-pos-badge,
.dict-pos-heading {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  font-style: normal;
  color: var(--gold);
  background: var(--gold-container);
  padding: 2px 11px;
  border-radius: var(--r-chip);
  line-height: 1.6;
  letter-spacing: 0.02em;
  text-transform: capitalize;
}

/* Translation (the Myanmar word, or the English word when searching Myanmar) */
.dict-sense { padding-top: 6px; }
.dict-sense-divider { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--border-light); }
.dict-sense-translations { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.dict-sense-label {
  position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap;   /* read by screen readers, hidden visually like the app's rows */
}
.dict-sense-value { font-size: 17px; font-weight: 600; color: var(--accent); line-height: 1.4; }
.dict-sense-def { margin-top: 6px; font-size: 14px; color: var(--text-2); line-height: 1.65; }

/* Examples: QuoteBlock */
.dict-sense-example,
.dict-example {
  position: relative;
  margin-top: 10px;
  padding: 2px 0 2px 16px;
  font-family: var(--font-serif);
  font-size: 15.5px;
  font-style: italic;
  color: var(--text);
  line-height: 1.6;
}
.dict-sense-example::before,
.dict-example::before {
  content: '';
  position: absolute;
  left: 0; top: 3px; bottom: 3px;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(to bottom, var(--gold), var(--accent));
}

.share-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  color: var(--text-2);
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.share-btn:hover { background: var(--accent-container); color: var(--on-accent-container); }

/* Keep the plain word / pos styles the pre-rendered word page uses */
.dict-word {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.015em;
  line-height: 1.15;
}
.dict-pos {
  display: inline-block;
  font-size: 13px;
  color: var(--gold);
  background: var(--gold-container);
  padding: 2px 11px;
  border-radius: var(--r-chip);
}


/* ================================================================
   WORD PAGE — hero card, then the definitions (the app's detail screen)
   ================================================================ */
.dict-entry-detail { padding: 26px 24px 28px; overflow: hidden; }
.dict-entry-detail .dict-entry-header { margin-bottom: 4px; align-items: center; }
.dict-word-lg { font-size: clamp(36px, 8vw, 48px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }

.detail-back-btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  margin-bottom: 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--quiet-a);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  transition: background var(--transition), color var(--transition);
}
.detail-back-btn:hover { background: var(--accent-container); color: var(--on-accent-container); border-color: transparent; }

.dict-category-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.dict-category-tag,
.dict-label-tag {
  display: inline-block;
  padding: 2px 11px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--r-chip);
  background: var(--quiet-a);
}
.dict-label-tag { margin: 8px 6px 0 0; }

.dict-pron-row { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px; font-size: 15px; color: var(--text-2); }
.dict-pron-play {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent-container);
  color: var(--on-accent-container);
  flex-shrink: 0;
  transition: background var(--transition), transform var(--transition);
}
.dict-pron-play:hover { background: var(--accent); color: var(--on-accent); transform: scale(1.05); }

/* Listen in English / Listen in Myanmar (coming soon): a pill under the headword */
.dict-listen { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 4px; }
.dict-listen-btn {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 0 20px;
  border-radius: var(--r-full);
  background: var(--accent-container);
  color: var(--on-accent-container);
  font-size: 15px; font-weight: 600;
  transition: background var(--transition), color var(--transition);
}
.dict-listen-btn:hover:not(:disabled) { background: var(--accent); color: var(--on-accent); }
.dict-listen-btn.is-speaking { background: var(--accent); color: var(--on-accent); }
.dict-listen-btn.is-speaking svg { animation: dict-listen-pulse 1.1s ease-in-out infinite; }
.dict-listen-btn:disabled { background: var(--quiet-a); color: var(--text-2); cursor: default; opacity: 0.8; }
@keyframes dict-listen-pulse { 50% { transform: scale(1.18); } }

/* One raised panel per part of speech */
.dict-pos-section {
  margin-top: 18px;
  padding: 18px 20px 20px;
  border-radius: 20px;
  background: linear-gradient(to bottom, var(--raised-a), var(--raised-b));
  border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
}
.dict-pos-section:first-of-type { margin-top: 18px; }
.dict-pos-heading { margin: 0 0 12px; }

.dict-translation-block { padding: 0 0 4px; }
.dict-translation-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-2);
  margin-bottom: 2px;
}
.dict-translation {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.dict-definition {
  margin-top: 12px;
  font-size: 16px;
  color: var(--text);
  line-height: 1.7;
}

.dict-meaning-list { margin: 10px 0 0 0; padding-left: 1.6rem; list-style: decimal; }
.dict-meaning-item { margin-bottom: 14px; padding-left: 4px; line-height: 1.65; }
.dict-meaning-item::marker { color: var(--gold); font-weight: 700; }
.dict-meaning-def { font-size: 16px; font-weight: 450; color: var(--text); line-height: 1.65; }
.dict-meaning-item .dict-example { margin-left: -1.6rem; }

/* The Myanmar word(s) recorded for one sense, under that sense's definition */
.dict-meaning-target {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 2px 10px;
  margin-top: 6px;
}
.dict-meaning-target-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-2);
}
.dict-meaning-target-word {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.3;
}
/* the dot sits after a word, so when the line wraps it stays behind that word instead of starting the next line */
.dict-meaning-target-word:not(:last-child)::after {
  content: "\00b7";
  margin-left: 10px;
  color: var(--text-2);
  font-weight: 400;
}

/* SIMILAR / OPPOSITE chips */
.dict-syn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.dict-meaning-item .dict-syn-row { margin-left: -1.6rem; }
.dict-syn-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-right: 2px;
}
.dict-syn-chip,
.dict-ant-chip {
  display: inline-flex; align-items: center;
  min-height: 32px;
  padding: 0 14px;
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.dict-syn-chip { background: var(--accent-subtle); color: var(--accent); }
.dict-syn-chip:hover { background: var(--accent); color: var(--on-accent); }
.dict-ant-chip { background: color-mix(in srgb, var(--error) 12%, transparent); color: var(--error); }
.dict-ant-chip:hover { background: var(--error); color: var(--bg); }

.dict-etymology {
  margin-top: 18px;
  padding: 12px 16px;
  background: var(--green-bg);
  border-radius: 16px;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.65;
}
.dict-etymology-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--green); margin-bottom: 4px; }

.dict-word-forms { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border-light); }
.dict-word-form-row { display: flex; gap: 10px; padding: 6px 0; font-size: 13.5px; border-top: 1px solid var(--border-light); }
.dict-word-form-row:first-child { border-top: none; }
.dict-word-form-type { flex: 0 0 110px; color: var(--text-2); text-transform: capitalize; }
.dict-word-form-value { color: var(--text); font-weight: 500; }

/* Related words (thesaurus) */
.dict-related { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border-light); }
.dict-related-count { font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.dict-related-list { display: flex; flex-wrap: wrap; gap: 8px; }
.dict-related-word {
  display: inline-flex; align-items: center;
  min-height: 36px;
  padding: 0 16px;
  background: var(--accent-subtle);
  color: var(--accent);
  border-radius: var(--r-full);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.dict-related-word:hover { background: var(--accent); color: var(--on-accent); }

/* Contribute */
.dict-contribute { margin-top: 26px; }
.contribute-link { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; color: var(--accent); }
.contribute-link:hover { text-decoration: underline; }
.contribute-link-primary {
  min-height: 48px;
  padding: 0 24px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--r-btn);
  width: fit-content;
  transition: background var(--transition), transform var(--transition);
}
.contribute-link-primary:hover { text-decoration: none; background: var(--accent-hover); }
.contribute-link-primary:active { transform: scale(0.98); }


/* ================================================================
   WORD OF THE DAY — the home screen's hero card (WotdHeroCard, tone Accent)
   ================================================================ */
.wotd {
  position: relative;
  overflow: hidden;
  padding: 24px 24px 22px;
  border-radius: var(--r-card);
  background: linear-gradient(135deg, var(--accent-card-a), var(--accent-card-b));
  color: var(--on-accent-container);
  animation: cardFadeIn 0.35s ease both;
}
.wotd::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 45%, transparent), color-mix(in srgb, var(--accent) 8%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}
/* the giant faint initial behind the word */
.wotd::after {
  content: attr(data-initial);
  position: absolute;
  right: -20px; bottom: -92px;
  font-family: var(--font-serif);
  font-size: 230px;
  font-weight: 500;
  line-height: 1;
  color: color-mix(in srgb, var(--accent) 11%, transparent);
  pointer-events: none;
  user-select: none;
}
.wotd > * { position: relative; z-index: 1; }

.wotd-tag {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 12px;
  border-radius: var(--r-full);
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--on-accent-container);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.wotd-word {
  font-family: var(--font-serif);
  font-size: clamp(38px, 9vw, 48px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-top: 16px;
  word-break: break-word;
}
.wotd-pos { font-family: var(--font-serif); font-style: italic; font-size: 17px; color: var(--on-gold-container); margin-top: 4px; }
[data-theme="dark"] .wotd-pos { color: var(--gold); }
.wotd-translation {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.25;
  margin-top: 10px;
  color: var(--on-accent-container);
}
.wotd-def { margin-top: 8px; font-size: 15.5px; line-height: 1.6; color: var(--on-accent-container); opacity: 0.88; max-width: 34em; }
.wotd-open {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px;
  margin: 12px 0 0 -4px;
  padding: 0 16px;
  border-radius: var(--r-full);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--on-accent-container);
  transition: background var(--transition);
}
.wotd-open:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.wotd-loading { min-height: 220px; opacity: 0.55; }

.welcome-hint { text-align: center; padding: 28px 12px 4px; color: var(--text-2); font-size: 14px; }


/* ================================================================
   EMPTY / LOADING
   ================================================================ */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-2); }
.empty-state-icon {
  display: grid; place-items: center;
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  border-radius: 20px;
  background: var(--accent-container);
  font-size: 28px;
}
.empty-state-text { font-family: var(--font-serif); font-size: 22px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state-hint { font-size: 14.5px; color: var(--text-2); max-width: 360px; margin: 0 auto; }
.empty-suggestions { margin-top: 24px; }
.empty-suggestions-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-2); margin-bottom: 10px; }
.empty-suggestions-list { justify-content: center; }
.empty-submit-btn { margin-top: 28px; }

.loading-spinner { display: flex; justify-content: center; padding: 48px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }


/* ================================================================
   RECENT SEARCHES · ALPHABET · BROWSE
   ================================================================ */
.recent-section { margin-top: 36px; }
.recent-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.recent-item {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  background: var(--quiet-a);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.recent-item:hover { background: var(--accent-container); color: var(--on-accent-container); border-color: transparent; }
.recent-item-lang {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--gold); background: var(--gold-container);
  padding: 1px 7px; border-radius: 6px;
}

.alphabet-section { margin-top: 40px; padding-top: 32px; border-top: 1px solid var(--border-light); scroll-margin-top: 80px; }
.alphabet-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.alpha-btn {
  min-width: 42px; height: 42px;
  padding: 0 8px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-chip);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-2);
  background: var(--quiet-a);
  border: 1px solid var(--border);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.alpha-btn:hover { background: var(--accent-container); color: var(--on-accent-container); border-color: transparent; }
.alpha-btn.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.browse-results { display: block; }
.browse-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.browse-label { font-size: 14px; color: var(--text-2); }
.browse-count { font-size: 12px; color: var(--text-2); font-weight: 600; }
.browse-word-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.browse-word {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 52px;
  padding: 10px 16px;
  background: linear-gradient(to bottom, var(--glass-a), var(--glass-b));
  border-radius: 18px;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition);
}
.browse-word:hover { background: linear-gradient(to bottom, var(--raised-a), var(--raised-b)); }
.browse-word-text { font-family: var(--font-serif); font-size: 17px; font-weight: 600; color: var(--text); }
.browse-word-pos { font-size: 11.5px; color: var(--gold); white-space: nowrap; }
.browse-empty { text-align: center; padding: 28px; color: var(--text-2); font-size: 14px; }
.browse-pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 20px; }
.browse-page-btn {
  min-height: 44px;
  padding: 0 22px;
  font-size: 14px;
  font-weight: 600;
  color: var(--on-accent-container);
  background: var(--accent-container);
  border-radius: var(--r-btn);
  transition: background var(--transition), color var(--transition);
}
.browse-page-btn:hover { background: var(--accent); color: var(--on-accent); }
.browse-page-info { font-size: 13px; color: var(--text-2); }


/* ================================================================
   EXPLORE MORE — promo cards
   ================================================================ */
.promo-section { margin-top: 40px; padding-top: 32px; border-top: 1px solid var(--border-light); }
.promo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.promo-card {
  position: relative;
  display: flex; align-items: flex-start; gap: 16px;
  padding: 20px 22px;
  background: linear-gradient(to bottom, var(--glass-a), var(--glass-b));
  border-radius: var(--r-card);
  text-decoration: none;
  color: inherit;
  transition: background var(--transition);
}
.promo-card:hover { text-decoration: none; background: linear-gradient(to bottom, var(--raised-a), var(--raised-b)); }
.promo-card-icon {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px;
  border-radius: 16px;
  background: var(--accent-container);
  color: var(--on-accent-container);
}
.promo-card-body { flex: 1; min-width: 0; }
.promo-card-title { font-family: var(--font-serif); font-size: 20px; font-weight: 600; color: var(--text); margin-bottom: 4px; letter-spacing: -0.01em; }
.promo-card-desc { font-size: 14px; color: var(--text-2); line-height: 1.6; margin-bottom: 12px; }
.promo-card-cta { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--accent); }
.promo-card:hover .promo-card-cta svg { transform: translateX(3px); }
.promo-card-cta svg { transition: transform var(--transition); }


/* ================================================================
   FOOTER — quiet, on the backdrop (the app has none; the legal links live here)
   ================================================================ */
.footer { position: relative; margin-top: 8px; color: var(--text-2); }
.footer::before { content: ''; display: block; height: 1px; background: linear-gradient(90deg, transparent, var(--border), transparent); }

.footer-inner { display: flex; gap: 64px; padding: 48px 0 36px; align-items: flex-start; }
.footer-brand-col { display: flex; flex-direction: column; gap: 14px; flex: 0 0 268px; min-width: 0; }
.footer-logo { display: inline-flex; align-items: center; gap: 12px; font-family: var(--font-serif); font-size: 22px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.footer-logo-img { width: 34px; height: 34px; object-fit: contain; flex-shrink: 0; border-radius: 50%; box-shadow: 0 0 0 1px var(--border); background: color-mix(in srgb, var(--surface) 90%, transparent); }
.footer-tagline { font-size: 13.5px; color: var(--text-2); line-height: 1.7; max-width: 270px; margin: 0; }

.footer-feedback-btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  width: fit-content;
  font-size: 14px;
  font-weight: 600;
  color: var(--on-accent-container);
  background: var(--accent-container);
  border-radius: var(--r-btn);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.footer-feedback-btn:hover { background: var(--accent); color: var(--on-accent); text-decoration: none; }

.footer-links-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; flex: 1; min-width: 0; }
.footer-group-title { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-2); margin-bottom: 14px; }
.footer-link-group ul { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.footer-link-group li a {
  display: inline-flex; align-items: center;
  min-height: 32px;
  font-size: 14px;
  color: var(--text);
  font-weight: 450;
  text-decoration: none;
  transition: color var(--transition);
}
.footer-link-group li a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }

.footer-divider { height: 1px; background: var(--border-light); }
.footer-bottom { padding: 20px 0 28px; display: flex; align-items: center; justify-content: center; }
.footer-copy { font-size: 12.5px; color: var(--text-2); text-align: center; line-height: 1.6; }
.footer-copy a { color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--text-2) 40%, transparent); }
.footer-copy a:hover { color: var(--accent); text-decoration-color: currentColor; }
.mobile-copy { display: none; }
.desktop-copy { display: inline; }

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 90;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--popover);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--border), var(--popover-shadow);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  text-decoration: none;
  font-size: 0; line-height: 0;
  /* hidden until the page has been scrolled (chrome.js adds .show) */
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity var(--transition), visibility var(--transition), background var(--transition), color var(--transition), transform var(--transition);
}
.back-to-top.show { opacity: 1; visibility: visible; transform: none; }
.back-to-top.show:hover { background: var(--accent); color: var(--on-accent); transform: translateY(-2px); text-decoration: none; }


/* ================================================================
   COOKIE NOTICE — a floating glass card
   ================================================================ */
.cookie-banner {
  position: fixed;
  left: 12px; right: 12px;
  bottom: 12px;
  z-index: 1000;
  max-width: calc(var(--max-w) + 24px);
  margin: 0 auto;
  border-radius: var(--r-card);
  background: var(--popover);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  backdrop-filter: blur(20px) saturate(1.3);
  box-shadow: var(--popover-shadow);
}
.cookie-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px 14px 20px; }
.cookie-text { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.cookie-text svg { flex-shrink: 0; margin-top: 2px; color: var(--accent); }
.cookie-accept {
  min-height: 44px;
  padding: 0 24px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--r-btn);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--transition);
}
.cookie-accept:hover { background: var(--accent-hover); }


/* ================================================================
   SUGGEST / FEEDBACK — modal and forms
   ================================================================ */
.suggest-modal-overlay {
  position: fixed; inset: 0;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.suggest-modal {
  position: relative;
  width: 100%;
  max-width: 660px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--popover);
  border-radius: 28px;
  box-shadow: var(--popover-shadow);
}
.suggest-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--border-light); }
.suggest-modal-header h3 { font-family: var(--font-serif); font-size: 22px; font-weight: 600; color: var(--text); }
.suggest-modal-close {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2);
  background: var(--quiet-a);
  transition: background var(--transition), color var(--transition);
}
.suggest-modal-close:hover { background: var(--accent-container); color: var(--on-accent-container); }
.suggest-modal-body { padding: 20px 24px; }
.suggest-field { margin-bottom: 14px; }
.suggest-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.suggest-field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field-required { color: var(--error); }
.suggest-field input:not([type="checkbox"]),
.suggest-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--quiet-a);
  color: var(--text);
  padding: 12px 14px;
  font-size: 15px;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.suggest-field textarea { resize: vertical; min-height: 96px; }
.suggest-field input:not([type="checkbox"]):focus,
.suggest-field textarea:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--ring); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.suggest-field input[readonly] { opacity: 0.85; }
.feedback-checkbox-label { display: flex !important; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.feedback-checkbox-label input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; }
.feedback-reply-toggle { margin-bottom: 12px; }

.suggest-error,
.suggest-success { border: 1px solid transparent; border-radius: 16px; padding: 12px 14px; font-size: 13.5px; margin-bottom: 14px; }
.suggest-error { color: var(--error); background: var(--error-container); border-color: color-mix(in srgb, var(--error) 25%, transparent); }
.suggest-success { color: var(--green); background: var(--green-bg); border-color: color-mix(in srgb, var(--green) 28%, transparent); }

.suggest-modal-footer { display: flex; justify-content: flex-end; align-items: center; gap: 10px; border-top: 1px solid var(--border-light); padding: 16px 24px 20px; }
.suggest-modal-footer .detail-back-btn { margin-bottom: 0; min-height: 48px; padding: 0 22px; border-radius: var(--r-btn); }
.suggest-turnstile-wrap { min-height: 66px; display: flex; align-items: center; }


/* ================================================================
   ABOUT · FEEDBACK · LEGAL PAGES — a title, then groups of glass cards (like the app's Settings)
   ================================================================ */
.about-page { padding-top: 12px; }
.about-heading {
  font-family: var(--font-serif);
  font-size: clamp(32px, 6vw, 42px);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  line-height: 1.15;
  text-wrap: balance;
}
.about-lead { font-size: 16px; color: var(--text-2); line-height: 1.7; margin-bottom: 28px; }

.about-section {
  position: relative;
  margin-bottom: 14px;
  padding: 22px 24px;
  border-radius: var(--r-card);
  background: linear-gradient(to bottom, var(--glass-a), var(--glass-b));
}
.about-section-title { font-family: var(--font-serif); font-size: 21px; font-weight: 600; color: var(--text); margin-bottom: 10px; letter-spacing: -0.01em; }
.about-section p { font-size: 15px; color: var(--text-2); line-height: 1.75; }
.about-section p + p { margin-top: 10px; }
.about-section ul, .about-section ol { color: var(--text-2); }
.about-info, .about-stats { margin-bottom: 14px; }
.about-info .about-section-title,
.about-stats .about-section-title { margin: 22px 4px 12px; }

.about-list { list-style: none; padding: 0; }
.about-list li { padding: 7px 0; font-size: 14.5px; color: var(--text-2); line-height: 1.65; }
.about-list li::before { content: '\2713'; margin-right: 10px; color: var(--accent); font-weight: 700; }
.about-list-plain li::before { content: '\2022'; color: var(--gold); }

.about-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.about-btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  border-radius: var(--r-btn);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--on-accent-container);
  background: var(--accent-container);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}
.about-btn:hover { background: var(--accent); color: var(--on-accent); text-decoration: none; }
.about-btn:active { transform: scale(0.98); }
/* A form's submit is the page's one primary action: filled, not tonal */
.about-btn[type="submit"] { background: var(--accent); color: var(--on-accent); }
.about-btn[type="submit"]:hover { background: var(--accent-hover); }
.about-btn[disabled] { opacity: 0.6; cursor: not-allowed; }

.info-card {
  position: relative;
  display: flex; align-items: flex-start; gap: 20px;
  background: linear-gradient(to bottom, var(--glass-a), var(--glass-b));
  border-radius: var(--r-card);
  padding: 20px 24px;
  margin-bottom: 28px;
}
.info-card-logo { flex-shrink: 0; border-radius: 16px; object-fit: contain; }
.info-card-details { flex: 1; min-width: 0; margin: 0; }
.info-row { display: flex; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border-light); font-size: 14px; }
.info-row:first-child { border-top: none; padding-top: 0; }
.info-row dt { flex: 0 0 130px; color: var(--text-2); font-weight: 500; }
.info-row dd { margin: 0; color: var(--text); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 28px; }
.stat-card {
  position: relative;
  background: linear-gradient(to bottom, var(--glass-a), var(--glass-b));
  border-radius: 20px;
  padding: 20px 16px;
  text-align: center;
}
.stat-value { font-family: var(--font-serif); font-size: 34px; font-weight: 600; color: var(--accent); line-height: 1.15; margin-bottom: 4px; }
.stat-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-2); }

.pos-breakdown { margin-bottom: 28px; }
.about-stats-note { font-size: 12.5px; color: var(--text-2); font-style: italic; margin-top: -14px; margin-bottom: 28px; }
.pos-title { font-family: var(--font-serif); font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 14px; }
.pos-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 13px; }
.pos-row-label, .pos-name { width: 90px; font-weight: 500; color: var(--text-2); text-align: right; text-transform: capitalize; }
.pos-bar { flex: 1; height: 20px; background: var(--bg-inset); border-radius: var(--r-full); overflow: hidden; }
.pos-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); border-radius: var(--r-full); transition: width 0.6s ease; min-width: 4px; }
.pos-row-count, .pos-count { width: 40px; font-size: 12px; font-weight: 600; color: var(--text-2); }


/* ── Credits, Contributors & Partners (About page; filled by credits.js from /api/credits) ── */
.about-credits { margin-bottom: 14px; }
.about-credits .about-section-title { margin: 22px 4px 12px; }
.credits-group { margin-bottom: 22px; }
.credits-group-title { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-2); margin: 0 4px 4px; }
.credits-group-intro { font-size: 14.5px; line-height: 1.6; color: var(--text-2); margin: 0 4px 12px; max-width: 62ch; text-wrap: pretty; }
.credits-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.credit-card {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  min-width: 0;
  padding: 16px 18px;
  border-radius: 20px;
  background: linear-gradient(to bottom, var(--glass-a), var(--glass-b));
}
.credit-avatar { flex-shrink: 0; width: 56px; height: 56px; border-radius: 16px; object-fit: cover; background: var(--bg-inset); }
.credit-avatar-fallback { display: flex; align-items: center; justify-content: center; background: var(--accent-container); color: var(--on-accent-container); font-family: var(--font-serif); font-size: 24px; font-weight: 600; }
.credit-body { min-width: 0; }
.credit-name { font-size: 15.5px; font-weight: 600; color: var(--text); line-height: 1.35; overflow-wrap: anywhere; }
.credit-role { font-size: 13.5px; color: var(--text-2); line-height: 1.45; margin-top: 2px; overflow-wrap: anywhere; }
.credit-links { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.credit-link {
  display: inline-block; padding: 3px 11px;
  border-radius: var(--r-chip);
  font-size: 12.5px; font-weight: 600;
  color: var(--on-accent-container); background: var(--accent-container);
  text-decoration: none; overflow-wrap: anywhere;
  transition: background var(--transition), color var(--transition);
}
.credit-link:hover { background: var(--accent); color: var(--on-accent); text-decoration: none; }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (min-width: 768px) {
  .desktop-copy { display: inline !important; }
  .mobile-copy  { display: none !important; }
}

@media (min-width: 641px) and (max-width: 900px) {
  .footer-inner { gap: 40px; padding: 40px 0 32px; }
  .footer-brand-col { flex: 0 0 220px; }
  .footer-links-grid { gap: 24px; }
}

@media (min-width: 769px) {
  .search-input { font-size: 18px; padding: 18px 14px; }
  .search-bar { min-height: 64px; }
  .dict-entry { padding: 20px 26px; }
  .dict-word-link { font-size: 26px; }
  .dict-entry-detail { padding: 32px 36px 34px; }
  .about-section { padding: 26px 30px; }
}

/* Phones: the floating pill replaces the top bar's links and buttons */
@media (max-width: 640px) {
  :root { --nav-h: 60px; }
  body { padding-bottom: calc(var(--pill-h) + 28px + env(safe-area-inset-bottom, 0px)); }

  /* the Theme tab of the pill opens the appearance panel; the top bar keeps only the brand */
  .topnav-links,
  .topnav-actions > .theme-toggle,
  .theme-picker > .theme-toggle { display: none; }

  .bottomnav {
    display: flex;
    position: fixed;
    z-index: 150;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: min(calc(100% - 24px), 440px);
    padding: 8px 6px;
    gap: 2px;
    border-radius: 32px;
    background: color-mix(in srgb, var(--surface-high) 84%, transparent);
    -webkit-backdrop-filter: blur(22px) saturate(1.4);
    backdrop-filter: blur(22px) saturate(1.4);
    box-shadow: var(--popover-shadow);
  }

  /* The appearance panel opens above the pill */
  .theme-picker-panel {
    position: fixed;
    top: auto;
    left: 12px; right: 12px;
    width: auto;
    bottom: calc(var(--pill-h) + 28px + env(safe-area-inset-bottom, 0px));
    max-width: 440px;
    margin: 0 auto;
  }

  .container { padding: 0 16px; }
  .search-header { padding: 24px 0 0; }
  .hero-content { margin-bottom: 22px; }
  .lang-toggle { width: 100%; }
  .lang-btn { flex: 1; }
  .search-meta-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .kbd-hint { display: none; }

  .dict-entry { padding: 16px 18px; }
  .dict-word-link { font-size: 22px; }
  .dict-entry-detail { padding: 22px 18px 24px; }
  .dict-pos-section { padding: 16px 16px 18px; }
  .dict-translation { font-size: 28px; }

  .main { padding: 18px 0 40px; }
  .alpha-btn { min-width: 40px; height: 40px; }
  .browse-word-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .suggest-field-row { grid-template-columns: 1fr; }

  .about-section { padding: 18px 18px; border-radius: 22px; }
  .info-card { flex-direction: column; align-items: center; text-align: center; padding: 18px; }
  .info-row { flex-direction: column; gap: 2px; text-align: left; }
  .info-row dt { flex: none; }

  .footer-inner { flex-direction: column; gap: 32px; padding: 36px 0 24px; }
  .footer-brand-col { flex: none; width: 100%; align-items: center; text-align: center; }
  .footer-tagline { text-align: center; max-width: 100%; }
  .footer-feedback-btn { align-self: center; }
  .footer-links-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; width: 100%; }
  .footer-group-title { font-size: 10.5px; letter-spacing: 0.1em; }
  .footer-link-group li a { font-size: 13px; }
  .desktop-copy { display: none; }
  .mobile-copy { display: inline; }

  .back-to-top { bottom: calc(var(--pill-h) + 40px + env(safe-area-inset-bottom, 0px)); right: 14px; width: 40px; height: 40px; }
  /* The notice floats above the pill, never behind it */
  .cookie-banner { bottom: calc(var(--pill-h) + 28px + env(safe-area-inset-bottom, 0px)); }
  .cookie-inner { flex-direction: column; text-align: center; padding: 16px; }
  .cookie-text { flex-direction: column; align-items: center; }
  .cookie-accept { width: 100%; }
}

@media (max-width: 380px) {
  .footer-links-grid { grid-template-columns: repeat(2, 1fr); }
  .bottomnav-icon { width: 52px; }
}


/* ================================================================
   REDUCED MOTION — the app's reduce-motion setting: decorative animation is skipped
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* ── Browse A–Z (server-rendered by functions/_lib/browse.js): plain links, so crawlers and visitors without JavaScript reach every word ── */
.browse-crumbs { font-size: 13.5px; color: var(--text-2); margin-bottom: 14px; }
.browse-crumbs a { color: var(--text-2); }
.browse-switch { color: var(--text-2); margin: 4px 0 20px; }
.browse-switch a, .browse-pager a, .browse-all-link a { color: var(--accent); font-weight: 600; }
.browse-all-link { margin: 6px 0 12px; color: var(--text-2); font-size: 14px; }
.browse-words { list-style: none; columns: 3 220px; column-gap: 28px; margin: 22px 0 0; padding: 0; }
.browse-words li { break-inside: avoid; padding: 5px 0; border-bottom: 1px solid var(--border-light); }
.browse-words a, .browse-ranges a { color: var(--text); text-decoration: none; }
.browse-words a:hover, .browse-words a:focus-visible, .browse-ranges a:hover, .browse-ranges a:focus-visible { color: var(--accent); text-decoration: underline; }
.browse-ranges { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px 16px; }
.browse-ranges li { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r-chip); overflow-wrap: anywhere; }
.browse-pager { display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: space-between; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border-light); }

/* ── Print ── */
@media print {
  body::before { display: none; }
  .topnav, .bottomnav, .search-header, .recent-section, .footer, .cookie-banner, .alphabet-section, .share-btn,
  .theme-toggle, .promo-section, .back-to-top { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
  .main { padding: 0; }
  .dict-entry { background: none; border: 1px solid #ccc; break-inside: avoid; }
  .dict-entry::before { display: none; }
}

/* ── The 404 page ───────────────────────────────────────────────────────────────────────────────── */
.notfound-code { font-family: var(--font-serif); font-size: clamp(72px, 22vw, 140px); line-height: 1; font-weight: 600; color: var(--accent); margin: 0 0 4px; }
.about-page .notfound-note { font-size: 14px; color: var(--text-2); margin-top: 22px; }


/* ================================================================
   MYANMAR SCRIPT
   Burmese letters stack marks above and below the line, so Myanmar text needs its own font and a taller line than
   Latin text (Latin line-heights of 1.1–1.3 clip the marks). It is never italic (a slanted synthetic face is
   unreadable) and never letter-spaced. script.js and the Pages Functions mark Myanmar text with lang="my".
   ================================================================ */
:lang(my) { font-family: var(--font-my); font-style: normal; letter-spacing: 0; text-transform: none; line-height: 1.85; }
.dict-translation:lang(my)        { font-size: 27px; line-height: 1.75; }
.dict-word:lang(my)               { font-size: 27px; line-height: 1.6; letter-spacing: 0; }
.dict-word-lg:lang(my)            { font-size: clamp(32px, 7vw, 42px); line-height: 1.5; }
.dict-sense-value:lang(my)        { font-size: 17px; line-height: 1.75; }
.dict-meaning-target-word:lang(my){ font-size: 17px; line-height: 1.75; }
.dict-example:lang(my),
.dict-sense-example:lang(my)      { font-size: 15.5px; line-height: 1.9; }
.browse-word-text:lang(my)        { font-size: 16px; line-height: 1.7; }
.search-input:lang(my)            { font-size: 19px; line-height: 1.6; }
.suggestion-item:lang(my)         { line-height: 1.7; }
.wotd-word:lang(my)               { line-height: 1.6; }
.alpha-btn:lang(my)               { line-height: 1.5; }

/* The translated sentence under an English example: Myanmar, quieter than the English line above it */
.dict-example-translation { margin-top: 2px; padding-left: 16px; font-size: 14.5px; color: var(--text-2); }

/* A note on how a word is used (register, who says it): small and quiet, under the definition */
.dict-usage-note { margin-top: 8px; font-size: 13.5px; font-style: italic; color: var(--text-2); line-height: 1.9; }
.dict-usage-note::before { content: "\2139\00a0\00a0"; font-style: normal; color: var(--gold); }
