/* FancyTextGenie — one small stylesheet, system fonts, light + dark themes. */

:root {
  --bg: #f7f6fb;
  --surface: #ffffff;
  --surface-2: #f1eff8;
  --text: #1c1830;
  --muted: #5f5a75;
  --border: #e3e0ef;
  --brand: #6d28d9;
  --brand-2: #db2777;
  --brand-ink: #ffffff;
  --brand-soft: #ede7fb;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --shadow: 0 1px 2px rgba(28, 24, 48, .06), 0 4px 16px rgba(28, 24, 48, .06);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  /* Colour emoji fonts come before the symbol fonts so emojis render in colour (not monochrome). */
  --font-out: system-ui, "Segoe UI", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", "Noto Sans Symbols", "Noto Sans Symbols 2", "Apple Symbols", "Noto Sans", sans-serif;
  color-scheme: light;
}

/* Theme: follows the device setting (light or dark) unless the visitor picks one with the 🌙/☀️ button,
   which sets data-theme="light"|"dark" and is remembered. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #100e1a;
    --surface: #1a1727;
    --surface-2: #231f34;
    --text: #ece9f7;
    --muted: #a7a1bf;
    --border: #322c49;
    --brand: #a78bfa;
    --brand-2: #f472b6;
    --brand-ink: #160f2b;
    --brand-soft: #2a2245;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #100e1a;
  --surface: #1a1727;
  --surface-2: #231f34;
  --text: #ece9f7;
  --muted: #a7a1bf;
  --border: #322c49;
  --brand: #a78bfa;
  --brand-2: #f472b6;
  --brand-ink: #160f2b;
  --brand-soft: #2a2245;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

/* Theme button: moon in light mode (switch to dark), sun in dark mode (switch back). */
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  overflow-x: hidden;
}
a { color: var(--brand); }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; }

.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }
.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; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* ---------- header / footer ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 58px; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.15rem; }
.logo b { color: var(--brand); }
.site-nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; }
.site-nav a { color: var(--muted); text-decoration: none; padding: 6px 8px; border-radius: 8px; white-space: nowrap; font-size: .92rem; }
/* The header gets a wider container than the content so every menu item fits on desktop. */
.site-header .wrap { max-width: 1200px; }
@media (min-width: 1024px) and (max-width: 1180px) {
  .site-nav a { padding: 6px 6px; font-size: .85rem; }
  .logo span { font-size: 1rem; }
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.theme-toggle {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; flex: none;
}

/* Main menu: normal bar on desktop; on phones a ☰ button opens a drawer that slides in from the left. */
.menu-toggle, .nav-head, .nav-home { display: none; }
.menu-toggle {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  width: 38px; height: 38px; border-radius: 10px; place-items: center; cursor: pointer; flex: none;
}
.nav-title { font-weight: 700; }
.nav-close {
  border: 0; background: var(--surface-2); color: var(--text); width: 34px; height: 34px;
  border-radius: 10px; font-size: 1rem; cursor: pointer;
}
@media (max-width: 1023px) {
  .site-header { position: static; }        /* no stacking context, so the drawer can sit above everything */
  .theme-toggle { margin-left: auto; }
  .menu-toggle { display: grid; }
  .site-nav {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 31; width: min(300px, 84vw); margin: 0;
    display: flex; flex-direction: column; gap: 2px; overflow-y: auto; overscroll-behavior: contain;
    background: var(--surface); border-right: 1px solid var(--border); padding: 14px 12px 24px;
    box-shadow: 8px 0 30px rgba(0, 0, 0, .35);
    transform: translateX(-105%); transition: transform .25s ease; visibility: hidden;
  }
  .site-nav.open { transform: translateX(0); visibility: visible; }
  .nav-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 10px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
  .nav-home { display: block; }
  .site-nav a { padding: 12px 12px; font-size: 1rem; border-radius: 10px; }
  .nav-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(10, 8, 20, .55); }
}

.site-footer { margin-top: 56px; padding: 36px 0 28px; border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .92rem; }
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 760px) { .footer-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .footer-grid { grid-template-columns: 1.5fr repeat(5, 1fr); } }
.site-footer .wrap { max-width: 1200px; }
.footer-about p { margin: 10px 0 0; max-width: 320px; }
.footer-about .logo { font-size: 1.05rem; }
.footer-col h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text); margin: 0 0 10px; }
.footer-col a { display: block; color: var(--muted); text-decoration: none; padding: 3px 0; }
.footer-col a:hover { color: var(--brand); }
.footer-bottom { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; }
.copyright, .footer-trust { margin: 0; font-size: .85rem; color: var(--muted); }
.footer-bottom a { color: inherit; }

/* ---------- page head ---------- */
.breadcrumbs { font-size: .88rem; color: var(--muted); padding-top: 14px; }
.breadcrumbs a { color: var(--muted); }
.page-head { text-align: center; padding: 22px 0 6px; }
.page-head h1 {
  margin: 0 0 8px;
  font-size: clamp(1.75rem, 5vw, 2.6rem);
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead { margin: 0 auto; max-width: 680px; color: var(--muted); font-size: 1.02rem; }

/* ---------- generator ---------- */
.generator { margin-top: 18px; }

.gen-input {
  background: var(--surface);
  border: 2px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 12px 8px;
}
.gen-input textarea {
  width: 100%; border: 0; outline: none; resize: vertical; min-height: 56px;
  background: transparent; color: var(--text); font: 1.15rem/1.45 var(--font);
}
.gen-input textarea::placeholder { color: var(--muted); opacity: .8; }
.gen-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 8px; }
.gen-count { color: var(--muted); font-size: .85rem; margin-right: auto; font-variant-numeric: tabular-nums; }

.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 10px; padding: 7px 12px; font: 600 .9rem var(--font); cursor: pointer; min-height: 36px;
}
.btn:hover { border-color: var(--brand); }
.btn-ghost { background: var(--surface-2); border-color: transparent; }
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); padding: 10px 22px; }
.btn-primary:hover { filter: brightness(1.08); }

.gen-decor, .gen-recent { display: flex; align-items: center; gap: 8px; margin-top: 12px; min-width: 0; }
.gen-label { font-size: .85rem; color: var(--muted); font-weight: 600; flex: none; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 4px; min-width: 0; }
.chip {
  flex: none; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 5px 12px; font: .9rem var(--font-out); cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip-recent { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

/* Decorate panel: slide-in drawer (☰ button) on phones, sticky left sidebar on desktop. */
.gen-main { min-width: 0; }
.gen-side-head { display: flex; align-items: center; justify-content: space-between; }
.gen-side-title { margin: 0; font-size: 1rem; font-weight: 700; color: var(--text); }
.gen-side-hint { margin: 2px 0 10px; font-size: .8rem; color: var(--muted); }
.gen-side-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; overflow: visible; padding: 0; }
.gen-side-chips .chip { display: block; overflow: hidden; text-overflow: ellipsis; padding: 7px 8px; font-size: .85rem; text-align: center; }
.gen-side-chips .chip-none { grid-column: 1 / -1; }
.gen-side-group { grid-column: 1 / -1; margin-top: 8px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

.gen-decor-toggle { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; max-width: 100%; }
.decor-current { font: 400 .85rem var(--font-out); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hamburger, .hamburger::before, .hamburger::after { display: block; width: 16px; height: 2px; background: currentColor; border-radius: 2px; }
.hamburger { position: relative; flex: none; }
.hamburger::before, .hamburger::after { content: ""; position: absolute; left: 0; }
.hamburger::before { top: -5px; }
.hamburger::after { top: 5px; }
.gen-side-close {
  border: 0; background: var(--surface-2); color: var(--text); width: 34px; height: 34px; border-radius: 10px;
  font-size: 1rem; cursor: pointer;
}

@media (max-width: 899px) {
  .gen-side {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 30; width: min(320px, 86vw);
    overflow-y: auto; overscroll-behavior: contain; background: var(--surface);
    border-right: 1px solid var(--border); padding: 14px 14px 24px;
    box-shadow: 8px 0 30px rgba(0, 0, 0, .35);
    transform: translateX(-105%); transition: transform .25s ease; visibility: hidden;
  }
  .gen-side.open { transform: translateX(0); visibility: visible; }
  .gen-backdrop { position: fixed; inset: 0; z-index: 29; background: rgba(10, 8, 20, .55); }
  body.drawer-open { overflow: hidden; }
}

@media (min-width: 900px) {
  .gen-decor-toggle, .gen-side-close, .gen-backdrop { display: none !important; }
  .gen-body { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 16px; }
  .gen-side {
    position: sticky; top: 72px;
    max-height: calc(100vh - 88px); overflow-y: auto; scrollbar-width: thin;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px;
  }
  .gen-main .gen-tabs { margin-top: 0; }
}
/* Give the generator a little more room on large screens so results keep two columns. */
@media (min-width: 1240px) { .generator { margin-left: -120px; margin-right: -120px; } }

.gen-tabs {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 12px; padding-bottom: 6px;
  background: var(--bg); padding-top: 6px;
}
/* Sticky only on wider screens; on phones the wrapped tabs would cover too much of the screen. */
@media (min-width: 900px) { .gen-tabs { position: sticky; top: 58px; z-index: 3; } }
.tab {
  flex: none; border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font: 600 .85rem var(--font); cursor: pointer;
}
@media (min-width: 760px) { .tab { padding: 7px 14px; font-size: .9rem; } }
.tab[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

.results { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 720px) { .results { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px 10px; cursor: pointer; transition: border-color .15s, transform .15s;
  min-width: 0;
}
.card:hover { border-color: var(--brand); }
.card.copied { border-color: var(--ok); }
.out {
  margin: 0 0 8px; font: 1.3rem/1.5 var(--font-out); color: var(--text);
  overflow-wrap: anywhere; word-break: break-word; min-height: 1.5em;
}
.meta { display: flex; align-items: center; gap: 8px; }
.name { color: var(--muted); font-size: .82rem; margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.len {
  flex: none; font-size: .72rem; font-weight: 700; color: var(--muted); background: var(--surface-2);
  border-radius: 6px; padding: 2px 6px; font-variant-numeric: tabular-nums;
}
.len::after { content: " chars"; font-weight: 400; }
.gen-option { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; font-size: .85rem; color: var(--muted); cursor: pointer; }
.gen-option input { margin-top: 3px; accent-color: var(--brand); }
.compat { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.compat.c1 { background: var(--ok); }
.compat.c2 { background: var(--warn); }
.compat.c3 { background: var(--bad); }
.fav { border: 0; background: none; color: var(--warn); font-size: 1.2rem; cursor: pointer; padding: 2px 6px; line-height: 1; }
.copy {
  border: 0; background: var(--brand-soft); color: var(--brand); font: 700 .85rem var(--font);
  border-radius: 8px; padding: 6px 14px; cursor: pointer; min-height: 32px;
}
.card.copied .copy { background: var(--ok); color: #fff; }

.gen-random { margin-bottom: 12px; }
.random-label { display: block; font-size: .85rem; font-weight: 700; color: var(--brand); margin-bottom: 6px; }
.gen-random .card { border-color: var(--brand); }

.results-empty { text-align: center; color: var(--muted); padding: 24px 0; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-weight: 600; font-size: .92rem; opacity: 0; pointer-events: none; transition: .2s; z-index: 20;
  max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.noscript { color: var(--muted); text-align: center; }

/* ---------- long-form content ---------- */
.content { margin-top: 44px; }
.content h2 { font-size: 1.5rem; margin: 36px 0 10px; }
.content h3 { font-size: 1.15rem; margin: 24px 0 8px; }
.content p, .content li { color: var(--text); }
.content ul, .content ol { padding-left: 22px; }
.content .styled { font-family: var(--font-out); }
.content table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: .95rem; }
.content th, .content td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.content th { background: var(--surface-2); }
.table-scroll { overflow-x: auto; }
.note { background: var(--brand-soft); border-radius: var(--radius); padding: 12px 16px; }

.faq { margin-top: 44px; }
.faq h2 { font-size: 1.5rem; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; }
.faq summary { cursor: pointer; padding: 14px 16px; font-weight: 600; list-style: none; position: relative; padding-right: 40px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 16px; top: 12px; font-size: 1.3rem; color: var(--brand); }
.faq details[open] summary::after { content: "−"; }
.faq-a { padding: 0 16px 6px; color: var(--muted); }
.faq-a p { margin-top: 0; }

/* inline copy buttons, copy lists, style tables, alphabets */
.copy-inline {
  border: 0; background: var(--brand-soft); color: var(--brand); font: 700 .8rem var(--font);
  border-radius: 8px; padding: 5px 12px; cursor: pointer; vertical-align: middle; white-space: nowrap; min-height: 30px;
}
.copy-inline.done { background: var(--ok); color: #fff; }
.copy-list { list-style: none; padding: 0; display: grid; gap: 8px; }
@media (min-width: 720px) { .copy-list { grid-template-columns: 1fr 1fr; } }
.copy-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; min-width: 0;
}
.copy-list .styled { font-size: 1.1rem; overflow-wrap: anywhere; min-width: 0; }
.style-table td.styled { font-size: 1.1rem; overflow-wrap: anywhere; }
.style-table td:last-child { text-align: right; width: 1%; }

.alphabets { display: grid; gap: 12px; }
.alphabet { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.alphabet h3 { margin: 0 0 6px; font-size: 1rem; }
.alphabet-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px dashed var(--border); }
.alphabet-row:first-of-type { border-top: 0; }
.alphabet-label { flex: none; width: 34px; color: var(--muted); font-size: .8rem; font-weight: 700; }
.alphabet-chars { flex: 1; min-width: 0; font-size: 1.15rem; overflow-wrap: anywhere; letter-spacing: .02em; }

/* related tools */
.related { margin-top: 44px; }
.related h2 { font-size: 1.5rem; }
.tool-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 600px) { .tool-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .tool-grid { grid-template-columns: repeat(3, 1fr); } }
.tool-card {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; text-decoration: none; color: var(--text); transition: border-color .15s;
}
.tool-card:hover { border-color: var(--brand); }
.tool-icon { grid-row: span 2; font-size: 1.6rem; width: 44px; height: 44px; display: grid; place-items: center; background: var(--brand-soft); border-radius: 12px; }
.tool-name { font-weight: 700; }
.tool-blurb { color: var(--muted); font-size: .88rem; line-height: 1.4; }

/* text pages */
.wrap-narrow { max-width: 760px; }
.page-head-left { text-align: left; }
.page-head-left h1 { display: inline-block; }
.updated { color: var(--muted); font-size: .9rem; margin: 0; }
.content-page { margin-top: 16px; }
.content-page h2 { font-size: 1.25rem; margin-top: 28px; }
.contact-email { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 1.2rem; font-weight: 700; }
.content code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: .9em; }

/* ---------- cursive letters ---------- */
.hand { font-family: "Playwrite US Trad", "Segoe Script", cursive; font-weight: 400; }
.cl-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.cl-hero figure { margin: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cl-hero img { display: block; width: 100%; height: auto; }
.cl-hero figcaption { text-align: center; font-size: .85rem; color: #4b4668; padding: 6px; background: #fff; }
.cl-content { margin-top: 28px; }
.cl-learn-grid { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 760px) { .cl-learn-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.cl-steps li { margin-bottom: 6px; }
.cl-big { font-size: 1.6rem; }

.cp { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.cp-svg { display: block; width: 100%; height: auto; max-height: 360px; }
.cp-svg .g-top { stroke: #a5b4fc; stroke-width: 8; }
.cp-svg .g-mid { stroke: #fca5a5; stroke-width: 7; stroke-dasharray: 60 45; }
.cp-svg .g-base { stroke: #60a5fa; stroke-width: 10; }
.cp-svg .g-desc { stroke: #c7d2fe; stroke-width: 6; }
.cp-ghost { fill: var(--surface-2); }
.cp-ink { fill: var(--text); display: none; }
.cp-done .cp-ink { display: inline; }
.cp-stroke { fill: none; stroke: var(--text); stroke-linecap: round; stroke-linejoin: round; }
.cp-done .cp-strokes { display: none; }
.cp-start circle { fill: var(--ok); opacity: .9; }
.cp-start text { fill: #fff; font: 700 72px/1 var(--font); text-anchor: middle; }
.cp-start.active circle { fill: var(--brand-2); }
.cp-pen { fill: var(--brand-2); opacity: 0; transition: opacity .15s; }
.cp figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.cp-label { color: var(--muted); font-size: .85rem; margin-left: auto; }
.cp-speed[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }

.ws-card { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.ws-card p { margin: 0 0 8px; }
.ws-icon { font-size: 2.2rem; line-height: 1; }
.ws-desc { color: var(--muted); }
.ws-card .btn { margin: 4px 6px 0 0; display: inline-block; text-decoration: none; }

.hand-words { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 720px) { .hand-words { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.hand-words li { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px; text-align: center; min-width: 0; }
.hand-words .hand { display: block; font-size: 1.6rem; line-height: 1.9; overflow-wrap: anywhere; }
.hand-label { font-size: .78rem; color: var(--muted); }
.hand-try { margin-top: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.hand-try label { display: block; font-weight: 600; margin-bottom: 6px; }
.hand-try input { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; font: 1rem var(--font); background: var(--bg); color: var(--text); }
.hand-preview {
  font-size: clamp(2rem, 7vw, 3.2rem); line-height: 2; margin: 10px 0 0; overflow-wrap: anywhere; min-height: 2em;
  background: linear-gradient(to bottom, transparent 64%, #60a5fa 64%, #60a5fa calc(64% + 2px), transparent calc(64% + 2px));
}

.cl-nav { margin-top: 40px; }
.cl-nav h2 { font-size: 1.25rem; }
.cl-prevnext { display: flex; justify-content: space-between; gap: 10px; }
.cl-prevnext .btn { text-decoration: none; }
.az-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
@media (min-width: 600px) { .az-grid { grid-template-columns: repeat(9, minmax(0, 1fr)); } }
@media (min-width: 900px) { .az-grid { grid-template-columns: repeat(13, minmax(0, 1fr)); } }
.az-grid a {
  display: flex; flex-direction: column; align-items: center; padding: 6px 2px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.az-grid a:hover, .az-grid a[aria-current="page"] { border-color: var(--brand); background: var(--brand-soft); }
.az-grid a { overflow: hidden; }
.az-grid .hand { font-size: 1.1rem; line-height: 1.8; white-space: nowrap; }
@media (min-width: 600px) { .az-grid .hand { font-size: 1.35rem; } }
.az-label { font-size: .72rem; color: var(--muted); text-align: center; }
.az-grid-lg { margin-top: 18px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 600px) { .az-grid-lg { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (min-width: 900px) { .az-grid-lg { grid-template-columns: repeat(9, minmax(0, 1fr)); } }
.az-grid-lg .hand { font-size: 1.8rem; }
.chart { margin: 24px 0 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.chart img { display: block; width: 100%; height: auto; }
.chart figcaption { padding: 10px 14px; color: #4b4668; font-size: .9rem; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; }
.chart-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chart-actions .btn { text-decoration: none; }
.hub-gen { margin-top: 36px; }
.hub-gen h2 { font-size: 1.5rem; margin-bottom: 4px; }

.ad { margin: 24px 0; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* ---------- Symbol / kaomoji listings (phase 6) ---------- */
.sym-tool { margin: 8px 0 24px; }
.sym-bar {
  position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; gap: 8px; padding: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
@media (min-width: 1024px) { .sym-bar { top: 66px; } }
.sym-search { flex: 1 1 220px; }
.sym-search input, .sym-tray input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text); font: 1rem var(--font-out);
}
.sym-tray { flex: 2 1 320px; display: flex; gap: 6px; }
.sym-tray input { flex: 1; min-width: 0; }
.sym-tray .btn-primary { padding: 8px 16px; }
.sym-hint { color: var(--muted); font-size: .85rem; margin: 8px 2px 0; }
.sym-jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 4px; }
.sym-jump a {
  padding: 4px 11px; border-radius: 999px; background: var(--surface-2); color: var(--text);
  text-decoration: none; font-size: .85rem;
}
.sym-jump a:hover { background: var(--brand-soft); color: var(--brand); }
.sym-section { margin-top: 22px; scroll-margin-top: 140px; }
.sym-section h2 { font-size: 1.15rem; margin: 0 0 10px; }
.sym-more { margin: -4px 0 10px; font-size: .9rem; }
.sym-grid { display: grid; gap: 6px; }
.sym-sm { grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); }
.sym-md { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.sym-lg { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.sym {
  min-height: 46px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); font: 1.25rem/1.2 var(--font-out); cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sym-md .sym, .sym-lg .sym { font-size: 1rem; }
.sym:hover { border-color: var(--brand); background: var(--brand-soft); }
.sym.done { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 15%, var(--surface)); }
.sym-none { text-align: center; color: var(--muted); padding: 24px 0; }

/* Emoticon hub cards */
.mood-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin: 8px 0 20px; }
.mood-card {
  display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); text-decoration: none;
}
.mood-card:hover { border-color: var(--brand); }
.mood-sample { font: 1.1rem var(--font-out); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mood-name { font-weight: 600; }
.mood-count { color: var(--muted); font-size: .8rem; }

/* ---------- Small text tools ---------- */
.util { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin: 8px 0 24px; }
.util-text {
  width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
  color: var(--text); font: 1rem/1.5 var(--font-out); resize: vertical;
}
.util-out { margin-top: 10px; }
.util-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.util-actions .btn.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.util-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 12px; }
.util-row label { display: flex; align-items: center; gap: 6px; font-size: .9rem; }
.util-row input[type=number], .util-row select, .rep-custom {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit;
}
.util-row input[type=number] { width: 90px; }
.util-row .gen-option { margin: 0; }
.util-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.util-stat, .util-note { color: var(--muted); font-size: .85rem; }
.util-btns { display: flex; gap: 6px; }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.inv-card { display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.inv-card .copy-inline { align-self: flex-start; margin-top: 4px; }
.inv-box { font-family: monospace; color: var(--muted); }
.inv-char { background: var(--brand-soft); }
.inv-use { color: var(--muted); font-size: .85rem; }
.count-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
@media (min-width: 700px) { .count-stats { grid-template-columns: repeat(6, 1fr); } }
.count-stats div { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.count-stats b { font-size: 1.4rem; }
.count-stats span { color: var(--muted); font-size: .75rem; text-align: center; }
.limits-title { font-size: 1.1rem; margin: 20px 0 8px; }
.limits { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.limits li { display: grid; grid-template-columns: minmax(130px, 200px) 1fr 120px; align-items: center; gap: 10px; font-size: .9rem; }
@media (max-width: 520px) { .limits li { grid-template-columns: 1fr auto; } .lim-bar { grid-column: 1 / -1; grid-row: 2; } }
.lim-bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.lim-bar span { display: block; height: 100%; width: 0; background: var(--ok); transition: width .15s; }
.limits li.near .lim-bar span { background: var(--warn); }
.limits li.over .lim-bar span { background: var(--bad); }
.limits li.over .lim-val { color: var(--bad); font-weight: 600; }
.lim-val { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.sym-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px 18px; }
.sym-group h3 { font-size: .95rem; margin: 0 0 6px; }
.sym-group h3 a { color: var(--text); text-decoration: none; }
.sym-group h3 a:hover { color: var(--brand); }
/* 900–1023px: generator sidebar layout, but the header is not sticky (menu drawer), so stick to the top edge. */
@media (min-width: 900px) and (max-width: 1023px) {
  .gen-tabs { top: 0; }
  .gen-side { top: 12px; }
}

/* ---------- Blog (phase 7) ---------- */
.post-meta { color: var(--muted); font-size: .9rem; margin: 4px 0 10px; }
.page-head-left .lead { text-align: left; margin-left: 0; }
.toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin: 8px 0 20px; }
.toc ol { margin: 8px 0 0; padding-left: 20px; columns: 2 220px; column-gap: 24px; }
.toc li { margin: 3px 0; break-inside: avoid; }
.toc a { color: var(--text); text-decoration: none; }
.toc a:hover { color: var(--brand); text-decoration: underline; }
.content-post h2 { scroll-margin-top: 80px; }
.post-cta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 28px 0 8px; padding: 16px;
  background: var(--brand-soft); border-radius: var(--radius);
}
.post-cta-links { display: flex; flex-wrap: wrap; gap: 8px; }
.post-list { display: grid; gap: 10px; }
.post-card {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); text-decoration: none;
}
.post-card:hover { border-color: var(--brand); }
.post-card-icon { font-size: 1.6rem; line-height: 1; font-family: var(--font-out); }
.post-card-body { display: flex; flex-direction: column; gap: 4px; }
.post-card-title { font-weight: 700; font-size: 1.05rem; }
.post-card-excerpt { color: var(--muted); font-size: .92rem; }
.post-card time { color: var(--muted); font-size: .8rem; }
.post-feed { margin-top: 18px; font-size: .9rem; }
.guides { margin: 8px 0 24px; }
.guides h2 { font-size: 1.1rem; }
.guides ul { margin: 0; padding-left: 20px; }
.guides li { margin: 4px 0; }

/* ---------- Embeddable widget (/widget) and embed page ---------- */
.embed-code { font: .85rem/1.5 ui-monospace, Consolas, monospace; }
.embed-preview { border: 1px dashed var(--border); border-radius: var(--radius); padding: 12px; }
.widget-body { margin: 0; background: var(--bg); }
.widget { padding: 12px; max-width: 640px; margin: 0 auto; }
.widget-input {
  width: 100%; padding: 12px; font: 1rem var(--font-out); border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
}
.widget-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.widget-list li {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface);
}
.widget-out { flex: 1; min-width: 0; font: 1.05rem var(--font-out); color: var(--text); overflow-wrap: anywhere; }
.widget-copy {
  flex: none; border: 0; border-radius: 8px; padding: 6px 12px; background: var(--brand); color: var(--brand-ink);
  font: 600 .85rem var(--font); cursor: pointer;
}
.widget-credit { text-align: center; font-size: .85rem; margin: 12px 0 0; }
.widget-credit a { color: var(--muted); }

/* ---------- A/B test variants (config/site.php → experiments) ---------- */
@media (min-width: 720px) { :root[data-exp-results-layout="b"] .results { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Trust layer (E-E-A-T) ---------- */
.byline { margin: 12px 0 0; font-size: .85rem; color: var(--muted); text-align: center; }
.byline a { color: var(--text); }
.link-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--brand); text-decoration: underline; cursor: pointer; }
.trust { margin: 32px 0 8px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.trust h2 { font-size: 1.2rem; margin: 22px 0 8px; scroll-margin-top: 80px; }
.trust h2:first-child { margin-top: 0; }
.trust ul, .trust ol { padding-left: 20px; }
.trust li { margin: 4px 0; }
.cp-table td { vertical-align: top; }
.cp-table code, .trust code { font-size: .85em; }
.source-list li { margin: 6px 0; }
.trust-more, .source-used { font-size: .9rem; color: var(--muted); }
.trust-actions { margin: 18px 0 6px; }
.trust details { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.trust summary { cursor: pointer; font-weight: 600; }
.cite-text { font-size: .9rem; background: var(--bg); padding: 10px 12px; border-radius: 8px; overflow-wrap: anywhere; }
.source-note { font-size: .9rem; color: var(--muted); margin: 24px 0; }
.report-dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 0; width: min(560px, calc(100vw - 32px)); }
.report-dialog::backdrop { background: rgba(10, 8, 20, .55); }
.report-dialog form, .contact-form { display: grid; gap: 10px; padding: 18px; }
.contact-form { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin: 12px 0 24px; }
.report-dialog h2 { margin: 0; font-size: 1.2rem; }
.report-intro { margin: 0; font-size: .9rem; color: var(--muted); }
.report-dialog label, .contact-form label { display: grid; gap: 4px; font-size: .9rem; font-weight: 600; }
.report-dialog input, .report-dialog textarea, .contact-form input, .contact-form textarea, .contact-form select {
  font: 400 1rem var(--font); padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text);
}
.report-actions { display: flex; gap: 8px; justify-content: flex-end; }
.form-status { margin: 0; font-size: .9rem; min-height: 1.2em; }
.form-status.ok, .form-done { color: var(--ok); }
.form-status.err, .form-error { color: var(--bad); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.trust-nav { margin: 28px 0 8px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.trust-nav h2 { font-size: 1rem; margin: 0 0 8px; }
.trust-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.author-head { display: flex; align-items: center; gap: 16px; }
.author-head h1 { margin: 0; }
.author-role { margin: 4px 0 0; color: var(--muted); }
.author-photo { border-radius: 50%; object-fit: cover; }
.author-initial { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 1.4rem; flex: none; }
.author-initial-lg { width: 96px; height: 96px; font-size: 2.4rem; }
.author-list { display: grid; gap: 10px; margin: 16px 0; }
.author-card { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; }
.author-card:hover { border-color: var(--brand); }
.tool-index { padding-left: 20px; }
.tool-index li { margin: 5px 0; }
.source-entry { margin: 14px 0; }
.source-entry h3 { font-size: 1.02rem; margin: 0 0 4px; }
.source-entry p { margin: 2px 0; }
.chart-list { columns: 2 240px; }
