:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  --bg: #0a0b0d;
  --surface: #111318;
  --raised: #171a20;
  --line: #2a2e38;
  --text: #f4f5f7;
  --muted: #999fab;
  --accent: #8cf0c8;
  --accent-ink: #06251a;
  --danger: #ff8585;
  --warning: #ffd37a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body { margin: 0; color: var(--text); background: radial-gradient(circle at 50% -20%, #18221f 0, var(--bg) 42rem); }
body, button, input, textarea, select { font: inherit; }
button, input, textarea, select { color: inherit; }
button, a, input, textarea, select, summary { outline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); }
button { border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
a { color: var(--accent); text-underline-offset: .2em; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 16ch; font-size: clamp(2rem, 6vw, 4.5rem); line-height: .98; letter-spacing: -.055em; }
h2 { font-size: 1.35rem; }
h3 { margin-top: 2rem; font-size: 1rem; }
code, pre, textarea, .id, .credential dd { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

.skip { position: fixed; top: -5rem; left: 1rem; z-index: 10; padding: .75rem 1rem; background: var(--accent); color: var(--accent-ink); }
.skip:focus { top: 1rem; }
.shell { width: min(70rem, calc(100% - 2rem)); min-height: 100vh; margin: auto; padding: 1.5rem 0 5rem; }
.site-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: clamp(4rem, 10vh, 8rem); }
.brand { color: var(--text); font-size: 1.4rem; font-weight: 800; text-decoration: none; }
.brand span, .eyebrow { color: var(--accent); }
.eyebrow { margin-bottom: .85rem; font-size: .73rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.lede { max-width: 42rem; color: var(--muted); font-size: 1.08rem; line-height: 1.7; }
.landing, .checkpoint { max-width: 54rem; }
.landing-actions { display: flex; align-items: end; gap: 1rem; margin: 2.5rem 0 1rem; }
.open-form { min-width: min(32rem, 100%); }
.open-form > label, label { display: grid; gap: .45rem; color: var(--muted); font-size: .85rem; }
.input-action { display: flex; gap: .55rem; }
.input-action input { flex: 1; }
.or { align-self: center; color: var(--muted); }

input, textarea, select {
  width: 100%;
  min-height: 2.8rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  padding: .7rem .8rem;
  background: var(--surface);
}
textarea { min-height: 18rem; resize: vertical; line-height: 1.55; tab-size: 2; }
.code-editor, #setting-value { min-height: 9rem; }
button, .file-button { display: inline-flex; min-height: 2.7rem; align-items: center; justify-content: center; border-radius: .5rem; padding: .65rem 1rem; font-weight: 700; white-space: nowrap; }
.primary { background: var(--accent); color: var(--accent-ink); }
.quiet, .file-button { border: 1px solid var(--line); background: var(--raised); color: var(--text); }
.text-button { padding-inline: .45rem; background: transparent; color: var(--muted); }
.danger-button { border: 1px solid #713e43; background: #2c171a; color: var(--danger); }
.actions { display: flex; align-items: center; gap: .65rem; margin-top: 1rem; }
.actions.compact { margin-top: 0; gap: .45rem; }
.actions.compact button { min-height: 2.35rem; padding: .45rem .7rem; font-size: .82rem; }
.wrap { flex-wrap: wrap; }
.muted, .hint, .file-meta { color: var(--muted); }
.error-text { color: var(--danger); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

.credential { display: grid; gap: .8rem; margin: 2rem 0; }
.credential div { min-width: 0; border: 1px solid var(--line); border-radius: .6rem; padding: 1rem; background: var(--surface); }
.credential dt { margin-bottom: .4rem; color: var(--muted); font-size: .78rem; }
.credential dd { margin: 0; overflow-wrap: anywhere; }
.confirm { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: .6rem; margin-top: 1.5rem; color: var(--text); }
.confirm input { width: 1.1rem; min-height: 1.1rem; }

.title-row, .section-head, .usage-copy { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.title-row h1 { margin-bottom: .4rem; font-size: clamp(2rem, 5vw, 3.4rem); }
.id { margin-bottom: 2rem; color: var(--muted); overflow-wrap: anywhere; }
.notice { margin: 1rem 0; border-left: 3px solid var(--danger); padding: .9rem 1rem; background: #251619; }
.notice.ok { border-color: var(--accent); background: #10231d; }
.notice.warning { border-color: var(--warning); background: #292313; }
.overview { border: 1px solid var(--line); border-radius: .8rem; padding: 1.2rem; background: color-mix(in srgb, var(--surface) 88%, transparent); }
.usage-copy strong { font-size: 1.15rem; }
progress { width: 100%; height: .65rem; margin-top: .8rem; accent-color: var(--accent); }
.summary-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 1.2rem; }
.grid { display: grid; gap: .7rem; }
.summary-grid article { min-width: 0; border-top: 1px solid var(--line); padding-top: .8rem; }
.summary-grid span { display: block; margin-bottom: .35rem; color: var(--muted); font-size: .75rem; }
.summary-grid strong { overflow-wrap: anywhere; font-size: .9rem; }

.tabs { display: flex; gap: .25rem; margin-top: 2rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border-radius: .4rem .4rem 0 0; padding: .75rem 1rem; background: transparent; color: var(--muted); }
.tabs button.selected, .tabs button[aria-selected="true"] { box-shadow: inset 0 -2px var(--accent); color: var(--text); }
.panel { padding: 2rem 0; }
.section-head p { max-width: 38rem; color: var(--muted); }
.form-grid { grid-template-columns: minmax(0, 1fr) minmax(14rem, .45fr); }
.drop-zone { position: relative; display: grid; place-items: center; min-height: 10rem; border: 1px dashed #505866; border-radius: .75rem; background: var(--surface); text-align: center; }
.drop-zone.dragging, .drop-zone:focus-within { border-color: var(--accent); background: #12251f; }
.drop-zone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop-zone span { color: var(--muted); }
.upload-options { display: grid; gap: .8rem; margin: 1rem 0; }
.upload-options > p { align-self: end; margin-bottom: .75rem; }
.queue { display: grid; gap: .5rem; }
.queue-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; gap: .7rem; border: 1px solid var(--line); border-radius: .6rem; padding: .7rem; }
.queue-item > span { align-self: center; color: var(--muted); font-size: .8rem; }
.file-list { display: grid; gap: .55rem; }
.file { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border: 1px solid var(--line); border-radius: .6rem; padding: .8rem; background: var(--surface); }
.file-name, .file-meta { display: block; overflow-wrap: anywhere; }
.file-meta { margin-top: .3rem; font-size: .75rem; }
.preview { margin-top: 1rem; border: 1px solid var(--line); border-radius: .7rem; padding: 1rem; background: var(--surface); }
.preview pre { max-height: 25rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.preview img { display: block; max-width: 100%; max-height: 35rem; margin: auto; }
.file-button { position: relative; overflow: hidden; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.badge { border: 1px solid var(--line); border-radius: 99rem; padding: .3rem .6rem; color: var(--muted); font-size: .75rem; }
.badge.dirty { border-color: #725f31; color: var(--warning); }
details { margin-top: 1.2rem; border: 1px solid var(--line); border-radius: .65rem; padding: 1rem; background: var(--surface); }
summary { cursor: pointer; font-weight: 700; }
.key-editor { display: grid; gap: .8rem; margin-top: 1rem; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; }
.facts div { border: 1px solid var(--line); border-radius: .5rem; padding: .8rem; }
.facts dt { color: var(--muted); font-size: .75rem; }
.facts dd { margin: .4rem 0 0; overflow-wrap: anywhere; }
.danger-zone { border-top: 1px solid #61383c; }
.danger-zone > input { max-width: 20rem; margin: .6rem 0 1rem; }
.danger-zone > button { display: flex; }
dialog { width: min(28rem, calc(100% - 2rem)); border: 1px solid var(--line); border-radius: .75rem; padding: 1.25rem; background: var(--raised); color: var(--text); }
dialog::backdrop { background: rgb(0 0 0 / .72); }

@media (max-width: 760px) {
  .site-head { margin-bottom: 4rem; }
  .landing-actions, .title-row, .section-head, .file { align-items: stretch; flex-direction: column; }
  .or { align-self: flex-start; }
  .input-action { flex-direction: column; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid, .facts { grid-template-columns: 1fr 1fr; }
  .queue-item { grid-template-columns: 1fr; align-items: stretch; }
}

@media (max-width: 460px) {
  .shell { width: min(100% - 1.1rem, 70rem); }
  .actions:not(.compact) { align-items: stretch; flex-direction: column; }
  .actions:not(.compact) button, .actions:not(.compact) .file-button { width: 100%; }
  .summary-grid, .form-grid, .facts { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
