:root { --bg:#fff; --fg:#1b1b1f; --muted:#6b6b76; --line:#e2e2e8; --accent:#2a5bd7; --card:#f4f4f7; }
@media (prefers-color-scheme: dark) { :root { --bg:#16161a; --fg:#ececf1; --muted:#9a9aa6; --line:#2e2e36; --accent:#7ba2ff; --card:#22222a; } }
html { scrollbar-gutter: stable; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body.noscroll { overflow: hidden; }
a { color: inherit; }
[hidden] { display: none !important; }
.header { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.brand { font-weight: 600; text-decoration: none; }
.main { padding: 16px; max-width: 1600px; margin: 0 auto; }
h1 { margin: 0 0 4px; font-size: 1.5rem; }
.meta, .desc { margin: 0 0 12px; color: var(--muted); }
.desc { overflow-wrap: anywhere; }
.footer { max-width: 1600px; margin: 0 auto; padding: 8px 16px 24px; color: var(--muted); font-size: .8125rem; overflow-wrap: anywhere; }
.footer p { margin: 0 0 6px; }
.footer summary { cursor: pointer; }
.footer ul { margin: 6px 0 0; padding-left: 20px; }
.error { padding: 24px 0; color: #c0392b; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 12px; }
.card { text-decoration: none; display: block; }
.card-img { aspect-ratio: 3/2; background: var(--card); border-radius: 6px; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-title { margin-top: 6px; font-weight: 600; }
.card-sub { color: var(--muted); font-size: .875rem; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.halls { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-size: .9rem; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn { font: inherit; padding: 6px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--fg); text-decoration: none; cursor: pointer; display: inline-block; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
.selbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; padding: 8px; background: var(--card); border-radius: 6px; position: sticky; top: 0; z-index: 5; }
.sel-count { font-weight: 600; margin-right: auto; }
.sel-status { color: var(--muted); font-size: .875rem; }

.grid { width: 100%; overflow: hidden; }
.row { display: flex; gap: 4px; margin-bottom: 4px; }
.tile { position: relative; flex: none; display: block; background: var(--card); overflow: hidden; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.check { display: none; position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.35); }
.selecting .check { display: block; }
.tile.selected { outline: 3px solid var(--accent); outline-offset: -3px; }
.tile.selected .check { background: var(--accent); }
.sentinel { height: 1px; }

.viewer { position: fixed; inset: 0; z-index: 20; background: #0c0c0f; color: #eee; display: flex; flex-direction: column; overscroll-behavior: contain; }
.stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; touch-action: none; }
.photo { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; cursor: zoom-out; }
.photo.back { transition: transform .2s, opacity .2s; }
.nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 44px; height: 64px; border: 0; background: rgba(0,0,0,.4); color: #fff; font-size: 2rem; cursor: pointer; }
.nav.prev { left: 0; }
.nav.next { right: 0; }
.nav:disabled { display: none; }
.caption { padding: 8px 16px 0; text-align: center; }
.cap-title { font-weight: 600; }
.cap-meta { color: #a8a8b4; font-size: .875rem; }
.cap-copy { color: #a8a8b4; font-size: .75rem; margin-top: 4px; }
.vbar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 12px 16px; }
/* Телефон лёжа: фото на всю высоту, подпись и кнопки — колонкой в пустом поле справа */
@media (orientation: landscape) and (max-height: 500px) {
  .viewer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, 200px); grid-template-rows: 1fr auto; }
  .viewer .stage { grid-column: 1; grid-row: 1 / 3; }
  .viewer .caption { grid-column: 2; grid-row: 1; align-self: end; text-align: left; padding: 8px 12px 0 8px; }
  .viewer .vbar { grid-column: 2; grid-row: 2; flex-direction: column; align-items: stretch; padding: 10px 12px 12px 8px; }
  .viewer .vbar .btn { font-size: .875rem; padding: 6px 10px; text-align: center; }
  .viewer .vbar .copy .btn { width: 100%; }
}
.viewer .btn { background: #26262d; border-color: #3a3a44; color: #eee; }
.copy { display: inline-flex; flex-direction: column; gap: 4px; }
.hint { font-size: .8rem; color: #a8a8b4; }
.link { font: inherit; width: min(80vw, 420px); padding: 4px 8px; }
@media (max-width: 599px) { .main { padding: 8px; } .footer { padding: 8px 8px 16px; } .nav { width: 36px; } }

/* Подборки: строка меток и заголовок активной подборки */
.sels { margin-bottom: 12px; }
.selinfo { margin-bottom: 12px; }
.sel-title { margin: 0 0 6px; font-weight: 600; }
.sel-empty { margin: 0 0 8px; color: var(--muted); }
.sel-cmds { display: flex; flex-wrap: wrap; gap: 8px; }

/* Главная: блоки подборок и свежих мероприятий над архивом */
.hb { margin: 0 0 28px; }
.hb-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-start; justify-content: space-between; margin-bottom: 8px; }
.hb-label { color: var(--accent); font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.hb-title { margin: 0; font-size: 1.15rem; }
.hb-title a { text-decoration: none; }
.hb-sub { color: var(--muted); font-size: .875rem; }
.hb-chips { margin-bottom: 8px; }
.hb-fresh > h2, .hb-archive { margin: 8px 0 12px; font-size: 1.5rem; }
.hb-archive { padding-top: 16px; border-top: 1px solid var(--line); }
.strip { min-height: 1px; }
.strip .row:last-child { margin-bottom: 0; }
