:root {
  --bg: #fbfbfd;
  --card: #ffffff;
  --line: #e7e7ee;
  --text: #1c1c28;
  --muted: #71717f;
  --accent: #6b4cff;
  --accent-soft: #efeaff;
  --good: #17a06a;
  --star: #f4b73f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20,20,40,.05), 0 4px 16px rgba(20,20,40,.04);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* .card sets display:flex, which would otherwise override the [hidden] attribute */
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.topbar { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fff; }
.brand { font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; letter-spacing: .2px; white-space: nowrap; }
.brand::first-letter { color: var(--accent); }

/* ---- global nav: hamburger on mobile, link bar on desktop (pure-CSS checkbox toggle) ---- */
.nav-checkbox { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; } /* hidden but focusable */
.nav-toggle {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; color: var(--text);
}
.nav-toggle-text { font-weight: 600; }
.burger, .burger::before, .burger::after {
  display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; content: '';
}
.burger { position: relative; }
.burger::before { position: absolute; top: -6px; }
.burger::after { position: absolute; top: 6px; }
.nav-checkbox:checked + .nav-toggle { border-color: var(--accent); color: var(--accent); }
.nav-checkbox:focus-visible + .nav-toggle { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.nav-links {
  display: none; position: absolute; right: 16px; top: calc(100% + 6px); z-index: 60;
  flex-direction: column; gap: 2px; min-width: 200px; padding: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(20,20,40,.14);
}
.nav-checkbox:checked ~ .nav-links { display: flex; }
.nav-links a { padding: 10px 12px; border-radius: 8px; text-decoration: none; color: var(--text); font-size: 15px; }
.nav-links a:hover { background: var(--accent-soft); color: var(--accent); }

@media (min-width: 720px) {
  .nav-toggle { display: none; }
  .nav-links {
    display: flex; position: static; flex-direction: row; flex-wrap: wrap;
    justify-content: flex-end; align-items: center; gap: 2px;
    min-width: 0; padding: 0; background: none; border: 0; box-shadow: none;
  }
  .nav-links a { padding: 6px 10px; font-size: 14px; color: var(--muted); }
}

main { max-width: 760px; margin: 0 auto; padding: 16px; }
h1 { font-size: 24px; line-height: 1.2; margin: 12px 4px 6px; }
.intro { color: var(--muted); margin: 0 4px 16px; font-size: 15px; }

/* ---- tool: sticky so the input stays reachable while scrolling results ---- */
.tool {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg); padding: 10px 0 8px; margin: 0 0 8px;
}
.inputwrap { position: relative; }
#text {
  width: 100%; font-size: 18px; padding: 15px 44px 15px 16px;
  border: 2px solid var(--accent); border-radius: var(--radius);
  background: #fff; color: var(--text); box-shadow: var(--shadow);
}
#text:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
#clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border: 0; border-radius: 50%;
  background: #ececf3; color: var(--muted); font-size: 18px; cursor: pointer;
}
#clear:hover { background: #e0e0ea; }
#stylesearch {
  width: 100%; margin-top: 8px; padding: 10px 14px; font-size: 14px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text);
}
#stylesearch:focus { outline: none; border-color: var(--accent); }
.statusrow { display: flex; justify-content: flex-end; color: var(--muted); font-size: 12px; margin-top: 6px; }

/* ---- results grid: whole card is the tap target ---- */
.grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 560px) { .grid { grid-template-columns: 1fr 1fr; } }

.card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start;
  gap: 6px; width: 100%; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 44px 12px 16px; box-shadow: var(--shadow);
  font: inherit; color: inherit; transition: border-color .12s, transform .06s;
}
.card:hover { border-color: #d6d0ff; }
.card:active { transform: scale(.995); }
.card:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.preview { font-size: 22px; line-height: 1.35; word-break: break-word; }
.meta { display: flex; align-items: center; gap: 8px; }
.label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

.star {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 30px;
  display: grid; place-items: center; font-size: 18px; color: var(--star);
  border-radius: 8px; cursor: pointer; user-select: none;
}
.star:hover { background: #fff6e3; }
.card.is-fav { border-color: var(--star); }

.copied {
  position: absolute; right: 10px; bottom: 10px; font-size: 12px; font-weight: 600;
  color: var(--good); opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s;
}
.card.just-copied { border-color: var(--good); }
.card.just-copied .copied { opacity: 1; transform: translateY(0); }

/* ---- toast at thumb height ---- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: #1c1c28; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .18s; z-index: 50; box-shadow: 0 8px 30px rgba(0,0,0,.25);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- prose / SEO content below the tool ---- */
.prose { margin-top: 32px; color: var(--text); }
.prose h2 { font-size: 16px; margin: 22px 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--text); text-decoration: none; font-size: 14px;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.faq details { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; background: #fff; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { color: var(--muted); margin: 8px 0 0; }

.foot { max-width: 760px; margin: 40px auto 24px; padding: 16px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.foot a { color: var(--muted); }
.footlinks { margin-bottom: 8px; }
.footlinks a { color: var(--text); }
.footlinks a:hover { color: var(--accent); }

/* ---- names browse hub ---- */
.namesindex { margin-top: 8px; }
.namesindex h2 { font-size: 16px; margin: 20px 0 10px; }
.chip-more { border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* ---- style checklist (replaces the search box) ---- */
.stylepanel { margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.stylepanel > summary { cursor: pointer; padding: 10px 14px; font-size: 14px; color: var(--muted); list-style: none; user-select: none; }
.stylepanel > summary::-webkit-details-marker { display: none; }
.stylepanel > summary::after { content: ' ▾'; }
.stylepanel[open] > summary::after { content: ' ▴'; }
.stylepanel #shownCount { color: var(--text); font-weight: 600; }
.panelctl { display: flex; gap: 8px; padding: 0 14px 8px; }
.minibtn { background: var(--panel-2, #f2f2f7); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; font-size: 12px; color: var(--text); cursor: pointer; }
.minibtn:hover { border-color: var(--accent); color: var(--accent); }
.stylegroups { padding: 4px 14px 12px; max-height: 340px; overflow: auto; }
.stylegroup { margin-bottom: 12px; }
.grouptoggle { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin-top: 6px; }
@media (min-width: 560px) { .opts { grid-template-columns: 1fr 1fr 1fr; } }
.opt { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; min-width: 0; }
.opt-label { font-size: 16px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt input { flex: none; }

/* ---- reference chart (per-letter rows) ---- */
.chart { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.chartrow { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 8px 10px; box-shadow: var(--shadow); }
.rowhead { flex: none; width: 40px; height: 40px; display: grid; place-items: center; font-size: 22px; font-weight: 700; color: var(--text); text-decoration: none; border-radius: 10px; background: var(--accent-soft); }
a.rowhead:hover { color: var(--accent); }
.rowcells { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.seeall { flex: none; font-size: 12px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.seeall:hover { color: var(--accent); }

/* ---- symbol palette ---- */
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 8px; }
.palette-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; }
.palette-glyph { font-size: 30px; line-height: 1; }
.palette-name { font-size: 11px; color: var(--muted); }

/* ---- copyable static cell (chart + palette) ---- */
.copycell {
  cursor: pointer; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font: inherit; font-size: 20px; line-height: 1.2;
  padding: 6px 10px; min-width: 40px; text-align: center; transition: border-color .1s, transform .06s;
}
.copycell:hover { border-color: #d6d0ff; }
.copycell:active { transform: scale(.96); }
.copycell.just-copied { border-color: var(--good); background: #f2fbf6; }
.palette .copycell { min-width: 0; }

/* ---- single-glyph pages: bigger previews ---- */
#results[data-glyph] .preview { font-size: 40px; }
