/* Builder on Perso's tokens: warm ground, dark ink, Instrument Sans; Builder's own accent is sky blue. */
:root {
  --ground: #f6f2ea;
  --surface: #fffdf9;
  --ink: #222222;
  --ink-soft: #5d5a55;
  --line: #e4ddd0;
  --sky-1: #b6e2ff;
  --sky-2: #7ecbfb;
  --sky-3: #69c0fa;
  --sky-ink: #0b3a5c;
  --focus: #2f8fd6;
  --error: #a8331f;
  --radius: 14px;
  --font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #1c1b19;
    --surface: #262522;
    --ink: #f2efe9;
    --ink-soft: #b3ada3;
    --line: #3a3833;
    --sky-ink: #06263d;
    --focus: #7ecbfb;
    --error: #ff9b85;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #1c1b19;
  --surface: #262522;
  --ink: #f2efe9;
  --ink-soft: #b3ada3;
  --line: #3a3833;
  --sky-ink: #06263d;
  --focus: #7ecbfb;
  --error: #ff9b85;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
}
[hidden] { display: none !important; }

.shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 12px 32px rgb(0 0 0 / 0.06);
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.mark {
  width: 28px; height: 28px; border-radius: 9px;
  background: linear-gradient(135deg, var(--sky-1), var(--sky-2) 55%, var(--sky-3));
}
.brand-name { font-weight: 600; font-size: 1.0625rem; letter-spacing: -0.01em; }

h1 { font-size: 1.5rem; line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 6px; }
h2 { font-size: 1rem; font-weight: 600; margin: 0 0 12px; }
.lede { margin: 0 0 20px; color: var(--ink-soft); }
.fine { margin: 18px 0 0; font-size: 0.875rem; color: var(--ink-soft); }

form { display: grid; gap: 6px; }
label { font-size: 0.875rem; font-weight: 500; margin-top: 8px; }
input {
  font: inherit;
  color: var(--ink);
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 44px;
  padding: 10px 12px;
  width: 100%;
}
input:focus-visible, button:focus-visible, a:focus-visible, .out:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

button, .as-button {
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.primary {
  margin-top: 16px;
  width: 100%;
  color: var(--sky-ink);
  background: linear-gradient(135deg, var(--sky-1), var(--sky-2) 55%, var(--sky-3));
}
.primary:hover { filter: brightness(1.03); }
.primary:disabled { opacity: 0.6; cursor: default; }
.secondary { color: var(--ink); background: transparent; border-color: var(--line); }
.secondary:hover { border-color: var(--sky-3); }
.link { background: none; color: var(--ink-soft); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; padding: 10px 4px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; }
.row .primary { margin-top: 0; }

.error { color: var(--error); margin: 10px 0 0; font-size: 0.9375rem; }

.dots { display: flex; gap: 6px; margin: 4px 0 20px; }
.dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--sky-3); opacity: 0.35; }
@media (prefers-reduced-motion: no-preference) {
  .dots span { animation: pulse 1.2s ease-in-out infinite; }
  .dots span:nth-child(2) { animation-delay: 0.15s; }
  .dots span:nth-child(3) { animation-delay: 0.3s; }
}
@keyframes pulse { 50% { opacity: 1; } }

.spikes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.spikes button { padding: 8px 10px; font-size: 0.875rem; }
.out {
  margin: 12px 0 0;
  max-height: 50vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font: 0.75rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}

.held-title { margin: 28px 0 8px; font-size: 1rem; }
.held { margin: 14px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line); }
.held h3 { margin: 0 0 6px; font-size: 0.875rem; }
.held-why { margin: 0; padding-left: 18px; font-size: 0.875rem; }
.held .fine { white-space: pre-wrap; margin-top: 8px; }
/* A Dari run in shown code: isolated (its own direction, signs around it in source order) and outlined, so a Dari
   letter can't pass for a Latin one (alef for l). */
.out .rtl { unicode-bidi: isolate; outline: 1px dashed var(--sky-3); outline-offset: 1px; border-radius: 2px; }

@media (min-width: 900px) {
  .card { padding: 36px 32px; }
  .card:has(#view-admin:not([hidden])) { max-width: 640px; }
  .spikes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
