:root {
  --bg: #f2f5f5;
  --surface: #ffffff;
  --fg: #14201f;
  --muted: #566866;
  --line: #d3dcdb;
  --accent: #0b6e6a;
  --accent-fg: #ffffff;
  --accent-soft: #e0f0ee;
  --shadow: 0 1px 2px rgba(16, 32, 31, .06), 0 8px 24px rgba(16, 32, 31, .06);
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1514; --surface: #162120; --fg: #e7f0ef; --muted: #93a7a4; --line: #293937;
    --accent: #4fd1c5; --accent-fg: #06201e; --accent-soft: #1b3331;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1514; --surface: #162120; --fg: #e7f0ef; --muted: #93a7a4; --line: #293937;
  --accent: #4fd1c5; --accent-fg: #06201e; --accent-soft: #1b3331;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
.narrow { max-width: 760px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -48px; background: var(--accent); color: var(--accent-fg); padding: 8px 14px; border-radius: 6px; z-index: 50; }
.skip:focus { top: 10px; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.nav { display: flex; align-items: center; gap: 22px; }
.nav a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.nav a:hover { color: var(--fg); }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 8px; cursor: pointer; }
.icon-btn:hover { border-color: var(--accent); }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: block; }
  :root:not([data-theme="light"]) .i-moon { display: none; }
}

/* Hero */
.hero { padding-top: 56px; padding-bottom: 28px; }
h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(32px, 6vw, 52px); line-height: 1.08; letter-spacing: -0.025em; margin: 0 0 14px; max-width: 18ch; text-wrap: balance; }
.lede { color: var(--muted); font-size: 18px; max-width: 62ch; margin: 0; }

/* Tool */
.tool { padding-bottom: 24px; position: relative; }
.modes-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { font-family: var(--font-body); font-size: 14px; font-weight: 600; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; cursor: pointer; transition: background .12s, border-color .12s, color .12s; }
.chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.chip.alt { font-weight: 500; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }

.panes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.pane { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 0; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px 0; }
.pane-head label { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent); padding: 2px 9px; border-radius: 999px; }
.pane-tools { display: flex; gap: 12px; }
.link-btn { background: none; border: 0; padding: 2px 0; font: inherit; font-size: 13px; font-weight: 500; color: var(--accent); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
textarea { flex: 1; width: 100%; min-height: 280px; resize: vertical; background: transparent; color: var(--fg); border: 0; padding: 12px 16px; font-family: var(--font-body); font-size: 16px; line-height: 1.6; }
textarea:focus-visible { outline: none; }
.pane:focus-within { border-color: var(--accent); }
textarea::placeholder { color: var(--muted); }
.out textarea { background: color-mix(in srgb, var(--accent-soft) 40%, transparent); }
.pane-foot { padding: 8px 16px 12px; border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.btn { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-body); font-size: 14px; font-weight: 600; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 16px; cursor: pointer; }
.btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.download { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.download input, .download select { font-family: var(--font-body); font-size: 14px; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; height: 40px; }
.download input { width: 190px; max-width: 100%; }
.status { min-height: 22px; margin: 12px 0 0; font-size: 14px; color: var(--muted); }
.drop { position: fixed; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 88%, transparent); color: var(--accent-fg); font-family: var(--font-display); font-size: 26px; font-weight: 700; z-index: 40; }
.drop[hidden] { display: none; }

/* Sections */
.section { padding-top: 48px; padding-bottom: 24px; }
h2 { font-family: var(--font-display); font-size: 28px; letter-spacing: -0.015em; margin: 0 0 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; min-width: 0; }
.card h3 { font-family: var(--font-display); font-size: 18px; margin: 0 0 6px; }
.card p { color: var(--muted); margin: 0 0 12px; font-size: 15px; }
.card code { display: block; font-family: var(--font-mono); font-size: 13px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; overflow-x: auto; }
details { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; margin-bottom: 10px; }
summary { cursor: pointer; font-weight: 600; }
details p { color: var(--muted); margin: 10px 0 0; }

.site-footer { margin-top: 48px; border-top: 1px solid var(--line); padding: 24px 0; color: var(--muted); font-size: 14px; }
.foot { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

@media (max-width: 760px) {
  .panes { grid-template-columns: minmax(0, 1fr); }
  textarea { min-height: 200px; }
  .nav a { display: none; }
  .hero { padding-top: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .chip { transition: none; }
}
