/* Red Pen — shared tokens and base styles */
:root {
  --paper: #F3F6F9;
  --paper-2: #FFFFFF;
  --rule: #C9D8E6;
  --margin: #E8A3A0;
  --ink: #1F2A44;
  --muted: #5B6781;
  --faint: #8A94A8;
  --red: #C8322A;
  --red-soft: #F7DEDC;
  --hl: #F4E04D;
  --p1: #C8322A;
  --p2: #D9822B;
  --p3: #2F6FD0;
  --p4: #1F2A44;
  --radius: 10px;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-pen: "Kalam", "Comic Neue", "Bradley Hand", cursive;
  --line: 36px;
  --desk: #DCE3EB;
  --desk-dot: rgba(31,42,68,.07);
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141B2B; --paper-2: #1B2438; --rule: #243049; --margin: #6B2E33;
    --ink: #E6EBF5; --muted: #9AA5BD; --faint: #6B7590; --red: #FF6B5E; --red-soft: #3A2025;
    --hl: #8A7A12; --p1: #FF6B5E; --p2: #F0A04B; --p3: #6FA3F5; --p4: #C4CCDD;
    --desk: #0C111C; --desk-dot: rgba(230,235,245,.05);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #141B2B; --paper-2: #1B2438; --rule: #243049; --margin: #6B2E33;
  --ink: #E6EBF5; --muted: #9AA5BD; --faint: #6B7590; --red: #FF6B5E; --red-soft: #3A2025;
  --hl: #8A7A12; --p1: #FF6B5E; --p2: #F0A04B; --p3: #6FA3F5; --p4: #C4CCDD;
    --desk: #0C111C; --desk-dot: rgba(230,235,245,.05);
  color-scheme: dark;
}
html { scroll-padding-top: env(safe-area-inset-top, 0px); -webkit-text-size-adjust: 100%; }
*, *::before, *::after { box-sizing: inherit; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}
.lined {
  background-image: repeating-linear-gradient(to bottom, transparent 0 calc(var(--line) - 1px), var(--rule) calc(var(--line) - 1px) var(--line));
}
a { color: inherit; }
img, svg { max-width: 100%; }
button { font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: var(--ink); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; border-radius: 4px; }

.pen { font-family: var(--font-pen); color: var(--red); }
.scrawl { font-family: var(--font-pen); color: var(--red); font-weight: 700; display: inline-block; transform: rotate(-3deg); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; padding: 11px 18px; border-radius: var(--radius);
  border: 1.5px solid var(--ink); background: var(--ink); color: var(--paper);
  cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.2;
}
.btn:hover { filter: brightness(1.12); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.small { padding: 7px 12px; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: default; filter: none; }
.linkish { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: .9rem; }

.field { display: grid; gap: 6px; }
.field label, .field .label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.input {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--rule); border-radius: 8px; background: var(--paper-2);
}
.input:focus { border-color: var(--ink); outline: none; }

.seg { display: inline-flex; border: 1.5px solid var(--ink); border-radius: 999px; overflow: hidden; }
.seg button { background: none; border: 0; padding: 7px 14px; font-size: .9rem; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }

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