:root {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --surface-2: #f0f0f6;
  --text: #16161d;
  --muted: #5c5c6e;
  --border: #e2e2ea;
  --accent: #5b4cf0;
  --accent-hover: #4a3cd6;
  --accent-soft: #ecebfe;
  --danger: #c62828;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 20, 40, .05), 0 8px 24px rgba(20, 20, 40, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f14;
    --surface: #17171f;
    --surface-2: #20202b;
    --text: #ececf2;
    --muted: #a0a0b4;
    --border: #2c2c3a;
    --accent: #8b80ff;
    --accent-hover: #a39aff;
    --accent-soft: #24223f;
    --danger: #ff6b6b;
    --shadow: none;
    color-scheme: dark;
  }
}

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

/* Header / footer */
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }
.logo { font-weight: 750; font-size: 1.15rem; color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.logo span { color: var(--accent); }
.nav { display: flex; gap: 18px; font-size: .95rem; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--text); }
.site-footer { border-top: 1px solid var(--border); margin-top: 64px; padding: 28px 0; color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.site-footer a { color: var(--muted); }

/* Hero */
.hero { text-align: center; padding: 44px 0 20px; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.15; margin: 0 0 12px; letter-spacing: -.02em; }
.hero p { color: var(--muted); margin: 0 auto; max-width: 560px; font-size: 1.05rem; }

/* Tool card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.drop {
  border: 2px dashed var(--border); border-radius: 12px; background: var(--surface-2);
  min-height: 220px; display: grid; place-items: center; text-align: center; padding: 20px;
  cursor: pointer; transition: border-color .15s, background .15s; position: relative;
}
.drop:hover, .drop.drag { border-color: var(--accent); background: var(--accent-soft); }
.drop:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.drop .hint strong { display: block; font-size: 1.05rem; margin-bottom: 4px; }
.drop .hint small { color: var(--muted); }
.drop img { max-height: 340px; border-radius: 8px; margin: 0 auto; }
.drop .icon { width: 42px; height: 42px; margin: 0 auto 10px; color: var(--accent); }
.clear-btn {
  position: absolute; top: 10px; right: 10px; border: 0; border-radius: 999px; width: 32px; height: 32px;
  background: rgba(0,0,0,.6); color: #fff; font-size: 18px; cursor: pointer; line-height: 1;
}

.options { display: grid; gap: 14px; margin: 18px 0; }
.opt-label { font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: .95rem; user-select: none;
}
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; padding: 12px 20px; font: inherit; font-weight: 650; cursor: pointer;
  background: var(--accent); color: #fff; transition: background .15s, opacity .15s;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: var(--accent-soft); }
.btn.full { width: 100%; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.result { margin-top: 18px; }
.result textarea {
  width: 100%; min-height: 150px; resize: vertical; padding: 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font: 15px/1.55 ui-monospace, "Cascadia Code", Consolas, monospace;
}
.result-actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.error { color: var(--danger); margin-top: 12px; font-weight: 500; }
[hidden] { display: none !important; }

/* Ad slots — visible outline only until AdSense is active */
.ad-slot { margin: 28px 0; min-height: 90px; display: grid; place-items: center; }
.ad-slot:empty::before, .ad-slot.placeholder::before {
  content: "Advertisement"; color: var(--muted); font-size: .8rem; border: 1px dashed var(--border);
  border-radius: 8px; width: 100%; min-height: 90px; display: grid; place-items: center;
}

/* Content sections */
.content h2 { font-size: 1.45rem; margin: 44px 0 12px; letter-spacing: -.01em; }
.content h3 { font-size: 1.1rem; margin: 22px 0 6px; }
.content p, .content li { color: var(--text); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; padding: 0; list-style: none; }
.steps li { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.steps b { display: block; margin-bottom: 4px; }
details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
summary { cursor: pointer; font-weight: 600; }
details p { margin: 10px 0 0; color: var(--muted); }

/* Simple text pages */
.page { padding-top: 36px; }
.page h1 { font-size: clamp(1.7rem, 4.5vw, 2.3rem); letter-spacing: -.02em; margin: 0 0 6px; line-height: 1.2; }
.page .meta { color: var(--muted); margin: 0 0 24px; }
.page code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-size: .92em; }
.page pre { background: var(--surface-2); padding: 14px; border-radius: 10px; overflow-x: auto; white-space: pre-wrap; }

@media (max-width: 560px) {
  .nav { gap: 12px; font-size: .9rem; }
  .nav .hide-sm { display: none; }
  .card { padding: 14px; }
  .result-actions .btn { flex: 1; }
}
