:root {
  color-scheme: light dark;
  --bg: #fff;
  --text: #111;
  --muted: #888;
  --border: #ddd;
  --border-subtle: #eee;
  --input-bg: #fff;
  --code-bg: #f3f3f3;
}

/* System preference is the default signal (no explicit choice stored)... */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16171d;
    --text: #e7e7ea;
    --muted: #9a9fae;
    --border: #33353f;
    --border-subtle: #2a2c35;
    --input-bg: #1e2027;
    --code-bg: #1e2027;
  }
}

/* ...but an explicit toggle choice (stamped as data-theme on <html>) always wins. */
:root[data-theme="dark"] {
  --bg: #16171d;
  --text: #e7e7ea;
  --muted: #9a9fae;
  --border: #33353f;
  --border-subtle: #2a2c35;
  --input-bg: #1e2027;
  --code-bg: #1e2027;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, sans-serif; color: var(--text); background: var(--bg); }
.topnav {
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.topnav a { text-decoration: none; font-weight: 600; color: var(--text); }
.topnav-brand { display: flex; align-items: center; gap: 0.5rem; }
.nav-logo { height: 1.5rem; width: auto; display: block; }

.theme-toggle { display: flex; gap: 0.25rem; }
.theme-toggle button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.45rem;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--text);
  cursor: pointer;
}
.theme-toggle button.active {
  background: var(--border-subtle);
  border-color: var(--muted);
}

.container { max-width: 900px; margin: 0 auto; padding: 1.5rem; }
.container.narrow { max-width: 480px; }

.hint { color: var(--muted); font-size: 0.9rem; }
.error { color: #ef4444; }

.button {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  background: #2563eb;
  color: #fff;
  border-radius: 4px;
  text-decoration: none;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
}
.button.secondary { background: #6b7280; }

.share-row { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; }
.share-row input {
  flex: 1;
  padding: 0.4rem;
  font-size: 0.9rem;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.file-picker { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.file-picker label { font-size: 0.9rem; }

#progress-wrap { display: flex; align-items: center; gap: 0.75rem; }
progress { flex: 1; height: 0.6rem; }

.curl-info { margin-top: 1.5rem; }
.curl-info summary { cursor: pointer; font-size: 0.9rem; color: var(--muted); }
.curl-box { display: flex; align-items: flex-start; gap: 0.5rem; margin-top: 0.5rem; }
.curl-box pre {
  flex: 1;
  margin: 0;
  padding: 0.6rem 0.75rem;
  background: var(--code-bg);
  border-radius: 4px;
  overflow-x: auto;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-all;
}
