/*
  Margin: notes app screens (Screenery template)
  1. Tokens: colour roles registered with @property so a new seed glides across the whole page, then type, shape and motion.
     The default values below are the Dune wallpaper's scheme, so the page is themed before (or without) JavaScript.
  2. Page: top bar, hero and wallpaper picker, the device stage, features, the colour explainer, widgets, privacy,
     pricing, download, questions, footer. 3. The app itself (.app), laid out by container queries on its host:
     compact under 600px, medium 600 to 840px, expanded above 840px, like Android window size classes.
*/

/* ---------- Colour roles (registered so they can transition) ---------- */
@property --c-primary { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-on-primary { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-primary-container { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-on-primary-container { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-secondary { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-on-secondary { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-secondary-container { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-on-secondary-container { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-tertiary { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-on-tertiary { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-tertiary-container { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-on-tertiary-container { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-error { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-on-error { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-error-container { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-on-error-container { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-surface { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-surface-dim { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-surface-bright { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-sc-lowest { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-sc-low { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-sc { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-sc-high { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-sc-highest { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-on-surface { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-on-surface-variant { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-outline { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-outline-variant { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-inverse-surface { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-inverse-on-surface { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-inverse-primary { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-note-clay { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-note-sand { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-note-moss { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-note-sea { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-note-lilac { syntax: '<color>'; inherits: true; initial-value: #808080; }
@property --c-note-rose { syntax: '<color>'; inherits: true; initial-value: #808080; }

:root {
  --c-primary: #9c4412;
  --c-on-primary: #ffffff;
  --c-primary-container: #ffdbcb;
  --c-on-primary-container: #351000;
  --c-secondary: #76584a;
  --c-on-secondary: #ffffff;
  --c-secondary-container: #ffdbcb;
  --c-on-secondary-container: #2e1509;
  --c-tertiary: #656020;
  --c-on-tertiary: #ffffff;
  --c-tertiary-container: #e9e6a3;
  --c-on-tertiary-container: #1f1c00;
  --c-error: #b12c28;
  --c-on-error: #ffffff;
  --c-error-container: #ffdad5;
  --c-on-error-container: #410002;
  --c-surface: #fff8f5;
  --c-surface-dim: #e2d8d4;
  --c-surface-bright: #fff8f5;
  --c-sc-lowest: #ffffff;
  --c-sc-low: #fbf2ed;
  --c-sc: #f6ece8;
  --c-sc-high: #f0e6e2;
  --c-sc-highest: #eae1dc;
  --c-on-surface: #211a17;
  --c-on-surface-variant: #53443d;
  --c-outline: #84746c;
  --c-outline-variant: #d5c3bb;
  --c-inverse-surface: #362f2c;
  --c-inverse-on-surface: #f8efea;
  --c-inverse-primary: #ffb694;
  --c-note-clay: #ffdbd0;
  --c-note-sand: #f9dfb7;
  --c-note-moss: #d7e9be;
  --c-note-sea: #b2edf0;
  --c-note-lilac: #efdbff;
  --c-note-rose: #ffd9e2;

  /* Type: Roboto Flex is variable in weight, width and optical size */
  --font: 'Roboto Flex', system-ui, sans-serif;
  --fs-display: clamp(2.75rem, 1.5rem + 4.4vw, 5.6rem);
  --fs-headline: clamp(2rem, 1.35rem + 2.1vw, 3.25rem);
  --fs-title-l: 1.5rem;
  --fs-title-m: 1.125rem;
  --fs-body: 1.0625rem;
  --fs-label: 0.875rem;

  /* Shape: Material's corner scale, extra large for page containers */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 32px;
  --r-xxl: 48px;
  --r-full: 999px;

  /* Space */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 72px;
  --s-9: 112px;
  --gutter: clamp(16px, 4vw, 48px);
  --maxw: 1344px;

  /* Motion. --spring is replaced by script.js with a linear() spring curve when the browser supports it */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --spring: cubic-bezier(0.2, 0, 0, 1);
  --theme-dur: 900ms;
  --device: #1d1b1e;
  --device-edge: #2c2a2e;

  color-scheme: light;
}

/* Dark scheme: tones flip (text 90 on surface 6). Follows the system until the toggle or ?scheme= decides. */
:root[data-scheme='dark'] {
  --c-primary: #ffb694;
  --c-on-primary: #561f00;
  --c-primary-container: #7a3000;
  --c-on-primary-container: #ffdbcb;
  --c-secondary: #e2bfb0;
  --c-on-secondary: #442a1e;
  --c-secondary-container: #5d4033;
  --c-on-secondary-container: #ffdbcb;
  --c-tertiary: #cdc988;
  --c-on-tertiary: #353100;
  --c-tertiary-container: #4d4800;
  --c-on-tertiary-container: #e9e6a3;
  --c-error: #ffb4aa;
  --c-on-error: #690006;
  --c-error-container: #93000c;
  --c-on-error-container: #ffdad5;
  --c-surface: #18120f;
  --c-surface-dim: #18120f;
  --c-surface-bright: #3f3834;
  --c-sc-lowest: #130d0a;
  --c-sc-low: #211a17;
  --c-sc: #251e1b;
  --c-sc-high: #302825;
  --c-sc-highest: #3b3330;
  --c-on-surface: #eae1dc;
  --c-on-surface-variant: #d5c3bb;
  --c-outline: #9f8d85;
  --c-outline-variant: #53443d;
  --c-inverse-surface: #eae1dc;
  --c-inverse-on-surface: #362f2c;
  --c-inverse-primary: #9c4412;
  --c-note-clay: #5b3a31;
  --c-note-sand: #513f22;
  --c-note-moss: #3b4628;
  --c-note-sea: #1a494b;
  --c-note-lilac: #4c3c58;
  --c-note-rose: #5a3841;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-scheme]) {
    --c-primary: #ffb694;
    --c-on-primary: #561f00;
    --c-primary-container: #7a3000;
    --c-on-primary-container: #ffdbcb;
    --c-secondary: #e2bfb0;
    --c-on-secondary: #442a1e;
    --c-secondary-container: #5d4033;
    --c-on-secondary-container: #ffdbcb;
    --c-tertiary: #cdc988;
    --c-on-tertiary: #353100;
    --c-tertiary-container: #4d4800;
    --c-on-tertiary-container: #e9e6a3;
    --c-error: #ffb4aa;
    --c-on-error: #690006;
    --c-error-container: #93000c;
    --c-on-error-container: #ffdad5;
    --c-surface: #18120f;
    --c-surface-dim: #18120f;
    --c-surface-bright: #3f3834;
    --c-sc-lowest: #130d0a;
    --c-sc-low: #211a17;
    --c-sc: #251e1b;
    --c-sc-high: #302825;
    --c-sc-highest: #3b3330;
    --c-on-surface: #eae1dc;
    --c-on-surface-variant: #d5c3bb;
    --c-outline: #9f8d85;
    --c-outline-variant: #53443d;
    --c-inverse-surface: #eae1dc;
    --c-inverse-on-surface: #362f2c;
    --c-inverse-primary: #9c4412;
    --c-note-clay: #5b3a31;
    --c-note-sand: #513f22;
    --c-note-moss: #3b4628;
    --c-note-sea: #1a494b;
    --c-note-lilac: #4c3c58;
    --c-note-rose: #5a3841;
    color-scheme: dark;
  }
}

:root {
  --state-hover: color-mix(in srgb, currentColor 8%, transparent);
  --state-press: color-mix(in srgb, currentColor 12%, transparent);
  transition-property: --c-primary, --c-on-primary, --c-primary-container, --c-on-primary-container, --c-secondary, --c-on-secondary, --c-secondary-container, --c-on-secondary-container, --c-tertiary, --c-on-tertiary, --c-tertiary-container, --c-on-tertiary-container, --c-error, --c-on-error, --c-error-container, --c-on-error-container, --c-surface, --c-surface-dim, --c-surface-bright, --c-sc-lowest, --c-sc-low, --c-sc, --c-sc-high, --c-sc-highest, --c-on-surface, --c-on-surface-variant, --c-outline, --c-outline-variant, --c-inverse-surface, --c-inverse-on-surface, --c-inverse-primary, --c-note-clay, --c-note-sand, --c-note-moss, --c-note-sea, --c-note-lilac, --c-note-rose;
  transition-duration: var(--theme-dur);
  transition-timing-function: var(--ease);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: var(--c-surface);
  color: var(--c-on-surface);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.55;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg, canvas { display: block; max-width: 100%; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--c-primary); text-underline-offset: 0.2em; text-decoration-thickness: 1.5px; }
::selection { background: var(--c-tertiary-container); color: var(--c-on-tertiary-container); }
:focus-visible { outline: 3px solid var(--c-primary); outline-offset: 2px; border-radius: var(--r-xs); }
input, textarea { caret-color: var(--c-primary); accent-color: var(--c-primary); }
html { scrollbar-color: var(--c-outline) var(--c-surface); }
[hidden] { display: none !important; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.skip { position: absolute; left: var(--s-4); top: -60px; z-index: 50; background: var(--c-primary); color: var(--c-on-primary); padding: var(--s-3) var(--s-5); border-radius: var(--r-full); font-weight: 600; text-decoration: none; }
.skip:focus { top: var(--s-4); }

/* Type roles */
.display {
  font-size: var(--fs-display);
  font-weight: 760;
  font-stretch: 116%;
  line-height: 0.98;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.headline { font-size: var(--fs-headline); font-weight: 700; font-stretch: 112%; line-height: 1.04; letter-spacing: -0.025em; text-wrap: balance; }
.title-l { font-size: var(--fs-title-l); font-weight: 650; font-stretch: 106%; line-height: 1.2; letter-spacing: -0.01em; text-wrap: balance; }
.title-m { font-size: var(--fs-title-m); font-weight: 650; line-height: 1.3; }
.label-l { font-size: var(--fs-label); font-weight: 650; letter-spacing: 0.01em; }

/* ---------- Buttons: pill at rest, the corners tighten on press (expressive shape morph) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px; padding: 0 var(--s-5);
  border: 0; border-radius: var(--r-full);
  font-size: 0.95rem; font-weight: 650; font-stretch: 104%; text-decoration: none; white-space: nowrap;
  transition: border-radius 420ms var(--spring), background-color 200ms var(--ease);
}
.btn-lg { min-height: 56px; padding: 0 var(--s-6); font-size: 1.05rem; }
.btn:hover { background-image: linear-gradient(var(--state-hover), var(--state-hover)); }
.btn:active { border-radius: var(--r-sm); background-image: linear-gradient(var(--state-press), var(--state-press)); }
.btn-filled { background-color: var(--c-primary); color: var(--c-on-primary); }
.btn-tonal { background-color: var(--c-secondary-container); color: var(--c-on-secondary-container); }
.btn-outlined { background-color: transparent; color: var(--c-primary); box-shadow: inset 0 0 0 1px var(--c-outline); }
.btn-text { background: transparent; color: var(--c-primary); padding: 0 var(--s-3); }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: var(--r-full);
  background: transparent; color: var(--c-on-surface-variant);
  transition: border-radius 420ms var(--spring), background-color 200ms var(--ease);
}
.icon-btn:hover { background-color: var(--state-hover); }
.icon-btn:active { border-radius: var(--r-sm); }
.icon-btn[aria-pressed='true'] { background-color: var(--c-secondary-container); color: var(--c-on-secondary-container); border-radius: var(--r-sm); }

/* ---------- Top app bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--c-surface); transition: background-color 300ms var(--ease); }
.topbar.is-scrolled { background: var(--c-sc); }
.topbar-in { max-width: var(--maxw); margin: 0 auto; padding: var(--s-3) var(--gutter); display: flex; align-items: center; gap: var(--s-5); }
.logo { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--c-on-surface); text-decoration: none; font-weight: 800; font-stretch: 120%; font-size: 1.35rem; letter-spacing: -0.02em; }
.logo-mark { width: 34px; height: 34px; }
.logo-cookie { fill: var(--c-primary); }
.logo-f { fill: none; stroke: var(--c-on-primary); stroke-width: 2.4; stroke-linecap: round; }
.topnav { display: flex; gap: var(--s-1); margin-left: auto; }
.topnav a { padding: 10px var(--s-4); border-radius: var(--r-full); color: var(--c-on-surface-variant); text-decoration: none; font-size: 0.95rem; font-weight: 600; }
.topnav a:hover { background: var(--state-hover); color: var(--c-on-surface); }
.topbar-actions { display: flex; align-items: center; gap: var(--s-2); }
.ico-sun { display: none; }
[data-scheme='dark'] .ico-sun { display: block; }
[data-scheme='dark'] .ico-moon { display: none; }
.menu-btn { display: none; }

/* ---------- Hero ---------- */
main > section { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: var(--s-7); align-items: end; padding-top: var(--s-7); padding-bottom: var(--s-7); }
.hero h1 { max-width: 12ch; }
.lede { margin-top: var(--s-5); max-width: 58ch; color: var(--c-on-surface-variant); font-size: 1.15rem; }
.hero-cta { margin-top: var(--s-6); display: flex; flex-wrap: wrap; gap: var(--s-3); }

.picker { background: var(--c-sc-low); border-radius: var(--r-xxl); padding: var(--s-5); }
.picker-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s-2) var(--s-4); margin-bottom: var(--s-4); }
.picker-seed { color: var(--c-on-surface-variant); font-size: var(--fs-label); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.seed-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 4px; border-radius: var(--r-full); background: var(--c-sc-highest); color: var(--c-on-surface); font-variant-numeric: tabular-nums; font-weight: 600; }
.seed-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--seed, var(--c-primary)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c-on-surface) 20%, transparent); }
.picker-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s-3); }
.wall {
  display: grid; gap: var(--s-2); justify-items: center; padding: 0; border: 0; background: none;
  color: var(--c-on-surface-variant); font-size: 0.82rem; font-weight: 600; border-radius: var(--r-md);
}
.wall-art { width: 100%; aspect-ratio: 1; border-radius: 30%; overflow: hidden; }
.wall-art svg { width: 100%; height: 100%; }
.wall-name { display: inline-flex; align-items: center; gap: 2px; min-height: 22px; }
.wall-name .ico { width: 16px; height: 16px; stroke-width: 2.2; display: none; }
.wall[aria-checked='true'] { color: var(--c-on-surface); font-weight: 750; }
.wall[aria-checked='true'] .wall-name .ico { display: block; color: var(--c-primary); }
.wall:hover .wall-art { filter: saturate(1.15); }
.seed-own { margin-top: var(--s-4); display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); color: var(--c-on-surface-variant); font-size: var(--fs-label); font-weight: 600; }
.seed-own input { width: 52px; height: 36px; padding: 0; border: 0; border-radius: var(--r-sm); background: none; cursor: pointer; }
.seed-own input::-webkit-color-swatch-wrapper { padding: 0; }
.seed-own input::-webkit-color-swatch { border: 1px solid var(--c-outline); border-radius: var(--r-sm); }
.noscript-note { grid-column: 1 / -1; color: var(--c-on-surface-variant); }

/* ---------- Device stage ---------- */
.stage { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); padding-top: var(--s-2); padding-bottom: var(--s-8); }
.stage-ground { grid-area: 1 / 1; position: relative; border-radius: var(--r-xxl); overflow: hidden; background: var(--c-primary-container); }
.stage-ground svg { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity 900ms var(--ease); }
.devices { grid-area: 1 / 1; position: relative; display: flex; justify-content: center; align-items: center; gap: var(--s-6); padding: var(--s-7) var(--s-6); }
.tablet {
  flex: 0 1 960px; height: 640px; min-width: 0; padding: 16px; border-radius: 40px;
  background: var(--device); box-shadow: 0 0 0 2px var(--device-edge), 0 30px 60px -20px rgb(0 0 0 / 0.45), 0 8px 18px -6px rgb(0 0 0 / 0.3);
}
.tablet-screen, .phone-screen { position: relative; height: 100%; border-radius: 26px; overflow: hidden; background: var(--c-surface); display: flex; flex-direction: column; }
.phone {
  flex: 0 0 344px; height: 700px; padding: 11px; border-radius: 46px;
  background: var(--device); box-shadow: 0 0 0 2px var(--device-edge), 0 30px 60px -20px rgb(0 0 0 / 0.45), 0 8px 18px -6px rgb(0 0 0 / 0.3);
}
.phone-screen { border-radius: 36px; }
.statusbar { flex: none; height: 30px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--c-on-surface); background: var(--c-surface); position: relative; }
.sb-cam { position: absolute; left: 50%; top: 8px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--device); }
.sb-icons { display: flex; gap: 5px; align-items: center; }
.sb-icons i { display: block; width: 13px; height: 9px; border-radius: 2px; background: var(--c-on-surface); opacity: 0.85; }
.sb-icons i:nth-child(1) { clip-path: polygon(0 100%, 100% 0, 100% 100%); }
.sb-icons i:nth-child(2) { border-radius: 50% 50% 2px 2px; }
.sb-icons i:nth-child(3) { width: 20px; }
.gesture-pill { flex: none; height: 18px; display: grid; place-items: center; background: var(--c-surface); }
.gesture-pill::before { content: ''; width: 108px; height: 4px; border-radius: 4px; background: var(--c-on-surface); opacity: 0.6; }
.app-host { flex: 1; min-height: 0; position: relative; container: app / inline-size; }
/* The tablet renders at 88% so its CSS width counts as an expanded window, like a real 11 inch screen at its density */
.tablet .app-host { zoom: 0.88; }
.stage-notes { position: relative; max-width: 70ch; margin: var(--s-6) auto 0; text-align: center; color: var(--c-on-surface-variant); }
.stage-narrow { display: none; margin-top: var(--s-3); font-size: 0.95rem; }
.nos-app { padding: 16px; display: grid; gap: 10px; }
.nos-card { display: grid; gap: 4px; padding: 14px; border-radius: 16px; background: var(--c-note-sea); }
.nos-card span, .nos-note { color: var(--c-on-surface-variant); font-size: 14px; }

/* ---------- Section heads ---------- */
.sec-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-5) var(--s-7); align-items: end; margin-bottom: var(--s-7); }
.sec-head p { color: var(--c-on-surface-variant); max-width: 60ch; }

/* ---------- Features ---------- */
.features { padding-top: var(--s-8); padding-bottom: var(--s-8); }
.feat-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s-4); }
.feat { border-radius: var(--r-xxl); padding: var(--s-6); display: grid; gap: var(--s-4); align-content: start; }
.feat p { max-width: 52ch; }
.feat-lists { grid-column: span 7; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: var(--s-6); background: var(--c-primary-container); color: var(--c-on-primary-container); }
.feat-lists .feat-text { display: grid; gap: var(--s-3); }
.feat-labels { grid-column: span 5; background: var(--c-tertiary-container); color: var(--c-on-tertiary-container); border-radius: var(--r-xxl) var(--r-xxl) var(--r-xxl) 120px; }
.feat-search { grid-column: span 5; background: var(--c-sc-high); }
.feat-sizes { grid-column: span 7; background: var(--c-secondary-container); color: var(--c-on-secondary-container); border-radius: 120px var(--r-xxl) var(--r-xxl) var(--r-xxl); }
.mini-list { display: grid; gap: 2px; background: var(--c-sc-lowest); color: var(--c-on-surface); border-radius: var(--r-lg); padding: var(--s-3); box-shadow: 0 10px 24px -14px rgb(0 0 0 / 0.35); }
.mini-list li { border-radius: var(--r-sm); }
.mini-list label { display: flex; align-items: center; gap: var(--s-3); padding: 10px var(--s-2); cursor: pointer; min-height: 44px; }
.mini-list input { width: 20px; height: 20px; margin: 0; flex: none; }
.mini-list li.done span { text-decoration: line-through; color: var(--c-on-surface-variant); }
.label-cloud { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-3); }
.lc { padding: 8px 18px; border-radius: var(--r-full); font-weight: 650; font-stretch: 110%; background: var(--c-sc-lowest); color: var(--c-on-surface); }
.lc-1 { background: var(--c-note-sand); }
.lc-2 { background: var(--c-note-moss); font-size: 1.25rem; }
.lc-3 { background: var(--c-note-lilac); }
.lc-4 { background: var(--c-note-sea); font-size: 1.1rem; }
.lc-5 { background: var(--c-note-rose); }
.mini-search { display: flex; align-items: center; gap: var(--s-2); height: 56px; padding: 0 var(--s-4); border-radius: var(--r-full); background: var(--c-sc-highest); color: var(--c-on-surface-variant); }
.mini-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--c-on-surface); font-size: 1.05rem; height: 100%; }
.mini-search:focus-within { outline: 3px solid var(--c-primary); outline-offset: 2px; }
.mini-results { display: grid; gap: var(--s-2); min-height: 100px; }
.mini-results li { padding: 10px var(--s-4); border-radius: var(--r-md); background: var(--c-sc-lowest); font-size: 0.95rem; }
.mini-results li b { display: block; font-weight: 650; }
.mini-results li span { color: var(--c-on-surface-variant); }
.mini-results .none { background: none; color: var(--c-on-surface-variant); }
mark { background: var(--c-tertiary-container); color: var(--c-on-tertiary-container); border-radius: 4px; padding: 0 2px; }
.sizes { display: grid; gap: var(--s-2); margin-top: var(--s-2); }
.sizes div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: var(--s-4); align-items: baseline; padding: var(--s-3) 0; border-top: 1px solid color-mix(in srgb, currentColor 25%, transparent); }
.sizes dt { font-weight: 750; font-stretch: 118%; font-size: 1.1rem; }
.sizes div:nth-child(2) dt { font-stretch: 100%; }
.sizes div:nth-child(1) dt { font-stretch: 80%; }

/* ---------- Colour explainer ---------- */
.colours { padding-top: var(--s-8); padding-bottom: var(--s-8); }
.steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); counter-reset: step; }
.step { position: relative; background: var(--c-sc-low); border-radius: var(--r-xl); padding: var(--s-6); padding-left: calc(var(--s-6) + 52px); display: grid; gap: var(--s-3); align-content: start; counter-increment: step; }
.step::before {
  content: counter(step); position: absolute; left: var(--s-5); top: var(--s-5);
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 30%;
  background: var(--c-primary); color: var(--c-on-primary); font-weight: 800; font-stretch: 120%;
}
.step p { color: var(--c-on-surface-variant); max-width: 64ch; }
.step-wide { grid-column: 1 / -1; }
.sample-canvas { width: 192px; height: 192px; image-rendering: pixelated; border-radius: var(--r-lg); margin-top: var(--s-2); background: var(--c-sc-highest); }
.cands { display: grid; gap: var(--s-2); margin-top: var(--s-2); }
.cand { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: var(--s-3); font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.cand-sw { width: 40px; height: 40px; border-radius: 50%; }
.cand.win .cand-sw { border-radius: 0; clip-path: var(--cookie9); }
.cand-bar { height: 10px; border-radius: 5px; background: var(--c-sc-highest); overflow: hidden; }
.cand-bar i { display: block; height: 100%; border-radius: 5px; background: var(--c-primary); }
.cand.win { font-weight: 700; }
.palettes { display: grid; gap: var(--s-2); margin-top: var(--s-2); }
.pal { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; gap: var(--s-3); }
.pal-name { font-size: 0.9rem; font-weight: 650; }
.pal-name small { display: block; font-weight: 450; color: var(--c-on-surface-variant); font-size: 0.78rem; }
.pal-tones { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); border-radius: var(--r-md); overflow: hidden; }
.pal-tones span { height: 44px; display: grid; place-items: end center; padding-bottom: 4px; font-size: 0.72rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.pal-tones span.used { box-shadow: inset 0 -4px 0 currentColor; }
.table-wrap { overflow-x: auto; margin-top: var(--s-2); border-radius: var(--r-md); }
.roles { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.roles th { text-align: left; font-weight: 650; font-size: 0.85rem; color: var(--c-on-surface-variant); padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--c-outline-variant); }
.roles td { padding: var(--s-3); border-bottom: 1px solid var(--c-outline-variant); vertical-align: middle; }
.roles .sample { display: inline-block; padding: 6px 14px; border-radius: var(--r-full); font-weight: 650; white-space: nowrap; }
.roles .ratio { font-weight: 700; }
.roles .pass { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: var(--r-full); background: var(--c-secondary-container); color: var(--c-on-secondary-container); font-size: 0.78rem; font-weight: 650; }
.seed-form { margin-top: var(--s-4); display: grid; gap: var(--s-2); max-width: 420px; }
.seed-form label { font-weight: 650; font-size: 0.95rem; }
.seed-field { display: flex; gap: var(--s-2); }
.seed-field input, .field input {
  flex: 1; min-width: 0; height: 56px; padding: 0 var(--s-4); border-radius: var(--r-sm);
  border: 1px solid var(--c-outline); background: var(--c-surface); color: var(--c-on-surface); font-size: 1rem;
}
.seed-field input::placeholder, .field input::placeholder { color: var(--c-on-surface-variant); }
.seed-field input:focus, .field input:focus { outline: none; border-color: var(--c-primary); box-shadow: inset 0 0 0 1px var(--c-primary); }
.seed-field .btn { min-height: 56px; }
.field-err { min-height: 1.4em; color: var(--c-error); font-size: 0.9rem; font-weight: 600; }
[aria-invalid='true'] { border-color: var(--c-error) !important; box-shadow: inset 0 0 0 1px var(--c-error) !important; }

/* ---------- Widgets ---------- */
.widgets { padding-top: var(--s-8); padding-bottom: var(--s-8); }
.home { position: relative; border-radius: var(--r-xxl); overflow: hidden; padding: var(--s-7); min-height: 520px; background: var(--c-primary-container); }
.home-ground { position: absolute; inset: 0; }
.home-ground svg { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity 900ms var(--ease); }
.home-grid { position: relative; display: grid; grid-template-columns: 220px minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: 'clock pinned check' 'clock quick check'; gap: var(--s-5); max-width: 1000px; margin: 0 auto; }
.w-clock { grid-area: clock; }
.w-pinned { grid-area: pinned; }
.w-check { grid-area: check; }
.w-quick { grid-area: quick; }
.widget { border-radius: var(--r-xl); background: var(--c-sc-lowest); color: var(--c-on-surface); padding: var(--s-5); box-shadow: 0 14px 30px -18px rgb(0 0 0 / 0.5); }
.w-clock {
  align-self: center; aspect-ratio: 1; display: grid; place-content: center; text-align: center; padding: 0;
  background: var(--c-primary-container); color: var(--c-on-primary-container); border-radius: 0; clip-path: var(--cookie12);
  box-shadow: none;
}
.w-time { font-size: 3.4rem; font-weight: 820; font-stretch: 130%; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.w-date { font-size: 0.9rem; font-weight: 600; margin: 6px auto 0; max-width: 72%; line-height: 1.25; }
.w-pinned { display: grid; gap: var(--s-2); align-content: start; }
.w-head { display: flex; align-items: center; gap: var(--s-2); color: var(--c-on-surface-variant); font-size: 0.85rem; font-weight: 650; }
.w-head .ico { width: 18px; height: 18px; }
.w-pinned h3 { font-size: 1.35rem; font-weight: 700; font-stretch: 110%; line-height: 1.2; }
.w-pinned p { color: var(--c-on-surface-variant); font-size: 0.95rem; }
.w-check { display: grid; gap: 2px; align-content: start; }
.w-check h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: var(--s-2); }
.w-check label { display: flex; align-items: center; gap: var(--s-3); min-height: 44px; padding: 0 var(--s-2); border-radius: var(--r-sm); cursor: pointer; }
.w-check label:hover { background: var(--state-hover); }
.w-check input { width: 20px; height: 20px; margin: 0; }
.w-check .done span { text-decoration: line-through; color: var(--c-on-surface-variant); }
.w-quick { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); background: none; box-shadow: none; padding: 0; }
.quick {
  aspect-ratio: 1; border: 0; display: grid; place-content: center; justify-items: center; gap: 6px; font-weight: 700; font-size: 0.95rem;
  background: var(--c-tertiary-container); color: var(--c-on-tertiary-container); border-radius: 28%;
}
.quick:nth-child(2) { background: var(--c-secondary-container); color: var(--c-on-secondary-container); }
.quick .ico { width: 30px; height: 30px; }
.w-empty { color: var(--c-on-surface-variant); }

/* ---------- Privacy ---------- */
.privacy { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: var(--s-7); align-items: center; padding-top: var(--s-8); padding-bottom: var(--s-8); }
.privacy > * { min-width: 0; }
.priv-art { background: var(--c-tertiary-container); border-radius: 50% 50% var(--r-xxl) var(--r-xxl); padding: var(--s-6); }
.priv-svg { width: 100%; height: auto; }
.pa-tab, .pa-phone { fill: var(--c-on-tertiary-container); }
.pa-screen { fill: var(--c-tertiary-container); }
.pa-line { fill: none; stroke: var(--c-on-tertiary-container); stroke-width: 3; stroke-linecap: round; }
.pa-dash { stroke-dasharray: 2 10; }
.pa-lock rect { fill: var(--c-tertiary); }
.pa-lock path, .pa-key { fill: none; stroke: var(--c-tertiary); stroke-width: 4; stroke-linecap: round; }
.pa-cookie { fill: var(--c-tertiary); }
.priv-copy { display: grid; gap: var(--s-5); }
.priv-copy > p { color: var(--c-on-surface-variant); max-width: 62ch; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-5) var(--s-6); }
.facts dt { display: flex; align-items: center; gap: var(--s-2); font-weight: 700; color: var(--c-on-surface); }
.facts dt .ico { color: var(--c-primary); }
.facts dd { margin-top: var(--s-1); color: var(--c-on-surface-variant); font-size: 0.98rem; }

/* ---------- Pricing ---------- */
.pricing { padding-top: var(--s-8); padding-bottom: var(--s-8); }
.seg { display: inline-flex; justify-self: start; border-radius: var(--r-full); box-shadow: inset 0 0 0 1px var(--c-outline); overflow: hidden; }
.seg button { display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 0 var(--s-5); border: 0; background: transparent; color: var(--c-on-surface); font-weight: 650; font-size: 0.95rem; }
.seg button + button { box-shadow: inset 1px 0 0 var(--c-outline); }
.seg button[aria-checked='true'] { background: var(--c-secondary-container); color: var(--c-on-secondary-container); }
.seg-check { width: 18px; height: 18px; display: none; stroke-width: 2.2; }
.seg button[aria-checked='true'] .seg-check { display: block; }
.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
.plan { border-radius: var(--r-xxl); padding: var(--s-6); display: grid; gap: var(--s-4); align-content: start; background: var(--c-sc-low); }
.plan-plus { background: var(--c-primary-container); color: var(--c-on-primary-container); }
.price { display: flex; align-items: baseline; gap: var(--s-2); }
.amount { font-size: 3.4rem; font-weight: 800; font-stretch: 125%; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.per { font-weight: 600; }
.plan-note { margin-top: calc(var(--s-2) * -1); font-size: 0.95rem; min-height: 1.5em; }
.ticks { display: grid; gap: var(--s-2); margin: var(--s-2) 0 var(--s-3); }
.ticks li { display: flex; gap: var(--s-3); align-items: baseline; }
.ticks li::before { content: ''; flex: none; width: 10px; height: 10px; border-radius: 30%; background: currentColor; transform: translateY(-1px) rotate(45deg); opacity: 0.8; }
.plan .btn { justify-self: start; }

/* ---------- Download ---------- */
.download {
  position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-7); align-items: start;
  margin-top: var(--s-6); padding: var(--s-8) clamp(24px, 5vw, 72px) !important; border-radius: var(--r-xxl);
  background: var(--c-primary-container); color: var(--c-on-primary-container); max-width: calc(var(--maxw) - 2 * var(--gutter)) !important;
}
.dl-shape { position: absolute; width: 520px; height: 520px; left: 34%; bottom: -300px; background: var(--c-primary); clip-path: var(--cookie9); opacity: 0.14; animation: spin 60s linear infinite; }
.dl-copy, .dl-form { position: relative; }
.specs { margin-top: var(--s-6); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4) var(--s-5); }
.specs dt { font-size: 0.85rem; font-weight: 600; }
.specs dd { font-size: 1.15rem; font-weight: 700; font-stretch: 108%; font-variant-numeric: tabular-nums; }
.dl-form { display: grid; gap: var(--s-3); background: var(--c-surface); color: var(--c-on-surface); border-radius: var(--r-xl); padding: var(--s-6); }
.dl-form > p { color: var(--c-on-surface-variant); font-size: 0.98rem; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 650; font-size: 0.95rem; }
.dl-send { justify-self: start; position: relative; }
.loader { display: none; width: 22px; height: 22px; background: currentColor; clip-path: var(--cookie9); }
.dl-form.is-loading .loader { display: block; animation: spin 1.1s linear infinite; }
.dl-form.is-loading .dl-send { pointer-events: none; }
.dl-status { min-height: 1.5em; font-weight: 600; }
.dl-status.ok { color: var(--c-on-surface); }
.dl-status.err { color: var(--c-error); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Questions ---------- */
.faq { padding-top: var(--s-9); padding-bottom: var(--s-8); display: grid; grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr); gap: var(--s-7); align-items: start; }
.faq-list { display: grid; gap: var(--s-2); }
.faq details { border-radius: var(--r-lg); background: var(--c-sc-low); transition: border-radius 420ms var(--spring), background-color 200ms var(--ease); }
.faq details[open] { background: var(--c-sc-high); border-radius: var(--r-xl); }
.faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: var(--s-4); padding: var(--s-4) var(--s-5); min-height: 60px; font-weight: 650; font-size: 1.08rem; border-radius: inherit; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .ico { transition: transform 420ms var(--spring); }
.faq details[open] summary .ico { transform: rotate(180deg); }
.faq details p { padding: 0 var(--s-5) var(--s-5); color: var(--c-on-surface-variant); max-width: 64ch; }

/* ---------- Footer ---------- */
.footer { background: var(--c-sc); margin-top: var(--s-7); border-radius: var(--r-xxl) var(--r-xxl) 0 0; }
.foot-in { max-width: var(--maxw); margin: 0 auto; padding: var(--s-7) var(--gutter) var(--s-5); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--s-7); }
.foot-brand p { margin-top: var(--s-3); color: var(--c-on-surface-variant); max-width: 40ch; }
.foot-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-5); }
.foot-cols div { display: grid; gap: var(--s-1); align-content: start; }
.foot-cols h3 { margin-bottom: var(--s-2); color: var(--c-on-surface); }
.foot-cols a { color: var(--c-on-surface-variant); text-decoration: none; padding: 6px 0; }
.foot-cols a:hover { color: var(--c-primary); text-decoration: underline; }
.foot-small { max-width: var(--maxw); margin: 0 auto; padding: var(--s-4) var(--gutter) var(--s-6); color: var(--c-on-surface-variant); font-size: 0.875rem; }

/* =====================================================================
   The app (.app), built by createApp() in script.js
   ===================================================================== */
.app {
  position: absolute; inset: 0; display: grid; overflow: hidden;
  grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: 'main' 'bar';
  background: var(--c-surface); color: var(--c-on-surface); font-size: 14px; line-height: 1.45;
}
.app .ico { width: 22px; height: 22px; }
.app-main { grid-area: main; display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; }

/* Rail (medium and expanded) */
.rail { grid-area: rail; display: none; flex-direction: column; gap: 4px; padding: 12px 10px; overflow-y: auto; background: var(--c-surface); }
.rail-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 0 6px; border: 0; background: none; color: var(--c-on-surface-variant);
  font-size: 12px; font-weight: 650; border-radius: var(--r-md);
}
.rail-pill { display: grid; place-items: center; width: 56px; height: 32px; border-radius: var(--r-full); transition: background-color 200ms var(--ease), width 420ms var(--spring); }
.rail-item:hover .rail-pill { background: var(--state-hover); }
.rail-item[aria-current='true'] { color: var(--c-on-surface); }
.rail-item[aria-current='true'] .rail-pill { background: var(--c-secondary-container); color: var(--c-on-secondary-container); }
.rail-sep { height: 1px; background: var(--c-outline-variant); margin: 8px 6px; }
.rail-title { display: none; padding: 6px 16px 4px; font-size: 12px; font-weight: 700; color: var(--c-on-surface-variant); }
.rail-sync { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; font-size: 11px; font-weight: 600; color: var(--c-on-surface-variant); text-align: center; }
.rail-sync .ico { width: 20px; height: 20px; }

/* Top search bar */
.app-top { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px 6px; }
.search {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 48px; padding: 0 6px 0 14px;
  border-radius: var(--r-full); background: var(--c-sc-high); color: var(--c-on-surface-variant);
}
.search:focus-within { outline: 2px solid var(--c-primary); outline-offset: 1px; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; color: var(--c-on-surface); font-size: 15px; }
.search input::placeholder { color: var(--c-on-surface-variant); }
.search input::-webkit-search-cancel-button { display: none; }
.search .icon-btn { width: 36px; height: 36px; }
.avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--c-tertiary-container); color: var(--c-on-tertiary-container); font-weight: 750; font-size: 13px; }

/* Offline banner */
.banner { flex: none; display: flex; align-items: center; gap: 10px; margin: 2px 12px 6px; padding: 10px 12px; border-radius: var(--r-md); background: var(--c-error-container); color: var(--c-on-error-container); font-size: 13px; }
.banner p { flex: 1; min-width: 0; }
.banner .btn { min-height: 36px; padding: 0 14px; font-size: 13px; background: var(--c-on-error-container); color: var(--c-error-container); }
.banner .mini-loader { display: none; width: 22px; height: 22px; background: currentColor; flex: none; }
.banner.is-trying .mini-loader { display: block; }
.banner.is-trying .btn { display: none; }

/* Label filter chips */
.chips { flex: none; display: flex; gap: 8px; padding: 2px 12px 8px; overflow-x: auto; scrollbar-width: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 12px; border-radius: var(--r-sm);
  border: 0; box-shadow: inset 0 0 0 1px var(--c-outline-variant); background: transparent; color: var(--c-on-surface-variant); font-size: 13px; font-weight: 650;
  transition: border-radius 420ms var(--spring), background-color 200ms var(--ease);
}
.chip .ico { width: 16px; height: 16px; stroke-width: 2.2; display: none; }
.chip[aria-pressed='true'] { background: var(--c-secondary-container); color: var(--c-on-secondary-container); box-shadow: none; border-radius: var(--r-full); }
.chip[aria-pressed='true'] .ico { display: block; }

/* Notes grid */
.scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 12px 96px; scrollbar-width: thin; scrollbar-color: var(--c-outline-variant) transparent; }
.group-title { font-size: 12px; font-weight: 700; letter-spacing: 0.02em; color: var(--c-on-surface-variant); margin: 10px 4px 8px; display: flex; align-items: center; gap: 6px; }
.group-title .ico { width: 16px; height: 16px; }
.notes { columns: 2 140px; column-gap: 10px; }
.card {
  display: block; width: 100%; break-inside: avoid; margin: 0 0 10px; padding: 14px 14px 12px; text-align: left;
  border: 0; border-radius: 20px; background: var(--c-sc-low); color: var(--c-on-surface); box-shadow: inset 0 0 0 1px var(--c-outline-variant);
  transition: border-radius 420ms var(--spring), transform 420ms var(--spring);
}
.card[data-color]:not([data-color='none']) { box-shadow: none; }
.card:hover { border-radius: 28px; }
.card:active { transform: scale(0.98); }
.card.is-open { box-shadow: inset 0 0 0 2px var(--c-primary); }
.card-title { display: block; font-size: 15px; font-weight: 700; font-stretch: 104%; line-height: 1.3; margin-bottom: 4px; }
.card-body { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; color: var(--c-on-surface-variant); white-space: pre-line; }
.card-list { display: grid; gap: 3px; color: var(--c-on-surface-variant); }
.card-li { display: flex; gap: 7px; align-items: flex-start; }
.card-li::before { content: ''; flex: none; width: 12px; height: 12px; margin-top: 3px; border-radius: 3px; box-shadow: inset 0 0 0 1.5px currentColor; }
.card-li.done { text-decoration: line-through; }
.card-li.done::before { background: currentColor; }
.card-more { color: var(--c-on-surface-variant); font-size: 12px; font-weight: 600; }
.card-labels { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.card-label { padding: 2px 8px; border-radius: var(--r-full); background: color-mix(in srgb, var(--c-on-surface) 9%, transparent); font-size: 11.5px; font-weight: 650; color: var(--c-on-surface); }
[data-color='clay'] { background-color: var(--c-note-clay); }
[data-color='sand'] { background-color: var(--c-note-sand); }
[data-color='moss'] { background-color: var(--c-note-moss); }
[data-color='sea'] { background-color: var(--c-note-sea); }
[data-color='lilac'] { background-color: var(--c-note-lilac); }
[data-color='rose'] { background-color: var(--c-note-rose); }

.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 48px 16px; color: var(--c-on-surface-variant); }
.empty-art { position: relative; width: 120px; height: 120px; }
.empty-art i { position: absolute; display: block; }
.empty-art i:nth-child(1) { inset: 0 24px 24px 0; background: var(--c-primary-container); clip-path: var(--cookie9); }
.empty-art i:nth-child(2) { width: 56px; height: 56px; right: 0; bottom: 0; background: var(--c-tertiary-container); clip-path: var(--clover); }
.empty-art i:nth-child(3) { width: 28px; height: 28px; left: 34px; top: 30px; border-radius: 50%; background: var(--c-primary); }
.empty b { color: var(--c-on-surface); font-size: 16px; font-weight: 700; }

/* FAB: squircle at rest, morphs on hover and press (script.js drives the clip-path) */
.fab {
  position: absolute; right: 16px; bottom: 16px; z-index: 4; width: 60px; height: 60px; border: 0; display: grid; place-items: center;
  background: var(--c-primary-container); color: var(--c-on-primary-container); border-radius: 18px;
  filter: drop-shadow(0 4px 6px rgb(0 0 0 / 0.22));
}
.fab .ico { width: 26px; height: 26px; transition: transform 500ms var(--spring); }
.fab:hover .ico, .fab:focus-visible .ico { transform: rotate(-12deg) scale(1.08); }
.fab:focus-visible { outline: none; }
.fab:focus-visible::after { content: ''; position: absolute; inset: 6px; border-radius: 12px; box-shadow: 0 0 0 2px var(--c-on-primary-container); }
.app.is-editing .fab { display: none; }

/* Bottom navigation (compact) */
.navbar { grid-area: bar; display: flex; justify-content: space-around; padding: 8px 0 6px; background: var(--c-sc); }
.navbar .rail-item { flex: 1; }

/* Editor */
.editor { display: none; flex-direction: column; min-height: 0; background: var(--c-sc-low); color: var(--c-on-surface); }
.app.is-editing .editor { display: flex; position: absolute; inset: 0; z-index: 6; }
.editor[data-color='clay'] { background: var(--c-note-clay); }
.editor[data-color='sand'] { background: var(--c-note-sand); }
.editor[data-color='moss'] { background: var(--c-note-moss); }
.editor[data-color='sea'] { background: var(--c-note-sea); }
.editor[data-color='lilac'] { background: var(--c-note-lilac); }
.editor[data-color='rose'] { background: var(--c-note-rose); }
.ed-bar { flex: none; display: flex; align-items: center; gap: 2px; padding: 6px 6px 0; }
.ed-bar .spacer { flex: 1; }
.ed-bar .icon-btn { color: var(--c-on-surface); }
.ed-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 18px 12px; display: grid; gap: 8px; align-content: start; overscroll-behavior: contain; }
.ed-title { width: 100%; border: 0; background: none; outline: none; padding: 4px 0; font-size: 24px; font-weight: 720; font-stretch: 112%; letter-spacing: -0.01em; color: var(--c-on-surface); }
.ed-text { width: 100%; min-height: 72px; border: 0; background: none; outline: none; resize: none; padding: 0; font-size: 15px; line-height: 1.5; color: var(--c-on-surface); field-sizing: content; }
.ed-title::placeholder, .ed-text::placeholder, .ed-li input::placeholder { color: var(--c-on-surface-variant); }
.ed-title:focus-visible, .ed-text:focus-visible { outline: none; }
.ed-list { display: grid; gap: 0; }
.ed-li { display: flex; align-items: center; gap: 8px; min-height: 40px; border-radius: var(--r-sm); }
.ed-li input[type='checkbox'] { width: 20px; height: 20px; margin: 0 2px; flex: none; }
.ed-li input[type='text'] { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 15px; padding: 8px 0; color: var(--c-on-surface); }
.ed-li.done input[type='text'] { text-decoration: line-through; color: var(--c-on-surface-variant); }
.ed-li .icon-btn { width: 36px; height: 36px; color: var(--c-on-surface-variant); }
.ed-li .icon-btn .ico { width: 18px; height: 18px; }
.ed-li:focus-within { background: color-mix(in srgb, var(--c-on-surface) 6%, transparent); }
.ed-done-title { font-size: 12px; font-weight: 700; color: var(--c-on-surface-variant); padding: 8px 2px 2px; }
.ed-add { justify-self: start; min-height: 40px; padding: 0 12px 0 6px; gap: 6px; color: var(--c-on-surface-variant); font-size: 14px; }
.ed-add .ico { width: 20px; height: 20px; }
.ed-section { display: grid; gap: 8px; padding-top: 8px; border-top: 1px solid color-mix(in srgb, var(--c-on-surface) 14%, transparent); }
.ed-section legend, .ed-legend { font-size: 12px; font-weight: 700; color: var(--c-on-surface-variant); padding: 0; margin-bottom: 6px; }
.ed-section fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.ed-labels { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-labels .chip { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c-on-surface) 30%, transparent); color: var(--c-on-surface); }
.ed-labels .chip[aria-pressed='true'] { box-shadow: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 36px; height: 36px; border: 0; padding: 0; border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c-on-surface) 35%, transparent); display: grid; place-items: center; color: var(--c-on-surface);
}
.swatch[data-color='none'] { background: var(--c-surface); }
.swatch .ico { width: 18px; height: 18px; stroke-width: 2.4; opacity: 0; }
.swatch[aria-checked='true'] .ico { opacity: 1; }
.swatch[aria-checked='true'] { box-shadow: inset 0 0 0 2.5px var(--c-on-surface); }
.ed-foot { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px 10px 18px; font-size: 12px; color: var(--c-on-surface-variant); font-variant-numeric: tabular-nums; }
.ed-foot .grow { flex: 1; }
.ed-foot .btn { min-height: 40px; padding: 0 18px; font-size: 14px; }
.ed-err { color: var(--c-error); font-weight: 650; font-size: 13px; }
.ed-err:empty { display: none; }
.editor:not(.is-new) .ed-new-only { display: none; }
.editor.is-new .ed-old-only { display: none; }

/* Snackbar */
.snack {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 8; display: flex; align-items: center; gap: 8px; max-width: 420px; margin: 0 auto;
  min-height: 48px; padding: 6px 6px 6px 16px; border-radius: var(--r-sm); background: var(--c-inverse-surface); color: var(--c-inverse-on-surface);
  font-size: 14px; box-shadow: 0 6px 14px -4px rgb(0 0 0 / 0.35);
}
.snack[hidden] { display: none; }
.snack p { flex: 1; }
.snack .btn-text { color: var(--c-inverse-primary); min-height: 40px; }
.app.has-bar .snack { bottom: 12px; }

/* Medium window: rail and two or three columns; the editor still covers the notes */
@container app (min-width: 600px) {
  .app { grid-template-columns: 84px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: 'rail main'; }
  .rail { display: flex; }
  .navbar { display: none; }
  .chips { display: none; }
  .app-top { padding: 12px 16px 8px 4px; }
  .scroll { padding: 4px 16px 96px 4px; }
  .notes { columns: 3 150px; }
  .fab { right: 20px; bottom: 20px; }
}

/* Expanded window: the rail grows into a drawer with labels, and the editor opens beside the notes */
@container app (min-width: 840px) {
  .app { grid-template-columns: 196px minmax(0, 1fr) auto; grid-template-areas: 'rail main ed'; }
  .rail { padding: 12px; gap: 2px; }
  .rail-item { flex-direction: row; gap: 12px; padding: 0; font-size: 14px; }
  .rail-pill { width: 100%; height: 44px; justify-content: start; grid-auto-flow: column; gap: 12px; padding: 0 14px; }
  .rail-item .rail-text { display: none; }
  .rail-pill .rail-inline { display: inline; }
  .rail-title { display: block; }
  .rail-sync { flex-direction: row; justify-content: center; gap: 6px; font-size: 12px; }
  .notes { columns: 3 170px; }
  .app.is-editing .editor { position: relative; inset: auto; grid-area: ed; width: 360px; margin: 8px 8px 8px 0; border-radius: var(--r-lg); }
  .app.is-editing .fab { display: grid; right: 20px; }
  .app.is-editing .notes { columns: 2 150px; }
}
.rail-inline { display: none; }

/* No-JS clip-path fallbacks for the shape tokens (script.js replaces them with exact polygons) */
:root { --cookie9: circle(50%); --cookie12: circle(50%); --clover: circle(50%); }

/* ---------- Responsive page ---------- */
@media (max-width: 1180px) {
  .topnav a { padding: 10px 10px; }
  .hero { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .hero h1 { max-width: 14ch; }
  .devices { flex-direction: column; gap: var(--s-6); padding: var(--s-6) var(--s-5); }
  .tablet { flex: none; width: 100%; max-width: 900px; height: 600px; }
  .phone { flex: none; width: 344px; height: 700px; }
  .feat-lists, .feat-labels, .feat-search, .feat-sizes { grid-column: span 12; }
  .feat-lists { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 980px) {
  .topnav { display: none; position: absolute; top: 100%; left: var(--gutter); right: var(--gutter); flex-direction: column; padding: var(--s-2); border-radius: var(--r-xl); background: var(--c-sc-high); box-shadow: 0 16px 30px -18px rgb(0 0 0 / 0.5); }
  .topnav.is-open { display: flex; }
  .topnav a { padding: 14px var(--s-4); }
  .menu-btn { display: inline-grid; }
  .topbar-in { position: relative; }
  .topbar-actions { margin-left: auto; }
  .sec-head, .privacy, .faq, .download, .foot-in { grid-template-columns: minmax(0, 1fr); }
  .privacy .priv-art { max-width: 520px; }
  .home-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: 'pinned pinned' 'clock check' 'quick check'; }
  .w-clock { width: min(100%, 240px); justify-self: center; }
}
@media (max-width: 760px) {
  .tablet { display: none; }
  .stage-narrow { display: block; }
  .devices { padding: var(--s-5) 0; }
  .phone { flex: none; width: min(340px, calc(100% - 32px)); height: 690px; }
  .picker-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .feat-lists { grid-template-columns: minmax(0, 1fr); }
  .feat { padding: var(--s-5); }
  .feat-labels, .feat-sizes { border-radius: var(--r-xxl); }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .step { padding: var(--s-5); padding-top: calc(var(--s-5) + 52px); }
  .pal { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .pal-tones span { height: 38px; font-size: 0.62rem; }
  .home { padding: var(--s-5); }
  .home-grid { grid-template-areas: 'pinned pinned' 'clock quick' 'check check'; gap: var(--s-4); }
  .w-clock { width: 100%; }
  .w-quick { grid-template-columns: 1fr; gap: var(--s-3); }
  .quick { aspect-ratio: auto; min-height: 72px; grid-auto-flow: column; gap: 10px; border-radius: var(--r-xl); }
  .quick .ico { width: 24px; height: 24px; }
  .w-time { font-size: 2.6rem; }
  .facts, .plans, .specs { grid-template-columns: minmax(0, 1fr); }
  .foot-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sizes div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .btn-get { display: none; }
  .seg button { padding: 0 var(--s-4); font-size: 0.88rem; }
}
@media (max-width: 420px) {
  .hero-cta .btn { width: 100%; }
  .roles th:nth-child(2), .roles td:nth-child(2), .roles th:nth-child(3), .roles td:nth-child(3) { display: none; }
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  :root { --theme-dur: 250ms; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  :root, .stage-ground svg, .home-ground svg { transition-duration: 250ms !important; }
}
