/* Cervix base: tokens, reset, type, controls. Shared by the login page and the app.
   Dark "sodium night" by default; light "drafting paper" follows the OS. */

:root {
  color-scheme: dark;
  --bg: #121110;
  --bg-tex: rgba(255, 255, 255, 0.014);
  --panel: #1a1917;
  --panel-2: #23211d;
  --panel-3: #2b2924;
  --line: #2f2c27;
  --line-strong: #47433b;
  --text: #ece6d9;
  --text-dim: #a59e90;
  --text-faint: #6f695e;
  --accent: #f5a524;
  --accent-ink: #1b1305;
  --accent-soft: rgba(245, 165, 36, 0.13);
  --accent-line: rgba(245, 165, 36, 0.45);
  --ok: #8fd19e;
  --ok-soft: rgba(143, 209, 158, 0.12);
  --danger: #f0603f;
  --danger-soft: rgba(240, 96, 63, 0.13);
  --sel: rgba(245, 165, 36, 0.16);
  --cursor: rgba(236, 230, 217, 0.06);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4);
  --stripe: repeating-linear-gradient(-45deg, rgba(245, 165, 36, 0.22) 0 6px, transparent 6px 12px);

  --f-ui: Bahnschrift, "DIN Alternate", "DIN Condensed", "sans-serif-condensed", "Arial Narrow", sans-serif;
  --f-mono: "Cascadia Mono", "Cascadia Code", "JetBrains Mono", "SF Mono", Menlo, Consolas, "Roboto Mono", "Droid Sans Mono", monospace;
  --r: 3px;
  --row: 30px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #efebe1;
    --bg-tex: rgba(60, 52, 36, 0.045);
    --panel: #f8f5ee;
    --panel-2: #ebe6da;
    --panel-3: #e2dccd;
    --line: #d6cfbf;
    --line-strong: #b4ab97;
    --text: #1d1b17;
    --text-dim: #5b554a;
    --text-faint: #8b8475;
    --accent: #b4620a;
    --accent-ink: #fff8ec;
    --accent-soft: rgba(180, 98, 10, 0.11);
    --accent-line: rgba(180, 98, 10, 0.45);
    --ok: #2c7a43;
    --ok-soft: rgba(44, 122, 67, 0.1);
    --danger: #c0391d;
    --danger-soft: rgba(192, 57, 29, 0.1);
    --sel: rgba(180, 98, 10, 0.13);
    --cursor: rgba(29, 27, 23, 0.05);
    --shadow: 0 18px 44px rgba(60, 48, 24, 0.18), 0 2px 6px rgba(60, 48, 24, 0.12);
    --stripe: repeating-linear-gradient(-45deg, rgba(180, 98, 10, 0.2) 0 6px, transparent 6px 12px);
  }
}

*, *::before, *::after { box-sizing: border-box; }

/* Component rules set display:, which would otherwise beat the hidden attribute. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background-color: var(--bg);
  /* Fine scanlines: atmosphere without an image request. */
  background-image: repeating-linear-gradient(0deg, transparent 0 3px, var(--bg-tex) 3px 4px);
  color: var(--text);
  font: 400 15px/1.4 var(--f-ui);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.mono, code, kbd, input.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums slashed-zero; }

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--text);
  font-size: 12px;
  line-height: 1.3;
  text-align: center;
}

.label {
  font: 600 11px/1 var(--f-ui);
  font-stretch: condensed;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

button, input, select { font: inherit; color: inherit; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--text);
  font: 500 13px/1 var(--f-ui);
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease);
}
.btn:hover { background: var(--panel-3); border-color: var(--text-faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn svg { width: 15px; height: 15px; flex: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.btn.danger:hover { background: var(--danger); color: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn.ghost:hover { color: var(--text); background: var(--cursor); border-color: var(--line); }
.btn.icon { width: 32px; padding: 0; justify-content: center; }
.btn kbd { margin-left: 2px; font-size: 10.5px; padding: 0 4px; opacity: 0.8; }

.field { display: grid; gap: 6px; }
.input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease);
}
.input::placeholder { color: var(--text-faint); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

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

.input.code {
  height: 46px;
  padding-left: 0.55em;
  font-size: 22px;
  letter-spacing: 0.55em;
  text-align: center;
}

.mark { display: inline-block; width: 30px; height: 15px; color: var(--accent); }
.mark svg { width: 100%; height: 100%; display: block; }

.wordmark {
  font: 700 15px/1 var(--f-ui);
  font-stretch: condensed;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
