/* theo-t — her study app. See DESIGN.md for the why.
   Scene: a 17-year-old at her desk or in bed, evening lamp light, a little anxious before boards.
   Ink-blue night / clear white day, one rosewood accent. Literata for reading, Atkinson
   Hyperlegible Next for the interface. Quiet: no scores, no streaks, one thing at a time. */

@font-face { font-family: "Literata"; src: url(/vendor/fonts/literata-latin-wght-normal.woff2) format("woff2"); font-weight: 200 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Literata"; src: url(/vendor/fonts/literata-latin-wght-italic.woff2) format("woff2"); font-weight: 200 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Atkinson Next"; src: url(/vendor/fonts/atkinson-hyperlegible-next-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Next"; src: url(/vendor/fonts/atkinson-hyperlegible-next-latin-400-italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Atkinson Next"; src: url(/vendor/fonts/atkinson-hyperlegible-next-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Atkinson Next"; src: url(/vendor/fonts/atkinson-hyperlegible-next-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --font-ui: "Atkinson Next", system-ui, sans-serif;
  --font-read: "Literata", Georgia, serif;

  /* day: clear white, ink-blue type, rosewood accent */
  --bg: oklch(0.987 0.003 262);
  --raised: oklch(1 0 0);
  --chrome: oklch(0.965 0.007 262);
  --ink: oklch(0.26 0.04 264);
  --ink-2: oklch(0.45 0.03 264);
  --ink-3: oklch(0.54 0.025 264);   /* 4.9:1 on --bg (AA) */
  --line: oklch(0.905 0.01 264);
  --accent: oklch(0.52 0.13 14);
  --accent-ink: oklch(0.99 0.005 14);
  --accent-text: oklch(0.48 0.13 14);
  --accent-soft: oklch(0.948 0.024 14);
  --focus: oklch(0.52 0.13 14 / 0.45);
  --mark: oklch(0.93 0.07 95);
  --co-note: oklch(0.955 0.015 250);   --co-note-ink: oklch(0.42 0.08 250);
  --co-tip: oklch(0.955 0.03 160);     --co-tip-ink: oklch(0.42 0.08 160);
  --co-question: oklch(0.955 0.025 300); --co-question-ink: oklch(0.44 0.08 300);
  --co-warn: oklch(0.955 0.04 70);     --co-warn-ink: oklch(0.46 0.1 60);
  --co-key: oklch(0.955 0.022 14);     --co-key-ink: oklch(0.47 0.12 14);
  --co-heart: oklch(0.958 0.028 355);  --co-heart-ink: oklch(0.5 0.15 0);
  --shadow: 0 1px 2px oklch(0.2 0.03 264 / 0.06), 0 4px 8px oklch(0.2 0.03 264 / 0.05);

  --r-s: 8px; --r-m: 12px; --r-l: 16px;
  --tap: 48px;
  --top-h: 56px;
  --tabs-h: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --z-sticky: 10; --z-banner: 20; --z-toast: 40;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* night: ink-blue, never pure black, never warm carbon */
    --bg: oklch(0.2 0.03 264);
    --raised: oklch(0.235 0.032 264);
    --chrome: oklch(0.18 0.03 264);
    --ink: oklch(0.935 0.01 264);
    --ink-2: oklch(0.78 0.02 264);
    --ink-3: oklch(0.66 0.025 264);
    --line: oklch(0.31 0.03 264);
    --accent: oklch(0.79 0.085 14);
    --accent-ink: oklch(0.22 0.04 264);
    --accent-text: oklch(0.82 0.08 14);
    --accent-soft: oklch(0.31 0.04 264);
    --focus: oklch(0.79 0.085 14 / 0.5);
    --mark: oklch(0.42 0.07 95);
    --co-note: oklch(0.26 0.035 250);  --co-note-ink: oklch(0.82 0.06 250);
    --co-tip: oklch(0.26 0.035 160);   --co-tip-ink: oklch(0.82 0.07 160);
    --co-question: oklch(0.27 0.035 300); --co-question-ink: oklch(0.84 0.06 300);
    --co-warn: oklch(0.275 0.03 85);   --co-warn-ink: oklch(0.88 0.08 85);
    --co-key: oklch(0.285 0.04 355);   --co-key-ink: oklch(0.86 0.07 10);
    --co-heart: oklch(0.28 0.05 355);  --co-heart-ink: oklch(0.85 0.09 355);
    --shadow: 0 1px 2px oklch(0 0 0 / 0.3), 0 4px 8px oklch(0 0 0 / 0.2);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 400 16px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--r-s); }
[hidden] { display: none !important; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ------------------------------------------------------------ frame */
.app {
  height: var(--vvh, 100dvh);
  display: grid; grid-template-rows: auto auto 1fr auto; grid-template-columns: minmax(0, 1fr);
  max-width: 760px; margin: 0 auto; overflow: hidden;
}
.offline { grid-row: 1; } .top { grid-row: 2; } .view { grid-row: 3; } .tabs { grid-row: 4; }
.top {
  display: flex; align-items: center; gap: 4px;
  min-height: var(--top-h); padding: env(safe-area-inset-top) 8px 0 16px;
  background: var(--bg);
}
.top.has-back { padding-left: 4px; }
.top-title { flex: 1; min-width: 0; }
.top h1 { margin: 0; font: 700 1.25rem/1.2 var(--font-ui); letter-spacing: -0.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-sub { margin: 1px 0 0; color: var(--ink-3); font-size: 0.8125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 2px; }
/* reading a note: the header title waits until the note's own h1 has scrolled away */
.top h1 { transition: opacity 200ms var(--ease), transform 200ms var(--ease); }
.top.title-peek h1 { opacity: 0; transform: translateY(6px); }
.icon-btn {
  width: var(--tap); height: var(--tap); display: grid; place-items: center;
  border: 0; background: none; border-radius: 50%; color: var(--ink-2);
  transition: background-color 160ms var(--ease);
}
.icon-btn:active { background: var(--chrome); }
.text-btn {
  min-height: var(--tap); padding: 0 14px; border-radius: 999px; border: 0;
  background: none; color: var(--accent-text); font-weight: 700;
}
.text-btn.solid { background: var(--accent); color: var(--accent-ink); }
.text-btn:disabled { opacity: 0.45; }

.view { overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; outline: none; position: relative; -webkit-overflow-scrolling: touch; }

.tabs {
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--chrome); border-top: 1px solid var(--line);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink-3); text-decoration: none; font-size: 0.75rem; font-weight: 500;
  position: relative;
}
.tabs a svg { width: 24px; height: 24px; padding: 0; transition: transform 200ms var(--ease); }
.tabs a.on { color: var(--ink); }
.tabs a.on::before {
  content: ""; position: absolute; top: 9px; width: 56px; height: 30px; border-radius: 999px;
  background: var(--accent-soft); z-index: -1;
}
.tabs a { isolation: isolate; }
.app.typing .tabs { display: none; }

.offline {
  display: flex; gap: 10px; align-items: center;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: var(--co-warn); color: var(--co-warn-ink);
  font-size: 0.875rem; z-index: var(--z-banner);
}
.offline + .top { padding-top: 0; }
.offline-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: breathe 2.4s ease-in-out infinite; flex: none; }
@keyframes breathe { 50% { opacity: 0.3; } }

/* ------------------------------------------------------------ chat */
.chat { display: flex; flex-direction: column; min-height: 100%; }
.thread { flex: 1; padding: 8px 16px 24px; display: flex; flex-direction: column; gap: 18px; }
.msg-user {
  align-self: flex-end; max-width: 85%;
  background: var(--accent-soft); color: var(--ink);
  padding: 10px 14px; border-radius: 18px 18px 6px 18px;
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1rem;
}
.msg-ai { max-width: 100%; }
.msg-ai .md { font-family: var(--font-read); font-size: 1.0625rem; line-height: 1.62; }
.msg-ai.streaming .md > :last-child::after {
  content: ""; display: inline-block; width: 0.5em; height: 0.5em; margin-left: 4px; border-radius: 50%;
  background: var(--accent); vertical-align: middle; animation: breathe 1.2s ease-in-out infinite;
}
.thinking { display: flex; gap: 6px; align-items: center; color: var(--ink-3); font-size: 0.875rem; height: 24px; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); animation: breathe 1.4s ease-in-out infinite; }
.thinking i:nth-child(2) { animation-delay: 0.2s; } .thinking i:nth-child(3) { animation-delay: 0.4s; }
.wrote-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.note-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 16px 0 12px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--raised);
  color: var(--ink); text-decoration: none; font-size: 0.875rem; font-weight: 500; max-width: 100%;
}
.note-chip svg { width: 18px; height: 18px; color: var(--accent-text); }
.note-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-chip b { font-weight: 500; color: var(--ink-3); flex: none; }
.msg-err { color: var(--co-warn-ink); background: var(--co-warn); padding: 10px 14px; border-radius: var(--r-m); font-size: 0.9375rem; }

.hello { padding: 12vh 24px 24px; max-width: 34ch; }
.hello h2 { font: 500 1.625rem/1.25 var(--font-read); margin: 0 0 10px; letter-spacing: -0.01em; text-wrap: balance; }
.hello p { margin: 0 0 20px; color: var(--ink-2); text-wrap: pretty; }
.hello p.lede { font: 400 1.1875rem/1.45 var(--font-read); color: var(--ink); }
.today + .hello { padding-top: 8vh; }
.suggest {
  display: block; text-align: left; width: 100%; min-height: var(--tap); padding: 12px 16px; margin-top: 8px;
  border: 1px solid var(--line); border-radius: var(--r-m); background: var(--raised); color: var(--ink);
  font-size: 0.9375rem;
}
.suggest:active { background: var(--chrome); }

.composer {
  position: sticky; bottom: 0; z-index: var(--z-sticky);
  padding: 8px 12px calc(10px); background: linear-gradient(to bottom, transparent, var(--bg) 14px);
}
.composer-box {
  display: flex; align-items: flex-end; gap: 6px;
  background: var(--raised); border: 1px solid var(--line); border-radius: 24px;
  padding: 4px 4px 4px 16px; box-shadow: var(--shadow);
  transition: border-color 160ms var(--ease);
}
.composer-box:focus-within { border-color: var(--accent); }
.composer textarea {
  flex: 1; border: 0; outline: none; background: none; resize: none;
  padding: 11px 0; max-height: 9.5em; min-height: 24px; line-height: 1.45; font-size: 1rem;
}
.composer textarea::placeholder { color: var(--ink-3); }
.send {
  width: var(--tap); height: var(--tap); border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); flex: none;
  transition: transform 160ms var(--ease), opacity 160ms;
}
.send:disabled { opacity: 0.35; }
.send:active:not(:disabled) { transform: scale(0.92); }
.send svg { width: 20px; height: 20px; stroke-width: 2.2; }
.send.stop { background: var(--ink); color: var(--bg); }

/* today's one thing: a quiet card at the top of Chat, from ❤️ Start Here */
.today {
  display: flex; gap: 12px; align-items: center; width: 100%; min-height: 64px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r-m); background: var(--raised);
  text-align: left; color: var(--ink); transition: transform 160ms var(--ease);
}
.today:active { transform: scale(0.98); }
.today-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; align-self: flex-start; margin-top: 7px; }
.today-txt { flex: 1; min-width: 0; }
.today-label { display: block; color: var(--ink-3); font-size: 0.8125rem; font-weight: 500; }
.today-line { display: block; font: 400 1rem/1.4 var(--font-read); margin-top: 2px; text-wrap: pretty; }
.today .chev { color: var(--ink-3); }
.today .chev svg { width: 20px; height: 20px; }
.app.typing .today { display: none; }

/* ------------------------------------------------------------ subjects */
.subjects { padding: 4px 0 24px; }
.subjects-lede { padding: 4px 20px 12px; color: var(--ink-2); margin: 0; }
.subject {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center;
  padding: 14px 16px 14px 20px; min-height: 76px; color: inherit; text-decoration: none;
  border-top: 1px solid var(--line);
}
.subject:last-child { border-bottom: 1px solid var(--line); }
.subject:active { background: var(--chrome); }
.glyph {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  font: 600 1.125rem/1 var(--font-read); color: var(--g-ink); background: var(--g-bg);
}
.subject h3 { margin: 0; font: 500 1.125rem/1.3 var(--font-read); }
.subject p { margin: 2px 0 0; color: var(--ink-3); font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 52vw; }
.subject .chev { color: var(--ink-3); }
.subject .chev svg { width: 20px; height: 20px; }
.g-physics { --g-bg: var(--co-note); --g-ink: var(--co-note-ink); }
.g-chemistry { --g-bg: var(--co-tip); --g-ink: var(--co-tip-ink); }
.g-maths { --g-bg: var(--co-question); --g-ink: var(--co-question-ink); }
.g-ip { --g-bg: var(--co-warn); --g-ink: var(--co-warn-ink); }
.g-english { --g-bg: var(--co-key); --g-ink: var(--co-key-ink); }

/* ------------------------------------------------------------ notes browser */
.crumbs { display: flex; gap: 4px; align-items: center; padding: 0 16px 8px; color: var(--ink-3); font-size: 0.875rem; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.crumbs button { border: 0; background: none; padding: 0 8px; color: var(--ink-2); min-height: var(--tap); }
.crumbs button:last-child { color: var(--ink); font-weight: 500; }
.rows { list-style: none; margin: 0; padding: 0 0 96px; }
.row {
  display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 6px 4px 6px 20px;
  border-top: 1px solid var(--line);
}
.row:last-child { border-bottom: 1px solid var(--line); }
.row > button.main { flex: 1; display: flex; align-items: center; gap: 14px; min-width: 0; border: 0; background: none; text-align: left; padding: 8px 0; min-height: 44px; }
.row:active { background: var(--chrome); }
.row .ic { width: 22px; height: 22px; color: var(--ink-3); }
.row .ic.folder { color: var(--accent-text); }
.row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; }
.row .meta { color: var(--ink-3); font-size: 0.8125rem; flex: none; }
.empty { padding: 40px 24px; color: var(--ink-2); text-align: left; max-width: 36ch; }
.empty h2 { font: 500 1.25rem/1.3 var(--font-read); margin: 0 0 6px; color: var(--ink); }

.fab {
  position: fixed; right: max(16px, calc(50vw - 380px + 16px)); bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 16px);
  height: 52px; padding: 0 20px 0 16px; border-radius: 16px; border: 0;
  display: flex; gap: 8px; align-items: center; font-weight: 700;
  background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); z-index: var(--z-sticky);
}

/* ------------------------------------------------------------ reading a note */
.reader { padding: 4px 20px 120px; }
.reader .md { font-family: var(--font-read); font-size: 1.0625rem; line-height: 1.65; max-width: 68ch; }
.reader img, .md img { max-width: 100%; height: auto; border-radius: var(--r-m); display: block; margin: 12px 0; }
.file-view { padding: 8px 16px 40px; }
.file-view img { max-width: 100%; border-radius: var(--r-m); display: block; margin: 0 auto; }
.pdf-pages { display: flex; flex-direction: column; gap: 12px; padding: 8px 12px 40px; }
.pdf-pages canvas { width: 100%; height: auto; border-radius: 6px; box-shadow: var(--shadow); background: white; }
.file-card { padding: 32px 24px; }
.file-card p { color: var(--ink-2); }

.md > :first-child { margin-top: 0; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--font-read); line-height: 1.25; margin: 1.4em 0 0.5em; text-wrap: balance; letter-spacing: -0.01em; }
.md h1 { font-size: 1.625rem; font-weight: 600; }
.md h2 { font-size: 1.3125rem; font-weight: 600; color: var(--accent-text); }
.md h3 { font-size: 1.125rem; font-weight: 600; }
.md h4 { font-size: 1rem; font-weight: 700; font-family: var(--font-ui); }
.md p { margin: 0 0 0.85em; text-wrap: pretty; }
.md ul, .md ol { margin: 0 0 0.9em; padding-left: 1.4em; }
.md li { margin: 0.2em 0; }
.md li::marker { color: var(--ink-3); }
.md li.task { list-style: none; margin-left: -1.4em; display: flex; gap: 10px; align-items: baseline; }
.md .box { width: 1.05em; height: 1.05em; border: 1.5px solid var(--ink-3); border-radius: 5px; flex: none; display: inline-grid; place-items: center; font-size: 0.75em; transform: translateY(0.15em); }
.md .box.done { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.md code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.86em; background: var(--chrome); padding: 0.1em 0.35em; border-radius: 5px; overflow-wrap: anywhere; }
.md pre { background: var(--chrome); border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px 14px; overflow-x: auto; font-size: 0.875rem; line-height: 1.5; margin: 0 0 1em; }
.md pre code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }
.md blockquote { margin: 0 0 1em; padding: 2px 0 2px 16px; color: var(--ink-2); font-style: italic; position: relative; }
.md blockquote::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 1px; background: var(--line); }
.md hr { border: 0; height: 1px; background: var(--line); margin: 1.6em 0; }
.md mark { background: var(--mark); color: inherit; padding: 0 0.15em; border-radius: 3px; }
.md a { color: var(--accent-text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.md a.wiki { text-decoration-style: dotted; }
.md .math-block { overflow-x: auto; overflow-y: hidden; margin: 0.6em 0 1em; padding: 4px 0; }
.md .katex { font-size: 1.05em; }
.table-wrap { overflow-x: auto; margin: 0 0 1em; border: 1px solid var(--line); border-radius: var(--r-m); }
.md table { border-collapse: collapse; font-family: var(--font-ui); font-size: 0.9375rem; min-width: 100%; }
.md th, .md td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.md th { background: var(--chrome); font-weight: 700; }
.md tr:last-child td { border-bottom: 0; }

.callout { background: var(--co-bg); border-radius: var(--r-m); padding: 12px 14px; margin: 0 0 1em; font-size: 0.97em; }
.callout-title { display: flex; gap: 10px; align-items: center; font-family: var(--font-ui); font-weight: 700; color: var(--co-ink); font-size: 0.9375rem; list-style: none; }
summary.callout-title { cursor: pointer; min-height: var(--tap); margin: -8px 0; }
summary.callout-title::-webkit-details-marker { display: none; }
summary.callout-title::after { content: "Show"; margin-left: auto; font-weight: 500; font-size: 0.8125rem; opacity: 0.8; }
details[open] > summary.callout-title::after { content: "Hide"; }
.callout-icon { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--co-ink); color: var(--co-bg); font-size: 0.75rem; flex: none; }
.callout-body { margin-top: 8px; }
.callout-body > :last-child { margin-bottom: 0; }
.callout.note { --co-bg: var(--co-note); --co-ink: var(--co-note-ink); }
.callout.tip { --co-bg: var(--co-tip); --co-ink: var(--co-tip-ink); }
.callout.question { --co-bg: var(--co-question); --co-ink: var(--co-question-ink); }
.callout.warn { --co-bg: var(--co-warn); --co-ink: var(--co-warn-ink); }
.callout.key { --co-bg: var(--co-key); --co-ink: var(--co-key-ink); }
.callout.heart { --co-bg: var(--co-heart); --co-ink: var(--co-heart-ink); }
.callout.heart .callout-icon { background: none; color: var(--co-ink); font-size: 1.05rem; }
.row.system .name, .row.system .ic { color: var(--ink-3); }
.row.pinned .ic { color: var(--accent-text); }
.row.pinned .name { font-weight: 500; }
.rows-label { padding: 20px 20px 6px; margin: 0; color: var(--ink-3); font-size: 0.8125rem; }

/* ------------------------------------------------------------ editor */
.editor { display: flex; flex-direction: column; height: 100%; }
.editor textarea {
  flex: 1; width: 100%; border: 0; outline: none; resize: none; background: var(--bg);
  padding: 8px 20px 40px; font: 400 1rem/1.6 var(--font-ui); tab-size: 2;
}
.editor-bar { display: flex; gap: 8px; align-items: center; padding: 6px 16px; color: var(--ink-3); font-size: 0.8125rem; border-top: 1px solid var(--line); background: var(--chrome); }
.editor-bar .grow { flex: 1; }
.editor-bar button { min-height: var(--tap); border: 0; background: none; color: var(--ink-2); padding: 0 8px; font-weight: 500; }

/* ------------------------------------------------------------ sheet (bottom dialog) */
.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: min(100%, 560px); max-width: 100%;
  background: var(--raised); color: var(--ink);
  border-radius: var(--r-l) var(--r-l) 0 0; padding-bottom: env(safe-area-inset-bottom);
  max-height: 85dvh;
}
.sheet[open] { animation: rise 260ms var(--ease); }
.sheet::backdrop { background: oklch(0.15 0.03 264 / 0.4); animation: fade 200ms ease; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.sheet-in { padding: 8px 0 12px; }
.sheet-grip { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 10px; }
.sheet h2 { font: 700 1.0625rem/1.3 var(--font-ui); margin: 0 20px 4px; }
.sheet .sheet-sub { margin: 0 20px 10px; color: var(--ink-3); font-size: 0.875rem; overflow-wrap: anywhere; }
.sheet-item {
  display: flex; gap: 16px; align-items: center; width: 100%; min-height: 52px; padding: 0 20px;
  border: 0; background: none; text-align: left; font-size: 1rem;
}
.sheet-item:active { background: var(--chrome); }
.sheet-item svg { color: var(--ink-2); }
.sheet-item.danger { color: var(--co-warn-ink); }
.sheet-item.danger svg { color: inherit; }
.sheet-item .check { margin-left: auto; color: var(--accent-text); font-weight: 700; }
.sheet form { padding: 4px 20px 8px; display: flex; flex-direction: column; gap: 12px; }
.field label { display: block; font-size: 0.875rem; color: var(--ink-2); margin-bottom: 6px; }
.field input {
  width: 100%; min-height: var(--tap); padding: 0 14px; border-radius: var(--r-m);
  border: 1px solid var(--line); background: var(--bg); outline: none; font-size: 1rem;
}
.field input:focus { border-color: var(--accent); }
.field .hint { font-size: 0.8125rem; color: var(--ink-3); margin-top: 6px; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.form-err { color: var(--co-warn-ink); font-size: 0.875rem; min-height: 1.2em; margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 84px); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 0.875rem;
  z-index: var(--z-toast); max-width: calc(100% - 32px); animation: rise 220ms var(--ease);
}

/* ------------------------------------------------------------ pairing */
.pair { padding: 14vh 28px 40px; max-width: 30rem; }
.pair h2 { font: 500 1.75rem/1.2 var(--font-read); margin: 0 0 12px; letter-spacing: -0.01em; }
.pair p { color: var(--ink-2); margin: 0 0 24px; text-wrap: pretty; }
.pair form { display: flex; flex-direction: column; gap: 14px; }
.pair .text-btn.solid { min-height: var(--tap); font-size: 1rem; }
.pair .quiet { margin-top: 18px; font-size: 0.875rem; color: var(--ink-3); }

.skeleton { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.skeleton i { display: block; height: 14px; border-radius: 7px; background: var(--chrome); animation: breathe 1.6s ease-in-out infinite; }
.skeleton i:nth-child(2) { width: 82%; } .skeleton i:nth-child(3) { width: 64%; }

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