:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --text: #1b1d1f;
  --muted: #64686d;
  --line: #e2e2de;
  --chip: #eeeeea;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121314;
    --surface: #1c1d1f;
    --text: #ececea;
    --muted: #9a9ea3;
    --line: #2c2e31;
    --chip: #2a2c2f;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.top { padding: 32px 0 20px; }
.org { margin: 0 0 4px; font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
h1 { margin: 0; font-size: clamp(24px, 4vw, 34px); line-height: 1.15; font-weight: 700; }
.meta { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.shared-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.shared-tag { display: inline-flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font-size: 15px; font-weight: 600; box-shadow: var(--shadow); }
.shared-group { font-size: 11px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; padding: 9px 14px; border-radius: 8px;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.btn:disabled { opacity: 0.6; cursor: default; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; padding-bottom: 24px; }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 8px; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.card button.thumb { all: unset; display: block; width: 100%; aspect-ratio: 1; cursor: zoom-in; background: var(--chip); }
.card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .tags { padding: 8px; display: flex; flex-wrap: wrap; gap: 4px; min-height: 0; }
.card .tags:empty { display: none; }
.chip { font-size: 12px; background: var(--chip); color: var(--text); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }

.empty { text-align: center; color: var(--muted); padding: 64px 16px; }
.empty strong { display: block; color: var(--text); font-size: 18px; margin-bottom: 6px; }
.foot { color: var(--muted); font-size: 12px; padding-bottom: 32px; }

.viewer { border: 0; padding: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; background: #000; color: #fff; }
.viewer::backdrop { background: #000; }
.viewer[open] { display: flex; flex-direction: column; }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); font-size: 14px; }
.viewer .btn { background: rgba(255, 255, 255, 0.12); border-color: transparent; color: #fff; }
.viewer-stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; touch-action: pan-y; }
.viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255, 255, 255, 0.12); color: #fff; border: 0; width: 44px; height: 44px; border-radius: 50%; font-size: 28px; line-height: 1; cursor: pointer; }
.nav.prev { left: 12px; } .nav.next { right: 12px; }
@media (hover: none) { .nav { display: none; } }
.viewer-tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; padding: 10px 16px; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
.viewer-tags .chip { background: rgba(255, 255, 255, 0.14); color: #fff; }
