[hidden] { display:none !important; }
  .tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .tile { position: relative; aspect-ratio: 1; min-width: 0; border: 1px solid var(--hair); border-radius: 4px; overflow: hidden; background: var(--page); cursor: zoom-in; padding: 0; display: block; width: 100%; text-decoration: none; }
  .tile:hover { border-color: var(--hair-strong); }
  .tile img { width: 100%; height: 100%; object-fit: contain; display: block; opacity: 0; transition: opacity .2s ease; }
  .tile img.on { opacity: 1; }
  .tile .over { position: absolute; inset: auto 0 0; padding: 8px 10px; background: var(--page); color: var(--ink-soft); border-top: 1px solid var(--hair); font: var(--label); opacity: 0; transition: opacity .2s ease; }
  .tile:hover .over, .tile:focus-visible .over { opacity: 1; }
  .tile.block { display: grid; place-items: center; background: var(--paper-2); font: var(--label); color: var(--ink-soft); }
  .gallery-empty { padding: 36px 0; font: var(--data); }
  .skel { aspect-ratio: 1; background: var(--paper-2); border: 1px solid var(--hair); }
  /* The work panel: painting or code on the left, one rail on the right. */
  .viewer { position: fixed; inset: 0; height: 100dvh; z-index: 60; background: var(--page); }
  .v-inner { display: grid; grid-template-columns: minmax(0, 1fr) 420px; height: 100%; }
  .v-stage { display: grid; grid-template-rows: auto 1fr auto; gap: 10px; min-width: 0; min-height: 0; padding: 22px 32px 20px; }
  .v-stage-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: min(100%, calc(100dvh - 128px)); margin: 0 auto; }
  .v-seg { display: inline-flex; border: 1px solid var(--hair-strong); border-radius: 999px; padding: 2px; }
  .v-seg button { border: 0; background: none; color: var(--ink-soft); font: var(--data); font-size: 13px; padding: 7px 14px; border-radius: 999px; cursor: pointer; }
  .v-seg button[aria-pressed="true"] { background: var(--ink); color: var(--page); }
  .v-position { display: flex; align-items: center; gap: 6px; font: var(--data); font-size: 12.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
  .v-position button { min-width: 36px; min-height: 36px; border: 0; background: none; color: var(--ink); font-size: 16px; cursor: pointer; border-radius: 18px; }
  .v-position button:hover { background: var(--paper-2); }
  .v-position button:disabled { color: var(--ink-faint); cursor: default; background: none; }
  .v-square { position: relative; width: min(100%, calc(100dvh - 128px)); aspect-ratio: 1; margin: 0 auto; border: 1px solid var(--hair); border-radius: 4px; background: var(--page); overflow: hidden; display: grid; place-items: center; }
  .v-square #vart { width: 100%; height: 100%; display: grid; place-items: center; }
  .v-square img { width: 100%; height: 100%; object-fit: contain; display: block; }
  .v-square .none { font: var(--label); color: var(--ink-soft); }
  .v-square pre { margin: 0; width: 100%; height: 100%; overflow: auto; padding: 18px 20px; background: var(--paper-2); color: var(--ink); font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; text-align: left; }
  .v-actions { display: flex; align-items: center; gap: 2px; width: min(100%, calc(100dvh - 128px)); margin: 0 auto; }
  .v-icon { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 10px; border: 0; background: none; border-radius: 18px; color: var(--ink); font: var(--data); font-size: 12.5px; cursor: pointer; text-decoration: none; }
  .v-icon:hover { background: var(--paper-2); }
  .v-icon:disabled { color: var(--ink-faint); cursor: default; }
  .v-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  .v-menu { position: relative; }
  .v-menu-list { position: absolute; left: 0; top: calc(100% + 6px); background: var(--page); border: 1px solid var(--hair-strong); border-radius: 6px; padding: 6px; display: grid; min-width: 200px; z-index: 3; }
  .v-menu-list button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 4px; font: var(--data); font-size: 13px; color: var(--ink); cursor: pointer; }
  .v-menu-list button:hover { background: var(--paper-2); }
  .v-menu-list button:disabled { color: var(--ink-faint); cursor: default; }
  .v-menu-list small { display: block; color: var(--ink-soft); font-size: 11.5px; margin-top: 2px; overflow-wrap: anywhere; }
  .v-hint { margin-left: auto; font: var(--data); font-size: 12px; color: var(--ink-soft); }
  .v-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--page); padding: 10px 16px; border-radius: 999px; font: var(--data); font-size: 13px; opacity: 0; transition: opacity .15s; pointer-events: none; z-index: 70; }
  .v-toast.on { opacity: 1; }
  .v-meta { border-left: 1px solid var(--hair); background: var(--page); overflow-y: auto; min-width: 0; padding: 14px 28px 40px; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 22px; }
  #vbody { display: flex; flex-direction: column; gap: 22px; }
  .v-topbar { display: flex; justify-content: flex-end; }
  .v-topbar button { min-height: 40px; padding: 0 10px; border: 0; background: none; color: var(--ink); font: var(--data); font-size: 13px; cursor: pointer; border-radius: 20px; }
  .v-topbar button:hover { background: var(--paper-2); }
  .v-topbar button:focus:not(:focus-visible) { outline: none; }
  .v-label { font: var(--label); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); margin: 0; }
  .v-title-card h2 { font-size: 30px; font-weight: 400; line-height: 1.15; margin: 4px 0 0; letter-spacing: -.005em; overflow-wrap: anywhere; }
  .v-maker { display: flex; align-items: center; gap: 8px; margin-top: 8px; font: var(--data); flex-wrap: wrap; }
  .v-maker .v-lab { color: var(--ink-soft); }
  .v-maker .lab-mark { flex: none; width: 16px; height: 16px; background: var(--ink); -webkit-mask: var(--mark) center / contain no-repeat; mask: var(--mark) center / contain no-repeat; }
  .v-maker .lab-mark-initial { background: none; border: 1px solid var(--hair-strong); border-radius: 3px; display: grid; place-items: center; font: var(--label); font-size: 9px; color: var(--ink-soft); }
  #vrecord:empty { display: none; }
  .v-fold { border-top: 1px solid var(--hair); padding: 10px 0; }
  .v-fold > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; min-height: 32px; font: var(--label); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
  .v-fold > summary::-webkit-details-marker { display: none; }
  .v-fold > summary::after { content: '+'; font: 400 16px/1 Helvetica, Arial, sans-serif; color: var(--ink-faint); }
  .v-fold[open] > summary::after { content: '–'; }
  .v-fold > summary:hover { color: var(--ink); }
  .v-details { display: grid; gap: 6px; padding-top: 8px; font: var(--data); font-size: 13px; font-variant-numeric: tabular-nums; }
  .v-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; }
  .v-row span:first-child { color: var(--ink-soft); }
  .v-prompt { font: 400 15px/1.55 Fraunces, Georgia, serif; margin: 10px 0 0; white-space: pre-wrap; }
  .v-more { border: 0; background: none; padding: 6px 0 0; color: var(--ink-soft); font: var(--data); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
  @media (max-width: 1100px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
  @media (max-width: 900px) {
    /* one scrolling column: stage in normal flow, then the rail */
    .v-inner { display: block; height: 100%; overflow-y: auto; overscroll-behavior: contain; }
    .v-stage { display: block; padding: 12px 16px 8px; }
    .v-stage-head { width: 100%; margin: 0 0 10px; }
    .v-square { width: 100%; margin: 0; }
    .v-actions { width: 100%; margin: 8px 0 0; flex-wrap: wrap; }
    .v-hint { display: none; }
    .v-meta { overflow: visible; height: auto; border-left: 0; border-top: 1px solid var(--hair); padding: 12px 18px max(28px, env(safe-area-inset-bottom)); }
    .v-topbar { position: sticky; top: 0; background: var(--page); z-index: 2; margin: -12px -18px 0; padding: 6px 12px; }
  }
  @media (max-width: 700px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }
  @media (prefers-reduced-motion: reduce) { .tile img, .tile .over { transition: none; } }

/* Gallery pick grid; scoped separately from the model-page tiles and Inspect. */
.grid-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.grid-head h1 { margin: 0; font-size: clamp(24px, 2.4vw, 32px); font-weight: 400; letter-spacing: -.02em; }
.grid-controls { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px 18px; min-width: 0; }
.grid-control { min-height: 44px; padding: 8px 0; border: 0; background: none; color: var(--ink-soft); font: var(--data); cursor: pointer; }
label.grid-control { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.grid-control select { min-width: 0; max-width: 100%; font: inherit; color: var(--ink); background: var(--page); border: 1px solid var(--hair); padding: 8px; }
.grid-control[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-underline-offset: 5px; }
.picks-control { color: var(--ink); font-variant-numeric: tabular-nums; }
.grid-filter { display: flex; gap: 16px; align-items: center; margin: 0 0 16px; font: var(--data); }
.grid-filter span { overflow-wrap: anywhere; }
.grid-paintings { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile-painting { position: relative; min-width: 0; }
.tile-artwork { position: relative; aspect-ratio: 1; }
.tile-category { display: block; padding: 7px 2px 5px; color: var(--ink-soft); font: var(--data); overflow-wrap: anywhere; }
.tile-pick { display: block; position: relative; width: 100%; height: 100%; padding: 0; border: 1px solid var(--hair); border-radius: 0; background: var(--page); color: var(--ink); cursor: pointer; }
.tile-pick img { display: block; width: 100%; height: 100%; object-fit: contain; }
/* A pick: an ink edge brushes around the painting and lets go, leaving a small gold star in the corner.
   The edge is the moment, the star is the memory, so twenty picks stay quiet in the grid. */
.tile-pick::after { content: ''; position: absolute; inset: 0; pointer-events: none; border: 3px solid var(--ink); opacity: 0; }
.tile-pick.just::after { animation: ab-edge 1.15s ease-out forwards; filter: url(#pt-graphite); }
.tile-unpicked .tile-pick img { opacity: .45; transition: opacity .25s ease; }
@keyframes ab-edge { 0% { opacity: 0; clip-path: inset(0 100% 100% 0); } 8% { opacity: 1; } 34% { clip-path: inset(0 0 0 0); } 62% { opacity: 1; } 100% { opacity: 0; clip-path: inset(0 0 0 0); } }
.tile-star { position: absolute; top: 7px; right: 7px; width: 28px; height: 28px; opacity: 0; transform: scale(.4) rotate(-40deg); transform-origin: 50% 50%; pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.tile-pick[aria-pressed="true"] .tile-star { opacity: 1; transform: scale(1) rotate(-8deg); }
/* the edge goes first; the star arrives as the edge lets go */
.tile-pick.just .tile-star { animation: ab-star .6s cubic-bezier(.2, .9, .3, 1.35) .62s both; }
@keyframes ab-star { 0% { opacity: 0; transform: scale(.3) rotate(-60deg); } 55% { opacity: 1; transform: scale(1.18) rotate(4deg); } 100% { opacity: 1; transform: scale(1) rotate(-8deg); } }
.tile-star svg { display: block; width: 100%; height: 100%; overflow: visible; }
/* the under-star bleeds like a wet wash; the top star keeps its points, grain only */
.tile-star .under { fill: #b07f18; fill-opacity: .6; filter: url(#pt-wash); }
.tile-star .gold { fill: #e4b53c; stroke: #b98d1f; stroke-width: .8; stroke-linejoin: miter; filter: url(#pt-wash-lite); }
/* the count carries the same star, small, inside the chip */
.picks-count { display: inline-flex; align-items: center; gap: 4px; }
.picks-count .tile-star { position: static; width: 14px; height: 14px; opacity: 1; transform: rotate(-8deg); transition: none; }
.picks-count .tile-star .under { display: none; }
.picks-count .tile-star .gold { filter: none; }
.tile-inspect { position: absolute; bottom: 8px; right: 8px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--hair); border-radius: 50%; background: var(--page); color: var(--ink); cursor: pointer; }
.tile-inspect svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.tile-pick:focus-visible, .tile-inspect:focus-visible { outline: 2px solid var(--ink); outline-offset: -5px; }
.tile-unavailable { position: absolute; inset: 0; display: grid; place-items: center; background: var(--paper-2); font: var(--data); pointer-events: none; }
.grid-end { text-align: center; padding: 28px 18px 0; font: var(--data); }
.grid-end p { margin: 0 0 8px; }
.grid-end button { min-height: 44px; margin: 0 8px; }
.grid-status { font: var(--data); color: var(--ink-soft); }
.picks-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 24px; background: var(--ink); color: var(--page); font: var(--data); z-index: 70; }
@media (hover: hover) and (pointer: fine) {
  .tile-inspect { opacity: 0; }
  .tile-painting:hover .tile-inspect, .tile-painting:focus-within .tile-inspect { opacity: 1; }
}
@media (any-pointer: coarse) { .tile-inspect { opacity: 1; } }
@media (max-width: 700px) {
  .grid-head { margin: 0 18px 12px; justify-content: flex-end; }
  .grid-head h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .grid-controls { width: 100%; justify-content: space-between; }
  label.grid-control { flex-basis: 100%; }
  .grid-control select { flex: 1; }
  .grid-filter { margin: 0 18px 12px; }
  .grid-paintings { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .tile-inspect { bottom: 5px; right: 5px; }
}

/* Picking feedback: a settle on the tile, a tick on the count. */
.tile-pick.just img { animation: ab-settle .32s cubic-bezier(.2,.7,.2,1); }
@keyframes ab-settle { 0% { transform: scale(1); } 45% { transform: scale(.965); } 100% { transform: scale(1); } }
.picks-control.tick { animation: ab-tick .36s ease; }
@keyframes ab-tick { 0% { transform: translateY(0); } 40% { transform: translateY(-3px); } 100% { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .tile-pick.just img, .picks-control.tick, .tile-pick.just::after, .tile-pick.just .tile-star { animation: none; } .tile-star { transition: none; } }
@media (max-width: 700px) { .tile-star .under { filter: none; } .tile-pick.just::after { filter: none; } }
