/* ---- tokens ---------------------------------------------------------------------------
   Warm paper and ink, one vermilion accent used sparingly. The inline script in
   index.html always sets data-theme, so dark tokens only need one block. */
:root {
  --bg: #f5f4f0;
  --surface: #fbfaf8;
  --surface-2: #eeede8;
  --raised: #ffffff;
  --ink: #1c1b19;
  --ink-2: #4a4843;
  --muted: #74716a;
  --line: #e3e1db;
  --line-2: #d0cdc5;
  --accent: #bf3f28;
  --accent-soft: rgb(191 63 40 / 9%);
  --inv: #1c1b19;
  --inv-hover: #34332f;
  --inv-ink: #f5f4f0;
  --glass: rgb(245 244 240 / 94%);
  --shadow-sm: 0 1px 2px rgb(28 27 25 / 5%);
  --shadow-lg: 0 18px 50px -12px rgb(28 27 25 / 22%), 0 2px 6px rgb(28 27 25 / 6%);
  --mark-bg: #ffffff;
  --img-bg: #e9e7e1;

  --radius: 12px;
  --radius-sm: 8px;
  --sans: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", Georgia, serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --wrap: 1200px;
  --gutter: 32px;
  --topbar: 64px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #121211;
  --surface: #191918;
  --surface-2: #222220;
  --raised: #1e1e1c;
  --ink: #ecebe6;
  --ink-2: #bcb9b1;
  --muted: #8d8a82;
  --line: #2a2927;
  --line-2: #3b3a36;
  --accent: #e46a50;
  --accent-soft: rgb(228 106 80 / 13%);
  --inv: #ecebe6;
  --inv-hover: #ffffff;
  --inv-ink: #121211;
  --glass: rgb(18 18 17 / 93%);
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 30%);
  --shadow-lg: 0 20px 60px -12px rgb(0 0 0 / 70%), 0 0 0 1px rgb(255 255 255 / 4%);
  --mark-bg: #f1f0ec;
  --img-bg: #1f1f1d;
  color-scheme: dark;
}

/* ---- base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar) + 64px); }
html, body { max-width: 100%; overflow-x: clip; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.lb-open, body.is-viewer { overflow: hidden; }
::selection { background: var(--accent-soft); color: var(--ink); }
a { color: inherit; }
a:not([class]) { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; transition: text-decoration-color 0.2s; }
a:not([class]):hover { text-decoration-color: var(--accent); }
img { display: block; max-width: 100%; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
code { font: 0.88em var(--mono); background: var(--surface-2); padding: 0.1em 0.4em; border-radius: 4px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 12.5px; line-height: 1.65; margin: 12px 0 0; }
.wrap { width: min(100%, var(--wrap) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.i { width: 1.15em; height: 1.15em; flex: none; }

/* Content fades up on each route; images fade in once decoded. */
.page { animation: rise 0.5s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
img[loading="lazy"], .result-media img, .mosaic img { opacity: 0; transition: opacity 0.5s ease, transform 0.8s var(--ease), filter 0.5s ease; }
img.is-loaded { opacity: 1; }

/* Theme switch cross-fades through the View Transitions API where available. */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.35s; animation-timing-function: ease; }

/* ---- controls ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--raised); color: var(--ink);
  font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.2s var(--ease);
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn .i { width: 16px; height: 16px; }
.btn.primary { background: var(--inv); border-color: var(--inv); color: var(--inv-ink); }
.btn.primary:hover { background: var(--inv-hover); border-color: var(--inv-hover); }
.btn.primary .i { transition: transform 0.25s var(--ease); }
.btn.primary:hover .i { transform: translateX(2px); }
.btn.is-disabled { opacity: 0.35; pointer-events: none; }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; gap: 6px; }
.btn.sm .i { width: 14px; height: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.link { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.link:hover { text-decoration-color: var(--accent); }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; flex: none;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--ink-2);
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn .i { width: 18px; height: 18px; }
.theme-toggle .i:last-child, :root[data-theme="dark"] .theme-toggle .i:first-child { display: none; }
:root[data-theme="dark"] .theme-toggle .i:last-child { display: block; }
.theme-toggle:hover .i { animation: tilt 0.5s var(--ease); }
@keyframes tilt { 40% { transform: rotate(-18deg); } }

.kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 0 14px; color: var(--muted); font: 12px/1.5 var(--mono); letter-spacing: 0.02em; }
.kicker .num { color: var(--accent); }
.eyebrow { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; color: var(--muted); font: 500 11.5px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; }
.eyebrow-mark { width: 18px; height: 1px; background: var(--accent); }
.lead { margin: 18px 0 0; max-width: 40em; color: var(--ink-2); font-size: 16.5px; line-height: 1.75; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tags li { padding: 0 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2); font-size: 12px; line-height: 24px; }
.badge {
  display: inline-block; margin-left: 6px; padding: 0 6px; border: 1px solid var(--line-2); border-radius: 4px;
  color: var(--ink-2); font: 500 10.5px/17px var(--mono); letter-spacing: 0.02em; vertical-align: 1px;
}
.badge.source-badge { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.img-empty { display: grid; place-items: center; background: var(--img-bg); color: var(--muted); font-size: 13px; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none;
  border: 1px solid var(--line); border-radius: 9px; background: var(--mark-bg);
  color: #4a4843; font: 600 15px var(--sans); text-decoration: none;
  transition: border-color 0.2s, transform 0.2s var(--ease);
}
.brand-mark img { width: 22px; height: 22px; object-fit: contain; opacity: 1; }
a.brand-mark:hover { border-color: var(--ink-2); transform: translateY(-1px); }
.brand-mark.sm { width: 20px; height: 20px; border-radius: 5px; font-size: 11px; }
.brand-mark.sm img { width: 13px; height: 13px; }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { display: flex; align-items: center; gap: 14px; height: var(--topbar); }
.brand { display: flex; align-items: center; gap: 11px; flex: none; text-decoration: none; }
.logo { width: 28px; height: 28px; flex: none; }
.logo-bg { fill: var(--ink); }
.logo-fg { fill: var(--bg); }
.logo-ac { fill: var(--accent); transition: transform 0.35s var(--ease); }
.brand:hover .logo-ac { transform: translateY(1.5px); }
.wordmark { font-size: 16px; font-weight: 650; letter-spacing: 0.12em; }
.brand-sub { padding-left: 12px; border-left: 1px solid var(--line-2); color: var(--muted); font-size: 12.5px; line-height: 16px; }
.crumbs { display: flex; align-items: center; min-width: 0; color: var(--ink-2); font-size: 13.5px; }
.crumbs .sep { margin: 0 12px 0 4px; color: var(--line-2); }
.crumbs span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs a { text-decoration: none; }
.topbar-tools { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.preview-setting { display: flex; flex: none; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.preview-setting button { min-height: 28px; padding: 0 9px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 12px; white-space: nowrap; }
.preview-setting button:hover { color: var(--ink); }
.preview-setting button[aria-pressed="true"] { background: var(--raised); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / 8%); }
.topbar-link { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: var(--radius-sm); color: var(--ink-2); font-size: 13.5px; text-decoration: none; transition: color 0.2s, background-color 0.2s; }
.topbar-link:hover { color: var(--ink); background: var(--surface-2); }
.topbar-link .i { width: 14px; height: 14px; opacity: 0.7; }

/* ---- home ---- */
.hero { padding-block: 88px 56px; }
.hero h1 { font: 600 clamp(48px, 7.2vw, 96px)/1.08 var(--serif); letter-spacing: 0.02em; }
.hero h1 .stop { color: var(--accent); }
.hero-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 32px 48px; margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--line); }
.hero .lead { margin: 0; max-width: 33em; font-size: 15.5px; }
.stats { display: flex; margin: 0; }
.stats div { display: flex; flex-direction: column-reverse; padding: 0 24px; border-left: 1px solid var(--line); }
.stats div:first-child { border-left: 0; }
.stats div:last-child { padding-right: 0; }
.stats dt { color: var(--muted); font-size: 12px; }
.stats dd { margin: 0 0 4px; font: 400 32px/1.1 var(--mono); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }

.block { padding-block: 32px; }
.block-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin-bottom: 24px; }
.block-head h2 { font-size: 22px; letter-spacing: 0; }
.block-head p { margin: 0; color: var(--muted); font-size: 13.5px; }
.block-head .block-hint { margin-left: auto; }

.task-list { display: grid; gap: 20px; }
.task-card {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.mosaic { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(2, 1fr); gap: 2px; min-height: 360px; background: var(--line); text-decoration: none; }
.mosaic figure { position: relative; margin: 0; min-height: 0; overflow: hidden; background: var(--img-bg); }
.mosaic figure:first-child { grid-column: span 2; grid-row: span 2; }
.mosaic.n2 figure:nth-child(2), .mosaic.n3 figure:nth-child(3) { grid-column: span 2; grid-row: span 2; }
.mosaic.n3 figure:nth-child(2) { grid-row: span 2; }
.mosaic.n1 figure:first-child { grid-column: 1 / -1; }
.mosaic img, .mosaic .img-empty { width: 100%; height: 100%; object-fit: cover; }
.mosaic:hover img.is-loaded { transform: scale(1.025); }
.mosaic figcaption {
  position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); padding: 2px 8px; border-radius: 4px;
  background: rgb(20 20 18 / 62%); color: #fff; font-size: 11px; line-height: 18px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0; transition: opacity 0.25s;
}
.mosaic figure:hover figcaption { opacity: 1; }
.task-body { display: flex; flex-direction: column; padding: 36px 36px 32px; }
.task-body h3 { font: 600 32px/1.25 var(--serif); letter-spacing: 0.01em; }
.task-body h3 a { text-decoration: none; }
.task-body h3 a:hover { color: var(--ink-2); }
.summary { margin: 12px 0 0; color: var(--ink-2); }
.task-body .tags { margin-top: 18px; }
.figures { display: flex; gap: 28px; margin: 28px 0 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.figures div { display: flex; flex-direction: column-reverse; }
.figures dt { color: var(--muted); font-size: 12px; }
.figures dd { margin: 0; font: 400 24px/1.2 var(--mono); letter-spacing: -0.02em; }
.task-body .actions { margin-top: auto; }

/* model directory */
.directory > summary { list-style: none; cursor: pointer; margin-bottom: 0; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.directory > summary::-webkit-details-marker { display: none; }
.dir-toggle { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; color: var(--muted); font-size: 13px; }
.dir-toggle .i { width: 16px; height: 16px; transform: rotate(-90deg); transition: transform 0.25s var(--ease); }
.directory:not([open]) .dir-toggle .i { transform: rotate(90deg); }
.directory[open] .when-closed, .directory:not([open]) .when-open { display: none; }
.directory > summary:hover .dir-toggle { color: var(--ink); }
.dir-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; padding-block: 22px; border-bottom: 1px solid var(--line); }
.dir-vendor h3 { font-size: 15px; }
.dir-vendor p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.dir-models { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 18px 24px; margin: 0; padding: 0; list-style: none; }
.dir-model { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.dir-model-body { min-width: 0; }
.dir-model h4 { font-size: 14.5px; line-height: 36px; }
.dir-model h4 .note { margin-left: 8px; color: var(--muted); font-size: 12px; font-weight: 400; }
.dir-model .muted { margin: 0; font-size: 12.5px; }
.dir-works { margin: -2px 0 0; padding: 0; list-style: none; }
.dir-works a { display: inline-flex; align-items: center; color: var(--ink-2); font-size: 13px; line-height: 1.9; text-decoration: none; }
.dir-works a::before { content: ""; width: 10px; height: 1px; margin-right: 8px; background: var(--line-2); transition: width 0.25s var(--ease), background-color 0.25s; }
.dir-works a:hover { color: var(--ink); }
.dir-works a:hover::before { width: 16px; background: var(--accent); }

.footer { margin-top: 56px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.footer-in { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding-block: 24px 32px; }
.footer p { margin: 0; }
.footer-brand { display: flex; align-items: center; gap: 10px; }
.footer-brand .logo { width: 18px; height: 18px; }
.footer-brand span:first-of-type { color: var(--ink); letter-spacing: 0.1em; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--ink-2); text-decoration: none; }
.footer-links a:hover { color: var(--ink); }
.empty-page { padding-block: 120px; }
.empty-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.platform-notice { border-bottom: 1px solid var(--line); background: var(--accent-soft); color: var(--ink-2); font-size: 13px; line-height: 1.6; }
.platform-notice-in { display: flex; align-items: flex-start; gap: 10px; padding-block: 9px; }
.platform-notice-mark { flex: none; width: 6px; height: 6px; margin-top: 0.6em; border-radius: 50%; background: var(--accent); }
.platform-notice p { flex: 1; min-width: 0; margin: 0; }
.platform-notice strong { margin-right: 8px; color: var(--ink); font-weight: 600; }
.platform-notice .link { flex: none; color: var(--ink); font-size: 13px; line-height: 1.6; }
.build-info { position: relative; }
.build-info summary { color: var(--muted); list-style: none; cursor: pointer; transition: color 0.2s; }
.build-info summary::-webkit-details-marker { display: none; }
.build-info summary:hover, .build-info[open] summary { color: var(--ink); }
.build-info dl {
  position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 25;
  display: grid; grid-template-columns: auto auto; gap: 4px 16px; margin: 0; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--raised); box-shadow: var(--shadow-lg);
  font-size: 12px; white-space: nowrap;
}
.build-info dt { color: var(--muted); }
.build-info dd { margin: 0; color: var(--ink); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.empty-page h1 { font: 600 40px var(--serif); margin-bottom: 12px; }
.empty-page p { color: var(--ink-2); }

/* ---- task ---- */
.task-hero { padding-block: 64px 36px; }
.task-hero h1 { font: 600 clamp(34px, 4.6vw, 56px)/1.15 var(--serif); letter-spacing: 0.02em; }
.task-hero .lead { margin-top: 16px; }
.task-hero-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-top: 28px; }
.task-count { margin: 0; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.subnav {
  position: sticky; top: var(--topbar); z-index: 15;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-block: 1px solid var(--line);
}
.subnav-in { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.subnav-in::-webkit-scrollbar { display: none; }
.subnav button {
  position: relative; flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 50px; padding: 0 12px; border: 0; background: none; color: var(--muted); font-size: 14px;
  transition: color 0.2s;
}
.subnav button:first-child { margin-left: -12px; }
.subnav button::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px;
  background: var(--ink); transform: scaleX(0); transition: transform 0.3s var(--ease);
}
.subnav button:hover { color: var(--ink); }
.subnav button[aria-pressed="true"] { color: var(--ink); font-weight: 600; }
.subnav button[aria-pressed="true"]::after { transform: scaleX(1); }
.subnav .count { padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font: 500 11px/18px var(--mono); }

.result-sort { display: inline-flex; align-items: center; align-self: center; gap: 8px; color: var(--muted); font-size: 13px; }
.result-sort select, .vselect, .pane-head select {
  appearance: none; min-width: 0; height: 32px; padding: 0 30px 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background-color: transparent; color: var(--ink-2); cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(-45deg, transparent 50%, currentColor 50%);
  background-position: right 15px center, right 11px center; background-size: 4px 4px; background-repeat: no-repeat;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.result-sort select:hover, .vselect:hover, .pane-head select:hover { border-color: var(--line-2); color: var(--ink); background-color: var(--surface-2); }
.result-sort select:focus-visible, .vselect:focus-visible, .pane-head select:focus-visible { border-radius: 999px; }
.result-sort option, .vselect option, .pane-head option { background: var(--surface); color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -8px 0 24px; }
.chips .chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink-2); font-size: 13px;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.chips .chip span { color: var(--muted); font: 11px var(--mono); }
.chips .chip:hover { border-color: var(--line-2); color: var(--ink); }
.chips .chip[aria-pressed="true"] { background: var(--inv); border-color: var(--inv); color: var(--inv-ink); }
.chips .chip[aria-pressed="true"] span { color: inherit; opacity: 0.65; }

.result-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 20px; }
.result { display: flex; flex-direction: column; min-width: 0; }
.result-media { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--img-bg); aspect-ratio: 16 / 10; box-shadow: 0 0 0 1px var(--line); transition: box-shadow 0.25s; }
.result-media > a { display: block; width: 100%; height: 100%; }
.result-media img, .result-media .img-empty { width: 100%; height: 100%; object-fit: cover; }
.result-media:hover img.is-loaded { transform: scale(1.03); }
.result-model-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity 0.4s ease; }
.has-model-preview .result-model-canvas { opacity: 1; }
/* Model mode: a baked still of the resting model stands in for the screenshot until the canvas fades in over it. */
.result-media img.result-model-poster { position: absolute; inset: 0; object-fit: contain; }
body:not([data-preview-mode="model"]) .result-model-poster,
body[data-preview-mode="model"] .result-media > a:has(.result-model-poster) > img:not(.result-model-poster) { display: none; }
.result-media:hover img.result-model-poster { transform: none; }
.has-model-preview .result-media > a > img { opacity: 0; transition-delay: 0.4s; }
.has-model-preview .result-media > a > img:not(.result-model-poster) { transition-delay: 0s; filter: blur(6px); transform: scale(1.04); }
.result-model-status { position: absolute; left: 12px; bottom: 12px; padding: 3px 9px; border-radius: 999px; background: var(--glass); color: var(--ink-2); font-size: 11px; pointer-events: none; opacity: 0; transition: opacity 0.25s ease; }
/* Fast loads never show the pill. */
.result[data-preview-state="loading"] .result-model-status { opacity: 1; transition-delay: 0.6s; }
.result[data-preview-state="error"] .result-model-status { opacity: 1; }
.result[data-preview-state="ready"] .result-model-status { display: none; }
.result-model-loader { position: fixed; left: -1500px; top: 0; width: 1000px; height: 700px; border: 0; pointer-events: none; visibility: hidden; }
.result.picked .result-media { box-shadow: 0 0 0 2px var(--accent); }
.play, .pick {
  position: absolute; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border: 0; border-radius: 999px; background: rgb(20 20 18 / 66%); color: #fff; font-size: 12px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: opacity 0.25s, transform 0.25s var(--ease), background-color 0.2s;
}
.play { left: 12px; bottom: 12px; opacity: 0; transform: translateY(4px); }
.result-media .play, .result-media .pick { z-index: 1; }
.play .i { width: 14px; height: 14px; }
.result-media:hover .play, .result-media a:focus-visible .play { opacity: 1; transform: none; }
.pick { top: 10px; right: 10px; padding-left: 5px; opacity: 0; }
.pick:hover { background: rgb(20 20 18 / 82%); }
.pick-box { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgb(255 255 255 / 55%); }
.pick-box .i { width: 12px; height: 12px; }
.pick .i:last-child, .pick[aria-pressed="true"] .i:first-child { display: none; }
.pick[aria-pressed="true"] .i:last-child { display: block; }
.pick[aria-pressed="true"] { background: var(--accent); opacity: 1; }
.pick[aria-pressed="true"] .pick-box { border-color: transparent; background: rgb(255 255 255 / 22%); }
.result-media:hover .pick, .pick:focus-visible, .has-tray .pick { opacity: 1; }
@media (hover: none) { .play, .pick { opacity: 1; transform: none; } }
.result-body { display: flex; flex-direction: column; flex: 1; padding: 16px 2px 0; }
.result-model { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 6px; color: var(--ink-2); font-size: 12.5px; }
.result-model b { font-weight: 500; }
.result-model .badge { margin-left: 0; }
.result h3 { font-size: 18px; }
.result h3 a { text-decoration: none; }
.result h3 a:hover { color: var(--ink-2); }
.result .summary { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin-top: 6px; font-size: 13.5px; line-height: 1.65; color: var(--muted); }
.result-foot { display: flex; gap: 16px; margin-top: auto; padding-top: 12px; }
.text-action { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; padding: 2px 0; color: var(--muted); font-size: 12.5px; text-decoration: none; transition: color 0.2s; }
.text-action .i { width: 14px; height: 14px; }
.text-action .i:last-child { width: 12px; height: 12px; opacity: 0.6; }
.text-action:hover { color: var(--ink); }
.filter-empty { padding: 40px 0; text-align: center; }

/* compare tray */
.tray {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 30;
  display: flex; align-items: center; gap: 16px; width: min(720px, calc(100% - 32px)); padding: 10px 10px 10px 12px;
  background: var(--raised); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
  transform: translateX(-50%); animation: tray-in 0.4s var(--ease) both;
}
@keyframes tray-in { from { opacity: 0; transform: translate(-50%, 16px); } }
.has-tray .footer { padding-bottom: 96px; }
.slots { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; margin: 0; padding: 0; list-style: none; }
.slot { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.slot-thumb { display: grid; place-items: center; width: 56px; height: 36px; flex: none; border-radius: 6px; overflow: hidden; background: var(--img-bg); color: var(--muted); font: 11px var(--mono); }
.slot-thumb img { width: 100%; height: 100%; object-fit: cover; }
.slot.empty .slot-thumb { border: 1px dashed var(--line-2); background: none; }
.slot-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.slot-text b, .slot-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-text b { font-size: 13px; font-weight: 600; }
.slot-text small { color: var(--muted); font-size: 11.5px; }
.slot.empty b { color: var(--muted); font-weight: 500; }
.slot-x { display: grid; place-items: center; width: 24px; height: 24px; flex: none; margin-left: auto; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); }
.slot-x:hover { background: var(--surface-2); color: var(--ink); }
.slot-x .i { width: 14px; height: 14px; }
.vs { flex: none; color: var(--accent); font: italic 12px var(--serif); }
.tray-actions { display: flex; align-items: center; gap: 4px; flex: none; }

/* screenshots */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; max-width: 100%; padding: 3px; border-radius: 10px; background: var(--surface-2); }
.seg button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 7px; background: none; color: var(--ink-2); font-size: 13px; transition: background-color 0.2s, color 0.2s, box-shadow 0.2s; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--raised); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.cond-note { margin: 12px 0 22px; color: var(--muted); font-size: 13px; min-height: 1.6em; }
.shot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 28px 20px; }
.shot-grid.phones { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); max-width: 1000px; }
.shot { margin: 0; }
.shot-img {
  display: block; width: 100%; padding: 0; border: 0; border-radius: var(--radius);
  overflow: hidden; background: var(--img-bg); aspect-ratio: 16 / 10; cursor: zoom-in; box-shadow: 0 0 0 1px var(--line);
}
.phones .shot-img { aspect-ratio: 390 / 844; border-radius: 18px; }
.shot-img img { width: 100%; height: 100%; object-fit: cover; }
.shot-img:hover img.is-loaded { transform: scale(1.02); }
.shot figcaption { display: grid; grid-template-columns: 1fr auto; align-items: baseline; column-gap: 8px; padding: 10px 2px 0; font-size: 13px; }
.shot figcaption b { font-weight: 600; font-size: 14px; }
.shot figcaption span { grid-row: 2; color: var(--muted); font-size: 12.5px; }
.shot figcaption a { grid-row: 1; grid-column: 2; font-size: 12.5px; white-space: nowrap; }

/* prompt */
.prompt { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.prompt-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 10px 8px 18px; border-bottom: 1px solid var(--line);
  font: 12.5px var(--mono); color: var(--muted);
}
.prompt-tools { display: flex; gap: 6px; }
.prompt pre {
  margin: 0; padding: 24px 28px; max-height: 620px; overflow: auto;
  white-space: pre-wrap; word-break: break-word; font: 14px/1.9 var(--sans); color: var(--ink-2);
}

/* ---- lightbox (always dark: photographs read best on a dark ground) ---- */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: grid; grid-template-columns: 72px minmax(0, 1fr) 72px; grid-template-rows: 56px minmax(0, 1fr); align-items: center;
  background: rgb(12 12 11 / 95%); color: #f1f0ec; animation: fade 0.25s ease both;
}
@keyframes fade { from { opacity: 0; } }
.lb-top { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; padding: 0 12px 0 24px; }
.lb-count { color: rgb(255 255 255 / 55%); font: 12px var(--mono); }
.lb-figure { grid-column: 2; grid-row: 2; align-self: stretch; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-width: 0; padding-bottom: 32px; }
.lb-img { max-width: 100%; max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px); border-radius: 6px; object-fit: contain; opacity: 0; transition: opacity 0.3s; }
.lb-img.is-loaded { opacity: 1; }
.lb-caption { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; font-size: 14px; }
.lb-caption span { color: rgb(255 255 255 / 55%); font-size: 12.5px; }
.lb-btn { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: rgb(255 255 255 / 8%); color: #f1f0ec; transition: background-color 0.2s; }
.lb-btn:hover { background: rgb(255 255 255 / 18%); }
.lb-btn .i { width: 20px; height: 20px; }
.lb-nav { grid-row: 2; justify-self: center; width: 44px; height: 44px; }
.lb-prev { grid-column: 1; }
.lb-next { grid-column: 3; }
.lightbox.single .lb-nav { visibility: hidden; }
.lightbox :focus-visible { outline-color: #f1f0ec; }

/* ---- viewer ---- */
.viewer {
  --vbar: 56px;
  position: fixed; inset: 0; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
}
.vbar {
  display: flex; align-items: center; gap: 12px; height: var(--vbar); flex: none; padding: 0 12px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.vback {
  display: flex; align-items: center; gap: 4px; flex: none; max-width: 220px; height: 36px; padding: 0 10px 0 4px;
  border-radius: var(--radius-sm); text-decoration: none; color: var(--ink-2); font-size: 13.5px; transition: background-color 0.2s, color 0.2s;
}
.vback .i { width: 20px; height: 20px; }
.vback-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vback:hover { background: var(--surface-2); color: var(--ink); }
.vnav { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; max-width: 520px; }
.split .vnav { display: none; }
.vselect-wrap { position: relative; display: flex; flex: 1; min-width: 0; }
.vmark { position: absolute; left: 8px; top: 50%; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--mark-bg); transform: translateY(-50%); pointer-events: none; }
.vmark:empty { display: none; }
.vmark img { width: 14px; height: 14px; object-fit: contain; }
.vselect {
  display: block; width: 100%; min-width: 0; height: 36px; padding: 0 30px 0 38px;
  font-size: 13.5px;
}
.split-context { display: none; color: var(--muted); font-size: 13px; }
.split .split-context { display: inline; }
.vtools { display: flex; align-items: center; gap: 2px; flex: none; margin-left: auto; }
.vtool {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 10px;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: none; color: var(--ink-2); font-size: 13px; text-decoration: none;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.vtool .i { width: 17px; height: 17px; }
.vtool.icon-only { width: 36px; padding: 0; }
.vtool:hover { background: var(--surface-2); color: var(--ink); }
.vtool[aria-pressed="true"]:not(.theme-toggle) { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.vdivider { width: 1px; height: 20px; margin: 0 6px; background: var(--line); }
.vmain { position: relative; display: flex; flex: 1; min-height: 0; }
.stage { display: flex; flex: 1; min-width: 0; gap: 1px; background: var(--line); }
.pane { position: relative; display: flex; flex-direction: column; flex: 1; min-width: 0; background: #121211; }
.pane-head { display: none; align-items: center; gap: 8px; min-height: 44px; padding: 0 6px 0 10px; background: var(--surface); border-bottom: 1px solid var(--line); color: var(--ink); }
.split .pane-head { display: flex; }
.pane-tag { display: grid; place-items: center; width: 20px; height: 20px; flex: none; border-radius: 5px; background: var(--surface-2); color: var(--muted); font: 600 11px var(--mono); transition: background-color 0.2s, color 0.2s; }
.split .pane.active .pane-tag { background: var(--accent); color: #fff; }
.pane-head select { flex: 1; font-size: 13px; }
.pane-close { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--muted); }
.pane-close .i { width: 16px; height: 16px; }
.pane-close:hover { background: var(--surface-2); color: var(--ink); }
.pane-body { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.pane-body iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #121211; }
.loader {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: #121211; color: #f1f0ec; text-align: center; padding: 16px; transition: opacity 0.6s ease, visibility 0.6s;
}
.loader::before {
  content: ""; position: absolute; inset: 0; background: var(--cover, none) center / cover; filter: blur(24px) brightness(0.4) saturate(0.9); transform: scale(1.15);
}
.loader > * { position: relative; }
.loader b { font: 600 24px var(--serif); letter-spacing: 0.04em; margin-top: 14px; }
.loader span { color: rgb(255 255 255 / 62%); font-size: 12.5px; }
.loader.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.spinner { width: 28px; height: 28px; border: 2px solid rgb(255 255 255 / 16%); border-top-color: #f1f0ec; border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.guide {
  display: none; flex: none; width: 344px; overflow-y: auto; background: var(--surface); border-left: 1px solid var(--line);
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.guide-open .guide { display: block; animation: slide-in 0.3s var(--ease) both; }
@keyframes slide-in { from { opacity: 0; transform: translateX(12px); } }
.guide-in { padding: 22px 22px 32px; }
.guide-head { display: flex; justify-content: space-between; gap: 12px; }
.guide .eyebrow { margin-bottom: 10px; font-family: var(--sans); letter-spacing: 0.06em; }
.guide h2 { font: 600 22px var(--serif); letter-spacing: 0.02em; }
.guide-model { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.guide-summary { margin: 14px 0 0; color: var(--ink-2); font-size: 13.5px; }
.guide-block { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.guide h3 { margin-bottom: 12px; color: var(--muted); font: 500 11.5px var(--mono); letter-spacing: 0.08em; }
.guide .fine { margin: 10px 0 0; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.presets .chip { min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--ink-2); font-size: 13px; transition: border-color 0.2s, background-color 0.2s, color 0.2s; }
.presets .chip:hover { border-color: var(--line-2); color: var(--ink); }
.presets .chip.on { background: var(--inv); border-color: var(--inv); color: var(--inv-ink); }
.presets .chip.ghost { border-style: dashed; color: var(--muted); }
.keys { margin: 0; display: grid; gap: 8px; }
.keys div { display: grid; grid-template-columns: minmax(96px, auto) 1fr; gap: 12px; align-items: baseline; font-size: 13px; }
.keys dt {
  justify-self: start; padding: 0 7px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px;
  background: var(--bg); color: var(--ink); font: 11.5px/1.8 var(--mono); word-break: break-all;
}
.keys dd { margin: 0; color: var(--ink-2); }
.tips { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 13.5px; }
.tips li::marker { color: var(--accent); }
.tips li + li { margin-top: 6px; }
.guide-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 26px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .spinner { animation: spin 3s linear infinite !important; }
}

/* ---- responsive ---- */
@media (max-width: 1000px) {
  .task-card { grid-template-columns: 1fr; }
  .mosaic { aspect-ratio: 16 / 9; min-height: 0; }
  .result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dir-row { grid-template-columns: 1fr; gap: 14px; }
  .brand-sub { display: none; }
}
@media (max-width: 1099px) {
  .guide {
    position: absolute; right: 0; top: 0; bottom: 0; z-index: 5; width: min(360px, 100%);
    box-shadow: var(--shadow-lg);
  }
}
@media (max-width: 860px) {
  .vtool-text, .vdivider { display: none; }
  .vtool { width: 36px; padding: 0; }
  .vback { padding-right: 4px; }
  .vback-text { display: none; }
  .vbar { gap: 6px; padding: 0 8px; }
  .split .stage { flex-direction: column; }
  .split-context { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 640px) {
  :root { --gutter: 16px; --topbar: 56px; }
  body { font-size: 14.5px; }
  .brand { gap: 9px; }
  .logo { width: 26px; height: 26px; }
  .wordmark { font-size: 15px; letter-spacing: 0.08em; }
  .crumbs { flex: 1; overflow: hidden; font-size: 13px; }
  .crumbs .sep { flex: none; margin: 0 8px 0 0; }
  .topbar-in { gap: 10px; }
  .topbar-link { padding: 6px; font-size: 12.5px; }
  .has-preview-setting { flex: none; }
  .has-preview-setting .topbar-link { display: none; }
  .hero { padding-block: 56px 36px; }
  .hero h1 { font-size: 48px; }
  .hero-foot { margin-top: 28px; padding-top: 22px; }
  .stats { width: 100%; }
  .stats div { flex: 1; padding: 0 12px; }
  .stats div:first-child { padding-left: 0; }
  .stats dd { font-size: 26px; }
  .block { padding-block: 24px; }
  .block-head .block-hint { display: none; }
  .task-body { padding: 24px 20px; }
  .task-body h3 { font-size: 26px; }
  .mosaic { grid-template-columns: repeat(2, 1fr); grid-template-rows: auto; aspect-ratio: auto; }
  .mosaic figure { aspect-ratio: 16 / 10; }
  .mosaic figure:first-child { grid-column: 1 / -1; grid-row: auto; aspect-ratio: 16 / 9; }
  .mosaic figure:nth-child(n+4) { display: none; }
  .task-hero { padding-block: 40px 28px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chips .chip { flex: none; }
  .result-grid { grid-template-columns: 1fr; gap: 28px; }
  .shot-grid.phones { grid-template-columns: repeat(2, 1fr); gap: 16px 12px; }
  .seg { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .seg button { flex: none; padding: 0 12px; }
  .prompt pre { padding: 18px; font-size: 13.5px; }
  .tray { gap: 8px; padding: 8px; bottom: max(12px, env(safe-area-inset-bottom)); flex-direction: column; align-items: stretch; }
  .slot-thumb { width: 44px; height: 30px; }
  .tray-actions { justify-content: space-between; }
  .tray-actions .btn { flex: 1; }
  .has-tray .footer { padding-bottom: 150px; }
  .lightbox { grid-template-columns: 1fr; }
  .lb-figure { grid-column: 1; padding: 0 12px 88px; }
  .lb-nav { position: absolute; bottom: 24px; }
  .lb-prev { left: calc(50% - 56px); }
  .lb-next { right: calc(50% - 56px); }
  .vtool[data-v="prev"], .vtool[data-v="next"], .vtool[data-v="open"] { display: none; }
  .guide { top: auto; width: 100%; max-height: 72%; border-left: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; }
  .guide-open .guide { animation-name: slide-up; }
  .footer-in { flex-direction: column; align-items: flex-start; }
}
@keyframes slide-up { from { opacity: 0; transform: translateY(16px); } }
