:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --ink: #1d1f22;
  --muted: #5d636b;
  --line: #e2e2de;
  --accent: #c8102e;
  --accent-ink: #ffffff;
  --radius: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131416;
    --surface: #1c1e21;
    --ink: #eceef0;
    --muted: #a4abb3;
    --line: #2c2f33;
    --accent: #ef3b4f;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
.wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: baseline; gap: 10px; padding-top: 14px; padding-bottom: 14px; }
.brand { font-weight: 700; letter-spacing: .01em; }
.brand::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--accent); margin-right: 8px; }
.sub { color: var(--muted); font-size: 14px; }
main { flex: 1; padding-top: 32px; padding-bottom: 32px; }
h1 { font-size: clamp(24px, 4vw, 32px); line-height: 1.2; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 24px; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
input {
  font: inherit; font-size: 22px; letter-spacing: .12em; text-transform: uppercase;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); width: 100%; max-width: 260px;
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button, .button {
  font: inherit; font-weight: 600; border: 0; border-radius: var(--radius); padding: 12px 20px;
  background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px;
}
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.error { color: var(--accent); margin-top: 12px; }
.gallery-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.meta { color: var(--muted); margin: 0; }
.grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(46%, 220px), 1fr)); }
.thumb { padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; width: 100%; min-height: 0; display: block; }
.thumb img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.empty, .loading { color: var(--muted); }
.back { margin-top: 28px; }
a { color: var(--accent); }
dialog { border: 0; padding: 0; background: #000; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
dialog::backdrop { background: rgba(0, 0, 0, .9); }
dialog img { width: 100%; height: calc(100vh - 80px); object-fit: contain; display: block; }
.viewer-bar { display: flex; gap: 8px; justify-content: center; padding: 12px; flex-wrap: wrap; }
.viewer-bar button.ghost { color: #fff; border-color: #555; }
#prev, #next { background: #333; font-size: 24px; min-width: 56px; }
.foot { color: var(--muted); font-size: 13px; padding-top: 16px; padding-bottom: 24px; border-top: 1px solid var(--line); }
.env-banner { background: #b45309; color: #fff; text-align: center; font-weight: 700; padding: 6px 12px; letter-spacing: .04em; font-size: 13px; }
[hidden] { display: none !important; }
