/* ==========================================================================
   Emoji Directory — design system
   Sora for display, Inter for body. Self-hosted (76 KB, two variable fonts),
   so there is no third-party request and the design renders offline too.
   All class names and ids here are load-bearing for site.js — see README.
   ========================================================================== */

@font-face {
  font-family: 'Sora';
  src: url('/assets/fonts/sora.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193,
                 U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter.woff2') format('woff2');
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193,
                 U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ------------------------------------------------------------------ tokens */
:root {
  --bg: #ffffff;
  --surface: #f6f6f7;
  --surface-2: #efeff1;
  --surface-hover: #f0f0f2;
  --border: #e8e8ea;
  --border-strong: #d4d4d8;
  --text: #0f0f0f;
  --muted: #6b6b72;
  --faint: #9b9ba3;
  --accent: #f5c518;
  --accent-dim: #fdf3c1;
  --accent-line: #e8b800;
  --on-accent: #171200;
  --ring: rgba(15, 15, 15, .10);
  --danger: #d33;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 100px;

  --shadow-sm: 0 1px 2px rgba(16, 18, 22, .05);
  --shadow: 0 6px 20px rgba(16, 18, 22, .09), 0 1px 3px rgba(16, 18, 22, .05);
  --shadow-lg: 0 24px 60px rgba(16, 18, 22, .16), 0 4px 14px rgba(16, 18, 22, .07);

  --dur: 150ms;
  --ease: cubic-bezier(.32, .72, 0, 1);

  --header-h: 60px;
  --maxw: 1160px;
  --gutter: 20px;

  --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji",
           "Android Emoji", "EmojiSymbols", sans-serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-hi: "Noto Sans Devanagari", "Nirmala UI", "Mangal", var(--font-ui);
  --font-ar: "Noto Naskh Arabic", "Segoe UI Historic", "Geeza Pro", "Tahoma", var(--font-ui);
  --font-thai: "Noto Sans Thai", "Leelawadee UI", var(--font-ui);
  --font-bn: "Noto Sans Bengali", "Nirmala UI", var(--font-ui);

  /* Language-specific fallback sits after the Latin display face: Sora has no
     Devanagari or Arabic glyphs, so the browser falls through per character. */
  --font-lang: var(--font-ui);
  --font-display: 'Sora', var(--font-lang);
  --font-body: 'Inter', var(--font-lang);
}

html[lang="hi"] { --font-lang: var(--font-hi); }
html[lang="ar"] { --font-lang: var(--font-ar); }

html[data-theme="dark"] {
  --bg: #0e0e10;
  --surface: #17171a;
  --surface-2: #1f1f23;
  --surface-hover: #232327;
  --border: #26262b;
  --border-strong: #3a3a42;
  --text: #f3f3f4;
  --muted: #9d9da6;
  --faint: #6e6e78;
  --accent: #f5c518;
  --accent-dim: #2b2408;
  --accent-line: #6b5a10;
  --on-accent: #171200;
  --ring: rgba(255, 255, 255, .14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 6px 22px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .3);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, .6), 0 6px 18px rgba(0, 0, 0, .35);
}

/* ------------------------------------------------------------------ reset */
*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  min-height: 100dvh;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--accent); color: var(--on-accent); }

/* -------------------------------------------------------------- utilities */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.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;
}

.skip {
  position: absolute; inset-block-start: -100px; inset-inline-start: 12px;
  z-index: 999; padding: 10px 16px;
  background: var(--text); color: var(--bg);
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  transition: inset-block-start var(--dur) var(--ease);
}
.skip:focus { inset-block-start: 12px; }

.spacer { flex: 1 1 auto; }

/* ------------------------------------------------------------------ header */
.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 80;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.7) blur(14px);
  backdrop-filter: saturate(1.7) blur(14px);
  border-block-end: 1px solid var(--border);
}

/* Everything inside the header is constrained to the same 1160px column as the
   page body, so the logo lines up with the hero instead of sitting in the
   far-left corner of a wide monitor. */
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: var(--header-h);
  flex-wrap: nowrap;
}
.header-actions { flex: none; }
.brand { min-width: 0; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -.3px;
  text-decoration: none;
  white-space: nowrap;
  color: var(--text);
}
.brand-mark { font-family: var(--emoji); font-size: 21px; line-height: 1; }
.brand-name { unicode-bidi: isolate; }
.brand-sub { color: var(--text); font-weight: 700; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Nav buttons — the Language / Theme / Favourites pills from the design. */
.nav-btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.2;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease),
              background var(--dur) var(--ease);
}
.nav-btn:hover,
.icon-btn:hover { border-color: var(--text); color: var(--text); }
.nav-btn svg, .icon-btn svg { width: 15px; height: 15px; flex: none; }
.icon-btn { padding: 6px 9px; position: relative; }

.nav-btn[aria-pressed="true"],
.icon-btn[aria-pressed="true"] {
  border-color: var(--text);
  color: var(--text);
  background: var(--surface);
}

.badge {
  position: absolute;
  inset-block-start: -5px;
  inset-inline-end: -5px;
  min-width: 17px;
  height: 17px;
  padding-inline: 4px;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--on-accent);
  background: var(--accent);
  border-radius: var(--radius-pill);
  line-height: 1;
}

/* Favourites count inside the nav pill */
#fav-count {
  position: static;
  min-width: 16px;
  height: 16px;
  padding-inline: 4px;
  display: inline-grid;
  place-items: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: var(--radius-pill);
}

/* ---------------------------------------------------------------- menus */
.menu { position: relative; }

.menu-panel {
  position: absolute;
  inset-block-start: calc(100% + 8px);
  inset-inline-end: 0;
  min-width: 178px;
  padding: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease),
              visibility var(--dur);
  z-index: 90;
}
.menu[data-open="true"] .menu-panel,
.menu.open .menu-panel,
.menu-panel.open {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.menu-label {
  padding: 7px 10px 5px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--faint);
}

.menu-panel button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: var(--font-body);
  color: var(--text);
  text-align: start;
  transition: background var(--dur) var(--ease);
}
.menu-panel button:hover { background: var(--surface); }
.menu-panel button[aria-checked="true"] {
  background: var(--surface);
  font-weight: 600;
}
.menu-panel button[aria-checked="true"]::after {
  content: "";
  margin-inline-start: auto;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ------------------------------------------------------------------- hero */
.hero {
  max-width: 700px;
  margin-inline: auto;
  padding-block: 64px 44px;
  text-align: center;
}
.hero--compact { padding-block: 28px 26px; }

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin-block-end: 26px;
  flex-wrap: wrap;
}
.hero-stats > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .01em;
}
.hero-stats b {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.5px;
  color: var(--text);
  line-height: 1.1;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 700;
  letter-spacing: -1.5px;
  line-height: 1.08;
  margin-block-end: 14px;
  white-space: pre-line;
}
.hero--compact h1 {
  font-size: clamp(24px, 3.4vw, 34px);
  letter-spacing: -.8px;
  margin-block-end: 10px;
}

.hero p {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.6;
  margin-block-end: 30px;
  margin-inline: auto;
  max-width: 54ch;
}
.hero--compact p { margin-block-end: 22px; font-size: 14.5px; }

/* ---------------------------------------------------------------- search */
.search {
  position: relative;
  max-width: 560px;
  margin-inline: auto;
  text-align: start;
}
.search input {
  width: 100%;
  padding: 15px 46px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              background var(--dur) var(--ease);
  appearance: none;
}
.search input::-webkit-search-cancel-button { display: none; }
.search input::placeholder { color: var(--faint); }
.search input:hover { border-color: var(--border-strong); }
.search input:focus {
  background: var(--bg);
  border-color: var(--text);
  box-shadow: 0 0 0 3px var(--ring);
}

.i-search {
  position: absolute;
  inset-inline-start: 16px;
  inset-block-start: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
  display: flex;
}
.search input:focus ~ .i-search,
.search:focus-within .i-search { color: var(--text); }

.i-clear {
  position: absolute;
  inset-inline-end: 12px;
  inset-block-start: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease), background var(--dur) var(--ease);
}
.i-clear:hover { background: var(--surface-2); color: var(--text); }
.search.has-value .i-clear { opacity: 1; pointer-events: auto; }
.search.has-value input { padding-inline-end: 46px; }

/* ------------------------------------------------------------- skin tones */
.tones {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-block-start: 18px;
  flex-wrap: wrap;
}
.tones-label {
  font-size: 12px;
  color: var(--muted);
  margin-inline-end: 2px;
}
.tone-swatches {
  display: flex;
  align-items: center;
  gap: 4px;
}
.tone-btn {
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  font-family: var(--emoji);
  font-size: 17px;
  line-height: 1;
  border: 2px solid transparent;
  border-radius: 50%;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.tone-btn:hover { transform: scale(1.15); }
.tone-btn[aria-pressed="true"] { border-color: var(--text); }
.tones-note { font-size: 11.5px; color: var(--faint); flex-basis: 100%; text-align: center; }

/* ------------------------------------------------------------------ tabs */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-block-end: 30px;
  border-block-end: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.toolbar::-webkit-scrollbar { display: none; }

.toolbar .chip {
  padding: 10px 2px;
  margin-block-end: -1px;
  font-size: 13.5px;
  color: var(--muted);
  border: 0;
  border-block-end: 2px solid transparent;
  border-radius: 0;
  background: none;
  white-space: nowrap;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.toolbar .chip:hover { color: var(--text); background: none; }
.toolbar .chip[aria-pressed="true"] {
  color: var(--text);
  font-weight: 600;
  border-block-end-color: var(--text);
}
.toolbar .chip + .chip { margin-inline-start: 6px; }
.toolbar .n {
  display: inline-block;
  min-width: 16px;
  padding-inline: 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: var(--radius-pill);
  text-align: center;
}

/* Generic pill chip — used inside .tones for "Show all skin tones" */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.chip:hover { border-color: var(--text); color: var(--text); }
.chip[aria-pressed="true"] { border-color: var(--text); color: var(--text); }

/* ----------------------------------------------------------- section head */
.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-block-end: 16px;
}
.sec-head h2 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.2px;
}
.sec-head .count { font-size: 12px; color: var(--muted); }

/* -------------------------------------------------------- category cards */
.groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-block-end: 52px;
}
.group-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
.group-card:hover {
  background: var(--accent-dim);
  border-color: var(--accent-line);
  transform: translateY(-1px);
}
.face-row {
  font-family: var(--emoji);
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 2px;
}
.group-card .meta { display: flex; flex-direction: column; gap: 2px; }
.group-card .name { font-size: 13px; font-weight: 500; }
.group-card .sub { font-size: 11px; color: var(--muted); }

/* ------------------------------------------------------------------ grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 4px;
}

/* The skin-tone pages group their cells by category, so #grid there contains
   headings and nested .grid blocks rather than cells directly. Without this,
   the outer grid lays each grouping out as if it were a single 52px cell,
   which collapses the whole page into one narrow column. */
#grid > .sec-head,
#grid > .grid { grid-column: 1 / -1; }

.cell {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  font-family: var(--emoji);
  font-size: 28px;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.cell:hover { background: var(--surface); transform: scale(1.15); z-index: 2; }
.cell:active { transform: scale(.95); }

.cell.is-copied { background: var(--accent-dim); }

.cell.is-selected {
  background: var(--accent-dim);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.cell.is-variant { background: var(--surface); }

.tone-dot {
  position: absolute;
  inset-block-start: 5px;
  inset-inline-end: 5px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--faint);
  opacity: .7;
}

/* -------------------------------------------------- subnav / tone chips */
.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block-end: 28px;
}
.subnav a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  text-decoration: none;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.subnav a:hover { border-color: var(--text); color: var(--text); }
.subnav a.is-active {
  border-color: var(--text);
  color: var(--text);
  background: var(--bg);
  font-weight: 500;
}
.subnav .n {
  font-size: 11px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.subnav a.is-active .n { color: var(--muted); }

.tone-nav { margin-block-start: 4px; }
.tone-nav a { font-family: var(--font-body); }
.t-glyph, .tone-nav .t-glyph { font-family: var(--emoji); font-size: 14px; }

/* ------------------------------------------------------------- breadcrumbs */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-block-start: 22px;
  font-size: 12.5px;
  color: var(--muted);
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.crumbs .sep { color: var(--faint); }
.crumbs [aria-current] { color: var(--text); }

/* ------------------------------------------------------------- home only */
.lang-bar {
  margin-block-start: 14px;
  font-size: 12px;
  color: var(--muted);
}
.lang-bar[data-show="false"] { display: none; }

.results-note {
  margin-block-end: 16px;
  font-size: 12.5px;
  color: var(--muted);
}
.results-note b { color: var(--text); font-weight: 600; }

.empty {
  padding-block: 56px 64px;
  text-align: center;
  color: var(--muted);
}
.empty .e-glyph { font-family: var(--emoji); font-size: 40px; margin-block-end: 12px; }
.empty p { font-size: 14px; margin-block-end: 4px; }
.empty b { color: var(--text); }

/* -------------------------------------------------- emoji detail page */
.detail-top {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  margin-block-end: 32px;
  flex-wrap: wrap;
}
.detail-glyph {
  font-family: var(--emoji);
  font-size: clamp(72px, 14vw, 112px);
  line-height: 1;
  padding: 20px 28px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  cursor: pointer;
  user-select: none;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.detail-glyph:hover { background: var(--accent-dim); transform: scale(1.02); }
.detail-glyph:active { transform: scale(.97); }

.actions { display: flex; flex-direction: column; gap: 10px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 18px;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.btn:hover { border-color: var(--text); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-line); border-color: var(--accent-line); }
.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn[aria-pressed="true"] { border-color: var(--text); background: var(--bg); }
.btn[aria-pressed="true"]::before { content: "★ "; color: var(--accent-line); }

.copy-row { display: flex; flex-wrap: wrap; gap: 6px; }

.kv { margin-block-end: 40px; }
.kv-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  padding-block: 16px;
  border-block-start: 1px solid var(--border);
}
.kv-row:last-child { border-block-end: 1px solid var(--border); }
.kv-label {
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--muted);
  padding-block-start: 3px;
}

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  padding: 3px 9px;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
  border-radius: var(--radius-pill);
}

.cp-line { display: flex; flex-wrap: wrap; gap: 6px; }
.cp {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11.5px;
  padding: 3px 8px;
  background: var(--surface);
  border-radius: 6px;
  color: var(--muted);
}

.mini-grid { display: flex; flex-wrap: wrap; gap: 4px; }
.mini {
  width: 42px; height: 42px;
  display: grid;
  place-items: center;
  font-family: var(--emoji);
  font-size: 22px;
  line-height: 1;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
.mini:hover { background: var(--accent-dim); border-color: var(--accent-line); transform: scale(1.06); }

.platforms { display: flex; gap: 10px; flex-wrap: wrap; }
.platform {
  flex: 1 1 110px;
  padding: 14px;
  text-align: center;
  background: var(--surface);
  border-radius: var(--radius);
}
.p-glyph { font-family: var(--emoji); font-size: 32px; line-height: 1.2; margin-block-end: 4px; }
.p-name { font-size: 11px; color: var(--muted); }
.platform-note {
  grid-column: 2;
  font-size: 12px;
  color: var(--faint);
  margin-block-start: 10px;
}

.counter { font-size: 13px; }
.counter .nums { font-weight: 600; }
.counter .msg { color: var(--muted); margin-inline-start: 8px; font-size: 12px; }
.counter[data-state="tight"] .msg { color: #b8860b; }
.counter[data-state="long"] .msg { color: var(--danger); }

/* ------------------------------------------------------------------ FAQ */
.faq { margin-block-end: 48px; }
.faq-item {
  padding-block: 22px;
  border-block-start: 1px solid var(--border);
}
.faq-item:last-child { border-block-end: 1px solid var(--border); }
.faq-item h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.2px;
  margin-block-end: 8px;
  line-height: 1.35;
}
.faq-item p {
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.65;
  max-width: 68ch;
}

/* --------------------------------------------------------------- footer */
.site-footer {
  border-block-start: 1px solid var(--border);
  margin-block-start: 24px;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  padding-block: 40px;
}
.footer-grid h3,
.footer-grid h4 {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-block-end: 12px;
}
.footer-grid p {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 34ch;
}
.footer-links { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.footer-links a {
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}
.footer-links a:hover { color: var(--muted); }

.footer-bottom {
  padding-block: 18px 28px;
  border-block-start: 1px solid var(--border);
}
.footer-bottom p { font-size: 11.5px; color: var(--faint); }

/* ------------------------------------------------------------------ tray */
.tray {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 70;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-block-start: 1px solid var(--border);
  box-shadow: 0 -6px 24px rgba(16, 18, 22, .06);
  transform: translateY(110%);
  transition: transform var(--dur) var(--ease);
}
.tray[data-open="true"] { transform: none; }
.tray-inner { padding-block: 12px; }
.tray-head { display: flex; align-items: center; gap: 8px; margin-block-end: 8px; }
.tray-head h2 {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.1px;
}
.tray-body {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 120px;
  overflow-y: auto;
}
.tray-item {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  font-family: var(--emoji);
  font-size: 20px;
  background: var(--surface);
  border-radius: var(--radius-sm);
}
.tray-item:hover { background: var(--surface-2); }
.tray-empty { font-size: 12.5px; color: var(--faint); }

/* ---------------------------------------------------------------- toasts */
.toast-layer {
  position: fixed;
  inset-block-end: 24px;
  inset-inline: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  padding-inline: 16px;
}
.toast {
  padding: 10px 20px;
  font-size: 13px;
  color: var(--bg);
  background: var(--text);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow);
  animation: toast-in 220ms var(--ease);
  max-width: min(90vw, 420px);
  text-align: center;
}
.toast[data-kind="error"] { background: var(--danger); color: #fff; }
.toast .g { font-family: var(--emoji); margin-inline-end: 6px; }
.toast.out { animation: toast-out 180ms var(--ease) forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(6px) scale(.98); }
}

/* ------------------------------------------------------------ copy panel */
.copy-panel {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 300;
  display: none;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  border-block-start: 1px solid var(--border);
  box-shadow: 0 -12px 40px rgba(16, 18, 22, .14);
}
.copy-panel.open { display: block; }
.cp-inner { display: flex; align-items: center; gap: 8px; max-width: var(--maxw); margin-inline: auto; }
.cp-field {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
.cp-hint { font-size: 12px; color: var(--muted); margin-block-start: 8px; max-width: var(--maxw); margin-inline: auto; }
.cp-close {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  color: var(--muted);
}
.cp-close:hover { background: var(--surface); color: var(--text); }

/* ------------------------------------------------------------ detail dialog */
dialog#detail {
  padding: 0;
  border: 0;
  background: transparent;
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  color: var(--text);
}
dialog#detail::backdrop {
  background: rgba(10, 10, 12, .45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
dialog#detail[open] { display: grid; place-items: end center; }

.sheet {
  width: min(680px, 100%);
  max-height: 88vh;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  animation: sheet-in 240ms var(--ease);
  overflow: hidden;
}
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}
.sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-block-end: 1px solid var(--border);
  flex: none;
}
.sheet-head h2 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.3px;
  flex: 1 1 auto;
  min-width: 0;
}
.sheet-body { padding: 20px 18px 26px; overflow-y: auto; }
.sheet-body .detail-top { padding-inline: 0; margin-block-end: 22px; }
.sheet-body .kv { padding-inline: 0; margin-block-end: 0; }
.sheet-body .detail-glyph { font-size: clamp(56px, 16vw, 86px); padding: 14px 20px; }

/* --------------------------------------------------------- print / motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------- responsive */
@media (max-width: 720px) {
  :root { --gutter: 20px; }
  .hero { padding-block: 40px 32px; }
  .hero--compact { padding-block: 20px 20px; }
  .hero-stats { gap: 20px; margin-block-end: 22px; }
  .hero-stats b { font-size: 19px; }
  .hero p { font-size: 14px; margin-block-end: 24px; }
  .search input { padding-block: 13px; font-size: 15px; }
  .groups { grid-template-columns: repeat(2, 1fr); margin-block-end: 40px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); }
  .cell { font-size: 25px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 26px; padding-block: 30px; }
  .kv-row { grid-template-columns: 1fr; gap: 8px; }
  .kv-label { padding-block-start: 0; }
  .detail-top { gap: 16px; }
  .toolbar { gap: 4px; }
  /* Icon-only nav on phones. Hidden labels stay in the DOM and still name the
     buttons through aria-label, so nothing is lost for screen readers. */
  .nav-btn .label { display: none; }
  .nav-btn { padding: 7px; position: relative; }
  .nav-btn #fav-count { position: absolute; inset-block-start: -5px; inset-inline-end: -5px; }
  .sheet { max-height: 92vh; max-height: 92dvh; }
}

@media (max-width: 420px) {
  .brand { font-size: 15px; gap: 6px; }
  .brand-mark { font-size: 19px; }
  .hero-stats { gap: 16px; }
  .hero-stats > div { font-size: 10px; }
  .groups { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .group-card { padding: 12px; }
  .face-row { font-size: 18px; letter-spacing: 1px; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* RTL — Arabic pages */
[dir="rtl"] .crumbs,
[dir="rtl"] .sec-head,
[dir="rtl"] .menu-panel button { text-align: start; }
[dir="rtl"] .tone-dot { inset-inline-end: auto; inset-inline-start: 5px; }
[dir="rtl"] .i-search { inset-inline-start: auto; inset-inline-end: 16px; }
[dir="rtl"] .i-clear { inset-inline-end: auto; inset-inline-start: 12px; }
[dir="rtl"] .search input { padding-inline: 46px; }

/* theme icon swap — sun in light, moon in dark */
.ic-sun, .ic-moon { display: inline-flex; }
html[data-theme="dark"] .ic-sun { display: none; }
html[data-theme="dark"] .ic-moon { display: inline-flex; }
html[data-theme="light"] .ic-moon { display: none; }

/* ------------------------------------------------- mobile action bar
   The tray is position: fixed at the bottom. On a phone the tray plus the
   on-screen keyboard would eat most of the viewport, so the tray collapses to a
   compact bar and only expands once it actually holds emoji. */
@media (max-width: 720px) {
  .tray-body { max-height: 84px; overflow-y: auto; }
  .tray-head h2 { font-size: 12px; }
  .tray-head .btn-sm { padding: 5px 10px; font-size: 12px; }
  .tray-inner { padding-block: 9px; }

  /* keep the last row of emoji clear of the tray when it is open */
  .tray[data-open="true"] ~ .toast-layer { inset-block-end: 150px; }

  .toolbar {
    position: sticky;
    inset-block-start: var(--header-h);
    z-index: 40;
    background: var(--bg);
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    margin-block-start: -6px;
    padding-block-start: 6px;
  }
}

/* When a fixed tray is visible, pad the page so the footer is reachable. */
body:has(.tray[data-open="true"]) { padding-block-end: 140px; }

@media (max-width: 480px) {
  .hero h1 { letter-spacing: -.8px; }
  .hero-stats b { font-size: 17px; }
  .hero-stats > div { font-size: 9.5px; }
  .search input { padding-inline: 42px; font-size: 14px; }
  .groups { gap: 8px; }
}
