:root {
  color-scheme: light dark;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --border: #dcdcd7;
  --text: #1c1c1a;
  --muted: #6b6b66;
  --accent: #2f5bd3;
  --accent-text: #ffffff;
  --accent-hover: #2449b0;
  --danger: #c0352b;
  --focus: #2f5bd3;
  --code-bg: #ffffff;
  --radius: 8px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131416;
    --surface: #1b1c1f;
    --border: #2e3035;
    --text: #e6e6e3;
    --muted: #9a9a95;
    --accent: #6b8ff0;
    --accent-text: #0d1020;
    --accent-hover: #89a6f5;
    --danger: #f0776c;
    --focus: #89a6f5;
    --code-bg: #17181b;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.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;
}

.top, main, footer {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 16px;
}

.top {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-top: 20px;
  padding-bottom: 16px;
}
.brand {
  font: 700 22px/1 var(--mono);
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.tagline { color: var(--muted); font-size: 13px; }
.top .new { margin-left: auto; align-self: center; }

main { flex: 1; }
footer { padding-top: 24px; padding-bottom: 24px; font-size: 13px; }

h1 { font-size: 18px; margin: 0; }
code { font-family: var(--mono); }
.muted { color: var(--muted); }
.muted:empty { display: none; }
small { color: var(--muted); font-weight: 400; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.stack > p { margin: 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

textarea, pre {
  width: 100%;
  margin: 0;
  font: 13.5px/1.55 var(--mono);
  tab-size: 4;
  color: var(--text);
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
textarea { min-height: 55vh; resize: vertical; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; min-height: 30vh; }

input, select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  min-width: 0;
}
input[readonly] { font-family: var(--mono); font-size: 13px; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.options {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 20px;
}
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; padding-bottom: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.actions, .toolbar, .buttons, .copy-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.actions { justify-content: flex-end; }
.actions .muted:first-child { margin-right: auto; }
.toolbar { justify-content: space-between; }
.copy-row input { flex: 1; min-width: 200px; }

button, .button {
  font: 600 14px/1 var(--sans);
  color: var(--accent-text);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 9px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button:disabled { opacity: 0.6; cursor: progress; }
button.secondary, .button.secondary {
  color: var(--text);
  background: transparent;
  border-color: var(--border);
}
button.secondary:hover, .button.secondary:hover { background: var(--surface); border-color: var(--muted); }
button.danger { color: var(--danger); background: transparent; border-color: var(--danger); }
button.danger:hover { color: var(--accent-text); background: var(--danger); }

.error { color: var(--danger); margin: 0; }
.status { margin: 0 0 14px; }
details summary { cursor: pointer; color: var(--muted); font-size: 14px; }
details[open] summary { margin-bottom: 10px; }
details .copy-row { margin-top: 8px; }

@media (max-width: 600px) {
  .hint { display: none; }
  .options { flex-direction: column; align-items: stretch; }
  .tagline { display: none; }
  textarea { min-height: 45vh; }
}

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