*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  :root {
    --bg:        #080b14;
    --bg2:       #0d1220;
    --layer1:    #111827;
    --amber:     #d4960a;
    --amber-dim: #9a6c08;
    --amber-glow:#f0b429;
    --red:       #c0392b;
    --blue-deep: #1a2a4a;
    --blue-mid:  #1e3a6e;
    --purple:    #2d1b4e;
    --text:      #dde3ef;
    --text-dim:  #8a93a8;
    --text-faint:#4a5168;
    --border:    rgba(212,150,10,0.15);
    --border2:   rgba(255,255,255,0.06);

    /* Nav tokens — matches /word/ pages so the two feel like one site */
    --nav-bg:        rgba(4,8,15,0.95);
    --nav-border:    rgba(122,96,48,0.33);
    --nav-amber:     #c9a84c;
    --nav-amber-hot: #e0b860;
    --nav-text:      #8aa0b8;
    --nav-h:         44px;
  }

  html { scroll-behavior: smooth; }

  body {
    background: var(--bg);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-weight: 300;
    min-height: 100vh;
    overflow-x: hidden;
    padding-top: var(--nav-h); /* make room for fixed nav */
  }

  /* Background field — matches USNow wave atmosphere */
  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
      radial-gradient(ellipse 80% 50% at 50% 100%, rgba(45,27,78,0.6) 0%, transparent 70%),
      radial-gradient(ellipse 60% 40% at 20% 60%, rgba(26,42,74,0.5) 0%, transparent 60%),
      radial-gradient(ellipse 50% 30% at 80% 40%, rgba(192,57,43,0.08) 0%, transparent 50%),
      radial-gradient(ellipse 100% 60% at 50% 0%, rgba(13,18,32,0.9) 0%, transparent 80%);
    pointer-events: none;
    z-index: 0;
  }

  /* Subtle star field */
  body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
      radial-gradient(1px 1px at 15% 20%, rgba(255,255,255,0.3) 0%, transparent 100%),
      radial-gradient(1px 1px at 35% 8%, rgba(255,255,255,0.2) 0%, transparent 100%),
      radial-gradient(1px 1px at 58% 35%, rgba(255,255,255,0.25) 0%, transparent 100%),
      radial-gradient(1px 1px at 72% 15%, rgba(255,255,255,0.15) 0%, transparent 100%),
      radial-gradient(1px 1px at 88% 28%, rgba(255,255,255,0.2) 0%, transparent 100%),
      radial-gradient(1px 1px at 6%  55%, rgba(255,255,255,0.1) 0%, transparent 100%),
      radial-gradient(1px 1px at 92% 70%, rgba(255,255,255,0.15) 0%, transparent 100%),
      radial-gradient(1px 1px at 44% 80%, rgba(255,255,255,0.1) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
  }

  /* ── SITE NAV (canonical USNow header — matches /word/) ─── */

  nav {
    position: fixed;
    top: 0;
    left: 0; right: 0;
    z-index: 500;
    background: var(--nav-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--nav-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: var(--nav-h);
  }

  .nav-logo {
    display: flex;
    align-items: baseline;
    gap: 4px;
    text-decoration: none;
  }
  .nav-logo .us {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: var(--nav-amber);
    font-family: 'Courier New', monospace;
  }
  .nav-logo .now {
    font-size: 11px;
    letter-spacing: 0.4em;
    color: var(--nav-text);
    font-family: 'Courier New', monospace;
    opacity: 0.85;
  }
  .nav-logo .app {
    font-size: 10px;
    letter-spacing: 0.2em;
    color: var(--nav-text);
    font-family: 'Courier New', monospace;
    opacity: 0.5;
    margin-left: 2px;
  }
  .nav-logo:hover .us { color: var(--nav-amber-hot); }

  .nav-links {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .nav-pill {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.18em;
    color: var(--nav-text);
    text-decoration: none;
    padding: 5px 12px;
    border: 1px solid transparent;
    border-radius: 16px;
    transition: all 0.2s;
    text-transform: uppercase;
  }
  .nav-pill:hover {
    color: var(--nav-amber);
    border-color: rgba(201,168,76,0.35);
  }
  .nav-pill.active {
    background: var(--nav-amber);
    color: #04080f;
    font-weight: 700;
    border-color: var(--nav-amber);
  }
  .nav-pill.active:hover {
    background: var(--nav-amber-hot);
    border-color: var(--nav-amber-hot);
  }

  @media (max-width: 720px) {
    nav { padding: 0 14px; gap: 8px; }
    .nav-links { gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
    .nav-pill { padding: 4px 8px; font-size: 9px; letter-spacing: 0.1em; }
    .nav-logo .now { letter-spacing: 0.25em; }
    .nav-logo .app { display: none; }
  }

  .wrap {
    position: relative;
    z-index: 1;
    max-width: 860px;
    margin: 0 auto;
    padding: 0 24px 80px;
  }

  /* ── HEADER ── */
  header {
    padding: 48px 0 32px;
    border-bottom: 1px solid var(--border);
  }

  /* back-link kept for backward-compat with any direct callers,
     but the new nav supersedes it on the compendium page itself. */
  .back-link {
    display: inline-block;
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.12em;
    color: var(--amber-dim);
    text-decoration: none;
    text-transform: uppercase;
    margin-bottom: 28px;
    opacity: 0.7;
    transition: opacity 0.2s;
  }
  .back-link:hover { opacity: 1; }
  .back-link::before { content: '← '; }

  .site-name {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.2em;
    color: var(--amber-dim);
    text-transform: uppercase;
    margin-bottom: 14px;
  }

  /* H1 — beefier than original, but pulled back to leave room for the
     secondary headline and subtitle below it. */
  h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2.2rem, 5.6vw, 3.6rem);
    font-weight: 300;
    color: var(--text);
    letter-spacing: 0.01em;
    line-height: 1.05;
    margin-bottom: 14px;
  }

  h1 em {
    color: var(--amber);
    font-style: normal;  /* emoji + "Living" highlight — not italic */
  }

  /* Secondary headline — sits between H1 and subtitle.
     One step smaller than H1, still bigger and more present than the
     descriptor below. The italicized words highlight amber. */
  .secondary-headline {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.5rem, 3.4vw, 2.1rem);
    font-weight: 300;
    color: var(--text);
    letter-spacing: 0.02em;
    line-height: 1.15;
    margin-bottom: 16px;
  }
  .secondary-headline em {
    color: var(--amber);
    font-style: italic;
  }

  .subtitle {
    font-size: 14px;
    color: var(--text-dim);
    letter-spacing: 0.04em;
    line-height: 1.6;
    margin-bottom: 4px;
  }

  .suggest-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    align-items: center;
  }
  .suggest-form input {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
    color: var(--text);
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    padding: 8px 12px;
    outline: none;
    transition: border-color 0.2s;
  }
  .suggest-form input:focus { border-color: rgba(212,168,85,0.5); }
  #sg-word { width: 140px; }
  #sg-def  { flex: 1; min-width: 180px; }
  .suggest-form button {
    background: transparent;
    border: 1px solid rgba(212,168,85,0.35);
    border-radius: 4px;
    color: var(--amber-dim);
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.08em;
    padding: 8px 16px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    text-transform: uppercase;
  }
  .suggest-form button:hover { border-color: var(--amber); color: var(--amber); }
  .sg-confirm {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: var(--amber-dim);
    width: 100%;
    min-height: 16px;
    letter-spacing: 0.04em;
  }

  .entry-count {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: var(--amber-dim);
    margin-top: 8px;
    opacity: 0.6;
  }

  /* ── CONTROLS ── */
  /* Slim sticky bar — only search + clear. Filters scroll with the page.
     Keeps the word list visible above the fold on mobile. */
  .controls {
    position: sticky;
    top: var(--nav-h);
    z-index: 10;
    background: rgba(8,11,20,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 14px 0;
    border-bottom: 1px solid var(--border2);
    margin-bottom: 0;
  }

  /* Filters live outside the sticky region — scroll back up to use. */
  .filter-controls {
    padding: 14px 0 8px;
    border-bottom: 1px solid var(--border2);
    margin-bottom: 8px;
  }

  .search-row {
    display: flex;
    gap: 10px;
    margin-bottom: 0;
  }

  #search {
    flex: 1;
    background: var(--layer1);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 300;
    padding: 10px 16px;
    outline: none;
    transition: border-color 0.2s;
  }
  #search::placeholder { color: var(--text-faint); }
  #search:focus { border-color: var(--amber); }

  .clear-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.08em;
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
  }
  .clear-btn:hover { border-color: var(--amber); color: var(--amber); }

  /* Category filters */
  .cat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
  }

  .cat-btn {
    background: transparent;
    border: 1px solid var(--border2);
    color: var(--text-faint);
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.08em;
    padding: 5px 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    white-space: nowrap;
  }
  .cat-btn:hover { border-color: var(--amber-dim); color: var(--amber-dim); }
  .cat-btn.active { background: rgba(212,150,10,0.12); border-color: var(--amber); color: var(--amber); }

  /* Alpha row */
  .alpha-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .alpha-btn {
    background: transparent;
    border: none;
    color: var(--text-faint);
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .alpha-btn:hover { color: var(--amber); }
  .alpha-btn.active { color: var(--amber-glow); font-weight: 500; }
  .alpha-btn.has-entries { color: var(--text-dim); }
  .alpha-btn.no-entries { opacity: 0.25; cursor: default; }

  /* ── RESULTS INFO ── */
  .results-info {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: var(--text-faint);
    letter-spacing: 0.06em;
    padding: 12px 0 4px;
    min-height: 28px;
  }

  /* ── LETTER GROUP ── */
  .letter-group { margin-bottom: 8px; }

  .letter-anchor {
    font-family: 'Cormorant Garamond', serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3em;
    color: var(--amber-dim);
    text-transform: uppercase;
    padding: 20px 0 6px;
    opacity: 0.5;
  }

  /* ── ENTRY ── */
  .entry {
    border-bottom: 1px solid var(--border2);
    padding: 16px 0 14px;
    transition: background 0.15s;
  }
  .entry:hover { background: rgba(255,255,255,0.015); }

  /* Always-visible row: WORD + DEFINITION side by side */
  .entry-main {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 20px;
    align-items: baseline;
    cursor: pointer;
    user-select: none;
  }

  .entry-word {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--amber-glow);
    letter-spacing: 0.03em;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .entry:hover .entry-word { color: #f5c842; }

  .entry-toggle {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: var(--text-faint);
    transition: transform 0.2s, color 0.2s;
    flex-shrink: 0;
  }
  .entry.open .entry-toggle { transform: rotate(90deg); color: var(--amber); }

  .entry-definition {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.02rem;
    font-weight: 400;
    line-height: 1.7;
    color: var(--text);
    font-style: normal;
  }

  /* Expandable: category + tags — hidden until click */
  .entry-detail {
    display: none;
    padding: 10px 0 0 220px;
  }
  .entry.open .entry-detail { display: block; }

  .entry-cat-label {
    font-family: 'DM Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.14em;
    color: var(--amber-dim);
    text-transform: uppercase;
    margin-bottom: 6px;
    opacity: 0.7;
  }

  .entry-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }

  .entry-tag {
    font-family: 'DM Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.1em;
    color: var(--text-faint);
    border: 1px solid var(--border2);
    padding: 3px 8px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.15s;
  }
  .entry-tag:hover { border-color: var(--amber-dim); color: var(--amber-dim); }

  @media (max-width: 600px) {
    .entry-main { grid-template-columns: 1fr; gap: 6px; }
    .entry-detail { padding-left: 0; }
  }

  /* ── EMPTY STATE ── */
  .empty {
    text-align: center;
    padding: 60px 0;
    color: var(--text-faint);
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    font-style: italic;
    display: none;
  }

  /* ── FOOTER ── */
  footer {
    margin-top: 60px;
    padding-top: 24px;
    border-top: 1px solid var(--border2);
    text-align: center;
  }

  .footer-text {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.15em;
    color: var(--text-faint);
    text-transform: uppercase;
  }

  .footer-tagline {
    font-family: 'Cormorant Garamond', serif;
    font-size: 13px;
    color: var(--amber-dim);
    margin-top: 6px;
    font-style: italic;
    opacity: 0.6;
  }

  /* ── SCROLLBAR ── */
  ::-webkit-scrollbar { width: 4px; }
  ::-webkit-scrollbar-track { background: var(--bg); }
  ::-webkit-scrollbar-thumb { background: var(--amber-dim); opacity: 0.3; }

  /* ── Expanded card pills ── */
  .entry-phonetic {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    color: var(--text-dim);
    letter-spacing: 0.06em;
    margin-bottom: 14px;
  }
  .entry-pills {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
  }
  .pill-block {}
  .pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid;
    border-radius: 20px;
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding: 5px 14px 5px 10px;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
  }
  .pill-btn:hover { background: rgba(255,255,255,0.04); }
  .pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  .pill-content {
    display: none;
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.7;
    padding: 10px 14px 4px 28px;
    max-width: 640px;
  }
  .pill-block.open .pill-content { display: block; }
  .pill-block.open .pill-btn { opacity: 0.7; }
  .pill-phonetic {
    font-family: 'DM Mono', monospace;
    font-size: 18px;
    letter-spacing: 0.18em;
    color: #d4a855;
    padding: 12px 14px 4px 28px;
    font-style: normal;
  }

  /* ── See-also cross-reference links ── */
  /* Two flavors, intentionally distinct so the reader can tell editorial
     intent from system-detected at a glance:
       .glory-ref  → explicit (see X) parenthetical — italic + dotted
       .glory-link → auto-detected glory-word match — dotted, no italic
     Both scroll-and-flash to the target entry (no popup, no navigation). */

  .glory-ref {
    color: var(--amber);
    text-decoration: none;
    font-style: italic;
    border-bottom: 1px dotted rgba(212,150,10,0.35);
    transition: color 0.15s, border-color 0.15s;
    cursor: pointer;
  }
  .glory-ref:hover {
    color: var(--amber-glow);
    border-bottom-color: var(--amber-glow);
  }

  .glory-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted rgba(212,150,10,0.32);
    transition: color 0.15s, border-color 0.15s;
    cursor: pointer;
  }
  .glory-link:hover {
    color: var(--amber);
    border-bottom-color: var(--amber);
  }

  /* Brief flash on the entry that was scrolled to. */
  @keyframes gloryFlash {
    0%   { background: rgba(212,150,10,0.18); }
    100% { background: transparent; }
  }
  .entry.glory-flash {
    animation: gloryFlash 1.8s ease-out;
  }

  /* Highlight inside search results — shows the user *where* the match
     was found in each entry. Amber background + bold, similar to the
     main-site tree search. */
  mark.search-hit {
    background: rgba(212,150,10,0.32);
    color: var(--text);
    font-weight: 600;
    padding: 0 2px;
    border-radius: 2px;
  }

  /* Phone — h1 + secondary still readable */
  @media (max-width: 600px) {
    h1 { font-size: 2rem; }
    .secondary-headline { font-size: 1.4rem; }
    header { padding: 32px 0 24px; }
  }
