:root {
  --bg: #faf7f2; --surface: #ffffff; --fg: #2b2a33; --muted: #6b6878; --line: #e4dfd6;
  --accent: #6c4cf0; --accent-fg: #ffffff; --ok: #1f8a4c; --warn: #b26a00; --bad: #c62828;
  --radius: 10px; --max: 1180px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14131a; --surface: #1d1c26; --fg: #f1eef8; --muted: #a29fb3; --line: #34323f;
    --accent: #a58bff; --accent-fg: #14131a; --ok: #55c98a; --warn: #f0b24a; --bad: #ff7b7b;
  }
}
:root[data-theme="dark"] {
  --bg: #14131a; --surface: #1d1c26; --fg: #f1eef8; --muted: #a29fb3; --line: #34323f;
  --accent: #a58bff; --accent-fg: #14131a; --ok: #55c98a; --warn: #f0b24a; --bad: #ff7b7b;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* Header / footer */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.brand { font: 400 1.35rem Georgia, serif; text-decoration: none; color: var(--fg); letter-spacing: .02em; }
.brand b { color: var(--accent); font-weight: 400; }
.nav { display: flex; gap: 16px; flex-wrap: wrap; font-size: .95rem; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--fg); }
.site-footer { margin-top: 48px; border-top: 1px solid var(--line); padding: 24px 0 40px; color: var(--muted); font-size: .9rem; }
.site-footer .nav { margin-bottom: 8px; }

/* Ad slots: reserved space only. No ad code lives here. */
.ad-slot { display: block; width: 100%; margin: 20px auto; background: transparent; overflow: hidden; }
.ad-slot--top-banner, .ad-slot--footer-banner { min-height: 100px; max-width: 970px; }
.ad-slot--in-content, .ad-slot--below-results { min-height: 280px; max-width: 728px; }
.ad-slot--in-article { min-height: 250px; max-width: 728px; }
.ad-slot--sidebar { display: none; min-height: 600px; width: 300px; margin: 0; }
@media (max-width: 600px) {
  .ad-slot--top-banner, .ad-slot--footer-banner { min-height: 60px; }
  .ad-slot--in-content, .ad-slot--below-results { min-height: 250px; }
}

/* Layout: tool + optional sidebar */
.layout { display: block; }
@media (min-width: 1100px) {
  .layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
  .ad-slot--sidebar { display: block; position: sticky; top: 16px; }
}

/* Hero */
.hero { padding: 28px 0 4px; }
.hero h1 { font: 400 clamp(1.7rem, 4.5vw, 2.5rem)/1.2 Georgia, serif; margin: 0 0 8px; }
.hero p { margin: 0; color: var(--muted); font-size: 1.05rem; max-width: 60ch; }

/* Steps */
.step { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-top: 18px; }
.step h2 { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; margin: 0 0 12px; }
.num { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); font-size: .95rem; flex: 0 0 auto; }
.hint { color: var(--muted); font-size: .95rem; margin: 8px 0 0; }
.dot-demo, .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); vertical-align: middle; }
.dot { position: absolute; top: 8px; right: 8px; }
.dot[hidden] { display: none; }

/* Dropzone */
.drop { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 2px dashed var(--accent); border-radius: 12px; padding: 30px 16px; text-align: center; background: var(--bg); cursor: pointer; transition: background .15s; }
.drop:hover, .drop.is-over, .drop:focus-visible { background: color-mix(in srgb, var(--accent) 10%, var(--bg)); outline: none; }
.drop-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; font-size: 2rem; line-height: 1; margin-bottom: 8px; }
.drop strong { font-size: 1.15rem; }
.drop span { color: var(--muted); }

/* Tabs */
.tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 14px 0; }
.tab { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; font: inherit; font-size: .9rem; font-weight: 600; padding: 10px 6px; background: var(--bg); color: var(--fg); border: 2px solid var(--line); border-radius: 10px; cursor: pointer; text-align: center; }
.tab:hover { border-color: var(--accent); }
.tab.is-active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.tab-ico { font: 700 1rem/1.2 Georgia, serif; color: var(--accent); }
.panel { border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: var(--bg); }
.panel[hidden] { display: none; }
.grid2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-weight: 600; font-size: .98rem; }
.field em { font-weight: 400; color: var(--muted); font-style: normal; font-size: .88rem; }
small { color: var(--muted); font-size: .85rem; font-weight: 400; }
.sub { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.sub[hidden] { display: none; }
.check { display: flex; align-items: center; gap: 10px; margin-top: 12px; cursor: pointer; }
.check.big { font-weight: 600; margin-top: 16px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: 0 0 auto; }
.adv { margin-top: 12px; padding: 0; border: 0; }
.adv summary { color: var(--muted); font-weight: 400; font-size: .9rem; }
.reset-row { margin-top: 10px; text-align: right; }

input[type="text"], input[type="number"], select {
  width: 100%; font: inherit; font-size: 1rem; color: var(--fg); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-height: 44px;
}
input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible, .drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Buttons */
.btn { font: inherit; font-weight: 600; border-radius: 10px; padding: 10px 18px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn--big { font-size: 1.1rem; padding: 14px 24px; width: 100%; max-width: 380px; }
.btn--small { padding: 8px 14px; font-size: .92rem; }
.link-btn { background: none; border: 0; color: var(--accent); font: inherit; font-size: .92rem; text-decoration: underline; cursor: pointer; padding: 6px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Results */
.summary { font-weight: 600; margin: 0 0 12px; }
.list { border: 1px solid var(--line); border-radius: 10px; max-height: 420px; overflow-y: auto; }
.item { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item--bad { background: color-mix(in srgb, var(--bad) 8%, var(--surface)); }
.item-body { flex: 1; min-width: 0; }
.before { color: var(--muted); font-size: .88rem; text-decoration: line-through; word-break: break-all; }
.after { font-weight: 600; word-break: break-all; }
.after::before { content: "\2192  "; color: var(--accent); }
.msg { font-size: .85rem; margin-top: 2px; }
.msg--unchanged { color: var(--muted); }
.msg--duplicate, .msg--illegal, .msg--empty, .msg--reserved { color: var(--bad); font-weight: 600; }
.x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1.5rem; line-height: 1; padding: 6px 12px; min-height: 44px; }
.x:hover { color: var(--bad); }
.fix { margin-top: 12px; padding: 12px; border: 1px solid var(--bad); border-radius: 10px; }
.fix p { margin: 0 0 8px; color: var(--bad); font-weight: 600; }
.notice { color: var(--warn); font-size: .92rem; margin: 10px 0 0; min-height: 1em; }
.empty { text-align: center; color: var(--muted); padding: 20px 8px; margin: 0; }
.dl { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 16px; }

/* Content pages */
.prose { max-width: 760px; padding: 24px 0; }
.prose h1 { font: 400 2rem/1.2 Georgia, serif; margin: 0 0 12px; }
.prose h2 { font-size: 1.2rem; margin: 28px 0 8px; }
.prose li { margin-bottom: 4px; }
details { border-top: 1px solid var(--line); padding: 10px 0; }
summary { cursor: pointer; font-weight: 600; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Live name preview */
.live { margin-top: 14px; padding: 14px; border: 2px solid var(--accent); border-radius: 12px; background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.live-title { font-weight: 700; margin-bottom: 6px; }
.live-note { font-weight: 400; color: var(--muted); font-size: .88rem; }
.live-names { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.live-names .before { font-size: .95rem; }
.live-arrow { color: var(--accent); font-weight: 700; }
.live-after { font-size: 1.15rem; word-break: break-all; }
.live-after.is-bad { color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: .85rem; max-width: 100%; overflow-wrap: anywhere; }
.chip--none { color: var(--muted); border-style: dashed; }

/* Added pictures list */
.small-note, .drop small { color: var(--muted); }
.drop small { margin-top: 6px; }
.skipped { margin: 10px 0 0; padding: 8px 12px; border-radius: 8px; background: color-mix(in srgb, var(--warn) 14%, var(--surface)); color: var(--fg); font-size: .92rem; }
.added { list-style: none; margin: 10px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; max-height: 260px; overflow-y: auto; }
.added:empty { display: none; }
.added li { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 10px; border-bottom: 1px solid var(--line); }
.added li:last-child { border-bottom: 0; }
.added img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; background: var(--bg); flex: 0 0 auto; }
.added-name { flex: 1; min-width: 0; word-break: break-all; font-size: .95rem; }
