:root { --bg: #fff; --fg: #000; --line: #ddd; --dim: #777; --panel: #f0f0f0; --select: #d8d8d8; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #111; --fg: #eee; --line: #333; --dim: #888; --panel: #1c1c1c; --select: #3a3a3a; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.4 "IBM Plex Sans", Arial, sans-serif; }
a { color: inherit; }
header { display: flex; gap: 16px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 10; flex-wrap: wrap; }
.logo { width: 20px; height: 20px; border-radius: 50%; background: var(--fg); flex: none; }
form { flex: 1; min-width: 200px; }
input[type=search] { width: 100%; max-width: 480px; padding: 6px 8px; border: 1px solid var(--fg); background: var(--bg); color: var(--fg); font: inherit; border-radius: 0; }
nav { display: flex; gap: 12px; }
nav a { text-decoration: none; color: var(--dim); }
nav a.on { color: var(--fg); text-decoration: underline; }
main { padding: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.card { text-decoration: none; }
.thumb { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; padding: 12px; overflow: hidden; }
.card:hover .thumb { background: var(--panel); }
.thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.thumb .name { color: var(--dim); word-break: break-all; text-align: center; }
.caption { text-align: center; color: var(--dim); font-size: 12px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.more, .empty { grid-column: 1 / -1; min-height: 1px; color: var(--dim); }
.block { position: relative; margin-bottom: 16px; }
.view { position: relative; display: flex; align-items: center; justify-content: center; padding: 0; height: max(260px, calc(100vh - 380px)); }
.view img, .view video { max-width: 100%; max-height: 100%; }
.meta { position: absolute; top: 0; right: 0; background: var(--panel); z-index: 1; }
.meta[open] { width: 280px; }
summary { padding: 6px 12px; white-space: nowrap; cursor: pointer; list-style: none; font-size: 12px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: " +"; color: var(--dim); }
.meta[open] summary::after { content: " −"; }
dl { margin: 0; padding: 0 12px 10px; line-height: 1.3; }
dt { color: var(--dim); font-size: 11px; margin-top: 6px; }
.open { margin-top: 8px; }
dd { margin: 0; font-size: 12px; overflow-wrap: anywhere; }
h2 { font-size: 14px; font-weight: 500; margin: 24px -16px 16px; padding: 0 16px 8px; border-bottom: 1px solid var(--line); }
@media (max-width: 700px) { .meta { position: static; } .meta[open] { width: auto; } }
.block ~ .grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.strip { display: flex; gap: 4px; width: max-content; min-width: 0; max-width: calc(100% - 96px); padding: 0 0 12px; overflow-x: auto; }
.qi { position: relative; flex: none; width: 120px; height: 120px; padding: 6px; display: flex; align-items: center; justify-content: center; text-decoration: none; color: var(--dim); font-size: 11px; text-transform: uppercase; }
.qi img { max-width: 100%; max-height: 100%; }
.qi.current { background: var(--select); }
.film { position: relative; display: flex; justify-content: center; margin-top: 16px; }
.step { flex: none; width: 40px; height: 120px; display: flex; align-items: center; justify-content: center; font-size: 36px; text-decoration: none; color: color-mix(in srgb, var(--fg) 30%, var(--bg)); }
a.step:hover { color: var(--fg); }
.step.off { visibility: hidden; }
.queue { display: flex; gap: 8px; max-width: 100%; }
.origin { position: absolute; left: 0; top: calc(var(--layers, 0) * 8px); z-index: 1; display: flex; flex-direction: column; align-items: flex-start; isolation: isolate; }
.origin .qi { width: auto; height: 100px; padding: 0; }
.origin img { width: auto; height: 100%; object-fit: contain; object-position: 50% 100%; transform-origin: 50% 100%; }
.origin .behind { position: absolute; inset: 0; width: 100%; height: 100%; transform: translateY(calc(var(--n) * -8px)) scale(calc(1 - var(--n) * 0.06)); z-index: calc(var(--n) * -1); }
.delete { margin: 0; padding: 0 12px 10px; }
.delete button { padding: 0; border: 0; background: none; color: var(--dim); font: inherit; font-size: 12px; cursor: pointer; }
.delete button:hover { color: var(--fg); text-decoration: underline; }
.hero { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 16px 0 24px; }
.hero form { flex: none; width: 100%; max-width: 640px; min-width: 0; }
.hero input[type=search] { max-width: none; padding: 12px 20px; font-size: 16px; border-radius: 24px; }
.hero input[type=search] { border-color: var(--line); }
.hero input[type=search]:focus { outline: 2px solid var(--dim); outline-offset: -1px; }
.searchrow { display: flex; align-items: center; gap: 16px; width: 100%; max-width: 700px; }
.hero form { flex: 1; }
.searchrow .logo { width: 28px; height: 28px; }
.card:hover .caption { color: var(--fg); }
.empty { text-align: center; padding-top: 24px; }
.login { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20vh 0 0; }
.login input, .login button { width: 280px; padding: 10px 14px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); font: inherit; border-radius: 0; }
.login button { background: var(--fg); color: var(--bg); border-color: var(--fg); cursor: pointer; }
.login p { margin: 0; color: var(--dim); }
