:root {
  color-scheme: dark;
  --bg: #12140f;
  --raise: #1c2018;
  --line: #34392c;
  --text: #f3efe4;
  --muted: #b1aa98;
  --accent: #e39a4a;
  --accent-ink: #23180c;
  --danger: #ef7a68;
  --sans: "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", monospace;
}

* { box-sizing: border-box; }

html { text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(227, 154, 74, 0.18), transparent 55%),
    var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--sans);
}

button, input, textarea, select { font: inherit; color: inherit; }

button { cursor: pointer; }

.shell, .gate {
  width: min(520px, 100%);
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 20px max(32px, env(safe-area-inset-bottom));
}

.gate { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; }

.mark {
  margin: 0;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 { margin: 8px 0 0; font-size: 1.8rem; font-weight: 650; letter-spacing: -0.03em; }

.lede, .hint, .fine, .count, .empty { color: var(--muted); }

.lede { margin: 8px 0 18px; }

.fine { margin: 18px 0 0; font-size: 0.82rem; }

.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }

.field > span { font-size: 0.92rem; }

input, textarea, select {
  width: 100%;
  padding: 12px 14px;
  background: #10130e;
  border: 1px solid var(--line);
  border-radius: 12px;
}

textarea { min-height: 110px; resize: vertical; }

input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.mono { font-family: var(--mono); }

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 12px 16px;
  background: var(--raise);
}

.btn.primary { background: var(--accent); color: var(--accent-ink); font-weight: 700; }

.btn.ghost { background: transparent; border-color: var(--line); }

.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }

.btn:disabled { opacity: 0.6; cursor: wait; }

.row-actions, .stack, .inline { display: flex; flex-wrap: wrap; gap: 8px; }

.stack { flex-direction: column; align-items: stretch; }

.stack .btn, .gate .btn.primary, .shell .btn.primary { width: 100%; }

.list { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 16px; }

.row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 14px;
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.row small, .check span { color: var(--muted); }

.row strong { word-break: break-word; }

.check { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }

.check input { width: 1.1rem; height: 1.1rem; }

.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 16px; }

.top h1 { font-size: 1.4rem; }

.secret-preview {
  margin: 0 0 16px;
  padding: 16px;
  background: #10130e;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-family: var(--mono);
  word-break: break-all;
}

.error { display: none; margin: 0 0 12px; color: var(--danger); }

.error.on { display: block; }

.busy { color: var(--accent); }

a { color: var(--accent); }

#toast {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(420px, calc(100% - 24px));
  padding: 12px 14px;
  background: #f3efe4;
  color: #1a1814;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
}

#toast.on { opacity: 1; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
