
:root {
  --bg: #1b1712;
  --card: #241f19;
  --text: #f3ead8;
  --text-soft: #d9ccb1;
  --muted: #b5a68a;
  --line: #5b4a31;
  --accent: #c9a25a;
  --accent-text: #1b1712;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  --viewer-bg: #ebe5d8;
  --picture-bg: #ddd7ca;
  --on-light-text: #22201c;
  --on-light-chip: #fbf8f1;
  --on-light-line: #cfc6b4;
  --grip: #1d64c4;
  --tip: #c4361f;
  color-scheme: dark;
  accent-color: var(--accent);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
.site-bar { background: var(--bg); border-bottom: 1px solid var(--line); }
.site-bar-inner { max-width: 980px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 8px 28px; flex-wrap: wrap; font-family: var(--serif); }
.site-bar a { text-decoration: none; }
.site-home { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 22px; font-weight: 600; line-height: 1.3; }
.site-home img { width: 34px; height: 32px; display: block; }
.site-link { color: var(--text-soft); font-size: 19px; line-height: 1.3; padding: 2px 0; border-bottom: 2px solid transparent; }
@media (max-width: 400px) { .site-bar-inner { column-gap: 12px; } .site-home { font-size: 20px; } .site-link { font-size: 17px; } }
.site-bar a:hover, .site-bar [aria-current] { color: var(--accent); border-color: var(--accent); }
.site-foot { border-top: 1px solid var(--line); color: var(--muted); font: 15px/1.6 var(--serif); padding: 24px 16px 40px; text-align: center; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.top { padding: 36px 0 8px; }
h1, h2, h3 { font-family: var(--serif); }
h1 { margin: 0 0 10px; font-size: clamp(40px, 7vw, 56px); line-height: 1.05; font-weight: 600; letter-spacing: 0.01em; }
h2 { font-size: 30px; line-height: 1.2; margin: 40px 0 6px; color: var(--accent); font-weight: 600; }
.lead, .note, .own p { margin: 0 0 16px; max-width: 760px; color: var(--text-soft); font: 18px/1.55 var(--serif); }
.lead { margin: 0; font-size: 20px; }
.make { margin-top: 8px; }
.own { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 4px 20px 20px; margin-top: 28px; }
.own h2 { margin-top: 16px; }
.own p { margin: 10px 0 0; }
.own .later { color: var(--muted); }
.own .commands {
  margin: 12px 0 0;
  padding: 10px 14px;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: 0.9rem/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
button, .button {
  font: inherit;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
.button.quiet, button.quiet { background: transparent; color: var(--accent); font-weight: 400; }
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 14px;
}
.gallery[aria-busy="true"] { min-height: 40rem; grid-template-rows: 20rem; }
.gallery > .loading-bar { grid-column: 1 / -1; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card .look {
  display: block;
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--picture-bg);
  aspect-ratio: 1 / 1;
  width: 100%;
  cursor: pointer;
}
.card .look img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .text { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 { margin: 0; font-size: 20px; line-height: 1.2; font-weight: 600; color: var(--text); }
.card .tags { margin: 0; font-size: 0.85rem; color: var(--muted); }
.card .count { margin: 0; font-size: 0.85rem; line-height: 1.4; min-height: 1.4em; white-space: nowrap; overflow: hidden; color: var(--muted); }
.card .actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.card .actions .button, .card .actions button { padding: 4px 9px; font-size: 0.85rem; }
dialog {
  width: min(1100px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
}
dialog { overflow: auto; }
dialog::backdrop { background: rgba(10, 8, 6, 0.72); }
.viewer-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.viewer-head h2 { margin: 0; font-size: 26px; }
.close { background: transparent; color: var(--text); border: 0; font-size: 1.6rem; line-height: 1; padding: 2px 8px; }
.viewer-body { display: grid; grid-template-columns: 1fr 360px; min-height: 0; }
.viewer-stage { position: relative; }
.viewer-pause {
  position: absolute; left: 12px; bottom: 12px; z-index: 2; min-width: 6.5em; min-height: 44px;
  padding: 8px 14px; border-radius: 22px; border: 1px solid var(--line); background: var(--card); color: var(--text);
  font: inherit; font-size: 0.95rem; cursor: pointer; opacity: 0.92;
}
.viewer-pause:hover { opacity: 1; }
.viewer-pause:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
.viewer-pause::before {
  content: ""; display: inline-block; vertical-align: -0.1em; margin-right: 0.55em;
  width: 0.28em; height: 0.85em; background: currentColor; box-shadow: 0.42em 0 0 currentColor; margin-right: 0.9em;
}
.viewer-pause[aria-pressed="true"]::before {
  width: 0; height: 0; background: none; box-shadow: none; margin-right: 0.55em;
  border-style: solid; border-color: transparent transparent transparent currentColor;
  border-width: 0.45em 0 0.45em 0.75em;
}
.viewer-slot { position: relative; background: var(--viewer-bg); min-height: 520px; height: min(640px, calc(100vh - 110px)); }
.viewer-slot canvas, .viewer-slot iframe { display: block; width: 100%; height: 100%; border: 0; }
.viewer-slot canvas:focus-visible { outline: 3px solid var(--text); outline-offset: -3px; }
.viewer-slot[aria-busy="true"] canvas, .viewer-slot[aria-busy="true"] .viewer-labels,
.viewer-slot[data-failed] canvas, .viewer-slot[data-failed] .viewer-labels { visibility: hidden; }
.viewer-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.viewer-label {
  position: absolute; left: 0; top: 0; padding: 1px 6px; border-radius: 5px;
  font-size: 0.78rem; line-height: 1.3; white-space: nowrap; background: var(--on-light-chip); color: var(--on-light-text);
  border: 1px solid var(--on-light-line); will-change: transform;
}
.viewer-label.grip, .viewer-label.tip { font-weight: 600; }
.viewer-label.grip { border-color: var(--grip); color: var(--grip); }
.viewer-label.tip { border-color: var(--tip); color: var(--tip); }
.viewer-side { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; max-height: min(640px, calc(100vh - 110px)); }
.hint { margin: 0; color: var(--muted); font-size: 0.9rem; }
.clips { display: flex; flex-wrap: wrap; gap: 6px; }
.clips button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
.clips button[aria-pressed="false"] { background: transparent; color: var(--accent); }
.spin { font-size: 0.9rem; }
.toggles { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.toggles label[hidden] { display: none; }
.size-text { margin: 0; font-size: 0.95rem; min-height: 3em; }
.clips:empty { display: none; }
.licence-note { margin: 0; font-size: 0.8rem; color: var(--muted); }
.licence-note:empty { display: none; }
.prompt-text { margin: 0; font-size: 0.9rem; font-style: italic; }
.prompt-text:empty { display: none; }
.viewer-picture-box { position: relative; height: 190px; flex: none; background: var(--picture-bg); border-radius: 6px; border: 1px solid var(--line); overflow: hidden; }
.viewer-picture-box[hidden] { display: none; }
.viewer-picture { display: block; width: 100%; height: 100%; object-fit: contain; }
.viewer-picture:not([src]) { visibility: hidden; }
.downloads { display: flex; flex-direction: column; gap: 6px; }
.downloads .button { background: transparent; color: var(--accent); font-weight: 400; }
.made { margin: 0; font-size: 0.8rem; color: var(--muted); }
.count-text { line-height: 1.4; min-height: 1.4em; }
.foot { color: var(--muted); font-size: 0.85rem; padding-top: 8px; padding-bottom: 24px; margin-top: 40px; }
.foot p { margin: 0; max-width: 760px; }
.loading-bar {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--text); font-size: 0.9rem; text-align: center; padding: 8px;
}
.loading-words { display: block; width: min(320px, 85%); min-height: 3em; text-align: left; font-variant-numeric: tabular-nums; }
.loading-track { display: block; position: relative; width: min(320px, 85%); height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.loading-fill { display: block; height: 100%; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 150ms linear; }
.loading-bar[data-state="waiting"] .loading-fill { width: 35%; transform: none; transition: none; animation: loading-stripe 1.3s ease-in-out infinite; }
@keyframes loading-stripe { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.loading-bar[data-state="failed"] .loading-track { visibility: hidden; }
.loading-bar[data-state="failed"] .loading-words { text-align: center; font-weight: 600; }
.loading-bar.over { position: absolute; inset: 0; }
.loading-bar.inline { display: inline-flex; flex-direction: row; padding: 0; gap: 10px; vertical-align: middle; }
.loading-bar.inline .loading-words { width: auto; min-height: 0; }
.loading-bar.inline .loading-track { width: 5em; }
.loading-bar.on-light, .viewer-slot .loading-bar { color: var(--on-light-text); }
.loading-bar.on-light { font-size: 0.8rem; }
.loading-bar.on-light .loading-track, .viewer-slot .loading-bar .loading-track { background: rgba(0, 0, 0, 0.14); }
.loading-bar.on-light .loading-fill, .viewer-slot .loading-bar .loading-fill { background: #8a6424; }
.pending { opacity: 0; }
.arrive { animation: arrive 150ms ease-out; }
@keyframes arrive { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .arrive { animation: none; }
  .loading-fill { transition: none; }
  .loading-bar[data-state="waiting"] .loading-fill { animation: none; width: 50%; opacity: 0.6; }
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 760px) {
  .viewer-body { grid-template-columns: 1fr; }
  .viewer-slot { min-height: 360px; height: 52vh; }
  .viewer-side { max-height: none; }
}
