/* Layout concept: a ruled studio sheet. Hairline columns frame the page, the ask box sits alone
   in the middle of the hero on a soft blue glow, answers float up under it, and the
   library is a stage driven by a list. One accent: blue, in shades. */
:root {
  --paper: #F7F7F3;
  --card: #FFFFFF;
  --ink: #0D1220;
  --ink-2: #4A5167;
  /* 4.58:1 on --paper: the old #868CA0 was 3.12:1, below AA, for every 12-13px label on the site */
  --ink-3: #6A7085;
  --rule: #E2E3DC;
  --b50: #EEF2FF; --b100: #DCE4FF; --b200: #B8C9FF; --b300: #8DA8FF; --b400: #5E83FF;
  --b500: #2F5BFF; --b600: #2045D6; --b700: #1834A6; --b800: #11246F; --b900: #0A1640;
  --stage-a: var(--b100);
  --stage-b: var(--b500);
  --stage-c: var(--b800);
  --on-stage-a: var(--ink);
  --cta-bg: var(--ink);
  --cta-fg: #FFFFFF;
  --shadow: 0 1px 0 rgba(13, 18, 32, .04), 0 12px 32px -12px rgba(13, 18, 32, .18);
  --f-sans: "Anuphan", "Noto Sans Thai", "Leelawadee UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --frame: 1280px;
  --gut: max(16px, env(safe-area-inset-left, 0px));
  --gut-r: max(16px, env(safe-area-inset-right, 0px));
  --ease: cubic-bezier(.2, .7, .1, 1);
  --nav-h: 56px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0A0E18; --card: #111827; --ink: #ECEFF6; --ink-2: #AAB1C4; --ink-3: #8E96AC; --rule: #1E2638;
    --stage-a: #13204F; --stage-b: var(--b600); --stage-c: #060D29; --on-stage-a: #ECEFF6;
    --cta-bg: var(--b500); --cta-fg: #FFFFFF;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 16px 40px -16px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0A0E18; --card: #111827; --ink: #ECEFF6; --ink-2: #AAB1C4; --ink-3: #8E96AC; --rule: #1E2638;
  --stage-a: #13204F; --stage-b: var(--b600); --stage-c: #060D29; --on-stage-a: #ECEFF6;
  --cta-bg: var(--b500); --cta-fg: #FFFFFF;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 16px 40px -16px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.65 var(--f-sans); overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--b500); outline-offset: 2px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono-label, .label {
  margin: 0; font: 500 13px/1.3 var(--f-sans); color: var(--ink-3); display: flex; align-items: center; gap: 8px;
}
/* Pixel slots stay out of the layout until pixel/pixel.js (element session) has loaded */
html:not(.px-ready) [data-px] { display: none !important; }
html:not(.px-ready) .foot-scene-wrap { display: none; }

/* The ruled frame: every band sits inside two hairlines */
.frame {
  max-width: var(--frame); margin-inline: auto;
  padding-left: var(--gut); padding-right: var(--gut-r);
  border-left: 1px solid var(--rule); border-right: 1px solid var(--rule);
}
@media (max-width: 1312px) { .frame { border-left: 0; border-right: 0; } }

/* Nav: cells divided by hairlines */
.topband { position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); background: var(--paper); z-index: 30; }
.nav {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.nav-row { display: flex; align-items: stretch; height: 56px; padding-left: 0; padding-right: 0; }
.nav-cell {
  display: flex; align-items: center; gap: 10px; padding: 0 20px; text-decoration: none;
  border-right: 1px solid var(--rule); font-weight: 500; font-size: 15px; white-space: nowrap;
  background: none; border-top: 0; border-bottom: 0; border-left: 0; cursor: pointer;
  transition: background-color .2s var(--ease);
}
.nav-cell:hover { background: var(--b50); }
:root[data-theme="dark"] .nav-cell:hover { background: var(--card); }
.brand { font-weight: 600; letter-spacing: -.01em; padding-left: var(--gut); }
.brand-mark { display: grid; grid-template-columns: 7px 7px; gap: 2px; }
.brand-mark i { width: 7px; height: 7px; background: var(--b500); }
.brand-mark i:nth-child(2) { background: var(--b300); }
.brand-mark i:nth-child(3) { background: var(--b800); }
.brand-mark i:nth-child(4) { background: transparent; box-shadow: inset 0 0 0 1.5px var(--b500); }
.nav-links { display: flex; }
.nav-end { margin-left: auto; display: flex; }
.nav-end .nav-cell { border-right: 0; border-left: 1px solid var(--rule); }
.icon-cell { padding: 0 18px; }
.nav-cta { background: var(--cta-bg); color: var(--cta-fg); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.nav-cta:hover { background: var(--b600); }
@media (max-width: 720px) {
  /* On a phone the boss must find every button, like on a desktop (12 Nov 2026: "ไม่เจอปุ่มอื่น ... ต้องเป็นแบบเดสท็อป"):
     the four links move to a second row of their own instead of being hidden. 56 + 44 = 100. */
  :root { --nav-h: 100px; }
  .nav-row { flex-wrap: wrap; height: auto; }
  .brand, .nav-end .nav-cell { height: 56px; }
  .nav-end { order: 2; }
  .nav-links { order: 3; display: flex; flex: 0 0 100%; border-top: 1px solid var(--rule); }
  .nav-links .nav-cell { flex: 1 1 0; justify-content: center; height: 44px; padding: 0 8px; font-size: 13px; }
  .nav-links .nav-cell:last-child { border-right: 0; }
  .nav-cell { padding: 0 14px; font-size: 14px; }
  .brand { padding-left: var(--gut); }
}
@media (max-width: 360px) { .nav-links .nav-cell { font-size: 12.5px; padding: 0 6px; letter-spacing: -.01em; } }

/* Hero:
   a pixel clapper in the headline, a faded editing timeline behind the box, the penguin walking the box's top edge.
   Only transform and opacity move. */
.hero { padding-top: 0; padding-bottom: 0; }
#home { overflow-x: hidden; overflow-x: clip; }   /* the full-width timeline band must never widen the page */
.hero-center { position: relative; display: grid; justify-items: center; text-align: center; padding-block: 56px 72px; border-bottom: 1px solid var(--rule); }
.hero-center > .px-f { position: absolute; z-index: 1; }
.hero-center > .px-f.px-off { display: none; }   /* placeBlocks() in app.js: a block that would touch the headline or subtitle */
/* the seven floating blocks of the old hero, kept clear of the band */
.hero-center > .f1 { top: 56px; left: 6%; } .hero-center > .f2 { top: 262px; left: 10%; } .hero-center > .f3 { top: 336px; left: 3%; }
.hero-center > .f4 { top: 64px; right: 7%; } .hero-center > .f5 { top: 272px; right: 11%; } .hero-center > .f6 { top: 352px; right: 4%; } .hero-center > .f7 { bottom: 28px; right: 22%; }
.hero-clap { display: inline-block; vertical-align: -0.04em; margin: 0 .03em; }
.ht-1, .ht-2 { display: block; }
/* "Your AI," small above the main line (his note, 28 Oct 2026: "your ai เอาเล็กๆดีกว่า") */
.ht-1 { font-size: max(20px, .36em); font-weight: 500; letter-spacing: -.01em; line-height: 1.2; margin-bottom: .1em; color: var(--ink-2); }
.px-ready .ht-o { display: none; }   /* the plain o only shows when the pixel layer did not load */
.hero-clap.px { --s: 4; }
.ask-wrap { position: relative; width: min(100%, 760px); margin-top: 96px; text-align: left; }
.ask-wrap > .askbox { margin-top: 0; z-index: 2; }
/* Glow: a pre-drawn soft light that only fades and scales (no animated blur or box-shadow: no lag); now only behind answers */
.glow {
  position: absolute; inset: -90px -120px; z-index: 0; pointer-events: none;
  background: radial-gradient(50% 50% at 50% 55%, rgba(47, 91, 255, .55), rgba(47, 91, 255, .22) 42%, rgba(47, 91, 255, 0) 72%);
  animation: glowBreath 5.5s ease-in-out infinite; will-change: opacity, transform;
}
@keyframes glowBreath { 0%, 100% { opacity: .55; transform: scale(.97); } 50% { opacity: .95; transform: scale(1.03); } }
:root[data-theme="dark"] .glow { background: radial-gradient(50% 50% at 50% 55%, rgba(94, 131, 255, .65), rgba(47, 91, 255, .25) 42%, rgba(47, 91, 255, 0) 72%); }
/* A static lit edge on the box (never animated) */
.ask-wrap > .askbox { border-color: var(--b300); box-shadow: 0 0 0 1px rgba(47, 91, 255, .18), 0 18px 60px -12px rgba(47, 91, 255, .45); }
.ask-wrap > .ask-status { position: relative; z-index: 2; text-align: center; }
.answer .sc-items { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.answer { width: min(100%, 760px); margin-top: 28px; display: grid; gap: 12px; text-align: left; scroll-margin-top: calc(72px + env(safe-area-inset-top, 0px)); }
.answer > .label { justify-content: flex-start; }
.answer .stage { background: transparent; padding: 0; min-height: 0; overflow: visible; display: block; }
.answer .stage::before { display: none; }
.glow-answer { inset: -60px -80px; opacity: .6; }

/* Off-screen, in a hidden tab: every CSS loop in the hero holds still (app.js heroSync pauses the strips) */
.hero.paused *, .hero.paused *::before, .hero.paused *::after { animation-play-state: paused !important; }

/* The timeline behind the box: full width, faded, middle density (timecodes, FX row, clip row, audio row, playhead) */
.hb-band { position: absolute; left: 50%; width: 100vw; top: -4px; height: 140px; z-index: 1; transform: translateX(-50%); pointer-events: none; overflow: hidden; overflow-x: clip; overflow-y: visible; }
.hb-track { position: absolute; left: 0; top: 0; width: 7200px; height: 100%; will-change: transform; }
.hb-track > * { position: absolute; left: 0; width: 7200px; }
.hb-ruler { top: 0; height: 14px; display: flex; }
.hb-ruler span { flex: 0 0 120px; border-left: 1px solid var(--ink-3); font: 500 10px/14px var(--f-mono); color: var(--ink-3); padding-left: 4px; opacity: .45; }
.hb-fx { top: 20px; height: 52px; }
.hb-v1 { top: 80px; height: 26px; display: flex; }
.hb-v1 i { flex: 0 0 auto; height: 100%; margin-right: 3px; background: var(--b400); opacity: .28; }
.hb-a1 { top: 112px; height: 24px; opacity: .3; }
.hb-chip { position: absolute; top: 0; width: 52px; height: 52px; display: grid; place-items: center; opacity: .42; transition: opacity .25s; }
.hb-chip > img { max-width: 100%; max-height: 100%; }
.hb-chip.hot { opacity: 1; }
.hb-anim { position: relative; overflow: hidden; }
.hb-anim img { display: block; height: 100%; max-width: none; }
.hb-playhead { position: absolute; left: 0; top: -8px; bottom: -8px; width: 2px; background: var(--b500); opacity: .55; }
.hb-playhead::before { content: ""; position: absolute; top: 0; left: -5px; border: 6px solid transparent; border-top-color: var(--b500); }
.hb-fly { position: absolute; left: 0; top: 0; z-index: 40; width: 52px; height: 52px; display: grid; place-items: center; pointer-events: none; transition: transform .7s cubic-bezier(.5, 0, .3, 1); }
.hb-fly > img { max-width: 100%; max-height: 100%; }

/* The penguin's lane on the box's top edge (acts: wander, sit, cut, drag, belly-slide, peek, nap) */
.hb-lane { position: absolute; left: 10px; right: 10px; bottom: 100%; height: 120px; z-index: 3; pointer-events: none; }
.hb-lane.clip { overflow: hidden; }
.hb-mover { position: absolute; left: 0; bottom: -6px; transition-property: transform; transition-timing-function: linear; will-change: transform; }
.hb-mover.sit { bottom: -12px; }
.hb-pivot { position: absolute; left: 0; bottom: 0; transform: translateX(-50%) scaleX(var(--dir, 1)); }
.hb-pivot .px { --s: 3; display: block; }
.hb-say { position: absolute; bottom: 70px; left: 0; transform: translateX(-50%); white-space: nowrap; font: 500 13px/1.3 var(--f-sans); color: var(--b700);
  background: var(--card); border: 1px solid var(--b200); padding: 3px 8px; opacity: 0; transition: opacity .25s; }
:root[data-theme="dark"] .hb-say { color: var(--b200); border-color: var(--b700); }
.hb-say.on { opacity: 1; }
/* Below 1240 px there is no room beside the box for pieces to land, so the timeline runs just under it with the
   playhead in the middle (as on a phone, where the box covers the full width) */
@media (max-width: 1239px) {
  .ask-wrap { margin-bottom: 150px; }
  .hb-band { top: calc(100% + 4px); }
  .hero-center > .f7 { bottom: 12px; }
}
@media (max-width: 900px) { .hero-clap.px { --s: 3; } }
@media (max-width: 600px) { .hero-clap.px { --s: 2; } }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--b400); display: inline-block; animation: blink 1.6s steps(2, jump-none) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.hero-title {
  margin: 22px 0 14px; font-weight: 600; font-size: clamp(42px, 7.4vw, 104px); line-height: 1.12;
  letter-spacing: -.02em; text-wrap: balance;
}

.askbox {
  position: relative; margin-top: 44px; background: var(--card); border: 1px solid var(--rule);
  box-shadow: var(--shadow); transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.askbox:focus-within { border-color: var(--b400); box-shadow: 0 0 0 4px color-mix(in srgb, var(--b500) 14%, transparent), var(--shadow); }
.askbox.busy { border-color: var(--b300); }
.ask-field { position: relative; }
.ask-field textarea {
  display: block; width: 100%; resize: none; border: 0; outline: 0; background: transparent;
  padding: 20px 22px 6px; font-size: 20px; line-height: 1.5; min-height: 92px;
}
.ask-ghost {
  position: absolute; left: 22px; top: 20px; right: 22px; font-size: 20px; line-height: 1.5;
  color: var(--ink-3); pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ask-ghost::after { content: ""; display: inline-block; width: 2px; height: 1.1em; margin-left: 2px; vertical-align: -3px; background: var(--b500); animation: blink 1s steps(2, jump-none) infinite; }
.ask-field textarea:not(:placeholder-shown) + .ask-ghost, .askbox:focus-within .ask-ghost { opacity: 0; }
.ask-clip {
  display: flex; align-items: center; gap: 12px; margin: 4px 22px 4px; padding: 8px;
  border: 1px solid var(--rule); background: var(--paper); min-width: 0;
}
.ask-clip video { width: 44px; height: 56px; object-fit: cover; background: var(--b900); flex: none; }
.clip-meta { display: flex; flex-direction: column; min-width: 0; font-size: 14px; line-height: 1.4; }
.clip-meta b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip-meta span { color: var(--ink-3); font-family: var(--f-mono); font-size: 12px; }
.clip-x { margin-left: auto; width: 32px; height: 32px; border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--ink-2); }
.ask-bar { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; }
.ask-attach {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer;
  font-size: 14px; font-weight: 500; border: 1px solid var(--rule); background: var(--paper);
  transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
.ask-attach:hover { border-color: var(--b300); background: var(--b50); }
:root[data-theme="dark"] .ask-attach:hover { background: var(--stage-a); }
.ask-hint { color: var(--ink-3); font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-send {
  margin-left: auto; width: 48px; height: 48px; flex: none; border: 0; cursor: pointer;
  background: var(--b500); color: #fff; display: grid; place-items: center;
  transition: transform .2s var(--ease), background-color .2s var(--ease);
}
.ask-send:hover { background: var(--b600); }
.ask-send:active { transform: scale(.94); }
.ask-send:disabled { background: var(--b200); cursor: progress; }
.ask-status { margin: 12px 0 0; min-height: 1.5em; font-size: 14px; color: var(--ink-2); }

/* Stages: solid blue panels with real UI on top */
.stage { position: relative; overflow: hidden; background: var(--stage-b); padding: 28px; min-height: 420px; display: grid; align-items: center; }
.stage[data-tone="a"] { background: var(--stage-a); }
/* the small mono label on the pale stage was --ink-3: 3.88:1 on #DCE4FF, under AA */
.stage[data-tone="a"] .mono-label, .stage[data-tone="a"] .label { color: var(--ink-2); }
.stage[data-tone="c"] { background: var(--stage-c); }
.stage::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(to right, rgba(255, 255, 255, .12) 1px, transparent 1px), linear-gradient(to bottom, rgba(255, 255, 255, .12) 1px, transparent 1px);
  background-size: 32px 32px;
}
.stage[data-tone="a"]::before { background-image: linear-gradient(to right, rgba(47, 91, 255, .12) 1px, transparent 1px), linear-gradient(to bottom, rgba(47, 91, 255, .12) 1px, transparent 1px); }

.stage-card {
  position: relative; background: var(--card); color: var(--ink); box-shadow: 0 24px 60px -24px rgba(6, 13, 41, .55);
  padding: 20px; min-width: 0; transform-origin: 50% 60%;
}
.stage-card.enter { animation: cardIn .55s var(--ease) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.sc-q { margin: 0 0 4px; font: 500 13px/1.4 var(--f-sans); color: var(--ink-3); }
.sc-reply { margin: 0 0 14px; font-size: 16px; line-height: 1.55; }
.sc-reply.thinking { color: var(--ink-3); }
.sc-reply.thinking::after { content: "▍"; color: var(--b500); animation: blink .9s steps(2, jump-none) infinite; }
.sc-items { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sc-item {
  aspect-ratio: 1; display: grid; place-items: center; padding: 8px; background: var(--b50);
  border: 1px solid transparent; text-decoration: none; transition: border-color .2s var(--ease), transform .25s var(--ease);
}
:root[data-theme="dark"] .sc-item { background: var(--stage-a); }
.sc-item:hover { border-color: var(--b400); transform: translateY(-2px); }
.sc-item img { max-height: 100%; object-fit: contain; }
.sc-item.pop { animation: pop .45s var(--ease) both; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.9); } }
.sc-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.sc-tell { font-size: 13px; color: var(--ink-2); min-width: 0; }
.sc-tell code { font: 500 13px/1.4 var(--f-sans); background: var(--b50); padding: 2px 6px; }
:root[data-theme="dark"] .sc-tell code { background: var(--stage-a); }
.link-arrow { font-weight: 500; font-size: 14px; text-decoration: none; color: var(--b600); white-space: nowrap; }
:root[data-theme="dark"] .link-arrow { color: var(--b300); }
.link-arrow .ico { margin-left: 6px; vertical-align: -1px; transform: rotate(-90deg); }
.spec { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
.spec dt { color: var(--ink-3); font-size: 13px; padding-top: 1px; }
.spec dd { margin: 0; min-width: 0; }
.swatches { display: flex; gap: 4px; }
.swatches i { width: 22px; height: 22px; display: block; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.meter { height: 6px; background: var(--b100); position: relative; margin-top: 10px; }
.meter > i { position: absolute; inset: 0 auto 0 0; background: var(--b500); width: 0; transition: width .2s linear; }
.steps-mini { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 14px; counter-reset: s; }
.steps-mini li { display: flex; gap: 10px; }
.steps-mini li::before { counter-increment: s; content: counter(s); font: 500 12px/22px var(--f-mono); width: 22px; height: 22px; flex: none; text-align: center; background: var(--b500); color: #fff; }

/* Sections */
.sec { padding-block: 72px; border-bottom: 1px solid var(--rule); }
.sec-head { display: grid; gap: 12px; max-width: 760px; margin-bottom: 36px; }
.sec-title { margin: 6px 0 0; font-weight: 500; font-size: clamp(30px, 4vw, 48px); line-height: 1.12; letter-spacing: -.015em; text-wrap: balance; }
.sec-sub { margin: 0; color: var(--ink-2); max-width: 40em; }
.nw { white-space: nowrap; }

/* Library: list drives the stage */
.lib-search input {
  width: 100%; max-width: 420px; margin-top: 8px; padding: 12px 14px; border: 1px solid var(--rule);
  background: var(--card); outline: 0;
}
.lib-search input:focus { border-color: var(--b400); }
.lib { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); border: 1px solid var(--rule); }
.lib-sets { list-style: none; margin: 0; padding: 0; border-right: 1px solid var(--rule);
  /* 30+ sets made this list ~2,800 px and stretched the board with it (boss, 10 Nov 2026: "ตารางกดเล่นคลังอะ ยาวเกิน"):
     the list now takes the board's height and scrolls inside itself */
  height: 0; min-height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.lib-sets button {
  width: 100%; display: flex; align-items: baseline; gap: 12px; text-align: left; padding: 18px 20px;
  background: none; border: 0; border-bottom: 1px solid var(--rule); cursor: pointer;
  transition: background-color .2s var(--ease), padding-left .3s var(--ease);
}
.lib-sets li:last-child button { border-bottom: 0; }
.lib-sets button:hover { background: var(--b50); }
:root[data-theme="dark"] .lib-sets button:hover { background: var(--card); }
.lib-sets button[aria-current="true"] { background: var(--card); padding-left: 28px; box-shadow: inset 3px 0 0 var(--b500); }
.lib-sets .n { font: 500 12px/1 var(--f-mono); color: var(--ink-3); width: 22px; }
.lib-sets .t { font-weight: 500; font-size: 17px; }
.lib-sets .c { margin-left: auto; font-size: 13px; color: var(--ink-3); }
.lib-stage { min-height: 520px; align-content: center; gap: 18px; padding: 36px; }
.lib-board { justify-self: center; width: min(100%, 460px); outline-offset: 6px; }
.lib-sheet { width: 100%; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 18px 30px rgba(10, 22, 64, .18)); transition: opacity .45s var(--ease), transform .45s var(--ease); }
.lib-sheet.swap { animation: sheetIn .6s var(--ease) both; }
@keyframes sheetIn { from { opacity: 0; transform: translateY(16px) scale(.96); } }
/* Tap to place (his note, 28 Oct 2026): pieces snap to the stage's own 32 px ruled cells */
.lib-stage { cursor: cell; }
.lib-stage.playing .lib-sheet { opacity: 0; transform: scale(.94); }
.lib-drops { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.lib-drop { position: absolute; margin: 0; animation: dropIn .42s var(--ease) both; }
.lib-drop img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 8px 14px rgba(10, 22, 64, .2)); }
.lib-drop figcaption { position: absolute; left: 50%; top: 100%; transform: translate(-50%, 4px); padding: 2px 8px; white-space: nowrap; font-size: 12px; background: var(--card); color: var(--ink); border: 1px solid var(--rule); transition: opacity .4s var(--ease); }
.lib-drop.quiet figcaption { opacity: 0; }
.lib-drop.at-l figcaption { left: 0; transform: translate(0, 4px); }
.lib-drop.at-r figcaption { left: auto; right: 0; transform: translate(0, 4px); }
@keyframes dropIn { from { opacity: 0; transform: translateY(-14px) scale(.7); } 60% { opacity: 1; transform: translateY(2px) scale(1.04); } }
.lib-ghost { position: absolute; left: 0; top: 0; z-index: 1; pointer-events: none; outline: 2px dashed var(--b500); outline-offset: -2px; background: rgba(47, 91, 255, .06); opacity: 0; transition: opacity .2s; }
.lib-ghost.on { opacity: 1; }
.lib-cap { z-index: 2; cursor: auto; }
.lib-cap .lib-acts { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; flex: 1 1 100%; opacity: 1; }
.lib-cur { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; }
.lib-cur.go { transition: transform .8s cubic-bezier(.5, 0, .2, 1), opacity .4s; }
.lib-cur.down svg path:last-child { fill: var(--b200); }
.lib-cur.out { opacity: 0; }
.lib-reset { padding: 0; border: 0; background: none; cursor: pointer; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; color: var(--on-stage-a); }
.lib-cap { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; color: var(--on-stage-a); }
.lib-cap b { font-weight: 600; font-size: 18px; }
.lib-cap span { color: var(--on-stage-a); opacity: .75; font-size: 14px; flex: 1 1 240px; }
.walkline { position: relative; height: 76px; border-bottom: 1px solid var(--rule); }
html:not(.px-ready) .walkline { display: none; }
.walkline > .px-walk { position: absolute; left: 0; bottom: -1px; }
.stage-card [data-px-slot="stage-prop"] { position: absolute; right: 16px; top: 0; transform: translateY(-60%); }

.more-row { display: flex; justify-content: center; margin-top: 20px; }
.more-row:has([hidden]) { display: none; }
.grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); border-left: 1px solid var(--rule); border-top: 1px solid var(--rule); margin-top: 32px; }
.walkline + .grid { margin-top: 0; border-top: 0; }
.cell {
  position: relative; aspect-ratio: 1; display: grid; place-items: center; padding: 16px;
  border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); text-decoration: none;
  background: var(--paper); transition: background-color .25s var(--ease);
}
.cell img { position: absolute; inset: 14%; width: 72%; height: 72%; object-fit: contain; transition: transform .35s var(--ease); }
.cell:hover { background: var(--b50); }
:root[data-theme="dark"] .cell:hover { background: var(--stage-a); }
.cell:hover img { transform: scale(1.08); }
.cell .cap { position: absolute; left: 10px; bottom: 8px; right: 10px; font-size: 12px; color: var(--ink-2); opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s var(--ease); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell:hover .cap, .cell:focus-visible .cap { opacity: 1; transform: none; }
.empty { display: grid; justify-items: center; gap: 12px; padding: 40px 16px; color: var(--ink-2); text-align: center; }

/* How: an editing timeline */
.tl { position: relative; border: 1px solid var(--rule); background: var(--card); overflow: hidden; }
.tl-ruler { display: flex; justify-content: space-between; padding: 8px 16px 8px 156px; font: 400 11px/1 var(--f-mono); color: var(--ink-3); border-bottom: 1px solid var(--rule); background: repeating-linear-gradient(90deg, var(--rule) 0 1px, transparent 1px 24px) bottom / 100% 6px no-repeat; }
.tl-track { display: grid; grid-template-columns: 140px minmax(0, 1fr); border-bottom: 1px solid var(--rule); min-height: 64px; }
.tl-track:last-of-type { border-bottom: 0; }
.tl-name { display: flex; align-items: center; padding: 0 16px; font: 500 13px/1.3 var(--f-sans); color: var(--ink-2); border-right: 1px solid var(--rule); background: var(--paper); }
.tl-lane { position: relative; padding: 10px 16px; }
.tl-clip {
  position: relative; left: calc(var(--s) * 1%); width: calc(var(--w) * 1%); min-height: 44px;
  padding: 8px 12px; font-size: 13px; line-height: 1.4; color: #fff; background: var(--b500);
  border-left: 3px solid var(--b800);
}
.tl-clip.c1 { background: var(--b300); color: var(--b900); border-left-color: var(--b600); }
.tl-clip.c2 { background: var(--b500); }
.tl-clip.c3 { background: var(--b700); border-left-color: var(--b300); }
.tl-clip.c4 { background: var(--b900); border-left-color: var(--b400); }
.tl-head { position: absolute; top: 0; bottom: 0; left: 156px; width: 2px; background: var(--b500); transform: translateX(var(--x, 0px)); will-change: transform; }
.tl-head::before { content: ""; position: absolute; top: 0; left: -6px; border: 7px solid transparent; border-top: 9px solid var(--b500); }
@media (max-width: 720px) {
  .tl-ruler { display: none; }
  .tl-track { grid-template-columns: 1fr; }
  .tl-name { border-right: 0; border-bottom: 1px solid var(--rule); padding: 8px 12px; }
  .tl-clip { left: 0 !important; width: 100% !important; }
  .tl-head { display: none; }
}


.url-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.url-row code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; padding: 12px 14px; background: var(--paper); border: 1px solid var(--rule); font: 400 14px/1.2 var(--f-mono); }
.btn-ghost { padding: 12px 16px; border: 1px solid var(--rule); background: var(--card); cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn-ghost:hover { border-color: var(--b400); }
.note { margin: 0; color: var(--ink-2); font-size: 14px; }
.pill { display: inline-block; padding: 2px 8px; margin-right: 6px; font: 500 12px/1.6 var(--f-sans); background: var(--b100); color: var(--b800); }
:root[data-theme="dark"] .pill { background: var(--stage-a); color: var(--b200); }
/* Connect walk-through: a drawn app window where a pixel cursor presses the real buttons, one AI per tab */
.cx { border: 1px solid var(--rule); border-top: 0; }
.cx-tabs { display: flex; border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.cx-tabs button { padding: 14px 22px; border: 0; border-right: 1px solid var(--rule); background: none; cursor: pointer; font-weight: 500; white-space: nowrap; color: var(--ink-2); }
.cx-tabs button[aria-selected="true"] { color: var(--ink); background: var(--card); box-shadow: inset 0 -3px 0 var(--b500); }
.cx-body { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.cx-screen { position: relative; padding: 28px; background: var(--stage-a); border-right: 1px solid var(--rule); min-width: 0; }
.cx-side { padding: 24px 28px; display: grid; gap: 18px; align-content: start; min-width: 0; }
.cx-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.cx-steps button { width: 100%; display: flex; gap: 12px; align-items: baseline; padding: 10px 12px; border: 0; background: none; cursor: pointer; text-align: left; color: var(--ink-3); transition: color .25s var(--ease), background-color .25s var(--ease); }
.cx-steps li.on button { color: var(--ink); background: var(--b50); }
:root[data-theme="dark"] .cx-steps li.on button { background: var(--stage-a); }
.cx-n { font: 500 12px/1 var(--f-mono); width: 22px; height: 22px; flex: none; display: grid; place-items: center; background: var(--b100); color: var(--b700); }
.cx-steps li.on .cx-n { background: var(--b500); color: #fff; }
.cx-link { display: grid; gap: 8px; }
.cli-note { font-size: 13px; }
.cli-note code { font-family: var(--f-mono); font-size: 12px; overflow-wrap: anywhere; }
.cx-more { justify-self: start; }
.cx-full ol { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 6px; color: var(--ink-2); }
.cx-full .note + .note { margin-top: 6px; font-size: 13px; color: var(--ink-3); }
/* the drawn window: real labels in English as each app shows them, grey bars for the rest */
.cxw { position: relative; background: var(--card); border: 1px solid var(--rule); box-shadow: var(--shadow); font-size: 13px; line-height: 1.3; overflow: hidden; }
.cxw-bar { display: flex; align-items: center; gap: 6px; padding: 9px 12px; border-bottom: 1px solid var(--rule); font: 500 12px/1 var(--f-sans); color: var(--ink-2); }
.cxw-bar i { width: 8px; height: 8px; border-radius: 50%; background: var(--rule); }
.cxw-bar span { margin-left: 8px; }
.cxw-in { display: grid; grid-template-columns: 34% 1fr; min-height: 250px; }
.cxw-side { padding: 14px 10px; display: grid; gap: 10px; align-content: start; border-right: 1px solid var(--rule); background: var(--paper); }
.cxw-side i, .cxm-bars i, .cxm-list i, .cxm-menu i, .cxm-radio i, .cxm-tabs i { display: block; height: 8px; background: var(--rule); }
.cxw-side i:nth-child(2n) { width: 70%; }
.cxw-side span { padding: 5px 8px; margin: -5px -2px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cxw-side span.on { background: var(--b100); color: var(--b800); }
:root[data-theme="dark"] .cxw-side span.on { background: var(--stage-a); color: var(--b200); }
.cxw-main { position: relative; padding: 16px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.cxw-main.swap { animation: cxIn .38s var(--ease) both; }
@keyframes cxIn { from { opacity: 0; transform: translateY(6px); } }
.cxm-h { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 14px; }
.cxm-bars { display: grid; gap: 9px; }
.cxm-bars i:nth-child(3n+1) { width: 82%; } .cxm-bars i:nth-child(3n+2) { width: 64%; }
.cxm-list, .cxm-radio, .cxm-check, .cxm-tabs { display: grid; gap: 8px; }
.cxm-list span, .cxm-radio span, .cxm-check span, .cxm-menu span { padding: 8px 10px; border: 1px solid var(--rule); background: var(--card); justify-self: stretch; }
.cxm-list i { width: 60%; }
.cxm-btn { padding: 6px 10px; border: 1px solid var(--rule); background: var(--card); font-weight: 500; font-size: 12px; white-space: nowrap; justify-self: start; }
.cxm-btn.solid { background: var(--ink); color: var(--paper); border-color: var(--ink); padding: 8px 14px; }
.cxm-menu { position: absolute; right: 16px; top: 44px; z-index: 1; display: grid; gap: 8px; padding: 8px; min-width: 60%; background: var(--card); border: 1px solid var(--rule); box-shadow: var(--shadow); }
.cxm-menu i { width: 70%; }
.cxm-f { display: grid; gap: 4px; font-size: 12px; color: var(--ink-2); }
.cxm-f b { display: block; min-height: 30px; padding: 7px 9px; border: 1px solid var(--rule); background: var(--paper); font: 400 12px/1.3 var(--f-mono); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cxm-f b.focus { border-color: var(--b500); box-shadow: 0 0 0 2px var(--b100); }
.cxm-f b.focus::after { content: ""; display: inline-block; width: 1px; height: 1em; margin-left: 1px; vertical-align: -2px; background: var(--ink); animation: blink 1s steps(2, jump-none) infinite; }
.cxm-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid var(--rule); }
.cxm-pick { padding: 3px 8px; background: var(--paper); border: 1px solid var(--rule); font-size: 12px; }
.cxm-tog { width: 30px; height: 16px; background: var(--rule); position: relative; transition: background-color .25s; }
.cxm-tog::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; background: #fff; transition: transform .25s var(--ease); }
.cxm-tog.on { background: var(--b500); } .cxm-tog.on::after { transform: translateX(14px); }
.cxm-radio span, .cxm-check span { display: flex; align-items: center; gap: 8px; }
.cxm-radio span::before, .cxm-check span::before { content: ""; width: 12px; height: 12px; flex: none; border: 1.5px solid var(--ink-3); background: var(--card); }
.cxm-radio span::before { border-radius: 50%; }
.cxm-radio span.on::before, .cxm-check span.on::before { border-color: var(--b500); background: var(--b500); box-shadow: inset 0 0 0 2px var(--card); }
.cxm-tabs { grid-template-columns: 1fr auto; align-items: center; border-bottom: 1px solid var(--rule); padding-bottom: 8px; }
.cxm-tabs i { width: 60%; }
.cxm-tabs span { padding: 6px 10px; font-weight: 500; }
.cxm-tabs span.on { box-shadow: inset 0 -2px 0 var(--b500); color: var(--b700); }
:root[data-theme="dark"] .cxm-tabs span.on { color: var(--b200); }
.cxm-ok { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px solid var(--b300); background: var(--b50); animation: cxIn .4s var(--ease) both; }
:root[data-theme="dark"] .cxm-ok { background: var(--stage-a); border-color: var(--b600); }
.cxm-ok-n { font-weight: 600; }
.cxm-tag { padding: 2px 8px; font-size: 12px; background: var(--b500); color: #fff; }
.cxm-note { margin: 0; color: var(--ink-2); font-size: 12px; }
.cxw [data-k].hit { background: var(--b100); border-color: var(--b500); }
:root[data-theme="dark"] .cxw [data-k].hit { background: var(--stage-a); }
.cxw-cur { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; transform: translate(240px, 200px); }
.cxw-cur.glide { transition: transform .62s cubic-bezier(.5, 0, .2, 1); }
.cxw-cur.down path:last-child { fill: var(--b200); }

.quota-band { background: var(--paper); }
.quota { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 32px; }
/* real generated animations, as a visitor gets them: a pixel "making" beat, then the animation */
.gen-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 32px; border-left: 1px solid var(--rule); border-top: 1px solid var(--rule); }
.gen-cell { position: relative; aspect-ratio: 1; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background-color: var(--stage-a);
  background-image: linear-gradient(to right, rgba(47, 91, 255, .1) 1px, transparent 1px), linear-gradient(to bottom, rgba(47, 91, 255, .1) 1px, transparent 1px); background-size: 16px 16px; }
.gen-win { position: absolute; inset: 0; margin: auto; overflow: hidden; opacity: 0; transition: opacity .35s var(--ease); }
.gen-strip { display: block; height: 100%; max-width: none; will-change: transform; }
.gen-cell.made .gen-win { opacity: 1; }
.gen-make { position: absolute; left: 50%; top: 50%; display: grid; grid-template-columns: 10px 10px; gap: 4px; transform: translate(-50%, -50%); transition: opacity .2s; }
/* blink only while the band is on screen and the cell is still being made: an endless animation off screen made the
   browser restyle every frame on the whole page (lag, 29 Oct 2026) */
.gen-make i { width: 10px; height: 10px; background: var(--b500); }
.gen-row.on .gen-cell:not(.made) .gen-make i { animation: genMake .8s steps(1) infinite; animation-delay: calc(var(--k) * -.2s); }
.gen-row.on .gen-make i:nth-child(2) { animation-delay: calc(var(--k) * -.2s - .2s); } .gen-row.on .gen-make i:nth-child(4) { animation-delay: calc(var(--k) * -.2s - .4s); } .gen-row.on .gen-make i:nth-child(3) { animation-delay: calc(var(--k) * -.2s - .6s); }
@keyframes genMake { 0% { opacity: 1; } 25% { opacity: .2; } }
.gen-cell.made .gen-make { visibility: hidden; }
.quota-meter { display: flex; gap: 6px; }
.quota-meter i { width: 28px; height: 28px; background: var(--b500); display: block; }
.quota-meter.left i:nth-child(n+4), .quota-meter i.off { background: var(--b100); }
.my-sheets { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 8px; }
.my-sheets figure { margin: 0; position: relative; aspect-ratio: 1; background: var(--stage-a); }
.my-sheets img { width: 100%; height: 100%; object-fit: contain; }
.my-sheets figcaption { position: absolute; left: 4px; bottom: 4px; font-size: 11px; padding: 1px 6px; background: var(--card); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 22px; border: 0; cursor: pointer;
  background: var(--cta-bg); color: var(--cta-fg); text-decoration: none; font-weight: 500; white-space: nowrap;
  transition: background-color .2s var(--ease), transform .2s var(--ease);
}
.btn:hover { background: var(--b600); }
.btn:disabled { background: var(--b200); color: var(--b800); cursor: not-allowed; }
:root[data-theme="dark"] .btn:disabled { background: var(--stage-a); color: var(--b200); }
.btn:active { transform: scale(.98); }
.btn.alt { background: var(--card); color: var(--ink); border: 1px solid var(--rule); }
.btn.alt:hover { border-color: var(--b400); background: var(--card); }

/* Footer */
.foot { border-top: 1px solid var(--rule); }
.foot-scene-wrap { padding-block: 28px 0; }
.foot-scene { position: relative; overflow: hidden; }
.foot-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; padding-block: 22px; border-top: 1px solid var(--rule); font-size: 14px; }
.foot-brand { font-weight: 600; }
/* under the company pixel word: only "by Kaipat", small (his notes, 28 Oct 2026) */
.foot-maker { display: flex; justify-content: center; padding-block: 10px 20px; }
.foot-maker small { font-size: 12px; letter-spacing: .04em; color: var(--ink-3); }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.foot-links a { text-decoration: none; color: var(--ink-2); }
.foot-links a:hover { color: var(--ink); }
.foot-note { margin-left: auto; color: var(--ink-3); font-size: 13px; }
/* the Openverse line shares the frame with every other band (margin: 0 used to cancel .frame's centring, so it ran
   from the left edge of the window to 1280px, outside the ruled frame on every page) */
.foot-src { margin: 0 auto; padding-block: 14px 22px; border-top: 1px solid var(--rule); font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.foot-src a { color: var(--ink); }
.foot-src .nw { white-space: nowrap; }
#sounds { scroll-margin-top: calc(var(--nav-h, 56px) + 26px + env(safe-area-inset-top, 0px)); }   /* clear of the sticky nav when the footer links here */

/* Inner pages */
/* an anchor jump must clear the sticky bar, which is 100px tall on a phone once the links have their own row */
section[id] { scroll-margin-top: calc(var(--nav-h, 56px) + 8px); }
.page-head { padding-block: 48px 28px; border-bottom: 1px solid var(--rule); display: grid; gap: 12px; }
.crumb { font-size: 14px; color: var(--ink-2); text-decoration: none; }
.crumb:hover { color: var(--ink); }
.page-title { margin: 0; font-weight: 500; font-size: clamp(32px, 5vw, 56px); line-height: 1.08; letter-spacing: -.02em; text-wrap: balance; }
.page-body { padding-block: 32px 72px; }
.sheet-view { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 0; border: 1px solid var(--rule); }
.sheet-stage { min-height: 560px; padding: 28px; display: grid; place-items: center; border-right: 1px solid var(--rule); transition: background-color .4s var(--ease); }
.sheet-side { padding: 28px; display: grid; gap: 20px; align-content: start; min-width: 0; }
.bg-switch { display: flex; gap: 6px; }
.bg-switch button { width: 32px; height: 32px; border: 1px solid var(--rule); cursor: pointer; }
.bg-switch button[aria-pressed="true"] { outline: 2px solid var(--b500); outline-offset: 2px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.kv dt { color: var(--ink-3); font-size: 13px; line-height: 1.7; }
.kv dd { margin: 0; min-width: 0; }
.tell-box { display: grid; gap: 8px; padding: 16px; background: var(--paper); border: 1px solid var(--rule); }
.tell-box p { margin: 0; font-size: 15px; }
/* Set page: every piece on the stage, one ruled cell each; the swatches change the stage under them */
.sheet-stage:has(.set-grid) { place-items: stretch; align-content: start; }
.set-grid { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-left: 1px solid rgba(47, 91, 255, .18); border-top: 1px solid rgba(47, 91, 255, .18); }
.set-cell { position: relative; aspect-ratio: 1; padding: 0; border: 0; border-right: 1px solid rgba(47, 91, 255, .18); border-bottom: 1px solid rgba(47, 91, 255, .18); background: none; cursor: pointer; }
.set-cell img { position: absolute; inset: 12%; width: 76%; height: 76%; object-fit: contain; transition: transform .35s var(--ease); }
.set-cell:hover img, .set-cell:focus-visible img { transform: scale(1.08); }
.set-cell .cap { position: absolute; left: 6px; bottom: 6px; max-width: calc(100% - 12px); padding: 1px 6px; font-size: 12px; color: var(--ink); background: var(--card); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .2s; }
.set-cell:hover .cap, .set-cell:focus-visible .cap { opacity: 1; }
.set-sheet { width: min(100%, 620px); aspect-ratio: 1; object-fit: contain; }

.decode-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); border: 1px solid var(--rule); }
.decode-frames { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; background: var(--stage-c); padding: 2px; align-content: start; border-right: 1px solid var(--rule); }
.decode-frames img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; }
.decode-frames.wide img { aspect-ratio: 16 / 9; }
.decode-info { padding: 28px; display: grid; gap: 22px; align-content: start; min-width: 0; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--rule); }
.facts div { padding: 14px; border-right: 1px solid var(--rule); min-width: 0; }
.facts div:last-child { border-right: 0; }
.facts b { display: block; font: 500 24px/1.1 var(--f-mono); font-variant-numeric: tabular-nums; }
.facts span { font-size: 12px; color: var(--ink-3); }
.cuts { position: relative; height: 34px; background: var(--b50); border: 1px solid var(--rule); }
:root[data-theme="dark"] .cuts { background: var(--stage-a); }
.cuts i { position: absolute; top: 4px; bottom: 4px; width: 2px; background: var(--b500); }
.ai-tag { font: 500 12px/1 var(--f-sans); color: var(--b700); background: var(--b100); padding: 4px 6px; }
:root[data-theme="dark"] .ai-tag { color: var(--b200); background: var(--stage-a); }
.prompt-out { white-space: pre-wrap; padding: 16px; background: var(--paper); border: 1px solid var(--rule); font-size: 15px; margin: 0; }

/* Share page (#with / #with-<style>): the style a friend sent, and the instruction to paste into their AI */
.with-card { display: grid; gap: 16px; justify-items: start; }
.with-card img { width: 100%; max-width: 420px; border: 1px solid var(--rule); }
.with-card p { margin: 0; font-size: 15px; }
/* the same scene in each clip mode, cut from the 2x2 sample (boss, 10 Nov 2026) */
.with-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; max-width: 420px; }
.with-modes figure { margin: 0; display: grid; gap: 4px; }
.with-modes img { width: 100%; max-width: none; }
.with-modes figcaption { font-size: 13px; color: var(--ink-2); }
/* 16px: iOS Safari zooms the page when a field under 16px takes focus; six empty rows for a one-line prompt was a
   big empty box (12 Nov 2026) */
.with-prompt { width: 100%; min-height: calc(1.5em * 3); max-height: calc(1.5em * 12); padding: 12px 14px; background: var(--paper); border: 1px solid var(--rule); font: 400 16px/1.5 var(--f-mono); color: var(--ink); resize: vertical; field-sizing: content; }

.signin-wrap { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); border: 1px solid var(--rule); align-items: start; }
.signin-card { padding: 40px; display: grid; gap: 18px; align-content: center; justify-items: start; }
.gbtn { display: inline-flex; align-items: center; gap: 12px; padding: 14px 22px; background: var(--card); color: var(--ink); border: 1px solid var(--rule); font-weight: 500; cursor: pointer; }
.gbtn:hover { border-color: var(--b400); }
.account-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--rule); }
.account-grid > div { padding: 24px; border-right: 1px solid var(--rule); display: grid; gap: 12px; align-content: start; min-width: 0; }
.account-grid > div:last-child { border-right: 0; }
.big-num { font: 500 48px/1 var(--f-mono); font-variant-numeric: tabular-nums; }
.prose { max-width: 680px; }
.prose h2 { font-weight: 600; font-size: 20px; margin: 32px 0 8px; }
.prose p { margin: 0 0 12px; color: var(--ink-2); }
.draft-tag { display: inline-block; font: 500 13px/1 var(--f-sans); padding: 6px 8px; background: var(--b100); color: var(--b800); }
:root[data-theme="dark"] .draft-tag { background: var(--stage-a); color: var(--b200); }

/* Drop overlay and toast */
.drop { position: fixed; inset: 0; z-index: 50; background: color-mix(in srgb, var(--b500) 88%, transparent); display: grid; place-items: center; color: #fff; padding: 24px; }
.drop-in { display: grid; justify-items: center; gap: 16px; padding: 48px; border: 2px dashed rgba(255, 255, 255, .7); font-size: 22px; font-weight: 500; text-align: center; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--paper); padding: 12px 18px; font-size: 14px; max-width: calc(100% - 32px); }

/* Reveal on scroll: content is visible at rest (a screenshot or a slow observer still shows it);
   the observer fires just before an element enters and only plays the entrance */
.rv.in { animation: riseIn .8s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes riseIn { from { opacity: 0; transform: translateY(22px); } }

/* The one orchestrated moment: the hero assembles on load */
h1.hero-title, .ask-wrap > .askbox { animation: riseIn .9s var(--ease) both; }
.hero-title { animation-delay: .05s; }
.askbox { animation-delay: .26s; }

/* View transitions between pages */
::view-transition-old(root) { animation: vtOut .28s var(--ease) both; }
::view-transition-new(root) { animation: vtIn .42s var(--ease) both; }
@keyframes vtOut { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vtIn { from { opacity: 0; transform: translateY(14px); } }

/* Phone */
@media (max-width: 900px) {
  .hero-center { padding-block: 40px 36px; }
  .hero-center > .f2, .hero-center > .f5, .hero-center > .f7 { display: none; }
  .hero-center > .f1 { top: 14px; left: 4%; } .hero-center > .f4 { top: 20px; right: 5%; }
  .glow { inset: -50px -30px; }
  .ask-wrap { margin-top: 88px; }
  .hero-center > .f3 { top: 84px; bottom: auto; left: 5%; } .hero-center > .f6 { top: 76px; bottom: auto; right: 6%; }   /* fallback only: placeBlocks() in app.js sets the real top beside the measured first line */
  .answer .sc-items { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stage { min-height: 340px; padding: 18px; }
  .ask-field textarea, .ask-ghost { font-size: 18px; }
  .ask-hint { display: none; }
  .lib { grid-template-columns: 1fr; }
  .lib-sets { display: flex; overflow-x: auto; overflow-y: hidden; height: auto; min-height: 0; border-right: 0; border-bottom: 1px solid var(--rule); scrollbar-width: none; }
  .lib-sets li { flex: none; }
  .lib-sets button { border-bottom: 0; border-right: 1px solid var(--rule); padding: 14px 16px; }
  .lib-sets button[aria-current="true"] { padding-left: 16px; box-shadow: inset 0 -3px 0 var(--b500); }
  .lib-sets .c { display: none; }
  .lib-stage { min-height: 0; padding: 20px; }
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cell { padding: 10px; }
  .cx-body, .sheet-view, .decode-grid, .signin-wrap { grid-template-columns: 1fr; }
  .cx-screen, .sheet-stage, .decode-frames { border-right: 0; border-bottom: 1px solid var(--rule); }
  .sheet-stage { min-height: 0; }
  .quota { grid-template-columns: 1fr; gap: 18px; }
  .gen-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts div:nth-child(2) { border-right: 0; }
  .facts div:nth-child(-n+2) { border-bottom: 1px solid var(--rule); }
  .account-grid { grid-template-columns: 1fr; }
  .account-grid > div { border-right: 0; border-bottom: 1px solid var(--rule); }
  .sec { padding-block: 52px; }
  .foot-note { margin-left: 0; }
}

/* Styles gallery (#styles, #styles-<direction>) */
.dir-list { display: grid; gap: 16px; }
.dir-card { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; padding: 16px; border: 1px solid var(--rule); background: var(--card); text-decoration: none; color: inherit; }
.dir-card:hover { border-color: var(--b400); }
.dir-mosaic { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; border: 1px solid var(--rule); background: var(--rule); }
.dir-mosaic img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.dir-info { display: grid; gap: 6px; align-content: start; }
.dir-name { font-weight: 500; font-size: 18px; color: var(--ink); }
.dir-about { color: var(--ink-2); font-size: 14px; }
.dir-count { font: 500 12px/1 var(--f-mono); color: var(--ink-3); }
.style-group { margin: 28px 0 12px; font-weight: 500; font-size: 20px; color: var(--ink); }
.style-group:first-child { margin-top: 0; }
.style-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.style-card { display: flex; flex-direction: column; border: 1px solid var(--rule); background: var(--card); overflow: hidden; }
.style-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--stage-a); }
.style-media > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.style-media .style-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s linear; pointer-events: none; }
.style-media .style-video.on { opacity: 1; }
.style-credit { margin: 24px 0 0; font: 400 12px/1.6 var(--f-mono); color: var(--ink-3); }
.style-credit a { color: inherit; }
@media (prefers-reduced-motion: reduce) { .style-media .style-video { display: none; } }
.style-card-body { display: grid; gap: 8px; padding: 14px 16px 16px; align-content: start; }
.style-name { margin: 0; font-weight: 500; font-size: 16px; line-height: 1.3; }
.style-line { margin: 0; color: var(--ink-2); font-size: 13px; }
.style-id { margin: 0; font: 500 12px/1.3 var(--f-mono); color: var(--ink-3); }
.style-actions { display: flex; align-items: center; gap: 14px; margin-top: 4px; flex-wrap: wrap; }
.style-actions .btn-ghost { padding: 10px 14px; font-size: 14px; white-space: normal; text-align: center; }
@media (min-width: 900px) { .style-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 600px) { .dir-card { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* Pixel button icons (decorate() in app.js): each acts out its button's job; his reference slides one arrow everywhere */
.ico { display: inline-block; flex: none; vertical-align: -0.15em; overflow: visible; }
.ico-play .i-b { opacity: 0; }
/* a mouse: loops while pointing. A touch screen keeps :hover on the last thing tapped, so there only .tap plays
   (once, about 0.9 s, set by app.js) — critic, 28 Oct 2026: the loop kept running after a tap */
@media (hover: hover) {
  :is(:hover, :focus-visible) > .ico-play .i-a { animation: icoNudge .5s steps(1) infinite; }
  :is(:hover, :focus-visible) > .ico-play .i-b { opacity: 1; animation: icoBlink .5s steps(1) infinite; }
  :is(:hover, :focus-visible) > .ico-up .i-a { animation: icoUp .9s steps(1) infinite; }
  :is(:hover, :focus-visible) > .ico-down .i-a { animation: icoDown .9s steps(1) infinite; }
  :is(:hover, :focus-visible) > .ico-copy .i-b { animation: icoCopy .9s steps(1) infinite; }
  :is(:hover, :focus-visible) > .ico-head .i-a { animation: icoPoint .8s steps(1) infinite; }   /* the playhead is drawn pointing down and turned to point right, so it moves on its own y */
}
.tap > .ico-play .i-a { animation: icoNudge .3s steps(1) 3; }
.tap > .ico-play .i-b { opacity: 1; animation: icoBlink .3s steps(1) 3 forwards; }
.tap > .ico-up .i-a { animation: icoUp .9s steps(1) 1; }
.tap > .ico-down .i-a { animation: icoDown .9s steps(1) 1; }
.tap > .ico-copy .i-b { animation: icoCopy .9s steps(1) 1; }
.tap > .ico-head .i-a { animation: icoPoint .8s steps(1) 1; }
@keyframes icoNudge { 50% { transform: translateX(2px); } }
@keyframes icoBlink { 50% { opacity: .35; } }
@keyframes icoUp { 25% { transform: translateY(-1px); } 50% { transform: translateY(-2px); } 75% { transform: translateY(-3px); } }
@keyframes icoDown { 25% { transform: translateY(1px); } 50% { transform: translateY(2px); } 75% { transform: translateY(3px); } }
@keyframes icoCopy { 33% { transform: translate(-1px, -1px); } 66% { transform: translate(-2px, -2px); } }
@keyframes icoPoint { 25% { transform: translateY(1px); } 50% { transform: translateY(2px); } 75% { transform: translateY(3px); } }
#copyUrl, button[data-copy], button[data-dl]:not(.set-cell) { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
/* set list: the selected set shows the playhead, pointing at it */
.lib-sets button .ico-head { order: -1; transform: rotate(-90deg); color: var(--b500); opacity: 0; margin-right: -4px; }
.lib-sets button[aria-current="true"] .ico-head { opacity: 1; animation: none; }   /* still: an endless loop here restyled the page every frame (lag, 29 Oct 2026) */
/* set page: a download mark in each cell's corner, always shown on touch screens */
.set-cell .ico-down { position: absolute; right: 8px; top: 8px; color: var(--on-stage-a); opacity: 0; transition: opacity .2s; }
.set-cell:hover .ico-down, .set-cell:focus-visible .ico-down { opacity: .9; }
/* on a touch screen the hover arrow was drawn on every piece at 70% (16 arrows over the artwork); the whole cell is
   already the download button, so the hint stays for mouse users only */
@media (hover: none) { .set-cell .ico-down { display: none; } }

/* ---------- make new (#make): form on the left, the plan as it will be spent on the right ---------- */
.mk { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 400px); border: 1px solid var(--rule); }
.mk-form { display: grid; gap: 20px; padding: 28px; align-content: start; min-width: 0; }
.mk-field { display: grid; gap: 8px; min-width: 0; }
.mk-field textarea, .mk-field input { width: 100%; padding: 12px 14px; border: 1px solid var(--rule); background: var(--card); color: var(--ink); font: inherit; outline: 0; resize: vertical; }
.mk-field textarea:focus, .mk-field input:focus { border-color: var(--b500); }
.mk-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; }
.mk-check { display: flex; gap: 10px; align-items: center; font-size: 15px; }
.mk-check input { width: 18px; height: 18px; accent-color: var(--b500); }
.seg { display: inline-flex; border: 1px solid var(--rule); justify-self: start; }
.seg button { padding: 10px 18px; border: 0; background: var(--card); color: var(--ink-2); font: 500 15px/1.2 var(--f-sans); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--paper); }
.mk-ref { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.mk-ref img { width: 72px; height: 72px; object-fit: cover; border: 1px solid var(--rule); }
.mk-plan { min-height: 0; padding: 28px; display: grid; gap: 14px; align-content: start; color: var(--on-stage-a, var(--ink)); border-left: 1px solid var(--rule); }
.mk-plan > * { position: relative; }
.mk-sum { margin: 0; font-size: 17px; line-height: 1.55; }
.mk-grids { display: flex; flex-wrap: wrap; gap: 10px; }
/* one square per image the job uses, cut by the real grid the system planned */
.mk-grid { position: relative; width: 150px; background: var(--card); border: 1.5px solid var(--b500); }
.mk-grid i { position: absolute; inset: 0; background-image: linear-gradient(to right, var(--b300) 1px, transparent 1px), linear-gradient(to bottom, var(--b300) 1px, transparent 1px); background-size: calc(100% / var(--c)) calc(100% / var(--r)); }
.mk-alts { display: flex; flex-wrap: wrap; gap: 8px; }
.mk-alts button { display: grid; gap: 2px; padding: 8px 12px; border: 1px solid var(--rule); background: var(--card); color: var(--ink); cursor: pointer; text-align: left; font: 400 13px/1.3 var(--f-sans); }
.mk-alts button b { font-weight: 600; font-size: 14px; }
.mk-alts button span { color: var(--ink-3); font-family: var(--f-mono); }
.mk-alts button[aria-checked="true"] { border-color: var(--b500); box-shadow: inset 0 0 0 1px var(--b500); }
.mk-plan .btn { width: 100%; justify-content: center; text-align: center; }
.mk-jobs { display: grid; gap: 20px; margin-top: 40px; }
.mk-jobs:empty { display: none; }
.mk-jobs-title { margin: 0; }
.mk-job { border: 1px solid var(--rule); display: grid; }
.mk-job-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; padding: 18px 20px; border-bottom: 1px solid var(--rule); }
.mk-job-head > div { min-width: 0; }
.mk-job-what { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.mk-tag { display: inline-flex; gap: 8px; align-items: center; font: 500 13px/1.3 var(--f-sans); padding: 5px 8px; background: var(--b50); color: var(--b800); white-space: nowrap; }
.mk-tag.ok { background: var(--b100); }
.mk-tag.bad { background: #FFE9E3; color: #9A2A12; white-space: normal; }
:root[data-theme="dark"] .mk-tag { background: var(--stage-a); color: var(--b200); }
:root[data-theme="dark"] .mk-tag.bad { background: #3A1A12; color: #FFB4A0; }
.mk-img { display: grid; gap: 12px; padding: 18px 20px; border-top: 1px solid var(--rule); min-width: 0; }
.mk-img:first-of-type { border-top: 0; }
.mk-img-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.mk-img-tools .btn-ghost:disabled { opacity: .5; cursor: default; }
/* pieces sit on a check pattern so the transparent edge shows */
.mk-pieces { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.mk-pieces figure { --ck: var(--rule); background: conic-gradient(var(--ck) 25%, var(--card) 0 50%, var(--ck) 0 75%, var(--card) 0) 0 0 / 16px 16px; }
.mk-pieces figure { margin: 0; position: relative; aspect-ratio: 1; display: grid; place-items: center; border: 1px solid var(--rule); }
.mk-pieces figure.bad { outline: 2px solid #E0572F; outline-offset: -2px; }
.mk-pieces img { max-width: 86%; max-height: 74%; object-fit: contain; }
.mk-pieces figcaption { position: absolute; left: 4px; right: 4px; bottom: 4px; font-size: 11px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-pieces figure button { position: absolute; inset: 0; border: 0; background: transparent; cursor: pointer; }
.mk-pieces figure button:hover { box-shadow: inset 0 0 0 2px var(--b500); }
.mk-anims { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.mk-anim { margin: 0; display: grid; gap: 6px; align-content: start; }
.mk-anim figcaption { display: grid; gap: 4px; justify-items: start; font-size: 13px; }
/* every animation sits in the same square, its own frame shape inside */
.mk-box { aspect-ratio: 1; display: grid; place-items: center; border: 1px solid var(--rule); background: conic-gradient(var(--rule) 25%, var(--card) 0 50%, var(--rule) 0 75%, var(--card) 0) 0 0 / 16px 16px; }
/* the strip plays by compositor steps (L59) and only while it is on screen (.on) */
.mk-play { width: 92%; max-height: 92%; background: var(--img) 0 0 / calc(var(--n) * 100%) 100% no-repeat; }
.mk-play.on { animation: mkStrip var(--d) steps(var(--n), jump-none) infinite; }
@keyframes mkStrip { to { background-position: 100% 0; } }
.mk-anims .mk-tag { font-size: 12px; padding: 3px 6px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--b600); font: inherit; text-decoration: underline; cursor: pointer; }
@media (max-width: 900px) {
  .mk { grid-template-columns: 1fr; }
  .mk-plan { border-left: 0; border-top: 1px solid var(--rule); }
  .mk-form, .mk-plan { padding: 20px 16px; }
  .mk-job-head { flex-direction: column; }
  .mk-img, .mk-job-head { padding: 16px; }
}
.mk-len { display: flex; gap: 8px; align-items: stretch; }
.mk-len input { flex: 1; min-width: 0; }
.mk-frames { margin: 0; font: 500 14px/1.4 var(--f-mono); }

/* generation not open to everyone yet: the system's message in place of the button (his card, 5 Nov 2026) */
.mk-closed { margin: 0; padding: 14px 16px; background: var(--card); border: 1px dashed var(--b300); color: var(--ink); font-weight: 500; }
/* open beta §3.3: a refusal turns the plan box into the way around it — the prompt to make it yourself, then the picture
   brought back — never an upsell or a dead button */
.mk-own { display: grid; gap: 10px; min-width: 0; }
.mk-own > .btn-ghost { width: 100%; text-align: center; white-space: normal; }
.mk-own .with-prompt { font-size: 14px; }
.mk-own-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mk-spec { font: 500 13px/1.3 var(--f-mono); color: var(--ink-3); }
.mk-mine { display: grid; gap: 16px; margin-top: 40px; }
.mk-mine:empty { display: none; }
.mk-mine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.mk-mine-item { display: grid; gap: 10px; align-content: start; padding: 12px; border: 1px solid var(--rule); min-width: 0; }
.mk-mine-item .mk-box { aspect-ratio: 16 / 10; }
.mk-mine-item img { max-width: 96%; max-height: 92%; object-fit: contain; }
.mk-mine-item .mk-consent { align-items: start; font-size: 13px; line-height: 1.45; }
.mk-mine-item .mk-consent input { flex: none; margin-top: 2px; }
.mk-mine-item .btn-ghost { text-align: center; white-space: normal; }
.mk-mine-item .btn-ghost:disabled { opacity: .5; cursor: default; }
.mk-mine-item .mk-tag { justify-self: start; white-space: normal; }
/* review: one shared sheet at a time, the picture first and as large as the screen allows, two big buttons */
.rv { display: grid; gap: 16px; max-width: 880px; }
.rv-pic { background: conic-gradient(var(--rule) 25%, var(--card) 0 50%, var(--rule) 0 75%, var(--card) 0) 0 0 / 20px 20px; border: 1px solid var(--rule); display: grid; place-items: center; }
.rv-pic img { width: 100%; max-height: 70vh; object-fit: contain; display: block; }
.rv-info { display: grid; gap: 6px; }
.rv-info p { margin: 0; }
.rv-title { margin: 0; font-size: 22px; font-weight: 600; }
.rv-act { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; position: sticky; bottom: 12px; }
.rv-act .btn { justify-content: center; padding-block: 16px; font-size: 17px; }
.rv-act .btn:disabled { opacity: .45; cursor: not-allowed; }
#rvLive { display: grid; gap: 12px; }
.rv-state { margin: 0; }
.rv-parts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.rv-parts li { aspect-ratio: 1; display: grid; place-items: center; border: 1px solid var(--rule); background: conic-gradient(var(--rule) 25%, var(--card) 0 50%, var(--rule) 0 75%, var(--card) 0) 0 0 / 12px 12px; }
.rv-parts li.bad { border: 2px solid #D93025; }
.rv-parts img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.rv-fail { border: 1px solid var(--rule); padding: 14px; display: grid; gap: 10px; justify-items: start; }
.rv-fail p { margin: 0; }
.account-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.acc-decodes { margin-top: 24px; display: grid; gap: 10px; }
.dec-list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--rule); }
.dec-list li { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--rule); }
.dec-list li:first-child { border-top: 0; }
.dec-list span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dec-list small { color: var(--ink-3); white-space: nowrap; }
@media (max-width: 900px) { .account-grid { grid-template-columns: 1fr; } }

/* ตามคลิปดัง (#clips / #clip-<id>): a list of popular clips, then one clip's moments with a library search per row */
.clip-list { display: grid; gap: 16px; }
@media (min-width: 1000px) { .clip-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.clip-card { display: grid; gap: 8px; padding: 20px; border: 1px solid var(--rule); background: var(--card); text-decoration: none; }
.clip-card:hover { border-color: var(--b400); }
.cc-top { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin: 0; }
.cc-creator { font-weight: 600; font-size: 15px; }
.cc-meta { color: var(--ink-3); font-family: var(--f-mono); font-size: 12px; }
.cc-views { margin: 0; color: var(--b600); font-weight: 500; font-size: 14px; }
:root[data-theme="dark"] .cc-views { color: var(--b300); }
.cc-topic { margin: 0; font-weight: 500; font-size: 18px; line-height: 1.45; }
.cc-count { margin: 0; color: var(--ink-2); font-size: 14px; }

.clip-moments { list-style: none; margin: 16px 0 0; padding: 0; border-top: 1px solid var(--rule); }
.clip-moment { border-bottom: 1px solid var(--rule); }
.cm-main { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 16px 0; }
.cm-time { font: 500 14px/1.4 var(--f-mono); color: var(--ink-3); padding-top: 3px; }
.cm-what { margin: 0; }
.cm-find { justify-self: end; }
.clip-results.has-cells { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-left: 1px solid var(--rule); border-top: 1px solid var(--rule); margin-bottom: 16px; }
.clip-results .cell { min-width: 0; }
.clip-none { margin: 0 0 16px; padding: 12px 16px; color: var(--ink-2); background: var(--paper); border: 1px solid var(--rule); }
.clip-none a { color: var(--b600); }
:root[data-theme="dark"] .clip-none a { color: var(--b300); }

.clip-prompt { display: grid; gap: 10px; margin-top: 28px; }
.clip-prompt-out { width: 100%; min-height: 150px; padding: 14px 16px; background: var(--paper); border: 1px solid var(--rule); font: 400 14px/1.6 var(--f-mono); color: var(--ink); resize: vertical; }
.clip-acts { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 720px) {
  .cm-main { grid-template-columns: 44px minmax(0, 1fr); }
  .cm-find { grid-column: 2; justify-self: start; }
  .clip-results.has-cells { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* The ? help button (PAGE-RULES.md): explanations open on a press, never sit in the reading path. */
.help-q { position: relative; justify-self: start; }
.help-q summary { list-style: none; width: 32px; height: 32px; margin: 2px; display: grid; place-items: center; cursor: pointer; color: var(--b500); background: var(--card);
  box-shadow: 0 -2px 0 var(--b500), 0 2px 0 var(--b500), -2px 0 0 var(--b500), 2px 0 0 var(--b500); }
.help-q summary::-webkit-details-marker { display: none; }
.help-q summary svg { display: block; shape-rendering: crispEdges; }
.help-q summary:hover, .help-q[open] summary { background: var(--b500); color: #FFFFFF; }
.help-q summary:focus-visible { outline: 2px solid var(--b500); outline-offset: 2px; }
.help-q-body { position: absolute; z-index: 5; left: 0; top: calc(100% + 10px); width: min(340px, calc(100vw - 48px)); display: grid; gap: 8px; padding: 14px 16px; background: var(--ink); box-shadow: 4px 4px 0 var(--b500); }
.help-q-body p { margin: 0; color: var(--paper); font-size: 14px; line-height: 1.55; }
.help-q-body a { color: inherit; }

/* #beta (open beta §4): one column of the #make form fields; the ticks wrap under their box on a phone */
.bt-form { display: grid; gap: 18px; max-width: 640px; min-width: 0; }
.bt-form .mk-check { align-items: flex-start; line-height: 1.5; }
.bt-form .mk-check input { flex: 0 0 auto; margin-top: 2px; }
.bt-file, .bt-prog { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; min-width: 0; }
.bt-file .note { overflow-wrap: anywhere; min-width: 0; }
.bt-prog progress { flex: 1 1 160px; height: 10px; accent-color: var(--b500); }
.bt-form .btn { justify-self: start; }
.bt-msg:empty { display: none; }
.bt-done { display: grid; gap: 14px; max-width: 640px; }
.bt-done .btn { justify-self: start; }
#btBox { margin-top: 16px; }
.bt-code { font-family: var(--f-mono); letter-spacing: .08em; color: var(--ink); }
.bt-remove { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.25); }
.bt-remove .mono-label { color: var(--paper); flex: 0 0 100%; }
.bt-remove input { flex: 1 1 120px; min-width: 0; padding: 8px 10px; border: 0; font: inherit; font-size: 14px; }
.bt-remove .btn-ghost { background: transparent; color: var(--paper); border: 1px solid var(--paper); }
.bt-remove input { background: var(--paper); color: var(--ink); }

/* One-field ask form (open beta §5.2 way 3): under a library search with no result, and at the foot of the styles pages */
.wish-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; min-width: 0; max-width: 520px; }
.wish-form input { flex: 1 1 180px; min-width: 0; padding: 10px 12px; border: 1px solid var(--rule); background: var(--card); color: var(--ink); font: inherit; }
.wish-row { padding-top: 0; }
