/* KidArt AI console. docs/BRAND.md is the source of every value, docs/UI.md lists the
   components. The idea: every drawing is a work in a small museum. A paper wall, pinned
   artworks, a wall-label caption under each, flat cut-paper shapes as the only ornament.
   Colour is data (the child's measured palette); the one action colour is ultramarine. */

/* ================= tokens ================= */
:root {
  color-scheme: light;
  --bg: #FAF4E8; --bg-2: #F2E9D6; --bg-3: #E9DEC6;
  --surface: #FFFDF8; --surface-2: #FBF6EA;
  --ink: #1E1B3A; --ink-2: #3A3760; --muted: #5E5A78; --faint: #8A86A3;
  --line: #E4DAC6; --line-2: #CFC3A9;
  --brand: #3A33E0; --brand-ink: #FFFFFF; --brand-soft: #E7E5F8; --brand-strong: #2C26BD;
  --ok: #1F8A4C; --ok-ink: #17703D; --ok-soft: #E1F1E6;
  --warn: #B26A00; --warn-ink: #8A5000; --warn-soft: #F8EBCF;
  --bad: #C23B2B; --bad-ink: #A52E1F; --bad-soft: #F8E1DC;
  --info: #3A33E0; --info-ink: #3A33E0; --info-soft: #E7E5F8;
  /* crayon data colours: identical in both themes, only ever data */
  --c-sun: #FFC83D; --c-tomato: #F25C3F; --c-grass: #3FA65B; --c-sky: #3AA9EA;
  --c-grape: #7B52D6; --c-pink: #F78FB8; --c-tangerine: #FF8B2E; --c-earth: #8A5A3C;
  --focus: #1E1B3A; --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--focus);
  --pin-shadow: 0 1px 0 rgba(30,27,58,.06), 0 14px 24px -16px rgba(30,27,58,.45);
  --shadow-lg: 0 24px 60px -20px rgba(30,27,58,.45);
  --scrim: rgba(30,27,58,.5);
  --tape-blend: multiply;
  --radius: 12px; --radius-sm: 8px; --radius-xs: 3px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Avenir Next", system-ui, sans-serif;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --serif: var(--display);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --page-w: 1180px; --gutter: 28px; --bar-h: 62px; --tab-h: 64px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #15132B; --bg-2: #1A1835; --bg-3: #24214A;
  --surface: #1E1B3A; --surface-2: #231F43;
  --ink: #F6F0E2; --ink-2: #DAD3C1; --muted: #A9A5C4; --faint: #7F7B9E;
  --line: #35316A; --line-2: #4A4584;
  --brand: #8F8AFF; --brand-ink: #15132B; --brand-soft: #2B2866; --brand-strong: #ADA9FF;
  --ok: #59D08C; --ok-ink: #59D08C; --ok-soft: #1B3A2E;
  --warn: #F2B24C; --warn-ink: #F2B24C; --warn-soft: #3D3120;
  --bad: #FF8A78; --bad-ink: #FF8A78; --bad-soft: #43242A;
  --info: #8F8AFF; --info-ink: #8F8AFF; --info-soft: #2B2866;
  --focus: #F6F0E2;
  --pin-shadow: 0 0 0 1px rgba(255,255,255,.04), 0 16px 28px -14px rgba(0,0,0,.75);
  --shadow-lg: 0 24px 60px -18px rgba(0,0,0,.8);
  --scrim: rgba(8,6,24,.72);
  --tape-blend: normal;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #15132B; --bg-2: #1A1835; --bg-3: #24214A;
    --surface: #1E1B3A; --surface-2: #231F43;
    --ink: #F6F0E2; --ink-2: #DAD3C1; --muted: #A9A5C4; --faint: #7F7B9E;
    --line: #35316A; --line-2: #4A4584;
    --brand: #8F8AFF; --brand-ink: #15132B; --brand-soft: #2B2866; --brand-strong: #ADA9FF;
    --ok: #59D08C; --ok-ink: #59D08C; --ok-soft: #1B3A2E;
    --warn: #F2B24C; --warn-ink: #F2B24C; --warn-soft: #3D3120;
    --bad: #FF8A78; --bad-ink: #FF8A78; --bad-soft: #43242A;
    --info: #8F8AFF; --info-ink: #8F8AFF; --info-soft: #2B2866;
    --focus: #F6F0E2;
    --pin-shadow: 0 0 0 1px rgba(255,255,255,.04), 0 16px 28px -14px rgba(0,0,0,.75);
    --shadow-lg: 0 24px 60px -18px rgba(0,0,0,.8);
    --scrim: rgba(8,6,24,.72);
    --tape-blend: normal;
  }
}

/* ================= base ================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font: 16px/1.55 var(--font); color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}
/* Dark: the wall is lit like a gallery, a soft wash from above. */
:root[data-theme="dark"] body { background: radial-gradient(1100px 520px at 50% -140px, rgba(143,138,255,.14), transparent 70%), var(--bg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body { background: radial-gradient(1100px 520px at 50% -140px, rgba(143,138,255,.14), transparent 70%), var(--bg); } }
h1, h2, h3, h4 { margin: 0; font-family: var(--display); line-height: 1.12; font-weight: 600; letter-spacing: -.012em; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 5.4vw, 3.4rem); letter-spacing: -.022em; line-height: 1.04; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.8rem); } h3 { font-size: 1.14rem; } h4 { font-size: 1rem; }
h1 em, h2 em, h3 em, .serif-i { font-style: italic; font-weight: 500; color: var(--brand); }
p { margin: 0 0 .8em; }
a { color: inherit; text-decoration: none; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration: underline; }
p a, .sub a, .hint a, a.link { color: var(--brand); text-decoration: underline; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }
button, input, select, textarea { font: inherit; color: inherit; }
code, pre, .mono { font-family: var(--mono); font-size: .86em; font-variant-numeric: normal; }
::selection { background: var(--c-sun); color: #1E1B3A; }
[hidden] { display: none !important; }
svg.i { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
img { max-width: 100%; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--radius-sm); z-index: 100; }
.skip-link:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ================= type helpers ================= */
.eyebrow, .caps { font: 700 .7rem/1.2 var(--font); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: .86rem; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.t-ok { color: var(--ok-ink); } .t-warn { color: var(--warn-ink); } .t-bad { color: var(--bad-ink); } .t-brand { color: var(--brand); }
.numeral { font: 600 clamp(2.4rem, 7vw, 4.4rem)/.95 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums lining-nums; }
.numeral.md { font-size: clamp(1.8rem, 4vw, 2.6rem); } .numeral.sm { font-size: 1.5rem; }
.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }
.rule.double { border-top: 3px double var(--line-2); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 32px; }
.page-head > :first-child { min-width: 0; flex: 1 1 320px; }
.page-head .eyebrow { display: block; margin-bottom: 12px; }
.page-head .sub { color: var(--muted); margin: 12px 0 0; max-width: 58ch; font-size: 1.04rem; }
.page-head .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.crumbs { font-size: .84rem; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }

/* ================= layout helpers ================= */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; } .row.between { justify-content: space-between; } .row.top { align-items: flex-start; }
.stack { display: grid; gap: 22px; align-content: start; } .stack.sm { gap: 10px; } .stack.lg { gap: 40px; }
.grid { display: grid; gap: 24px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.split { grid-template-columns: minmax(0, 5fr) minmax(0, 4fr); gap: 40px; }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grow { flex: 1; min-width: 0; }
@media (max-width: 860px) { .grid.c2, .grid.c3, .grid.split { grid-template-columns: minmax(0, 1fr); } .grid { gap: 18px; } }

/* a plain paper sheet (settings, forms): flat, hairline, no shadow */
.sheet-card, .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card-head h2 { font-size: 1.2rem; } .card-head .sub { color: var(--muted); font-size: .88rem; }

/* ================= shell ================= */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--bar-h);
  display: flex; align-items: center; gap: 28px;
  padding-inline: max(var(--gutter), calc((100vw - var(--page-w)) / 2 + var(--gutter)));
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font: 700 1.28rem/1 var(--display); letter-spacing: -.02em; flex: none; }
.brand:hover { text-decoration: none; }
.brand-mark { display: block; width: 32px; height: 32px; border-radius: 9px; overflow: hidden; flex: none; transform: rotate(-4deg); transition: transform .25s; }
.brand:hover .brand-mark { transform: rotate(3deg); }
.brand-mark img { width: 100%; height: 100%; display: block; }
.wm em { font-style: italic; font-weight: 500; color: var(--brand); }
.topnav { display: flex; align-self: stretch; gap: 2px; margin-right: auto; }
.topnav a { position: relative; display: flex; align-items: center; padding: 0 14px; font-size: .94rem; font-weight: 650; color: var(--muted); min-height: 44px; }
.topnav a:hover { color: var(--ink); text-decoration: none; }
.topnav a[aria-current="page"] { color: var(--ink); }
/* the current page is marked with a hand-cut strip of orange paper */
.topnav a[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 9px; height: 5px; background: var(--c-tangerine); border-radius: 2px 6px 3px 5px; transform: rotate(-1.2deg); }
.topnav a:focus-visible { box-shadow: var(--ring); }
.topbar-actions { display: flex; align-items: center; gap: 12px; flex: none; }
.topbar .top-cta[aria-current="page"] { display: none; }
.user-menu { position: relative; }
.avatar { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--c-sun); color: #1E1B3A; font: 800 .82rem var(--font); border: 2px solid var(--ink); cursor: pointer; }
.avatar:hover { background: var(--c-pink); }
.pop { position: absolute; right: 0; top: calc(100% + 10px); min-width: 240px; padding: 6px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); z-index: 40; }
@media (prefers-reduced-motion: no-preference) { .pop { animation: pop .14s ease-out; } @keyframes pop { from { opacity: 0; transform: translateY(-4px); } } }
.pop .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.pop .who b { display: block; font-family: var(--display); font-size: 1.05rem; } .pop .who span { color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
.pop a, .pop button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px; min-height: 44px; border: 0; background: none; border-radius: var(--radius-sm); color: var(--ink); cursor: pointer; text-align: left; font-size: .94rem; }
.pop a:hover, .pop button:hover { background: var(--bg-2); text-decoration: none; }
.pop hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { border-color: var(--ink); color: var(--ink); }
.icon-btn.sm { width: 36px; height: 36px; }

.main { flex: 1; width: 100%; max-width: var(--page-w); margin: 0 auto; padding: 44px var(--gutter) 72px; outline: none; }
#app { display: grid; gap: 52px; align-content: start; min-width: 0; }
#app > * { min-width: 0; }
@media (prefers-reduced-motion: no-preference) { #app:not(.settled) > * { animation: rise .45s cubic-bezier(.2,.7,.2,1) both; } #app:not(.settled) > *:nth-child(2) { animation-delay: .06s; } #app:not(.settled) > *:nth-child(3) { animation-delay: .12s; } @keyframes rise { from { opacity: 0; transform: translateY(10px); } } }

/* the hem: a zigzag of cut crayon paper above the footer */
.site-foot { position: relative; margin-top: 8px; padding: 34px var(--gutter) 40px; font-size: .86rem; color: var(--muted); }
.site-foot::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 12px;
  background: linear-gradient(135deg, var(--bg) 25%, transparent 25%) -6px 0 / 12px 12px, linear-gradient(225deg, var(--bg) 25%, transparent 25%) -6px 0 / 12px 12px,
    linear-gradient(90deg, var(--c-sun) 0 14%, var(--c-tomato) 0 28%, var(--c-grass) 0 42%, var(--c-sky) 0 56%, var(--c-grape) 0 70%, var(--c-pink) 0 84%, var(--c-tangerine) 0 100%); }
.site-foot-in { max-width: var(--page-w); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: center; justify-content: space-between; }
.site-foot a { color: var(--ink-2); }

/* phone tab bar: Studio, Portfolio, Add (centre), Activities, More */
.tabbar, .more-sheet { display: none; }
@media (max-width: 860px) {
  :root { --gutter: 18px; --bar-h: 56px; }
  .topbar .topnav, .topbar .top-cta { display: none; }
  .topbar { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; }
  .topbar .brand { grid-column: 2; }
  .topbar-actions { grid-column: 3; justify-self: end; }
  .main { padding: 28px var(--gutter) calc(var(--tab-h) + 56px + env(safe-area-inset-bottom)); }
  #app { gap: 40px; }
  .site-foot { padding-bottom: calc(var(--tab-h) + 28px + env(safe-area-inset-bottom)); }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding: 6px 6px env(safe-area-inset-bottom);
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; background: var(--surface); border-top: 1px solid var(--line-2); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; border: 0; background: none; color: var(--muted); font-size: .7rem; font-weight: 700; letter-spacing: .02em; cursor: pointer; text-decoration: none; border-radius: var(--radius-sm); }
  .tabbar .i { width: 24px; height: 24px; }
  .tabbar a[aria-current="page"], .tabbar button.current { color: var(--ink); }
  .tabbar a[aria-current="page"] .i { color: var(--brand); }
  .tabbar .tab-add { position: relative; top: -16px; justify-content: flex-start; color: var(--ink); gap: 5px; }
  .tabbar .tab-add .disc { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); box-shadow: 3px 3px 0 var(--c-sun), 0 0 0 4px var(--surface); }
  .tabbar .tab-add .i { width: 26px; height: 26px; stroke-width: 2.2; }
  .more-sheet { position: fixed; inset: 0; z-index: 50; background: var(--scrim); align-items: flex-end; }
  .more-sheet.open { display: flex; }
  .more-sheet .sheet { width: 100%; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); background: var(--surface); border-radius: 18px 18px 0 0; display: grid; gap: 2px; }
  .more-sheet .sheet .eyebrow { margin-bottom: 8px; }
  .more-sheet a, .more-sheet button { display: flex; align-items: center; gap: 12px; padding: 12px 8px; min-height: 48px; border: 0; background: none; border-radius: var(--radius-sm); color: var(--ink); font-size: 1rem; text-align: left; cursor: pointer; text-decoration: none; }
  .more-sheet a:hover, .more-sheet button:hover { background: var(--bg-2); }
  .more-sheet a[aria-current="page"] { font-weight: 700; }
  @media (prefers-reduced-motion: no-preference) { .more-sheet.open .sheet { animation: sheet-up .22s ease-out; } @keyframes sheet-up { from { transform: translateY(30px); opacity: 0; } } }
}

/* ================= buttons ================= */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 700; font-size: .95rem; cursor: pointer; text-decoration: none; white-space: nowrap; transition: border-color .12s, background .12s, transform .12s, box-shadow .12s; }
.btn:hover { border-color: var(--ink); text-decoration: none; }
.btn.sm { min-height: 36px; padding: 0 13px; font-size: .86rem; } .btn.lg { min-height: 52px; padding: 0 26px; font-size: 1.02rem; }
.btn.block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
/* THE call to action: one per view. Ultramarine paper with a sun-yellow cut-out shadow. */
.btn.cta, .btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); box-shadow: 3px 3px 0 var(--c-sun); }
.btn.cta:hover, .btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--c-sun); }
.btn.cta:active, .btn.primary:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--c-sun); }
.btn.cta:focus-visible { box-shadow: 3px 3px 0 var(--c-sun), var(--ring); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--bg-2); border-color: transparent; }
.btn.danger { color: var(--bad-ink); border-color: var(--bad); background: transparent; }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn[aria-busy="true"] { position: relative; color: transparent !important; pointer-events: none; }
.btn[aria-busy="true"]::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink-2); border-top-color: transparent; animation: spin .7s linear infinite; }
.btn.cta[aria-busy="true"]::after { border-color: var(--brand-ink); border-top-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.linkish { background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; cursor: pointer; font-weight: 600; }

/* ================= chips, segmented, tags ================= */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-size: .9rem; font-weight: 650; cursor: pointer; user-select: none; }
.chip:hover { border-color: var(--ink); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip[aria-pressed="true"], .chip.on, .chip:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); color: var(--ink); }
.chip[aria-pressed="true"]::before, .chip.on::before, .chip:has(input:checked)::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.chip:has(input:focus-visible) { box-shadow: var(--ring); }
.chip.static { cursor: default; min-height: 30px; padding: 0 11px; font-size: .8rem; background: var(--bg-2); border-color: var(--line); }
.chip.static:hover { border-color: var(--line); }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--line-2)); }
.seg { display: inline-flex; max-width: 100%; border: 1.5px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); padding: 3px; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.seg > button, .seg > label { flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 14px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-weight: 700; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.seg > button:hover, .seg > label:hover { color: var(--ink); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg > [aria-checked="true"], .seg > [aria-pressed="true"], .seg > .on, .seg > label:has(input:checked) { background: var(--ink); color: var(--bg); }
.seg > label:has(input:focus-visible) { box-shadow: var(--ring); }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 4px; font: 700 .64rem/1.5 var(--font); letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; vertical-align: middle; }
.tag.measured { border: 1px solid var(--ink-2); color: var(--ink-2); }
.tag.ai { border: 1px dashed var(--muted); color: var(--muted); font-family: var(--display); font-style: italic; font-weight: 500; letter-spacing: .02em; text-transform: none; font-size: .78rem; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--bg-2); color: var(--ink-2); }
.badge.ok { background: var(--ok-soft); color: var(--ok-ink); } .badge.warn { background: var(--warn-soft); color: var(--warn-ink); }
.badge.bad { background: var(--bad-soft); color: var(--bad-ink); } .badge.info { background: var(--info-soft); color: var(--info-ink); }

/* ================= form fields ================= */
.field { display: grid; gap: 6px; } .field > label, .field > .lbl { font-weight: 700; font-size: .88rem; }
.field .hint { color: var(--muted); font-size: .84rem; margin: 0; } .field .err { color: var(--bad-ink); font-size: .86rem; margin: 0; }
.input, select.input, textarea.input { width: 100%; min-height: 46px; padding: 10px 13px; border-radius: var(--radius-sm); border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink); }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:hover { border-color: var(--ink-2); } .input:focus-visible { border-color: var(--brand); box-shadow: var(--ring); }
.input[aria-invalid="true"] { border-color: var(--bad); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; } .check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.switch { display: flex; gap: 14px; align-items: center; justify-content: space-between; min-height: 44px; cursor: pointer; }
.switch input { appearance: none; width: 46px; height: 28px; border-radius: 99px; background: var(--line-2); position: relative; flex: none; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); transition: transform .15s; box-shadow: 0 1px 2px rgba(30,27,58,.3); }
.switch input:checked { background: var(--brand); } .switch input:checked::after { transform: translateX(18px); }
.switch input:focus-visible { box-shadow: var(--ring); }
.alert { padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface-2); font-size: .92rem; margin: 0; }
.alert.err { background: var(--bad-soft); border-color: var(--bad); color: var(--bad-ink); } .alert.info { background: var(--info-soft); border-color: var(--info); }
.alert.ok { background: var(--ok-soft); border-color: var(--ok); } .alert.warn { background: var(--warn-soft); border-color: var(--warn); }
.secret, .secret-box { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1.5px dashed var(--line-2); border-radius: var(--radius-sm); background: var(--bg-2); font-family: var(--mono); font-size: .86rem; word-break: break-all; }

/* ================= banners ================= */
#banners:empty { display: none; } #banners { margin-bottom: 28px; display: grid; gap: 10px; }
.banner { position: relative; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 12px 16px 12px 22px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface); font-size: .94rem; }
.banner::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 6px; border-radius: 0 4px 4px 0; background: var(--line-2); }
.banner .grow { flex: 1 1 260px; }
.banner.warn { background: var(--warn-soft); border-color: var(--warn); } .banner.warn::before { background: var(--c-tangerine); }
.banner.bad { background: var(--bad-soft); border-color: var(--bad); } .banner.bad::before { background: var(--c-tomato); }
.banner.info { background: var(--info-soft); border-color: var(--info); } .banner.info::before { background: var(--c-sky); }
.banner.ok { background: var(--ok-soft); border-color: var(--ok); } .banner.ok::before { background: var(--c-grass); }

/* ================= dialogs, sheets, toasts ================= */
.scrim { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--scrim); }
.dialog { width: min(480px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 24px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); }
.dialog.wide { width: min(720px, 100%); }
.dialog h2 { font-size: 1.4rem; }
.dialog .actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 22px; }
@media (prefers-reduced-motion: no-preference) { .dialog { animation: dlg .2s ease-out; } @keyframes dlg { from { opacity: 0; transform: translateY(10px) scale(.98); } } }
@media (max-width: 600px) { .scrim { align-items: flex-end; padding: 0; } .dialog { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; padding-bottom: calc(24px + env(safe-area-inset-bottom)); } .dialog .actions .btn { flex: 1; } }
.toasts { position: fixed; z-index: 90; left: 50%; bottom: 22px; transform: translateX(-50%); display: grid; gap: 10px; width: min(460px, calc(100vw - 28px)); pointer-events: none; }
@media (max-width: 860px) { .toasts { bottom: calc(var(--tab-h) + 24px + env(safe-area-inset-bottom)); } }
.toast { pointer-events: auto; position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 12px 12px 12px 22px; border-radius: var(--radius-sm); background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); font-size: .92rem; }
.toast::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 6px; border-radius: 0 4px 4px 0; background: var(--c-sky); }
.toast.ok::before { background: var(--c-grass); } .toast.warn::before { background: var(--c-tangerine); } .toast.bad::before { background: var(--c-tomato); }
.toast .body { flex: 1; min-width: 0; } .toast a { color: var(--c-sun); font-weight: 700; }
.toast .x { border: 0; background: none; color: inherit; opacity: .7; cursor: pointer; width: 28px; height: 28px; display: grid; place-items: center; flex: none; } .toast .x:hover { opacity: 1; }
@media (prefers-reduced-motion: no-preference) { .toast { animation: toast-in .22s ease-out; } @keyframes toast-in { from { opacity: 0; transform: translateY(8px); } } }

/* ================= skeleton, empty ================= */
.skel { position: relative; overflow: hidden; border-radius: var(--radius-sm); background: var(--bg-2); min-height: 16px; }
@media (prefers-reduced-motion: no-preference) { .skel::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--surface) 70%, transparent) 50%, transparent 80%); transform: translateX(-100%); animation: shimmer 1.4s infinite; } @keyframes shimmer { to { transform: translateX(100%); } } }
.skel.line { height: 14px; } .skel.title { height: 38px; width: 46%; } .skel.block { height: 180px; } .skel.chart { height: 240px; }
.skel.pin-s { height: 240px; border-radius: 4px; } .skel.pin-s:nth-child(3n+2) { height: 300px; } .skel.pin-s:nth-child(3n) { height: 200px; }
.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 48px 20px; max-width: 520px; margin: 0 auto; }
.empty .big { position: relative; width: 120px; height: 84px; margin-bottom: 10px; }
.empty .big > .i { display: none; }
.empty .big::before, .empty .big::after, .empty .big > i { content: ""; position: absolute; }
.empty .big::before { left: 6px; top: 14px; width: 58px; height: 58px; background: var(--c-sun); border-radius: 50%; }
.empty .big::after { left: 44px; top: 0; width: 54px; height: 54px; background: var(--c-grass); border-radius: 0 100% 0 100%; transform: rotate(8deg); }
.empty .big > i { left: 62px; top: 46px; width: 56px; height: 24px; background: var(--c-tomato); clip-path: polygon(0 100%,12% 0,25% 100%,37% 0,50% 100%,62% 0,75% 100%,87% 0,100% 100%); transform: rotate(-6deg); }
.empty h3 { font-size: 1.4rem; } .empty p { color: var(--muted); margin: 0; }

/* ================= the wall, the pin, the label, the crayons ================= */
.wall { column-width: 250px; column-gap: 30px; padding-top: 14px; }
.pin { position: relative; display: block; break-inside: avoid; margin: 0 0 34px; transform: rotate(var(--tilt, 0deg)); transform-origin: 50% 0; transition: transform .28s cubic-bezier(.2,.7,.2,1); color: inherit; text-decoration: none; }
a.pin:hover { transform: rotate(0deg) translateY(-4px); text-decoration: none; }
a.pin:focus-visible { box-shadow: none; } a.pin:focus-visible .pin-frame { box-shadow: var(--ring), var(--pin-shadow); }
.pin-frame { background: var(--surface-2); border: 1px solid var(--line); padding: 10px 10px 0; box-shadow: var(--pin-shadow); }
.pin-art { display: block; background: var(--bg-2); outline: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); outline-offset: -1px; }
.pin-art img, .pin-art svg { display: block; width: 100%; height: auto; }
.pin-cap { padding: 11px 2px 12px; display: grid; gap: 4px; }
.pin-cap b { font: 600 1.02rem/1.2 var(--display); overflow-wrap: anywhere; }
.pin-cap .sub { color: var(--muted); font-size: .8rem; }
.pin-cap .crayons { margin-top: 4px; }
.pin-cap .fav { position: absolute; right: 8px; bottom: 10px; color: var(--c-tomato); }
/* washi tape */
.pin::before { content: ""; position: absolute; z-index: 2; top: -13px; left: 16px; width: 78px; height: 26px; background: var(--tape, var(--c-sun)); opacity: .86; mix-blend-mode: var(--tape-blend); transform: rotate(-5deg);
  clip-path: polygon(0 0,100% 0,97% 20%,100% 40%,97% 60%,100% 80%,97% 100%,0 100%,3% 80%,0 60%,3% 40%,0 20%); pointer-events: none; }
.pin.r::before { left: auto; right: 16px; transform: rotate(6deg); }
.pin[data-tape="0"] { --tape: var(--c-sun); } .pin[data-tape="1"] { --tape: var(--c-sky); } .pin[data-tape="2"] { --tape: var(--c-pink); }
.pin[data-tape="3"] { --tape: var(--c-grass); } .pin[data-tape="4"] { --tape: var(--c-tangerine); }
.pin.flat { transform: none; break-inside: auto; margin: 0; }
.pin-status { position: absolute; left: 18px; top: 18px; z-index: 3; }
@media (prefers-reduced-motion: reduce) { .pin, a.pin:hover { transition: none; } a.pin:hover { transform: rotate(var(--tilt, 0deg)); } }
@media (max-width: 560px) { .wall { column-width: 150px; column-gap: 18px; } .pin { margin-bottom: 26px; } .pin::before { width: 56px; height: 20px; top: -10px; left: 10px; } .pin-frame { padding: 7px 7px 0; } .pin-cap b { font-size: .92rem; } .pin-cap .fav { display: none; } }

/* the wall label */
.label { position: relative; background: var(--surface); border: 1px solid var(--line-2); padding: 22px 24px 20px; box-shadow: 0 1px 0 var(--line); }
.label::after { content: ""; position: absolute; inset: 5px; border: 1px solid var(--line); pointer-events: none; }
.label-head { padding-bottom: 12px; border-bottom: 1px solid var(--ink); margin-bottom: 4px; }
.label-head h2, .label-head h3 { font-size: 1.5rem; } .label-head .sub { color: var(--muted); font-size: .86rem; margin-top: 4px; }
.label dl { margin: 0; } .label .f { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 4px 18px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: start; }
.label .f:last-child { border-bottom: 0; }
.label dt { font: 700 .68rem/1.6 var(--font); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.label dd { margin: 0; min-width: 0; display: grid; gap: 8px; } .label dd .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.label dd .num { font-variant-numeric: tabular-nums lining-nums; font-weight: 700; }
.label-foot { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
@media (max-width: 560px) { .label { padding: 18px 18px 16px; } .label .f { grid-template-columns: 1fr; gap: 6px; } }

/* the crayon strip: each stub's width is its measured share */
.crayons { display: flex; gap: 3px; height: 28px; align-items: stretch; min-width: 0; filter: drop-shadow(0 0 .6px color-mix(in srgb, var(--ink) 55%, transparent)); }
.crayons > i { position: relative; flex: var(--w, 1) 1 0; min-width: 14px; background: var(--c, var(--bg-3)); border-radius: 2px 0 0 2px; clip-path: polygon(0 0, calc(100% - 11px) 0, 100% 32%, 100% 68%, calc(100% - 11px) 100%, 0 100%); }
.crayons > i::before { content: ""; position: absolute; left: 12%; width: min(46%, 64px); top: 0; bottom: 0; background: linear-gradient(rgba(255,255,255,.6), rgba(255,255,255,.6)) center / 100% 2px no-repeat, rgba(30,27,58,.16); }
.crayons.sm { height: 16px; gap: 2px; } .crayons.sm > i { min-width: 9px; clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 35%, 100% 65%, calc(100% - 5px) 100%, 0 100%); } .crayons.sm > i::before { display: none; }
.crayons.lg { height: 52px; gap: 4px; } .crayons.lg > i { clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 34%, 100% 66%, calc(100% - 18px) 100%, 0 100%); }
.crayons.xl { height: 76px; gap: 5px; } .crayons.xl > i { clip-path: polygon(0 0, calc(100% - 26px) 0, 100% 34%, 100% 66%, calc(100% - 26px) 100%, 0 100%); }
.crayon-legend { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .86rem; }
.crayon-legend li { display: inline-flex; align-items: center; gap: 7px; }
.crayon-legend .sw { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 25%, transparent); flex: none; }
.crayon-legend .pc { color: var(--muted); font-variant-numeric: tabular-nums; }

/* cut-paper shapes: flat, bold, slightly rotated. Colour them with --c, size with --s, turn with --r. */
.cutout { display: inline-block; flex: none; width: var(--s, 56px); height: var(--s, 56px); background: var(--c, var(--c-sun)); transform: rotate(var(--r, 0deg)); }
.cutout.circle { border-radius: 50%; } .cutout.leaf { border-radius: 0 100% 0 100%; } .cutout.half { height: calc(var(--s, 56px) / 2); border-radius: var(--s, 56px) var(--s, 56px) 0 0; }
.cutout.blob { border-radius: 62% 38% 55% 45% / 48% 58% 42% 52%; }
.cutout.star { clip-path: polygon(50% 0,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%); }
.cutout.zig { height: calc(var(--s, 56px) / 2.2); clip-path: polygon(0 100%,10% 0,20% 100%,30% 0,40% 100%,50% 0,60% 100%,70% 0,80% 100%,90% 0,100% 100%); }
.cutout.sun { --c: var(--c-sun); } .cutout.tomato { --c: var(--c-tomato); } .cutout.grass { --c: var(--c-grass); } .cutout.sky { --c: var(--c-sky); }
.cutout.grape { --c: var(--c-grape); } .cutout.pink { --c: var(--c-pink); } .cutout.tangerine { --c: var(--c-tangerine); } .cutout.earth { --c: var(--c-earth); }

/* ================= tables, meter, lists ================= */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th { text-align: left; font: 700 .68rem/1.4 var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--ink); white-space: nowrap; }
table.t td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t .num { text-align: right; font-variant-numeric: tabular-nums; } table.t th.sortable { cursor: pointer; }
table.t tr.clickable { cursor: pointer; } table.t tr.clickable:hover td { background: var(--bg-2); }
.pagebar { display: flex; justify-content: center; padding-top: 14px; }
.meter { height: 8px; border-radius: 99px; background: var(--bg-3); overflow: hidden; } .meter > i { display: block; height: 100%; width: var(--p, 0%); background: var(--ink); border-radius: 99px; }
.dots { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; } .dots li { display: flex; gap: 10px; align-items: flex-start; }
.dots li::before { content: ""; width: 8px; height: 8px; margin-top: .55em; border-radius: 50%; background: var(--c-tangerine); flex: none; }

/* ================= public + error ================= */
.pubbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; height: var(--bar-h); padding-inline: max(var(--gutter), calc((100vw - var(--page-w)) / 2 + var(--gutter))); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.pubbar-actions { display: flex; align-items: center; gap: 14px; } .pub-link { font-weight: 700; font-size: .94rem; }
.err-page { flex: 1; display: grid; align-content: center; justify-items: center; text-align: center; gap: 18px; padding: 60px var(--gutter) 40px; }
.err-art { position: relative; width: 190px; height: 130px; margin-bottom: 6px; }
.err-art .cutout { position: absolute; }
.err-in { display: grid; justify-items: center; gap: 12px; max-width: 520px; } .err-in h1 { font-size: clamp(2rem, 6vw, 3rem); } .err-in p { color: var(--muted); margin: 0; }

/* ================= print ================= */
@media print {
  :root, :root[data-theme="dark"] { --bg: #fff; --surface: #fff; --ink: #1E1B3A; --muted: #4a4668; --line: #cfc8b4; --line-2: #b9b199; }
  body { background: #fff !important; display: block; }
  .topbar, .tabbar, .more-sheet, .site-foot, .toasts, #banners, .pwa-bar, .no-print, .skip-link { display: none !important; }
  .main { padding: 0; max-width: none; } .label, .pin-frame, .card { box-shadow: none; break-inside: avoid; }
  .pin { transform: none; } .pin::before { display: none; } a { text-decoration: none; }
}
