/* ============================================================================
   Play & Tools — design system
   One stylesheet for the whole site. Tokens first, then primitives, then the
   handful of layout shapes every tool page reuses.
   ========================================================================= */

/* ---- tokens --------------------------------------------------------------*/
:root {
  color-scheme: light dark;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter,
    Roboto, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #fbfbfd;
  --bg-sub: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --border: #e3e3e6;
  --border-strong: #d2d2d7;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --on-accent: #ffffff;
  --green: #1d8a4a;
  --green-soft: rgba(29, 138, 74, 0.1);
  --red: #d02b20;
  --red-soft: rgba(208, 43, 32, 0.1);
  --amber: #9a6400;
  --amber-soft: rgba(154, 100, 0, 0.12);
  --nav-bg: rgba(251, 251, 253, 0.72);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.1);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --r-xl: 24px;

  --nav-h: 52px;
  --page: 1080px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-sub: #0a0a0b;
    --surface: #161617;
    --surface-2: #1f1f21;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #86868b;
    --border: #2a2a2c;
    --border-strong: #3a3a3d;
    --accent: #2997ff;
    --accent-hover: #47a6ff;
    --accent-soft: rgba(41, 151, 255, 0.16);
    --on-accent: #001c33;
    --green: #4ad07d;
    --green-soft: rgba(74, 208, 125, 0.14);
    --red: #ff6b60;
    --red-soft: rgba(255, 107, 96, 0.14);
    --amber: #ffc85c;
    --amber-soft: rgba(255, 200, 92, 0.14);
    --nav-bg: rgba(10, 10, 11, 0.72);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme="dark"] {
  --bg: #000000;
  --bg-sub: #0a0a0b;
  --surface: #161617;
  --surface-2: #1f1f21;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #86868b;
  --border: #2a2a2c;
  --border-strong: #3a3a3d;
  --accent: #2997ff;
  --accent-hover: #47a6ff;
  --accent-soft: rgba(41, 151, 255, 0.16);
  --on-accent: #001c33;
  --green: #4ad07d;
  --green-soft: rgba(74, 208, 125, 0.14);
  --red: #ff6b60;
  --red-soft: rgba(255, 107, 96, 0.14);
  --amber: #ffc85c;
  --amber-soft: rgba(255, 200, 92, 0.14);
  --nav-bg: rgba(10, 10, 11, 0.72);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 24px);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, svg, video, canvas { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

::selection { background: var(--accent-soft); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Parked off-canvas with a transform rather than a negative offset, so its
   shadow cannot bleed back over the nav. */
.skip-link {
  position: fixed; left: 12px; top: 12px; z-index: 200;
  background: var(--surface); color: var(--text);
  padding: 10px 16px; border-radius: var(--r-sm); box-shadow: var(--shadow-lg);
  transform: translateY(-250%);
  transition: transform 0.2s var(--ease);
}
.skip-link:focus { transform: none; }

/* ---- type ----------------------------------------------------------------*/
h1, h2, h3, h4 { letter-spacing: -0.022em; line-height: 1.12; font-weight: 600; text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.25rem); }
h2 { font-size: clamp(1.4rem, 1.2rem + 0.9vw, 1.875rem); }
h3 { font-size: 1.2rem; }

.lead {
  font-size: clamp(1.0625rem, 1rem + 0.4vw, 1.3125rem);
  color: var(--text-2);
  line-height: 1.45;
  text-wrap: pretty;
}

.eyebrow {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-3);
}

code, kbd, pre, samp { font-family: var(--font-mono); font-size: 0.9em; }

kbd {
  display: inline-block; padding: 1px 6px; border-radius: 6px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px;
  background: var(--surface); font-size: 0.78em; line-height: 1.5;
  color: var(--text-2);
}

/* ---- layout --------------------------------------------------------------*/
.container { width: 100%; max-width: var(--page); margin-inline: auto; padding-inline: 22px; }
.container-wide { max-width: 1280px; }
main { flex: 1 0 auto; }
.stack > * + * { margin-top: var(--gap, 16px); }

/* ---- nav -----------------------------------------------------------------*/
.nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.nav-inner {
  height: 100%; display: flex; align-items: center; gap: 8px;
  max-width: 1280px; margin-inline: auto; padding-inline: 22px;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 1rem; font-weight: 600; letter-spacing: -0.02em;
  color: var(--text); margin-right: auto; white-space: nowrap;
}
.brand:hover { text-decoration: none; opacity: 0.7; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), #7b5cff);
  color: #fff;
}
.brand-mark svg { width: 17px; height: 17px; }
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-links a {
  color: var(--text-2); font-size: 0.875rem; padding: 6px 10px;
  border-radius: 999px; transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--text); font-weight: 500; }
@media (max-width: 620px) { .nav-links .opt { display: none; } }

.icon-btn {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  border: 1px solid transparent; border-radius: 999px;
  background: transparent; color: var(--text-2);
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: none; }
}

/* ---- hero ----------------------------------------------------------------*/
.hero { padding: clamp(56px, 9vw, 104px) 0 clamp(32px, 5vw, 56px); text-align: center; }
.hero h1 { margin-bottom: 18px; }
.hero .lead { max-width: 46ch; margin-inline: auto; }
.hero-badges {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 28px;
}
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 0.8125rem; color: var(--text-2); box-shadow: var(--shadow-sm);
}
.badge svg { width: 14px; height: 14px; }

/* ---- search --------------------------------------------------------------*/
.search-wrap { position: relative; max-width: 480px; margin: 34px auto 0; }
.search-wrap svg {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-3); pointer-events: none;
}
/* [type] selector needed: the generic input rule further down would otherwise
   win on equal specificity and clobber the padding that clears the icon. */
.search-wrap input[type="search"] {
  width: 100%; height: 46px; padding: 0 46px 0 44px;
  border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); font-size: 0.9375rem;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.search-wrap input[type="search"]::-webkit-search-decoration,
.search-wrap input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-wrap input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.search-wrap kbd { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); }
.search-wrap input:not(:placeholder-shown) ~ kbd { display: none; }

/* ---- tool grid -----------------------------------------------------------*/
.section { padding-block: clamp(28px, 4vw, 44px); }
.section-head {
  display: flex; align-items: baseline; gap: 12px; margin-bottom: 20px;
}
.section-head h2 { font-size: 1.375rem; }
.section-head .count { font-size: 0.8125rem; color: var(--text-3); }

.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(252px, 1fr));
}

.card {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  padding: 20px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); box-shadow: var(--shadow-sm);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s var(--ease);
}
.card:hover {
  text-decoration: none; transform: translateY(-2px);
  box-shadow: var(--shadow-lg); border-color: var(--border-strong);
}
.card:active { transform: translateY(0); }
.card-icon {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 4px;
}
.card-icon svg { width: 20px; height: 20px; }
.card h3 { font-size: 1.0625rem; font-weight: 600; }
.card p { font-size: 0.875rem; color: var(--text-2); line-height: 1.45; text-wrap: pretty; }
.card[hidden] { display: none; }

.empty-state {
  text-align: center; padding: 48px 0; color: var(--text-2); font-size: 0.9375rem;
}

/* ---- tool page shell -----------------------------------------------------*/
.breadcrumb {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding-top: 26px; font-size: 0.8125rem; color: var(--text-3);
}
.breadcrumb a { color: var(--text-2); }
.breadcrumb span[aria-hidden] { opacity: 0.5; }

.tool-head { padding: 20px 0 30px; max-width: 62ch; }
.tool-head .tool-icon {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 18px;
}
.tool-head .tool-icon svg { width: 24px; height: 24px; }
.tool-head h1 { font-size: clamp(1.75rem, 1.3rem + 1.9vw, 2.5rem); margin-bottom: 12px; }
.tool-head .lead { font-size: 1.0625rem; }

/* ---- panels & controls ---------------------------------------------------*/
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  padding: 20px; margin-bottom: 16px;
}
.panel-tight { padding: 14px 16px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar + .toolbar { margin-top: 10px; }
.spacer { flex: 1 1 auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-size: 0.875rem; font-weight: 500; white-space: nowrap;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease),
              color 0.15s var(--ease), transform 0.1s var(--ease), opacity 0.15s var(--ease);
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 500;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 0.8125rem; }
.btn-danger { color: var(--red); }
.btn:disabled { opacity: 0.45; pointer-events: none; }

/* segmented control — the iOS one */
.segmented {
  display: inline-flex; padding: 2px; gap: 2px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.segmented button {
  border: 0; background: transparent; color: var(--text-2);
  padding: 5px 14px; border-radius: 999px; font-size: 0.8125rem; font-weight: 500;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.segmented button[aria-selected="true"] {
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm);
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label {
  font-size: 0.8125rem; font-weight: 500; color: var(--text-2);
}
.hint { font-size: 0.8125rem; color: var(--text-3); }

input[type="text"], input[type="number"], input[type="search"],
input[type="url"], input[type="password"], select, textarea {
  width: 100%; padding: 9px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 0.9375rem; transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
select {
  appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2386868b' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M4 6.5 8 10.5 12 6.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 15px;
}
textarea {
  font-family: var(--font-mono); font-size: 0.8125rem; line-height: 1.6;
  resize: vertical; min-height: 200px; tab-size: 2;
}
.mono { font-family: var(--font-mono); }

input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px;
  background: var(--border-strong); border-radius: 999px; outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0,0,0,0.3); cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  border: 0; box-shadow: 0 1px 4px rgba(0,0,0,0.3); cursor: pointer;
}

/* switch */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 0.875rem; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 40px; height: 24px; border-radius: 999px; background: var(--border-strong);
  position: relative; flex: none; transition: background 0.22s var(--ease);
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.22s var(--ease);
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* checkbox row */
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.875rem; cursor: pointer; }
.check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* ---- editor pair ---------------------------------------------------------*/
.pair { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 800px) { .pair { grid-template-columns: 1fr; } }
.pane { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pane-head { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.pane-head .label { flex: 1 1 auto; }

.output-box {
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface-2); padding: 12px;
  font-family: var(--font-mono); font-size: 0.8125rem; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word; overflow-x: auto;
  min-height: 60px;
}

/* ---- status --------------------------------------------------------------*/
.status {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 13px; border-radius: var(--r-sm); font-size: 0.8125rem;
  line-height: 1.5; border: 1px solid transparent;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; flex: none; }
.status-ok { background: var(--green-soft); color: var(--green); }
.status-ok::before { background: currentColor; }
.status-err { background: var(--red-soft); color: var(--red); }
.status-err::before { background: currentColor; }
.status-warn { background: var(--amber-soft); color: var(--amber); }
.status-warn::before { background: currentColor; }
.status-muted { background: var(--surface-2); color: var(--text-2); }
.status-muted::before { background: var(--text-3); }
.status[hidden] { display: none; }

/* ---- stats ---------------------------------------------------------------*/
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.stat {
  padding: 14px 16px; border-radius: var(--r); background: var(--surface-2);
  border: 1px solid var(--border);
}
.stat-value {
  font-size: 1.625rem; font-weight: 600; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.stat-label { font-size: 0.75rem; color: var(--text-2); margin-top: 4px; }

/* ---- tables --------------------------------------------------------------*/
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); }
th { font-weight: 500; color: var(--text-2); font-size: 0.8125rem; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.mono, th.mono { font-family: var(--font-mono); font-size: 0.8125rem; word-break: break-all; }

/* ---- dropzone ------------------------------------------------------------*/
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--r);
  padding: 30px 20px; text-align: center; color: var(--text-2);
  background: var(--surface-2); cursor: pointer; font-size: 0.9375rem;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), color 0.18s var(--ease);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone strong { font-weight: 600; }

/* ---- diff ----------------------------------------------------------------*/
.diff {
  border: 1px solid var(--border); border-radius: var(--r); overflow: auto;
  font-family: var(--font-mono); font-size: 0.8125rem; line-height: 1.65;
  background: var(--surface);
}
.diff-row { display: grid; grid-template-columns: 48px 48px 1fr; min-width: max-content; }
.diff-row > .ln {
  padding: 0 8px; text-align: right; color: var(--text-3);
  background: var(--surface-2); border-right: 1px solid var(--border);
  user-select: none; font-size: 0.75rem;
}
.diff-row > .tx { padding: 0 12px; white-space: pre-wrap; word-break: break-word; }
.diff-row.add { background: var(--green-soft); }
.diff-row.del { background: var(--red-soft); }
.diff-row.add .tx::before { content: "+ "; color: var(--green); }
.diff-row.del .tx::before { content: "- "; color: var(--red); }
.diff-row.eq .tx::before { content: "  "; }
.diff mark { background: transparent; padding: 1px 0; border-radius: 3px; }
.diff-row.add mark { background: rgba(29, 138, 74, 0.28); color: inherit; }
.diff-row.del mark { background: rgba(208, 43, 32, 0.26); color: inherit; }

/* ---- prose (SEO copy) ----------------------------------------------------*/
.prose { max-width: 68ch; padding-block: 12px 8px; }
.prose h2 { margin-top: 44px; margin-bottom: 14px; }
.prose h3 { margin-top: 28px; margin-bottom: 8px; font-size: 1.0625rem; }
.prose p, .prose li { color: var(--text-2); font-size: 1rem; line-height: 1.65; text-wrap: pretty; }
.prose p + p { margin-top: 14px; }
.prose ul, .prose ol { margin: 14px 0; padding-left: 22px; }
.prose li + li { margin-top: 7px; }
.prose code {
  background: var(--surface-2); padding: 2px 6px; border-radius: 5px;
  border: 1px solid var(--border); font-size: 0.85em; color: var(--text);
}
.prose strong { color: var(--text); font-weight: 600; }

.faq details {
  border-bottom: 1px solid var(--border); padding: 4px 0;
}
.faq summary {
  cursor: pointer; padding: 14px 0; font-weight: 500; font-size: 1rem;
  list-style: none; display: flex; align-items: center; gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; margin-left: auto; width: 9px; height: 9px; flex: none;
  border-right: 1.5px solid var(--text-3); border-bottom: 1.5px solid var(--text-3);
  transform: rotate(45deg) translate(-2px, -2px); transition: transform 0.2s var(--ease);
}
.faq details[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.faq details > p { padding-bottom: 16px; color: var(--text-2); line-height: 1.65; }

/* ---- related -------------------------------------------------------------*/
.related { padding-block: 40px; border-top: 1px solid var(--border); margin-top: 48px; }
.related h2 { font-size: 1.125rem; margin-bottom: 16px; }
.rail { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.rail a {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface); color: var(--text); font-size: 0.875rem; font-weight: 500;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.rail a:hover { text-decoration: none; border-color: var(--border-strong); background: var(--surface-2); }
.rail svg { width: 17px; height: 17px; color: var(--accent); flex: none; }

/* ---- footer --------------------------------------------------------------*/
.footer {
  border-top: 1px solid var(--border); background: var(--bg-sub);
  padding: 44px 0 36px; margin-top: 60px; font-size: 0.8125rem; color: var(--text-2);
}
.footer-grid {
  display: grid; gap: 28px 24px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 32px;
}
.footer h4 { font-size: 0.75rem; color: var(--text); margin-bottom: 10px; font-weight: 600; }
.footer ul { list-style: none; padding: 0; }
.footer li + li { margin-top: 7px; }
.footer a { color: var(--text-2); }
.footer a:hover { color: var(--text); }
.footer-bottom {
  display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center;
  padding-top: 22px; border-top: 1px solid var(--border); color: var(--text-3);
}

/* ---- toast ---------------------------------------------------------------*/
.toast-host {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 300; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none;
}
.toast {
  padding: 10px 18px; border-radius: 999px; font-size: 0.875rem; font-weight: 500;
  background: rgba(29, 29, 31, 0.92); color: #fff; box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  animation: toast-in 0.24s var(--ease);
}
:root[data-theme="dark"] .toast { background: rgba(245, 245, 247, 0.94); color: #1d1d1f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .toast { background: rgba(245, 245, 247, 0.94); color: #1d1d1f; }
}
.toast.is-out { animation: toast-out 0.2s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px) scale(0.97); } }

/* ---- ads -----------------------------------------------------------------*/
.ad-slot { margin: 32px auto; text-align: center; min-height: 90px; }
.ad-slot::before {
  content: "Advertisement"; display: block; font-size: 0.6875rem;
  color: var(--text-3); letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 6px;
}

/* ---- misc ----------------------------------------------------------------*/
.copy-flash { color: var(--green) !important; border-color: var(--green) !important; }
.swatch { width: 100%; height: 96px; border-radius: var(--r); border: 1px solid var(--border); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 4px 11px; border-radius: 999px; font-size: 0.8125rem;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
}
.chip button { border: 0; background: none; padding: 0 0 0 4px; color: var(--text-3); }

.meter { height: 6px; border-radius: 999px; background: var(--border-strong); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 999px; transition: width 0.3s var(--ease), background 0.3s var(--ease); }

.list-reset { list-style: none; padding: 0; }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.nowrap { white-space: nowrap; }
