/* Chromatic Clash · OSO
   Layout: two-pane studio. A sticky palette library on the left; on the right, a live board that
   repaints every surface with the selected palette. The interface itself stays neutral so the
   palette is the only color on the page and reads true. */

@font-face { font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url(assets/fonts/schibsted-grotesk-latin-ext-wght-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url(assets/fonts/schibsted-grotesk-latin-wght-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(assets/fonts/dm-mono-400-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(assets/fonts/dm-mono-400-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 500; font-display: swap;
  src: url(assets/fonts/dm-mono-500-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 500; font-display: swap;
  src: url(assets/fonts/dm-mono-500-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* Palette channels. Registered so a palette change morphs instead of snapping. */
@property --f    { syntax: '<color>'; inherits: true; initial-value: #263E40; }
@property --r    { syntax: '<color>'; inherits: true; initial-value: #D59EF3; }
@property --c    { syntax: '<color>'; inherits: true; initial-value: #F2F94A; }
@property --i    { syntax: '<color>'; inherits: true; initial-value: #F6EDDF; }
@property --on-f { syntax: '<color>'; inherits: true; initial-value: #F6EDDF; }
@property --hl-f { syntax: '<color>'; inherits: true; initial-value: #F2F94A; }
@property --on-r { syntax: '<color>'; inherits: true; initial-value: #263E40; }
@property --hl-r { syntax: '<color>'; inherits: true; initial-value: #263E40; }
@property --on-c { syntax: '<color>'; inherits: true; initial-value: #263E40; }
@property --on-i { syntax: '<color>'; inherits: true; initial-value: #263E40; }

:root {
  --paper: #ECEBE7;
  --panel: #F4F3F0;
  --card: #FFFFFF;
  --wall: #E2E1DB;
  --plank: #D3D1CA;
  --plank-edge: #BFBDB5;
  --device: #2A2A28;
  --device-sh: #181817;
  --metal: #C9C8C2;
  --edge: rgba(0, 0, 0, .16);
  --text: #131312;
  --muted: #5E5D58;
  --line: rgba(19, 19, 18, .12);
  --line-2: rgba(19, 19, 18, .26);
  --hover: rgba(19, 19, 18, .055);
  --invert-bg: #131312;
  --invert-fg: #F4F3F0;

  --font-ui: 'Schibsted Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'DM Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --topbar-h: 56px;
  --lib-w: 336px;
  --radius: 3px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #151514; --panel: #1B1B1A; --card: #242422; --wall: #222220; --plank: #2E2E2B; --plank-edge: #3C3C39;
    --device: #BDBCB6; --device-sh: #9C9B95; --metal: #9A9993; --edge: rgba(0, 0, 0, .3);
    --text: #EDECE8; --muted: #A3A29C; --line: rgba(237, 236, 232, .11); --line-2: rgba(237, 236, 232, .24);
    --hover: rgba(237, 236, 232, .06); --invert-bg: #EDECE8; --invert-fg: #151514;
        color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #151514; --panel: #1B1B1A; --card: #242422; --wall: #222220; --plank: #2E2E2B; --plank-edge: #3C3C39;
    --device: #BDBCB6; --device-sh: #9C9B95; --metal: #9A9993; --edge: rgba(0, 0, 0, .3);
  --text: #EDECE8; --muted: #A3A29C; --line: rgba(237, 236, 232, .11); --line-2: rgba(237, 236, 232, .24);
  --hover: rgba(237, 236, 232, .06); --invert-bg: #EDECE8; --invert-fg: #151514;
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }
body { margin: 0; background: var(--paper); color: var(--text); font: 400 15px/1.5 var(--font-ui); -webkit-font-smoothing: antialiased;
  transition: --f .55s var(--ease), --r .55s var(--ease), --c .55s var(--ease), --i .55s var(--ease),
    --on-f .55s var(--ease), --hl-f .55s var(--ease), --on-r .55s var(--ease), --hl-r .55s var(--ease), --on-c .55s var(--ease), --on-i .55s var(--ease); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); background: var(--paper); z-index: 70; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--invert-bg); color: var(--invert-fg); padding: 10px 14px; border-radius: var(--radius); text-decoration: none; }
.skip:focus { top: calc(12px + env(safe-area-inset-top, 0px)); }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.mono, .count { font-family: var(--font-mono); }
.count { font-size: 11px; font-weight: 500; font-variant-numeric: tabular-nums; }
.link-btn { border: 0; background: none; padding: 2px 0; font-size: 12.5px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* ── Top bar ─────────────────────────────────────────── */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; color: var(--text); }
.oso-mark { width: 60px; height: 23px; display: block; overflow: visible; }
.oso-mark path { fill: currentColor; stroke: currentColor; stroke-width: .8; stroke-dasharray: 1; stroke-dashoffset: 0; }
@media (prefers-reduced-motion: no-preference) {
  .oso-mark path { animation: cc-trace 1.1s var(--ease) both, cc-fill .45s ease 1s both; }
  .oso-mark path:nth-child(2) { animation-delay: .08s, 1.06s; }
  .oso-mark path:nth-child(n+3) { animation-delay: .16s, 1.12s; }
}
@keyframes cc-trace { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes cc-fill { from { fill-opacity: 0; } to { fill-opacity: 1; } }
.brand-sep { width: 1px; height: 22px; background: var(--line-2); }
.tool-id { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.tool-title { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }
.tool-sub { font: 400 12px var(--font-mono); color: var(--muted); white-space: nowrap; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.hint { display: flex; align-items: center; gap: 4px; margin-right: 10px; font: 400 11.5px var(--font-mono); color: var(--muted); white-space: nowrap; }
.hint kbd + kbd { margin-left: -1px; }
.hint kbd:last-of-type { margin-left: 8px; }
kbd { font: 500 11px/18px var(--font-mono); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 3px; padding: 0 5px; min-width: 20px; text-align: center; color: var(--text); }
.tbtn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--radius); background: transparent; text-decoration: none; font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.tbtn:hover { background: var(--hover); }
.tbtn .icon { width: 16px; height: 16px; }
.tbtn-quiet { border-color: transparent; }

/* ── Two-pane shell ─────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--lib-w) minmax(0, 1fr); align-items: start; }

/* ── Library ───────────────────────────────────────── */
.library {
  position: sticky; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  height: calc(100dvh - var(--topbar-h) - env(safe-area-inset-top, 0px));
  display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line);
}
.lib-top { display: none; }
.lib-title { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.lib-controls { display: grid; gap: 11px; padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.lib-more { display: grid; gap: 11px; }
.search-row { display: flex; gap: 8px; }
.search-row .search { flex: 1; min-width: 0; }

.search { position: relative; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search input { width: 100%; height: 40px; padding: 0 12px 0 36px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--paper); font-size: 14px; }
.search input::placeholder, .match-in input::placeholder { color: var(--muted); opacity: .85; }
.lib-row { display: flex; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--radius); background: transparent; font-size: 13px; font-weight: 500; white-space: nowrap; }
.chip .icon { width: 15px; height: 15px; }
.chip[aria-pressed="true"] { background: var(--invert-bg); color: var(--invert-fg); border-color: var(--invert-bg); }
.chip[aria-pressed="true"] .icon { fill: currentColor; }
.select { flex: 1; min-width: 0; }
.select select { width: 100%; height: 34px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--paper); padding: 0 8px; font-size: 13px; }
.filter { display: grid; grid-template-columns: 50px minmax(0, 1fr); align-items: center; gap: 8px; }
.f-label { font: 500 10.5px var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.f-help { margin: -5px 0 0 58px; font-size: 12px; line-height: 1.35; color: var(--muted); }
.seg { display: flex; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; }
.seg button { flex: 1; height: 30px; border: 0; background: transparent; font-size: 12.5px; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button[aria-pressed="true"] { background: var(--invert-bg); color: var(--invert-fg); }
.seg .tone { width: 10px; height: 10px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 0 1px var(--line-2); }
.hues { display: flex; flex-wrap: wrap; gap: 6px 7px; }
.hue { position: relative; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: var(--hc); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); }
.hue[aria-pressed="true"]::after { content: ""; position: absolute; inset: -4px; border: 2px solid var(--text); border-radius: 50%; }
.hue:focus-visible { outline-offset: 4px; border-radius: 50%; }
.match-in { display: flex; gap: 6px; align-items: center; }
.match-in input[type="color"] { flex: none; width: 34px; height: 34px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--paper); cursor: pointer; }
.match-in input[type="text"] { flex: 1; min-width: 0; height: 34px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--paper); font: 400 13px var(--font-mono); text-transform: uppercase; }
.lib-status { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 36px; padding: 6px 16px; border-bottom: 1px solid var(--line); font: 400 11.5px var(--font-mono); color: var(--muted); }
.lib-status p { margin: 0; }
.lib-status .link-btn { font-family: var(--font-ui); color: var(--text); }
.lib-list { position: relative; list-style: none; margin: 0; padding: 0 0 32px; overflow: auto; flex: 1; overscroll-behavior: contain; }
.grp-rows { list-style: none; margin: 0; padding: 0; }
.grp { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 12px 16px 8px; background: var(--panel); border-bottom: 1px solid var(--line); font-size: 12.5px; font-weight: 700; }
.grp .count { color: var(--muted); font-weight: 400; }
.grp a { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font: 500 11px var(--font-mono); color: var(--muted); text-decoration: none; padding: 2px 0; }
.grp a:hover { color: var(--text); }
.grp a .icon { width: 13px; height: 13px; }
.row { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
.row-main { flex: 1; min-width: 0; display: grid; grid-template-columns: 54px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 9px 4px 9px 16px; border: 0; background: transparent; text-align: left; }
.row-main:hover { background: var(--hover); }
.row-main[aria-current="true"] { background: var(--invert-bg); color: var(--invert-fg); }
.row-main:focus-visible { outline-offset: -2px; }
.mini {
  grid-row: 1 / 3; width: 54px; height: 38px; border-radius: 2px;
  background:
    radial-gradient(circle at 72% 38%, var(--c) 0 8.5px, transparent 9px),
    linear-gradient(var(--i), var(--i)) 7px 8px / 15px 3px no-repeat,
    linear-gradient(var(--i), var(--i)) 7px 13px / 10px 3px no-repeat,
    linear-gradient(to top, var(--r) 0 30%, transparent 30%),
    var(--f);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
}
.row-name { font-size: 14px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font: 400 11px var(--font-mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-main[aria-current="true"] .row-sub { color: color-mix(in srgb, var(--invert-fg) 78%, var(--invert-bg)); }
.row-heart { flex: none; width: 44px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; }
.row-heart:hover { color: var(--text); }
.row-heart .icon { width: 16px; height: 16px; }
.row-heart[aria-pressed="true"] { color: var(--text); }
.row:has(.row-main[aria-current="true"]) { background: var(--invert-bg); }
.row:has(.row-main[aria-current="true"]) .row-heart { color: var(--invert-fg); }
.row-heart:focus-visible { outline-offset: -3px; }
.row:has(.row-main[aria-current="true"]) :focus-visible { outline-color: var(--invert-fg); }
.row-heart[aria-pressed="true"] .icon { fill: currentColor; }
.lib-empty { padding: 28px 16px; color: var(--muted); font-size: 14px; }
.lib-empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ── Index: the first read ─────────────────────────── */
.index { container: ix / inline-size; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 0 max(20px, env(safe-area-inset-right, 0px)) 0 max(20px, env(safe-area-inset-left, 0px)); outline: none; }

/* Collection tabs: plain words, the current one underlined. Search and Grid sit at the end. */
.fnav { position: sticky; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); z-index: 40; display: flex; align-items: center; gap: 12px; margin: 0 calc(-1 * max(20px, env(safe-area-inset-left, 0px))); padding: 0 max(20px, env(safe-area-inset-right, 0px)) 0 max(20px, env(safe-area-inset-left, 0px)); background: var(--paper); border-bottom: 1px solid var(--line); }
.ftabs { flex: 1; min-width: 0; display: flex; gap: 26px; overflow-x: auto; scrollbar-width: none; scroll-behavior: smooth; }
.ftabs::-webkit-scrollbar { display: none; }
.ftabs.fade-r { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); }
.ftabs.fade-l { -webkit-mask-image: linear-gradient(90deg, transparent, #000 48px); mask-image: linear-gradient(90deg, transparent, #000 48px); }
.ftabs.fade-l.fade-r { -webkit-mask-image: linear-gradient(90deg, transparent, #000 48px, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(90deg, transparent, #000 48px, #000 calc(100% - 48px), transparent); }
.ftab { flex: none; position: relative; height: 50px; padding: 0; border: 0; background: none; font-size: 14px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.ftab:hover { color: var(--text); }
.ftab[aria-current="true"] { color: var(--text); }
.ftab[aria-current="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--text); }
.ftab.out { opacity: .4; }
.ftab:focus-visible { outline-offset: -4px; }
.fnav-tools { flex: none; display: flex; align-items: center; gap: 6px; }
.fnav-btn { position: relative; width: 36px; height: 36px; }
.fnav-btn .icon { width: 17px; height: 17px; }
.fnav-btn[aria-pressed="true"], .fnav-btn[aria-expanded="true"] { background: var(--invert-bg); color: var(--invert-fg); border-color: var(--invert-bg); }
.fnav-btn .count { position: absolute; top: -6px; right: -6px; min-width: 17px; padding: 0 4px; border-radius: 9px; background: var(--invert-bg); color: var(--invert-fg); font: 500 10.5px/17px var(--font-mono); text-align: center; box-shadow: 0 0 0 2px var(--paper); }
.fnav-btn .count:empty { display: none; }
.fview { display: flex; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; }
.fview button { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border: 0; background: transparent; font-size: 13.5px; font-weight: 500; }
.fview button + button { border-left: 1px solid var(--line-2); }
.fview button:hover { background: var(--hover); }
.fview button[aria-pressed="true"] { background: var(--invert-bg); color: var(--invert-fg); }
.fview .icon { width: 16px; height: 16px; }
.tbtn-icon { width: 34px; padding: 0; justify-content: center; }
.top-nav { display: flex; align-items: center; gap: 18px; margin-right: 8px; font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.top-nav a { color: var(--muted); text-decoration: none; }
.top-nav a:hover { color: var(--text); }
.view-studio .top-nav { display: none; }
@media (max-width: 899px) { .top-nav { display: none; } }
.tbtn-make { background: var(--invert-bg); color: var(--invert-fg); border-color: var(--invert-bg); }
.tbtn-make .t-sm { display: none; }
.tbtn-make:hover { background: var(--invert-bg); opacity: .88; }
.view-index .studio-only, .view-make .studio-only { display: none !important; }

/* Carousel */
.car { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; padding-top: 4px; }
.car-stage { position: relative; height: clamp(420px, calc(100svh - 206px), 760px); overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.car-track { position: absolute; inset: 0; --drag: 0px; }
.slide { position: absolute; top: 0; bottom: 0; left: 50%; width: var(--sw, 80%); margin-left: calc(var(--sw, 80%) / -2); container: slide / size; overflow: hidden; border-radius: 4px; transform: translateX(calc(var(--slot) * (var(--sw, 80%) + var(--gap, 16px)) + var(--drag))); transition: transform .42s var(--ease); }
.car-track.dragging .slide, .car-track.snap .slide { transition: none; }
.slide[data-slot="0"] { cursor: grab; }
.slide-color[data-slot="0"] { cursor: pointer; }
.car-track.dragging .slide { cursor: grabbing; }
.slide.enter { animation: cc-enter .35s var(--ease) both; }
@keyframes cc-enter { from { opacity: .4; transform: translateX(calc(var(--slot) * (var(--sw) + var(--gap)))) scale(.985); } }
/* Neighbours peek as color only; their words appear once they arrive. */
.slide:not([data-slot="0"]) :is(.sl-id, .sl-name, .sl-note, .sl-chip, .sl-use-cap) { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .slide[data-slot="0"] :is(.sl-id, .sl-name, .sl-note, .sl-chip, .sl-use-cap) { animation: cc-words .4s var(--ease) both; }
}
@keyframes cc-words { from { opacity: 0; transform: translateY(6px); } }
.car-empty { position: absolute; inset: 0; display: grid; place-content: center; gap: 4px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: 4px; }
.car-empty b { color: var(--text); }
.car-bar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; }
.car-nav, .car-acts { display: flex; align-items: center; gap: 6px; }
.car-strip { display: flex; justify-content: center; gap: 5px; min-width: 0; }
.strip-chip { flex: 0 1 30px; min-width: 16px; height: 26px; padding: 0; border: 0; border-radius: 2px; background: linear-gradient(90deg, var(--f) 0 60%, var(--r) 60% 80%, var(--c) 80% 95%, var(--i) 95%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); transition: transform .2s var(--ease), opacity .2s; }
.strip-chip:hover:not(:disabled) { transform: translateY(-2px); }
.strip-chip[aria-current="true"] { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--text); }
.strip-chip.out { opacity: .2; cursor: default; }
.strip-chip:focus-visible { outline-offset: 4px; }
#car-save[aria-pressed="true"] { background: var(--invert-bg); color: var(--invert-fg); border-color: var(--invert-bg); }
#car-save[aria-pressed="true"] .icon { fill: currentColor; }
.car-acts .btn { height: 40px; }

/* Color slide: field 75%, relief 20%, ink 5%, clash disc 15% of the slide */
.sl-color { position: absolute; inset: 0; display: grid; grid-template-rows: 75fr 20fr 5fr; background: var(--f); color: var(--on-f); }
.sl-field { position: relative; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: clamp(20px, 4cqw, 52px); overflow: hidden; }
.sl-id { position: relative; z-index: 1; margin: 0; font: 500 12px var(--font-mono); letter-spacing: .08em; }
.sl-name { position: relative; z-index: 1; margin: auto 0 0; max-width: calc(100% - var(--disc, 30%) - 6cqw); font-size: clamp(42px, 9cqw, 120px); line-height: .9; font-weight: 800; letter-spacing: -.05em; color: var(--hl-f); text-wrap: balance; }
.sl-note { position: relative; z-index: 1; margin: 0; max-width: min(52ch, calc(100% - var(--disc, 30%) - 8cqw)); font-size: 12.5px; line-height: 1.4; }
.sl-disc { position: absolute; right: 7cqw; top: 50%; width: var(--disc, 30%); height: var(--disc, 30%); border-radius: 50%; background: var(--c); transform: translateY(-50%); }
.sl-relief { min-height: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: center; gap: 8px; padding: 0 clamp(12px, 3.4cqw, 44px); background: var(--r); color: var(--on-r); }
.sl-chip { justify-self: start; display: inline-flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 8px 6px 6px; border: 0; border-radius: 3px; background: none; color: inherit; cursor: copy; }
.sl-chip:hover { background: color-mix(in srgb, var(--on-r) 10%, transparent); }
.sl-chip:focus-visible { outline: 2px solid var(--on-r); outline-offset: 1px; }
.sl-chip i { flex: none; width: clamp(18px, 2.4cqw, 26px); aspect-ratio: 1; border-radius: 50%; box-shadow: 0 0 0 1px color-mix(in srgb, var(--on-r) 30%, transparent); }
.sl-chip b { font: 500 clamp(12.5px, 1.35cqw, 15px) var(--font-mono); white-space: nowrap; }
.sl-ink { min-height: 0; background: var(--i); }
@container slide (orientation: portrait) {
  .sl-name { max-width: 100%; margin-top: 4px; font-size: clamp(36px, 13cqw, 64px); }
  .sl-note { max-width: 100%; }
  .sl-disc { top: auto; bottom: 7cqw; transform: none; }
  .sl-relief { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 6px; padding: 4px 10px; }
  .sl-chip { gap: 8px; padding: 3px 6px 3px 4px; }
}

/* In use slide */
.sl-use { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in oklab, var(--f) 16%, var(--wall)); --pair-bg: color-mix(in oklab, var(--f) 16%, var(--wall)); }
.sl-use-cap { position: absolute; left: clamp(14px, 2.4cqw, 28px); top: clamp(12px, 2cqw, 22px); margin: 0; font: 400 11px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sl-use-cap b { margin-right: 6px; font-weight: 500; color: var(--text); }
.sl-use .pair-wrap { width: min(90%, calc((100cqh - 100px) * 1.8)); margin-top: 18px; }
@container slide (orientation: portrait) { .sl-use .pair-wrap { width: min(92%, calc((100cqh - 70px) / 1.45)); margin-top: 22px; } }

/* ── Laptop + phone ────────────────────────────────── */
.pair-wrap { container: pair / inline-size; margin-inline: auto; }
.pair { position: relative; aspect-ratio: 1.8; }
.laptop { position: absolute; left: 0; top: 0; width: 80%; }
.lid { padding: 1.4% 1.4% 1.7%; border-radius: 2.4% / 3.6%; background: var(--device); }
.screen { aspect-ratio: 16 / 10; overflow-x: hidden; overflow-y: auto; border-radius: .4% / .6%; background: var(--f); scrollbar-width: none; }
.screen::-webkit-scrollbar { display: none; }
.screen:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.base { position: relative; height: 0; margin: 0 -6%; padding-bottom: 2.3%; border-radius: 0 0 1.6% 1.6% / 0 0 70% 70%; background: var(--device); }
.base::before { content: ""; position: absolute; left: 50%; top: 0; width: 14%; height: 45%; border-radius: 0 0 6px 6px; background: var(--device-sh); transform: translateX(-50%); }
/* Padding percentages resolve against the pair, not the phone, so the bezel is sized from the
   phone's own width (--pw, in pair container units) to stay a thin, real-phone 3.5%. */
.phone { --pw: 22cqw; position: absolute; right: 0; bottom: 0; width: var(--pw); aspect-ratio: 9 / 19.5; padding: calc(var(--pw) * .035); border-radius: calc(var(--pw) * .16); background: var(--device); box-shadow: 0 0 0 max(3px, .6cqw) var(--pair-bg, var(--wall)); }
.phone-screen { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: calc(var(--pw) * .125); background: var(--f); }
/* Portrait pair (laptop above, phone in front). In the studio it follows the pair's own width;
   on a slide it follows the slide's shape, because the slide also sizes the pair from its height. */
@container pair (max-width: 559px) {
  .inuse-stage .pair { aspect-ratio: 1 / 1.45; }
  .inuse-stage .laptop { width: 100%; }
  .inuse-stage .phone { --pw: 50cqw; right: 3%; }
}
@container slide (orientation: portrait) {
  .sl-use .pair { aspect-ratio: 1 / 1.45; }
  .sl-use .laptop { width: 100%; }
  .sl-use .phone { --pw: 50cqw; right: 3%; }
}

/* Mini site, designed at 1280px and scaled with zoom */
.ms { width: 1280px; zoom: var(--z, .5); background: var(--f); color: var(--on-f); font-family: var(--font-ui); }
.ms-nav { display: flex; align-items: center; justify-content: space-between; padding: 28px 64px; font-size: 17px; font-weight: 500; }
.ms-logo { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.ms-logo i { width: 22px; height: 22px; border-radius: 50%; background: var(--c); }
.ms-nav nav { display: flex; gap: 36px; }
.ms-bag { padding: 9px 18px; border: 2px solid currentColor; border-radius: 99px; font-size: 15px; font-weight: 600; }
.ms-hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 56px; align-items: center; padding: 36px 64px 88px; }
.ms-eyebrow { font: 500 14px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.ms-h { display: block; margin: 18px 0 24px; font-size: 104px; line-height: .9; font-weight: 800; letter-spacing: -.05em; color: var(--hl-f); }
.ms-copy p { max-width: 30ch; margin: 0 0 32px; font-size: 21px; line-height: 1.45; }
.ms-ctas { display: flex; align-items: center; gap: 28px; }
.ms-btn { display: inline-flex; padding: 18px 30px; border-radius: 99px; background: var(--c); color: var(--on-c); font-size: 18px; font-weight: 700; }
.ms-link { font-size: 18px; font-weight: 600; text-decoration: underline; text-underline-offset: 5px; }
.ms-panel { position: relative; aspect-ratio: 1 / 1.02; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 30px; border-radius: 8px; background: var(--r); color: var(--on-r); }
.ms-tag { position: absolute; left: 24px; top: 22px; font: 500 15px var(--font-mono); }
.ms-obj { width: 46%; aspect-ratio: 1; border-radius: 50%; background: var(--c); }
.ms-shelf { width: 64%; height: 10px; background: var(--i); }
.ms-sec { padding: 72px 64px 80px; background: var(--r); color: var(--on-r); }
.ms-sec-h { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 32px; }
.ms-h2 { display: block; font-size: 40px; font-weight: 800; letter-spacing: -.03em; }
.ms-sec .ms-h2 { color: var(--hl-r); }
.ms-news .ms-h2 { color: var(--hl-f); }
.ms-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.ms-card { display: grid; gap: 10px; font-size: 19px; }
.ms-card b { font-weight: 700; }
.ms-card span { font: 400 15px var(--font-mono); }
.ms-img { aspect-ratio: 1; display: grid; place-items: center; border-radius: 6px; background: var(--f); }
.sh-disc { width: 46%; aspect-ratio: 1; border-radius: 50%; background: var(--c); }
.sh-block { width: 42%; aspect-ratio: 1; border-radius: 6px; background: var(--c); transform: rotate(12deg); }
.sh-bar { width: 26%; aspect-ratio: 1 / 1.6; border-radius: 40px 40px 6px 6px; background: var(--c); }
.ms-band { padding: 96px 64px; background: var(--c); color: var(--on-c); font-size: 64px; line-height: 1; font-weight: 800; letter-spacing: -.04em; }
.ms-news { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; padding: 80px 64px; }
.ms-news p { margin: 10px 0 0; font-size: 19px; }
.ms-form { display: flex; gap: 12px; }
.ms-input { flex: 1; padding: 18px 22px; border: 2px solid var(--on-f); border-radius: 99px; font-size: 17px; }
.ms-foot { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; padding: 48px 64px 60px; background: var(--i); color: var(--on-i); font-size: 16px; }
.ms-foot b { display: block; margin-bottom: 12px; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
.ms-foot span { display: block; margin-bottom: 8px; }
.ms-foot .ms-logo span { display: inline; margin: 0; }
.ms-foot .ms-logo i { background: var(--c); }
.ms-foot p { margin: 14px 0 0; }

/* Phone app, designed at 390px and scaled with zoom */
.pa { width: 390px; height: calc(var(--ph, 844) * 1px); zoom: var(--pz, .5); display: flex; flex-direction: column; background: var(--f); color: var(--on-f); font-family: var(--font-ui); }
.pa-status { display: flex; align-items: center; justify-content: space-between; padding: 18px 30px 8px; font-size: 16px; font-weight: 600; }
.pa-island { width: 110px; height: 32px; border-radius: 20px; background: #0E0E0D; }
.pa-sig { display: flex; gap: 4px; }
.pa-sig i { width: 6px; height: 12px; border-radius: 2px; background: currentColor; }
.pa-body { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.pa-screen { position: absolute; inset: 0; display: none; flex-direction: column; gap: 16px; padding: 10px 22px 20px; }
.pa[data-screen="shop"] .pa-shop, .pa[data-screen="item"] .pa-item, .pa[data-screen="bag"] .pa-bag { display: flex; }
.pa-head { display: flex; align-items: center; justify-content: space-between; }
.pa-logo { display: flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.pa-logo i { width: 20px; height: 20px; border-radius: 50%; background: var(--c); }
.pa-bagicon { width: 24px; height: 26px; border: 3px solid currentColor; border-radius: 4px 4px 8px 8px; }
.pa-back { font-size: 17px; font-weight: 600; }
.pa-hero { display: grid; gap: 6px; padding: 22px; border-radius: 16px; background: var(--c); color: var(--on-c); }
.pa-hero small { font: 500 12px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.pa-hero b { font-size: 32px; line-height: 1; letter-spacing: -.03em; }
.pa-hero span { font-size: 15px; }
.pa-h { font-size: 21px; font-weight: 800; letter-spacing: -.02em; color: var(--hl-f); }
.pa-row { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 14px; background: var(--r); color: var(--on-r); }
.pa-row b { display: block; font-size: 17px; }
.pa-row small { font: 400 14px var(--font-mono); }
.pa-th { flex: none; width: 58px; height: 58px; display: grid; place-items: center; border-radius: 10px; background: var(--f); }
.pa-th .sh-disc, .pa-th .sh-block { width: 56%; }
.pa-th .sh-bar { width: 34%; }
.pa-img { position: relative; aspect-ratio: 1; display: grid; place-items: center; border-radius: 18px; background: var(--r); }
.pa-img .sh-disc { width: 52%; }
.pa-img span { position: absolute; left: 22%; right: 22%; bottom: 14%; height: 6px; background: var(--i); }
.pa-title { font-size: 28px; font-weight: 800; letter-spacing: -.03em; color: var(--hl-f); }
.pa-price { margin-top: -10px; font: 500 17px var(--font-mono); }
.pa-label { font: 500 12px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.pa-swatches { display: flex; gap: 10px; margin-top: -8px; }
.pa-swatches i { width: 34px; height: 34px; border-radius: 50%; box-shadow: 0 0 0 2px var(--on-f); }
.sw-f { background: var(--f); } .sw-r { background: var(--r); } .sw-c { background: var(--c); } .sw-i { background: var(--i); }
.pa-cta { display: block; margin-top: auto; padding: 18px; border-radius: 99px; background: var(--c); color: var(--on-c); font-size: 18px; font-weight: 700; text-align: center; }
.pa-sum { display: flex; justify-content: space-between; padding-top: 14px; border-top: 2px solid var(--on-f); font-size: 18px; }
.pa-note { font-size: 14px; text-align: center; }
.pa-tabs { display: flex; justify-content: space-around; padding: 10px 0 26px; background: var(--r); }
.pa-tabs button { display: grid; justify-items: center; gap: 4px; padding: 6px 16px; border: 0; background: none; color: var(--on-r); font: 600 13px var(--font-ui); cursor: pointer; }
.pa-tabs button i { width: 24px; height: 24px; border: 3px solid currentColor; border-radius: 7px; }
.pa-tabs button[aria-pressed="true"] i { background: currentColor; }
.pa-tabs button:focus-visible { outline: 3px solid var(--on-r); outline-offset: 2px; }

/* Studio: In use */
.inuse { min-width: 0; }
.inuse-stage { padding: clamp(18px, 4cqw, 48px); border-radius: var(--radius); background: color-mix(in oklab, var(--f) 14%, var(--wall)); --pair-bg: color-mix(in oklab, var(--f) 14%, var(--wall)); }
.inuse-stage .pair-wrap { max-width: 1040px; }
.view-index .controls { display: grid; gap: 6px; }
.view-index .lib-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.view-index .search-row { flex: 1 1 220px; }
.view-index .lib-more { display: contents; }
.view-index .lib-row .select { flex: none; width: 160px; }
.view-index .match-in input[type="text"] { flex: none; width: 150px; }
.view-index .filter { grid-template-columns: auto auto; }
.view-index .f-help { display: none; }
.view-index .lib-status { min-height: 26px; padding: 0 2px; border: 0; }
.ix-group { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 14px 28px; padding: 22px 0 26px; border-top: 1px solid var(--line); }
.ix-head h3 { margin: 0 0 6px; font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.ix-head p { margin: 0 0 10px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.ix-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font: 400 11px var(--font-mono); color: var(--muted); }
.ix-meta a { display: inline-flex; align-items: center; gap: 4px; color: var(--text); text-decoration: none; }
.ix-meta a:hover { text-decoration: underline; text-underline-offset: 3px; }
.ix-meta .icon { width: 13px; height: 13px; }
.ix-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 18px 12px; }
.ix-item { position: relative; min-width: 0; }
.ix-open { display: grid; gap: 7px; width: 100%; padding: 0; border: 0; border-radius: var(--radius); background: none; text-align: left; }
.ix-open:focus-visible { outline-offset: 4px; }
.ix-thumb { display: block; width: 100%; height: auto; border-radius: 2px; box-shadow: 0 0 0 1px var(--line); transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.ix-open:hover .ix-thumb { transform: translateY(-3px); box-shadow: 0 0 0 1px var(--line), 0 8px 18px rgba(0, 0, 0, .12); }
.ix-open[aria-current="true"] .ix-thumb { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--text); }
.ix-label { display: grid; gap: 1px; min-width: 0; padding-right: 30px; }
.ix-name { font-size: 13.5px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ix-id { font: 400 10.5px var(--font-mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ix-heart { position: absolute; right: -6px; bottom: 0; width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: var(--muted); }
.ix-heart .icon { width: 15px; height: 15px; }
.ix-heart:hover, .ix-heart[aria-pressed="true"] { color: var(--text); }
.ix-heart[aria-pressed="true"] .icon { fill: currentColor; }
.ix-empty { padding: 32px 0; border-top: 1px solid var(--line); color: var(--muted); }
.ix-empty b { color: var(--text); }
.shared { container: shared / inline-size; display: grid; gap: 30px; min-width: 0; }
.view-index .shared { margin-top: 10px; }
.view-index .mbar { display: none !important; }
.view-index .hint { display: none; }
@container ix (max-width: 1080px) { .ix-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@container ix (max-width: 720px) { .ix-group { grid-template-columns: minmax(0, 1fr); gap: 12px; } .ix-head p { margin-bottom: 6px; } }
@container ix (max-width: 470px) { .ix-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; } .ix-label { padding-right: 24px; } .ix-name { font-size: 12.5px; } .ix-heart { right: -9px; } }

/* ── Stage ─────────────────────────────────────────── */
.stage {
  container: stage / inline-size;
  min-width: 0; display: grid; gap: 30px; outline: none;
  padding: 26px max(20px, env(safe-area-inset-right, 0px)) 0 28px;
}
.intro { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 24px 44px; align-items: start; }
.ph-meta { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 8px; font: 500 11.5px var(--font-mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.ph-meta span:empty { display: none; }
.ph-meta span + span::before { content: "/"; margin-right: 10px; opacity: .5; }
.pal-name { margin: 0; font-size: clamp(40px, 4.6vw, 70px); line-height: .94; font-weight: 800; letter-spacing: -.045em; text-wrap: balance; }
.pal-desc { margin: 12px 0 0; max-width: 46ch; color: var(--muted); font-size: 15px; text-wrap: pretty; }
.source { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--radius); display: grid; gap: 6px; max-width: 54ch; font-size: 13.5px; }
.source-k { display: flex; flex-wrap: wrap; font: 500 10.5px var(--font-mono); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.source-k span + span::before { content: "·"; margin: 0 7px; }
.source-model { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.source-colorway { color: var(--muted); }
.source-links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.source-links a { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; text-underline-offset: 3px; }
.source-links .icon { width: 14px; height: 14px; }
.source small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.ph-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line-2); border-radius: var(--radius); background: transparent; }
.icon-btn:hover, .act:hover { background: var(--hover); }
.act { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--radius); background: transparent; font-size: 14px; font-weight: 500; }
.act .icon { width: 16px; height: 16px; }
.act[aria-pressed="true"] { background: var(--invert-bg); color: var(--invert-fg); border-color: var(--invert-bg); }
.act[aria-pressed="true"] .icon { fill: currentColor; }
a.act { color: inherit; text-decoration: none; }

/* ── Mix ───────────────────────────────────────────── */
.mix { container: mix / inline-size; display: grid; gap: 10px; padding-top: 4px; min-width: 0; }
.mix-head { display: flex; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; }
.mix-head h3 { margin: 0; font: 500 11.5px var(--font-mono); text-transform: uppercase; letter-spacing: .08em; }
.mix-head p { margin: 0; font-size: 13px; color: var(--muted); }
.mix-head .link-btn { margin-left: auto; }
.mix-bar { position: relative; display: flex; height: 68px; user-select: none; -webkit-user-select: none; }
.seg-c { position: relative; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; padding: 8px 10px; overflow: hidden; font: 500 12px/1.25 var(--font-mono); white-space: nowrap; }
.seg-c:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.seg-c:last-of-type { border-radius: 0 var(--radius) var(--radius) 0; }
.seg-c[data-role="FIELD"] { background: var(--f); color: var(--on-f); }
.seg-c[data-role="RELIEF"] { background: var(--r); color: var(--on-r); }
.seg-c[data-role="CLASH"] { background: var(--c); color: var(--on-c); }
.seg-c[data-role="INK"] { background: var(--i); color: var(--on-i); }
.seg-c small { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.seg-c.narrow span, .seg-c.narrow small { visibility: hidden; }
.handle { position: absolute; top: -7px; bottom: -7px; z-index: 2; width: 30px; margin-left: -15px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; cursor: ew-resize; touch-action: none; }
.handle::before { content: ""; position: absolute; top: 7px; bottom: 7px; width: 3px; background: var(--paper); }
.handle::after { content: ""; position: relative; width: 12px; height: 28px; border-radius: 3px; background: var(--paper); box-shadow: 0 0 0 1px var(--line-2), 0 2px 6px rgba(0, 0, 0, .18);
  background-image: linear-gradient(var(--muted), var(--muted)), linear-gradient(var(--muted), var(--muted)); background-size: 1px 12px; background-position: 4px 50%, 7px 50%; background-repeat: no-repeat; }
.handle:focus-visible { outline: none; }
.handle:focus-visible::after { outline: 2px solid var(--text); outline-offset: 2px; }
.mix-bar.dragging, .mix-bar.dragging * { cursor: ew-resize; }
.ruler { position: relative; height: 22px; margin-top: -4px; font: 400 10px var(--font-mono); color: var(--muted);
  background:
    linear-gradient(to right, var(--line-2) 1px, transparent 1px) 0 0 / 25% 8px repeat-x,
    linear-gradient(to right, var(--line) 1px, transparent 1px) 0 0 / 5% 4px repeat-x; }
.ruler::after { content: ""; position: absolute; right: 0; top: 0; width: 1px; height: 8px; background: var(--line-2); }
.ruler span { position: absolute; top: 9px; transform: translateX(-50%); }
.ruler span:nth-child(1) { left: 0; transform: none; }
.ruler span:nth-child(2) { left: 25%; }
.ruler span:nth-child(3) { left: 50%; }
.ruler span:nth-child(4) { left: 75%; }
.ruler span:nth-child(5) { left: 100%; transform: translateX(-100%); }
.chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.chip-c { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; align-items: center; padding: 7px 10px 7px 7px; border: 1px solid var(--line); border-radius: var(--radius); background: transparent; text-align: left; min-width: 0; }
.chip-c:hover { border-color: var(--line-2); background: var(--hover); }
.chip-sw { grid-row: 1 / 4; width: 26px; align-self: stretch; min-height: 44px; border-radius: 2px; background: var(--x); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.chip-role { font: 500 10px var(--font-mono); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-role b { font-weight: 500; color: var(--text); }
.chip-hex { font: 500 13.5px var(--font-mono); white-space: nowrap; }
.chip-name { font-size: 11.5px; line-height: 1.3; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-name:empty { display: none; }
.lead { margin: 4px 0 0; padding: 0; border: 0; min-width: 0; }
.lead legend { padding: 0; margin-bottom: 7px; font: 500 11.5px var(--font-mono); text-transform: uppercase; letter-spacing: .08em; }
.lead legend span { margin-left: 8px; font: 400 13px var(--font-ui); text-transform: none; letter-spacing: 0; color: var(--muted); }
.lead-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.lead-opt { position: relative; display: block; }
.lead-opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.lead-opt span { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px 0 7px; border: 1px solid var(--line-2); border-radius: var(--radius); font-size: 13px; font-weight: 500; pointer-events: none; }
.lead-opt i { width: 18px; height: 18px; border-radius: 2px; background: var(--x); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); }
.lead-opt small { font: 400 10.5px var(--font-mono); color: var(--muted); }
.lead-opt input:hover + span { background: var(--hover); }
.lead-opt input:checked + span { background: var(--invert-bg); color: var(--invert-fg); border-color: var(--invert-bg); }
.lead-opt input:checked + span small { color: inherit; opacity: .7; }
.lead-opt input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 2px; }

/* ── Board: composition + type pairings ───────────── */
.board { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 14px; align-items: stretch; }
.tile { margin: 0; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.vis { position: relative; flex: 1; min-height: 0; overflow: hidden; border-radius: var(--radius); }
.t-comp .vis { min-height: 420px; }
.vis-comp { background: var(--f); touch-action: pan-y; }
.cap { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; padding-top: 7px; font: 400 10.5px/1.3 var(--font-mono); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.cap b { font-weight: 500; color: var(--text); margin-right: 6px; }
.cap-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border: 1px solid var(--line-2); border-radius: var(--radius); background: transparent; font: 500 10.5px var(--font-mono); text-transform: uppercase; letter-spacing: .04em; color: var(--text); }
.cap-btn:hover { background: var(--hover); }
.cap-btn .mono { color: var(--muted); }

/* SVG paint classes, shared by the composition, the shelf and the index thumbnails */
.c-f { fill: var(--f); } .c-r { fill: var(--r); } .c-c { fill: var(--c); } .c-i { fill: var(--i); }
.c-f-sh { fill: color-mix(in oklab, var(--f) 78%, #000); }
.c-f-hi { fill: color-mix(in oklab, var(--f) 80%, #fff); }
.s-r { stroke: var(--r); } .s-f { stroke: var(--f); }
.s-f-sh { stroke: color-mix(in oklab, var(--f) 78%, #000); }
.s-on-f { stroke: var(--on-f); }
svg .on-f { fill: var(--on-f); } svg .on-r { fill: var(--on-r); } svg .hl-f { fill: var(--hl-f); } svg .on-c { fill: var(--on-c); }
svg .mk { fill: none; stroke-width: 1; }
svg .mk.on-f { stroke: var(--on-f); fill: none; }
svg .mk.on-r { stroke: var(--on-r); fill: none; }
svg .on-f-dot { fill: var(--on-f); stroke: none; }
svg .dim { letter-spacing: .08em; }
.comp-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.comp-svg .lbl { font-family: var(--font-mono); font-weight: 500; letter-spacing: .05em; }
.comp-svg.fade { animation: cc-fade .35s ease both; }
@keyframes cc-fade { from { opacity: .35; } to { opacity: 1; } }

/* Type pairings */
.t-pair { container: pair / inline-size; display: grid; gap: 14px; align-content: start; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.pair-head h4 { margin: 0 0 8px; font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.pair-head p { margin: 0; max-width: 60ch; font-size: 13.5px; color: var(--muted); }
.pair-scroll { overflow-x: auto; min-width: 0; }
.pair-table { width: 100%; min-width: 0; border-collapse: separate; border-spacing: 6px; margin: -6px; table-layout: fixed; }
.pair-table th { font-weight: 500; text-align: left; font-size: 12.5px; }
.pair-table thead th { padding: 0 2px 2px; vertical-align: bottom; }
.pair-table thead th:first-child, .pair-table tbody th { width: 92px; }
.pt-corner span { display: block; font: 400 10px var(--font-mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pt-sw { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18); }
.pt-role { font-weight: 600; }
.pair-table code { display: block; margin-top: 2px; font: 400 11px var(--font-mono); color: var(--muted); }
.pt-cell { padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); }
.pt-demo { display: block; height: 50px; padding: 0 10px; font-size: 26px; font-weight: 700; letter-spacing: -.03em; line-height: 50px; }
.pt-meta { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 5px 8px; background: var(--card); font: 400 11px var(--font-mono); }
.pt-meta b { font-weight: 500; font-variant-numeric: tabular-nums; }
.pt-meta em { font-style: normal; padding: 1px 5px; border-radius: 2px; white-space: nowrap; }
.g-aaa .pt-meta em, .g-aa .pt-meta em { background: var(--invert-bg); color: var(--invert-fg); }
.g-large .pt-meta em { box-shadow: inset 0 0 0 1px var(--line-2); }
.g-fail .pt-meta em { color: var(--muted); padding-inline: 0; }
.pt-same { text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.g-short { display: none; }

/* ── Take it with you ─────────────────────────────── */
.sec-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 14px; }
.sec-head h2, .sec-head h3 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.03em; }
.sec-head p { margin: 0; max-width: 64ch; font-size: 14px; color: var(--muted); }
.use-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.code-panel { min-width: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.tabs { display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tab { flex: none; height: 42px; margin-bottom: -1px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; background: transparent; font: 500 11.5px var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--text); }
.tab:focus-visible { outline-offset: -2px; }
.code-wrap { overflow: auto; max-height: 320px; }
.code-wrap:focus-visible { outline-offset: -2px; }
.code-wrap pre { margin: 0; padding: 14px 16px; font: 400 12.5px/1.6 var(--font-mono); white-space: pre; tab-size: 2; }
.code-actions { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border: 1px solid var(--invert-bg); border-radius: var(--radius); background: var(--invert-bg); color: var(--invert-fg); font-size: 14px; font-weight: 600; }
.btn .icon { width: 16px; height: 16px; }
.dl-panel { display: grid; gap: 8px; align-content: start; min-width: 0; }
.dl { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line-2); border-radius: var(--radius); background: transparent; text-decoration: none; }
.dl:hover { background: var(--hover); }
.dl-main { display: grid; gap: 2px; min-width: 0; }
.dl-main b { font-size: 14.5px; font-weight: 600; }
.dl-main span { font: 400 11.5px var(--font-mono); color: var(--muted); }
.dl-size { font: 400 11.5px var(--font-mono); color: var(--muted); white-space: nowrap; }
.dl:first-child { background: var(--invert-bg); color: var(--invert-fg); border-color: var(--invert-bg); }
.dl:first-child .dl-main span, .dl:first-child .dl-size { color: inherit; opacity: .72; }
.dl:first-child:hover { opacity: .92; }
.dl-note { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }

/* ── Method ────────────────────────────────────────── */
.method, .files { padding-top: 30px; border-top: 1px solid var(--line); }
.roles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.roles li { display: grid; gap: 8px; align-content: start; }
.role-sw { height: 56px; border-radius: var(--radius); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.role-k { font: 500 11.5px var(--font-mono); text-transform: uppercase; letter-spacing: .07em; }
.role-k em { margin-left: 6px; font-style: normal; color: var(--muted); }
.roles p { margin: 0; font-size: 14px; color: var(--muted); }
.roles p b { font-weight: 600; color: var(--text); }
.notes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 28px; margin-top: 24px; }
.notes p { margin: 0; max-width: 62ch; font-size: 13.5px; color: var(--muted); }
.notes b { color: var(--text); font-weight: 600; }

/* ── Files ─────────────────────────────────────────── */
.files-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.files-grid .file { grid-column: span 2; }
.files-grid .file.big { grid-column: span 3; }
.file { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--radius); text-decoration: none; }
.file:hover { background: var(--hover); }
.file-strip { width: 46px; height: 40px; display: flex; border-radius: 2px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.file-strip i { flex: 1; background: linear-gradient(var(--c) 0 34%, var(--f) 34%); }
.file-main { display: grid; gap: 2px; min-width: 0; }
.file-main b { font-size: 14px; font-weight: 600; }
.file-main span { font: 400 11px var(--font-mono); color: var(--muted); }
.file .icon { color: var(--muted); }
.file.big { padding: 16px; }
.file.big .file-main b { font-size: 16px; }
.file.big .file-strip { width: 72px; height: 48px; }

/* ── Footer ───────────────────────────────────────── */
.foot { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; padding: 24px 0 calc(32px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.foot p { margin: 0; }
.foot-mark { display: flex; color: var(--text); }
.foot-mark svg { width: 54px; height: 21px; fill: currentColor; }
.foot-links { display: flex; gap: 16px; margin-left: auto; }
.foot-links a { color: var(--text); text-decoration: none; }
.foot-links a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── Create from image ────────────────────────────── */
.make { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; max-width: 1480px; margin: 0 auto; padding: 30px max(20px, env(safe-area-inset-right, 0px)) 36px max(20px, env(safe-area-inset-left, 0px)); outline: none; }
.make-head h2 { margin: 0; font-size: clamp(30px, 4vw, 46px); line-height: 1; font-weight: 800; letter-spacing: -.045em; }
.make-head p { margin: 10px 0 0; max-width: 64ch; color: var(--muted); }
.make-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.make.is-empty .make-grid { grid-template-columns: minmax(0, 1fr); }
.mk-src { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; }
.mk-drop { display: grid; justify-items: center; align-content: center; gap: 14px; min-height: 340px; padding: 32px 24px; border: 1.5px dashed var(--line-2); border-radius: 6px; background: var(--panel); text-align: center; cursor: pointer; transition: border-color .2s; }
.make.is-empty .mk-drop { min-height: min(58vh, 540px); }
.mk-drop:hover { border-color: var(--text); }
.mk-drop-icon { width: 42px; height: 42px; stroke-width: 1.3; color: var(--muted); }
.mk-drop-t { margin: 0; display: grid; gap: 2px; }
.mk-drop-t b { font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
.mk-drop-t span { color: var(--muted); }
.mk-drop-s { max-width: 42ch; margin: 0; font-size: 12.5px; color: var(--muted); }
.mk-stage { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 18px; border-radius: 6px; background: var(--wall); }
.mk-frame { position: relative; display: inline-block; max-width: 100%; line-height: 0; cursor: crosshair; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.mk-frame img { display: block; max-width: 100%; max-height: min(64vh, 660px); width: auto; height: auto; border-radius: 2px; -webkit-user-drag: none; }
.mk-markers { position: absolute; inset: 0; pointer-events: none; }
.mk-marker { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; padding: 0; border: 0; border-radius: 50%; background: var(--x); box-shadow: 0 0 0 3px #FFF, 0 0 0 4px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .35); font: 700 12px/30px var(--font-ui); text-align: center; pointer-events: auto; touch-action: none; cursor: grab; transition: transform .15s var(--ease); }
.mk-marker.on { z-index: 2; transform: scale(1.25); box-shadow: 0 0 0 3px #FFF, 0 0 0 5px #111, 0 2px 10px rgba(0, 0, 0, .4); }
.mk-marker:focus-visible { outline: none; box-shadow: 0 0 0 3px #FFF, 0 0 0 5px #111, 0 0 0 8px #FFF; }
.mk-frame.dragging, .mk-frame.dragging .mk-marker { cursor: grabbing; }
.mk-frame.dragging .mk-marker { transition: none; }
.mk-tools { display: grid; gap: 12px; }
.mk-tip { margin: 0; font-size: 13.5px; color: var(--muted); }
.mk-cands { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.mk-k { font: 500 11px var(--font-mono); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.mk-cand-list { display: flex; flex-wrap: wrap; gap: 6px; }
.mk-cand { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: var(--x); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .16); transition: transform .15s var(--ease); }
.mk-cand:hover { transform: scale(1.12); }
.mk-src-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.mk-busy { margin: 0; font: 500 12.5px var(--font-mono); color: var(--muted); }
.mk-error, .mk-warn { margin: 0; padding: 10px 12px; border-left: 3px solid var(--text); background: var(--panel); font-size: 13.5px; }
.mk-out { position: sticky; top: calc(var(--topbar-h) + 16px); display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; }
.mk-out-head { display: flex; align-items: center; gap: 10px; }
.mk-name { flex: 1; min-width: 0; height: 46px; margin-left: -10px; padding: 0 10px; border: 1px solid transparent; border-radius: var(--radius); background: transparent; font-size: 27px; font-weight: 800; letter-spacing: -.035em; }
.mk-name:hover { border-color: var(--line-2); }
.mk-name:focus { border-color: var(--text); outline: none; }
.mk-note { margin: -6px 0 0; font-size: 13px; color: var(--muted); }
.mk-preview { position: relative; aspect-ratio: 16 / 10; container: slide / size; overflow: hidden; border-radius: 4px; }
.mk-roles { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.mk-role { display: grid; grid-template-columns: auto 104px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.mk-pick { display: flex; align-items: center; gap: 10px; min-width: 124px; padding: 4px 10px 4px 4px; border: 1px solid transparent; border-radius: var(--radius); background: none; text-align: left; }
.mk-pick:not(:disabled):hover { background: var(--hover); }
.mk-pick[aria-pressed="true"] { border-color: var(--text); }
.mk-pick:disabled { cursor: default; color: inherit; }
.mk-sw { flex: none; width: 30px; height: 30px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); }
.mk-rk { display: grid; line-height: 1.2; }
.mk-rk b { font-size: 14.5px; }
.mk-rk small { font: 400 11.5px var(--font-mono); color: var(--muted); }
.mk-hex { width: 100%; height: 34px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--card); font: 500 13.5px var(--font-mono); text-transform: uppercase; }
.mk-hex:focus { border-color: var(--text); outline: none; }
.mk-hex.bad { border-color: #C42A1E; }
.mk-pair { font-size: 12.5px; color: var(--muted); }
.mk-g { display: inline-block; min-width: 40px; margin-right: 4px; padding: 0 5px; border: 1px solid var(--line-2); border-radius: 2px; font: 500 10.5px/17px var(--font-mono); text-align: center; color: var(--text); }
.mk-g-aaa, .mk-g-aa { border-color: var(--invert-bg); background: var(--invert-bg); color: var(--invert-fg); }
.mk-cp { width: 34px; height: 34px; }
.mk-cp .icon { width: 16px; height: 16px; }
.mk-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.mk-acts .btn { height: 40px; }
.mk-code .code-wrap { max-height: 280px; }
.view-make .mbar { display: none !important; }
.view-make .shared { margin-top: 26px; }
.dropzone { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 24px; background: color-mix(in srgb, var(--paper) 82%, transparent); pointer-events: none; }
.dropzone > div { display: grid; justify-items: center; gap: 10px; padding: 40px 56px; border: 2px dashed var(--text); border-radius: 8px; background: var(--paper); font-size: 18px; }
.dropzone .icon { width: 38px; height: 38px; }
@media (max-width: 999px) {
  .make-grid { grid-template-columns: minmax(0, 1fr); }
  .mk-out { position: static; }
}
@media (max-width: 560px) {
  .make { padding-top: 22px; gap: 18px; }
  .mk-stage { padding: 10px; }
  .mk-frame img { max-height: 58vh; }
  .mk-role { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "pick hex cp" "pair pair pair"; gap: 4px 10px; }
  .mk-pick { grid-area: pick; min-width: 0; }
  .mk-hex { grid-area: hex; }
  .mk-cp { grid-area: cp; }
  .mk-pair { grid-area: pair; padding-left: 4px; }
  .mk-name { font-size: 23px; }
  .mk-preview { aspect-ratio: 4 / 5; }
  .mk-drop { min-height: 300px; }
}

/* ── Toast and mobile bar ─────────────────────────── */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 90; max-width: calc(100vw - 32px); transform: translate(-50%, 16px); padding: 10px 16px; border-radius: var(--radius); background: var(--invert-bg); color: var(--invert-fg); font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.mbar { display: none; }

/* ── Responsive: each region sizes from its own width ─ */
@container stage (max-width: 860px) {
  .intro { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}
@container stage (max-width: 900px) {
  .board { grid-template-columns: minmax(0, 1fr); }
  .t-comp .vis { flex: none; aspect-ratio: 1 / 1; min-height: 0; }
}
@container stage (max-width: 760px) {
  .use-grid { grid-template-columns: minmax(0, 1fr); }
}
@container mix (max-width: 580px) {
  .chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container stage (max-width: 560px) {
  .board { gap: 10px; }
  .cap { font-size: 10px; }
  .cap > span b { display: block; }
  .lead-opt small { display: none; }
  .lead-opts { gap: 5px; }
  .lead-opt span { padding: 0 9px 0 6px; }
}
@container pair (max-width: 620px) {
  .pair-table { border-spacing: 4px; margin: -4px; }
  .pair-table thead th:first-child, .pair-table tbody th { width: 58px; }
  .pair-table thead th { font-size: 11.5px; }
  .pair-table code, .pt-corner span + span { display: none; }
  .pt-sw { display: block; margin: 0 0 3px; }
  .pt-demo { font-size: 19px; height: 40px; line-height: 40px; padding: 0 6px; }
  .pt-meta { flex-direction: column; align-items: flex-start; gap: 2px; padding: 4px 6px; font-size: 10.5px; }
  .pt-meta em .g-long { display: none; }
  .pt-meta em .g-short { display: inline; }
}
@container pair (max-width: 400px) { .t-pair { padding: 14px 12px; } }
@container shared (max-width: 800px) {
  .roles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notes { grid-template-columns: minmax(0, 1fr); }
  .files-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .files-grid .file { grid-column: span 1; }
  .files-grid .file.big { grid-column: span 2; }
}
@container shared (max-width: 540px) {
  .files-grid { grid-template-columns: minmax(0, 1fr); }
  .files-grid .file, .files-grid .file.big { grid-column: auto; }
}

@media (max-width: 1199px) { :root { --lib-w: 300px; } .hint { display: none; } }
@media (max-width: 999px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .library {
    position: fixed; inset: 0; z-index: 80; height: auto; border: 0;
    padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
    transform: translateY(102%); visibility: hidden;
    transition: transform .32s var(--ease), visibility 0s linear .32s;
  }
  .library.open { transform: none; visibility: visible; transition: transform .32s var(--ease), visibility 0s; }
  .lib-top { display: flex; align-items: center; justify-content: space-between; padding: 12px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); }
  .lib-controls, .lib-status { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .stage { padding: 20px max(16px, env(safe-area-inset-right, 0px)) 76px max(16px, env(safe-area-inset-left, 0px)); gap: 26px; }
  .hide-sm { display: none; }
  .mbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: flex; align-items: center; gap: 8px;
    padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
    background: var(--paper); border-top: 1px solid var(--line); }
  .mbar-browse { flex: 1; height: 44px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: var(--radius); background: var(--invert-bg); color: var(--invert-fg); font-size: 15px; font-weight: 600; }
  .mbar-browse .count { opacity: .7; }
  .mbar .icon-btn { width: 44px; height: 44px; }
  .mbar-pos { min-width: 54px; text-align: center; font: 500 12px var(--font-mono); font-variant-numeric: tabular-nums; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .foot { padding-bottom: 24px; }
}
@media (max-width: 699px) {
  .fview button span { display: none; }
  .fview button { padding: 0 11px; }
  .fnav { gap: 8px; }
  .ftabs { gap: 20px; }
  .ftab { height: 46px; font-size: 13.5px; }
  .car-stage { height: clamp(400px, calc(100svh - 236px), 640px); }
  .car-bar { grid-template-columns: auto 1fr auto; grid-template-areas: "strip strip strip" "nav view acts"; gap: 12px 8px; }
  .car-strip { grid-area: strip; }
  .car-nav { grid-area: nav; }
  .fview { grid-area: view; justify-self: center; }
  .car-acts { grid-area: acts; }
  .car-shuffle { display: none; }
  .view-index .lib-more { display: grid; gap: 11px; flex-basis: 100%; }
  .view-index .lib-controls { padding: 10px; }
  .view-index .lib-row .select { flex: 1; width: auto; }
  .view-index .filter { grid-template-columns: 50px minmax(0, 1fr); }
  .view-index .match-in input[type="text"] { flex: 1; width: auto; }
  .index { gap: 12px; }
}
@media (max-width: 600px) {
  .tool-sub { display: none; }
  .oso-mark { width: 50px; height: 19px; }
  .brand-sep { height: 18px; }
  .tool-title { font-size: 16px; }
  .tbtn span { display: none; }
  .tbtn { width: 38px; padding: 0; justify-content: center; }
  .tbtn-make { width: auto; padding: 0 11px; }
  .tbtn-make .t-sm { display: inline; }
  /* The studio's top bar also carries All palettes; Create goes icon-only and Shuffle steps aside. */
  .view-studio .tbtn-make { width: 38px; padding: 0; }
  .view-studio .tbtn-make .t-sm, .view-studio #shuffle { display: none; }
  .pal-name { font-size: clamp(36px, 11vw, 48px); }
  .mix-bar { height: 60px; }
  .seg-c { padding: 7px 8px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  body { transition: none; }
  .library, .library.open, .toast { transition: none; }
  .comp-svg.fade { animation: none; }
}
