/*
 * Penvy – shared stylesheet for the website, setup and legal pages.
 * All fonts live in public/fonts (no external services, privacy).
 *
 * Idea: "Notebook & fountain pen". Cool paper white, fine notebook rules, fountain pen blue as the only accent color.
 * The handwriting itself is the most striking thing on the page, everything else stays calm.
 */

/* --- Fonts ------------------------------------------------------------------------------ */

@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/fonts/bricolage-latin.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/fonts/bricolage-latin-ext.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Caveat';
  src: url('/fonts/caveat-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Caveat';
  src: url('/fonts/caveat-latin-ext.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Patrick Hand';
  src: url('/fonts/patrick-hand-latin.woff2') format('woff2');
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Patrick Hand';
  src: url('/fonts/patrick-hand-latin-ext.woff2') format('woff2');
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Shadows Into Light Two';
  src: url('/fonts/shadows-into-light-two-latin.woff2') format('woff2');
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Shadows Into Light Two';
  src: url('/fonts/shadows-into-light-two-latin-ext.woff2') format('woff2');
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- Tokens --------------------------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  --paper: #fbfcfe;          /* page background */
  --surface: #ffffff;        /* surfaces: dialog, tiles */
  --sheet: #ffffff;          /* the sheet in the editor, stays light in dark mode too */
  --sheet-rule: #dce4f2;     /* notebook rules */
  --sheet-margin: #eab2b2;   /* red margin line, editor only */
  --rule: #e3e8f1;           /* UI dividers */
  --rule-strong: #cfd7e5;
  --graphite: #1d2230;       /* text */
  --pencil: #5f6779;         /* secondary text */
  --ink: #1f3fa8;            /* fountain pen blue: buttons, links, selection */
  --ink-hover: #18338c;
  --ink-text: #1f3fa8;
  --ink-wash: #eef2fc;
  --on-ink: #ffffff;
  --unlock: #b4540a;         /* the unlock banner: orange, readable on its wash */
  --unlock-wash: #fff1df;
  --unlock-edge: #f2c48d;
  --chip: #edf0f6;
  --danger: #b42318;
  --focus: #6c8cff;
  --shadow-sheet: 0 0 0 1px rgba(29, 34, 48, 0.06), 0 1px 2px rgba(29, 34, 48, 0.05), 0 22px 44px -26px rgba(31, 63, 168, 0.35);
  --shadow-pop: 0 0 0 1px rgba(29, 34, 48, 0.06), 0 30px 80px -24px rgba(15, 25, 60, 0.45);

  /* ink colors as in lib/preferences.ts */
  --ink-blue: #1e3a8a;
  --ink-black: #1c1c22;
  --ink-royal: #2643c4;

  --font-ui: 'Bricolage Grotesque', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 14px;
  --radius-small: 10px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --content: 62rem;
  --header-height: 3.9rem;   /* header that stays at the top while scrolling */
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f131b;
    --surface: #171c27;
    --sheet: #f3f5f9;
    --sheet-rule: #d2dae9;
    --rule: #232a38;
    --rule-strong: #343d51;
    --graphite: #e8ebf2;
    --pencil: #a0a8ba;
    --ink: #3d5bd6;
    --ink-hover: #4c69e2;
    --ink-text: #a9b8ff;
    --ink-wash: rgba(112, 138, 255, 0.13);
    --unlock: #c2610f;
    --unlock-wash: rgba(255, 158, 64, 0.14);
    --unlock-edge: rgba(255, 170, 90, 0.35);
    --chip: #1d2330;
    --danger: #ff8f80;
    --shadow-sheet: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 26px 50px -24px rgba(0, 0, 0, 0.8);
    --shadow-pop: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 30px 80px -20px rgba(0, 0, 0, 0.75);
  }
}

/* --- Basics ----------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
/* Jump targets land below the header, not behind it */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-height) + 0.75rem); }
/* Jumps within the page (e.g. "Convert text") glide there quickly instead of jumping hard */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-ui);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-optical-sizing: auto;
  color: var(--graphite);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; width: 100%; max-width: var(--content); margin: 0 auto; padding: 0 var(--gutter) 4rem; }
h1, h2, h3 { line-height: 1.12; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
h2 { font-size: 1.5rem; font-weight: 650; }
p { margin: 0; }
p + p { margin-top: 0.75rem; }
a { color: var(--ink-text); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; }
strong { font-weight: 650; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.lede { font-size: 1.15rem; color: var(--pencil); max-width: 36rem; text-wrap: pretty; }
.muted { color: var(--pencil); }
.fine { font-size: 0.875rem; color: var(--pencil); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 40; padding: 0.5rem 1rem; background: var(--surface); border-radius: 8px; }
.skip-link:focus { top: 1rem; }
[hidden] { display: none !important; }

/* Handwriting fonts. Factor = size in the image relative to Caveat (lib/fonts.ts), so they all look the same size. */
.hand { font-weight: 400; letter-spacing: 0; }
.hand-caveat { font-family: 'Caveat', cursive; --hand-scale: 1; }
.hand-patrick-hand { font-family: 'Patrick Hand', cursive; --hand-scale: 0.825; }
.hand-shadows-into-light-two { font-family: 'Shadows Into Light Two', cursive; --hand-scale: 0.7; }

/* --- Header and footer ------------------------------------------------------------------------------ */

/* Full-width white bar with a fine line and soft shadow; stays at the top while scrolling */
.site-header {
  position: sticky; top: 0; z-index: 25;
  background: var(--surface); border-bottom: 1px solid var(--rule);
  box-shadow: 0 10px 24px -22px rgba(29, 34, 48, 0.5);
}
.site-header-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  width: 100%; max-width: var(--content); min-height: var(--header-height); margin: 0 auto; padding: 0.3rem var(--gutter);
}
.wordmark {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: 'Caveat', cursive; font-weight: 700; font-size: 2.1rem; line-height: 1;
  color: var(--ink-text); text-decoration: none; letter-spacing: 0.01em;
  padding-bottom: 0.1em;
}
/* The logo from the browser tab before the name */
.wordmark .logo { display: block; flex: none; width: 0.9em; height: 0.9em; }
.site-nav { display: flex; align-items: center; gap: 0.25rem 1.6rem; flex-wrap: wrap; justify-content: flex-end; }
.nav-link {
  position: relative; display: inline-flex; align-items: center; gap: 0.2rem; min-height: 2.75rem;
  color: var(--graphite); text-decoration: none; font-weight: 550; font-size: 1.0625rem; cursor: pointer;
  transition: color 0.15s;
}
.nav-link:hover, .nav-link[aria-current='page'] { color: var(--ink-text); }
/* "Set up" is what it's all about: in fountain pen blue */
.nav-setup { color: var(--ink-text); font-weight: 650; }
.nav-link .icon { width: 1.05em; height: 1.05em; transition: transform 0.2s; }
/* Underline as if drawn with a fountain pen: sits under the current section, under the others it draws itself from
   left to right on hover (pathLength 1: stroke 1, gap 2). The height matches the viewBox, the stroke width stays. */
.nav-underline { position: absolute; left: -3%; bottom: 0.3rem; width: 106%; height: 0.5rem; overflow: visible; pointer-events: none; }
.nav-underline path {
  fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round;
  stroke-dasharray: 1 2; stroke-dashoffset: 1; opacity: 0;
  transition: opacity 0.15s, stroke-dashoffset 0s 0.15s;
}
.nav-link[aria-current='page'] .nav-underline path { opacity: 1; stroke-dashoffset: 0; transition: none; }
@media (hover: hover) {
  .nav-link:hover .nav-underline path { opacity: 1; stroke-dashoffset: 0; transition: stroke-dashoffset 0.35s cubic-bezier(0.3, 0.6, 0.3, 1); }
}

/* Account menu: a note with a red margin line, the account's three sections stacked */
.account-menu { position: relative; }
.account-menu > summary { list-style: none; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu[open] > summary .icon { transform: rotate(180deg); }
.account-menu-panel {
  position: absolute; right: -0.5rem; top: calc(100% + 0.25rem); z-index: 30; width: min(19rem, calc(100vw - 2rem));
  display: grid; padding: 0.4rem 0.4rem 0.5rem 1.4rem; border-radius: 4px;
  background:
    linear-gradient(90deg, transparent 0.85rem, var(--sheet-margin) 0.85rem, var(--sheet-margin) calc(0.85rem + 1.5px), transparent calc(0.85rem + 1.5px)),
    var(--surface);
  box-shadow: var(--shadow-pop);
}
/* The note glides down briefly when opening instead of popping open */
.account-menu[open] .account-menu-panel { animation: menu-in 0.16s cubic-bezier(0.2, 0.8, 0.3, 1); }
@keyframes menu-in {
  from { opacity: 0; transform: translateY(-0.4rem); }
}
.account-menu-username { padding: 0.6rem 0.6rem 0.55rem; font-size: 0.85rem; color: var(--pencil); overflow-wrap: anywhere; border-bottom: 1px solid var(--rule); }
.account-menu-panel a, .account-menu-panel button {
  display: grid; gap: 0.05rem; width: 100%; padding: 0.6rem; text-align: left; text-decoration: none;
  font: inherit; font-weight: 600; color: var(--graphite); background: none; border: 0; border-bottom: 1px solid var(--rule); cursor: pointer;
}
.account-menu-panel small { font-weight: 400; font-size: 0.85rem; color: var(--pencil); }
.account-menu-panel a:hover span, .account-menu-panel button:hover { color: var(--ink-text); }
.account-menu-panel form { margin: 0; }
.account-menu-panel button { border-bottom: 0; color: var(--pencil); font-weight: 500; }
/* My preferences sits in the bar; only on phones, where there's no room for it, here in the menu */
.account-menu-panel .account-menu-preferences { display: none; }

.site-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem 2rem;
  width: 100%; max-width: var(--content); margin: 0 auto; padding: 2rem var(--gutter) 2.5rem;
  border-top: 1px solid var(--rule); font-size: 0.9rem; color: var(--pencil);
}

.footer-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
.footer-links a { padding: 0.15rem 0; color: var(--pencil); }
.footer-links a:hover { color: var(--ink-text); }
.site-footer .trademarks { flex-basis: 100%; max-width: 52rem; font-size: 0.78rem; line-height: 1.5; }
/* Signature: logo and name as in the header, just smaller */
.footer-sign .logo { display: inline-block; width: 1.5rem; height: 1.5rem; margin-right: 0.4rem; vertical-align: -0.4rem; }
.footer-name { margin-right: 0.15rem; font-family: 'Caveat', cursive; font-weight: 700; font-size: 1.45rem; line-height: 1; color: var(--ink-text); }

/* Account created without JavaScript: limited until it's unlocked (unlockBanner in lib/web/layout.ts). Not closable. */
.unlock-banner { background: var(--unlock-wash); border-bottom: 1px solid var(--unlock-edge); color: var(--graphite); }
.unlock-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1.25rem;
  max-width: calc(var(--content) + 2 * var(--gutter)); margin: 0 auto; padding: 0.7rem var(--gutter);
}
.unlock-inner > p { flex: 1 1 20rem; margin: 0; }
.unlock-action > summary { list-style: none; cursor: pointer; }
.unlock-action > summary::-webkit-details-marker { display: none; }
.unlock-action > summary.button { background: var(--unlock); border-color: var(--unlock); color: #fff; }
.unlock-action[open] > p { margin: 0.5rem 0 0; font-size: 0.9rem; }
.unlock-banner.is-done { background: var(--ink-wash); border-color: var(--rule); }

.notice {
  display: flex; gap: 0.6rem; align-items: flex-start; margin: 0 0 1.5rem;
  padding: 0.8rem 1rem; border-radius: var(--radius-small); background: var(--ink-wash); color: var(--graphite);
}
.notice .icon { color: var(--ink-text); flex: none; margin-top: 0.1rem; }

/* --- Buttons ---------------------------------------------------------------------------------- */

.icon { width: 1.25em; height: 1.25em; flex: none; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 2.875rem; padding: 0.65rem 1.15rem;
  font: inherit; font-size: 1rem; font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap;
  color: var(--graphite); background: var(--surface);
  border: 1px solid var(--rule-strong); border-radius: 12px;
  cursor: pointer; transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.button:hover { border-color: var(--pencil); }
.button:active { transform: translateY(1px); }
.button.primary { color: var(--on-ink); background: var(--ink); border-color: var(--ink); }
.button.primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); }
.button.ghost { background: transparent; border-color: transparent; color: var(--ink-text); }
.button.ghost:hover { background: var(--ink-wash); }
.button.small { min-height: 2.25rem; padding: 0.4rem 0.85rem; font-size: 0.925rem; }
.button.block { display: flex; width: 100%; }
.button.wide { min-width: min(100%, 14rem); }
.button.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.button.danger-text { color: var(--danger); }
.button:disabled, .button[aria-disabled='true'] { opacity: 0.45; cursor: not-allowed; transform: none; }
.button[aria-busy='true'] { cursor: progress; }
.icon-button {
  display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem; padding: 0;
  color: var(--graphite); background: transparent; border: 0; border-radius: 999px; cursor: pointer;
}
.icon-button:hover { background: var(--chip); }

/* --- Forms -------------------------------------------------------------------------------- */

.stack { display: grid; gap: 1.25rem; }
.field { display: grid; gap: 0.4rem; }
.field-label { font-weight: 600; font-size: 0.95rem; }
.field-hint { color: var(--pencil); font-size: 0.85rem; }
input[type='password'], input[type='text'], input[type='number'], select {
  width: 100%; min-height: 2.875rem; padding: 0.65rem 0.85rem;
  font: inherit; color: var(--graphite); background: var(--surface);
  border: 1px solid var(--rule-strong); border-radius: var(--radius-small);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type='password']:focus, input[type='text']:focus, input[type='number']:focus, select:focus {
  outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 35%, transparent);
}
.password { position: relative; }
.password input { padding-right: 3rem; }
.password .reveal {
  position: absolute; right: 0.3rem; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 2.4rem; height: 2.4rem;
  color: var(--pencil); background: none; border: 0; border-radius: 8px; cursor: pointer;
}
.password .reveal[aria-pressed='true'] { color: var(--ink-text); }
.check { display: flex; gap: 0.65rem; align-items: flex-start; font-size: 0.95rem; cursor: pointer; }
.check input { flex: none; width: 1.15rem; height: 1.15rem; margin: 0.2rem 0 0; accent-color: var(--ink); }
.form-error { padding: 0.7rem 0.9rem; border-radius: var(--radius-small); color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, transparent); font-size: 0.95rem; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; font-weight: 600; font-size: 0.95rem; margin-bottom: 0.6rem; }

/* --- Sign-in dialog ------------------------------------------------------------------------------- */

.auth-dialog {
  width: min(27rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow: auto;
  padding: 2rem 1.75rem 1.5rem; border: 0; border-radius: 22px;
  color: var(--graphite); background: var(--surface); box-shadow: var(--shadow-pop);
}
.auth-dialog::backdrop { background: rgba(16, 22, 36, 0.45); backdrop-filter: blur(3px); }
.auth-dialog[open] { animation: dialog-in 0.22s cubic-bezier(0.2, 0.8, 0.3, 1); }
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
}
.auth-dialog h2 { font-size: 1.6rem; font-weight: 700; padding-right: 2rem; }
.dialog-lede { color: var(--pencil); margin-top: 0.5rem; }
.dialog-close { position: absolute; top: 0.9rem; right: 0.9rem; }
.auth-form { display: grid; gap: 1rem; margin-top: 1.25rem; }
/* Create or sign in: two words, the active one with a fountain pen stroke underneath */
.auth-tabs { display: flex; gap: 1.6rem; margin-bottom: 0.25rem; border-bottom: 1px solid var(--rule); }
.auth-tabs button {
  position: relative; min-height: 2.75rem; padding: 0.5rem 0; font: inherit; font-weight: 650; font-size: 1rem;
  color: var(--pencil); background: none; border: 0; cursor: pointer;
}
.auth-tabs button:hover { color: var(--graphite); }
.auth-tabs button[aria-selected='true'] { color: var(--graphite); }
.auth-tabs button[aria-selected='true']::after {
  content: ''; position: absolute; left: -2px; right: -2px; bottom: -1.5px; height: 3px; border-radius: 2px; background: var(--ink);
}
.auth-form[data-mode='login'] [data-signup-only], .auth-form[data-mode='signup'] [data-login-only] { display: none; }
/* "Forgot your password?": no reset link, just the honest answer underneath */
.auth-forgot { font-size: 0.95rem; text-align: center; }
.auth-forgot > summary { display: inline-block; color: var(--ink-text); cursor: pointer; list-style: none; text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
.auth-forgot > summary::-webkit-details-marker { display: none; }
.auth-forgot > summary:hover { text-decoration-thickness: 2px; }
.auth-forgot p { margin-top: 0.5rem; text-align: left; color: var(--pencil); }

/* --- Simple pages (sign-in, account, messages) ---------------------------------------------------- */

.page-narrow main { max-width: calc(28rem + 2 * var(--gutter)); padding-top: clamp(1.5rem, 6vw, 4rem); }
.page-title { font-size: clamp(2rem, 1.5rem + 2vw, 2.6rem); font-weight: 700; margin-bottom: 0.6rem; }
.page-narrow .lede { margin-bottom: 1.5rem; }
.page-narrow .auth-form { margin-top: 0; }
.page-narrow .form-error { margin-bottom: 1rem; }
.page-narrow .stack + p, .page-narrow .lede + p { margin-top: 1.5rem; }

/* --- Stationery: choosing like on a desk (lib/web/stationery.ts) ---------------------------------
 * Ink is a stroke, paper a small sheet, apps our own drawings. Whatever is circled with the fountain pen
 * is selected. No cards with check marks, no pills.
 */

.picks { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.75rem 1.4rem; }
.pick {
  position: relative; display: inline-grid; justify-items: center; align-content: start; gap: 0.4rem;
  min-width: 2.75rem; min-height: 2.75rem; padding: 0.55rem 0.7rem;
  color: var(--graphite); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.pick-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
.pick-face { position: relative; display: grid; place-items: center; }
.pick-text { display: grid; justify-items: center; gap: 0.1rem; text-align: center; }
.pick-label { font-weight: 600; font-size: 0.95rem; line-height: 1.25; }
.pick-hint { max-width: 15rem; font-size: 0.82rem; line-height: 1.35; color: var(--pencil); }
.pick:hover .pick-label { color: var(--ink-text); }
.pick-input:checked ~ .pick-text .pick-label { color: var(--ink-text); }
.pick-input:focus-visible ~ .pick-text .pick-label { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
/* Image left, text right (start methods, outputs) */
.pick-row { grid-template-columns: auto minmax(0, 1fr); justify-items: start; align-items: center; column-gap: 0.9rem; text-align: left; }
.pick-row .pick-text { justify-items: start; text-align: left; }
/* Unavailable: faded, with the reason in words next to it (.pick-reason), never just hidden */
.pick:has(.pick-input:disabled) { cursor: not-allowed; }
.pick:has(.pick-input:disabled) > :not(.pen-ring, .pick-input) { opacity: 0.4; }
.pick:has(.pick-input:disabled):hover .pick-label { color: inherit; }
.pick-reason { font-size: 0.875rem; color: var(--pencil); max-width: 34rem; }

/* The circle: draws itself in ~0.4 s when something is selected. Bigger than the choice so it encloses image and text
   (an ellipse fits a rectangle of about 70% of its width and height). */
.pen-ring {
  position: absolute; left: -9%; top: -11%; width: 118%; height: 122%;
  overflow: visible; pointer-events: none;
}
/* Mirrored: the circle overshoots its start on the right, where the row is empty, not through the text */
.pick-row .pen-ring { left: -5%; top: -16%; width: 110%; height: 132%; transform: scaleX(-1); }
/* With non-scaling-stroke, browsers measure the stroke length on screen, not in pathLength units (up to three times as long
   on wide rows): hence a long stroke (3.4), hidden as long as nothing is selected */
.pen-ring path {
  fill: none; stroke: var(--ink); stroke-width: 2.25; stroke-linecap: round; vector-effect: non-scaling-stroke;
  stroke-dasharray: 3.4 7; stroke-dashoffset: 3.4; opacity: 0;
}
.pick-input:checked ~ .pen-ring path { opacity: 1; stroke-dashoffset: 0; transition: stroke-dashoffset 0.5s cubic-bezier(0.45, 0.05, 0.25, 1); }
@media (prefers-color-scheme: dark) {
  .pen-ring path { stroke: var(--ink-text); }
}

/* Ink as a stroke on a strip of paper (ink belongs on paper, in dark mode too) */
.ink-stroke {
  display: block; width: 5.5rem; height: auto; padding: 0.35rem 0.45rem; overflow: visible;
  background: var(--sheet); border-radius: 3px; box-shadow: 0 0 0 1px rgba(29, 34, 48, 0.08), 0 4px 10px -8px rgba(31, 63, 168, 0.4);
}

/* Paper as a small sheet (aspect ratio from the viewBox) */
.paper-thumb { display: block; width: 2.75rem; height: auto; overflow: visible; filter: drop-shadow(0 1px 1.5px rgba(29, 34, 48, 0.14)); }
.paper-thumb .paper-sheet { fill: #ffffff; stroke: rgba(29, 34, 48, 0.2); stroke-width: 0.8; }
.paper-thumb .paper-line { stroke: #b6c4dd; stroke-width: 0.6; }
.paper-thumb .paper-dot { fill: #8196b9; }
.paper-yellow .paper-sheet { fill: #fcf6df; }
.paper-yellow .paper-line { stroke: #d9ca9c; }
.paper-yellow .paper-dot { fill: #bfae78; }
.paper-dark .paper-sheet { fill: #2d2e31; stroke: rgba(0, 0, 0, 0.45); }
.paper-dark .paper-line { stroke: #55585f; }
.paper-dark .paper-dot { fill: #6d7179; }
@media (prefers-color-scheme: dark) {
  .paper-dark .paper-sheet { stroke: rgba(255, 255, 255, 0.3); }
}

/* Our own drawings of the notes apps */
.app-mark { display: block; width: 2.9rem; height: 2.9rem; color: var(--graphite); }
.app-mark .fill-paper { fill: var(--sheet); }
.app-mark .ink { stroke: var(--ink-text); }
@media (prefers-color-scheme: dark) {
  .app-mark .fill-paper { fill: var(--surface); }
}

/* "How did you hear about Penvy?" right after signing up (heardForm in lib/web/layout.ts): the popup's second step and a
   setup slide. Two columns of words to circle, one on narrow phones. */
.heard-step { margin-top: 1.25rem; }
.heard-form { display: grid; gap: 1.1rem; }
.picks-heard { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.35rem 1rem; }
.picks-heard .pick { display: grid; padding: 0.5rem 0.7rem; }
@media (max-width: 22rem) {
  .picks-heard { grid-template-columns: minmax(0, 1fr); }
}
.heard-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }

/* --- Handwriting quiz (lib/web/quiz.ts) ------------------------------------------------------- */

.picks-quiz { gap: 0.75rem 1rem; }
.picks-quiz .pick { width: 9.25rem; }
.quiz-card {
  display: grid; place-items: center; width: 8.25rem; height: 4.75rem; border-radius: 3px; overflow: hidden;
  background: linear-gradient(180deg, transparent 72%, var(--sheet-rule) 72%, var(--sheet-rule) calc(72% + 1px), transparent calc(72% + 1px)), var(--sheet);
  box-shadow: 0 0 0 1px rgba(29, 34, 48, 0.08), 0 6px 14px -10px rgba(31, 63, 168, 0.35);
}
.quiz-card .scribble { font-size: calc(2.4rem * var(--hand-scale)); }

/* Scribbles on the index cards: single letters, twisted for the "messy" answers */
.scribble { display: inline-flex; color: var(--ink-blue); font-size: calc(2.6rem * var(--hand-scale)); line-height: 1; }
.scribble span { display: inline-block; }
.scribble-messy span:nth-child(odd) { transform: rotate(-7deg) translateY(0.05em); }
.scribble-messy span:nth-child(even) { transform: rotate(6deg) translateY(-0.07em); }
.scribble-messy span:nth-child(3) { transform: rotate(-2deg) translateY(0.12em) scale(1.08); }
.scribble-chaos { letter-spacing: 0.02em; }
.scribble-chaos span:nth-child(1) { transform: rotate(-14deg) translateY(0.08em) scale(1.1); }
.scribble-chaos span:nth-child(2) { transform: rotate(10deg) translateY(-0.18em) scale(0.85); }
.scribble-chaos span:nth-child(3) { transform: rotate(-4deg) translateY(0.2em) scale(1.2); margin-left: 0.08em; }
.scribble-chaos span:nth-child(4) { transform: rotate(18deg) translateY(-0.05em); margin-left: -0.05em; }
.scribble-chaos span:nth-child(5) { transform: rotate(-9deg) translateY(0.14em) scale(0.9); }
.scribble-wide { transform: scaleX(1.25); letter-spacing: 0.05em; }
.scribble-narrow { transform: scaleX(0.75); letter-spacing: -0.04em; }
.scribble-rush { transform: skewX(-18deg); letter-spacing: -0.03em; }
.scribble-rush span:nth-child(even) { transform: translateY(0.08em); }
.scribble-rush span:nth-child(4) { transform: translateY(0.15em) rotate(4deg); }

/* --- Narrow screens --------------------------------------------------------------------------------- */

@media (max-width: 40rem) {
  .site-nav { gap: 0.25rem 1.1rem; }
  .nav-write, .nav-preferences { display: none; }
  .account-menu-panel .account-menu-preferences { display: grid; }
}

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