:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --ink: #16202e;
  --muted: #5f6b7a;
  --line: #e4ded4;
  --accent: #e2553b;
  --accent-ink: #ffffff;
  --accent-soft: #fbe4dd;
  --navy: #1d3557;
  --chip: #ece6dc;
  --shadow: 0 1px 2px rgba(22, 32, 46, .06), 0 8px 24px rgba(22, 32, 46, .06);
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b;
    --surface: #18202b;
    --ink: #eef1f5;
    --muted: #9aa6b5;
    --line: #283342;
    --accent: #ff6f52;
    --accent-ink: #1a0d09;
    --accent-soft: #3a2420;
    --navy: #9cc0ff;
    --chip: #222c39;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 "Manrope", system-ui, sans-serif;
}
body.has-selbar { padding-bottom: 84px; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }

/* ---------- шапка ---------- */
.hero { padding: 40px 0 24px; }
.brand { display: flex; gap: 16px; align-items: center; }
.brand-mark {
  flex: none; width: 52px; height: 52px; border-radius: 14px;
  background:
    radial-gradient(circle at 70% 30%, #ffd166 0 18%, transparent 19%),
    linear-gradient(160deg, var(--accent), #b8325a 60%, #1d3557);
}
h1 {
  font: 700 clamp(26px, 4vw, 40px)/1.1 "Unbounded", sans-serif;
  margin: 0; letter-spacing: -.02em;
}
.tagline { margin: 6px 0 0; color: var(--muted); max-width: 640px; }
.source { margin: 16px 0 0; font-size: 13px; color: var(--muted); }
.source a { color: var(--navy); }

/* ---------- фильтры ---------- */
.controls {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 12px 0 10px;
}
@media (max-width: 600px) { .controls { position: static; } }
.row { display: flex; gap: 10px; }
.search {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px;
}
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; flex: none; }
.search input { border: 0; outline: 0; background: transparent; padding: 11px 0; width: 100%; min-width: 0; }
.search:focus-within { border-color: var(--navy); }
select {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 0 12px; min-width: 140px; max-width: 40%;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chips.scroll { margin-top: 8px; }
/* На телефоне категории — одна прокручиваемая строка с затуханием у правого края. */
@media (max-width: 600px) {
  .chips.scroll {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px;
    margin-right: -16px; padding-right: 16px;
    mask-image: linear-gradient(to right, #000 85%, transparent);
  }
  .chips.scroll::-webkit-scrollbar { display: none; }
}
.chip {
  flex: none; border: 1px solid transparent; background: var(--chip); border-radius: 999px;
  padding: 6px 13px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--line); }
.chip.on { background: var(--ink); color: var(--bg); }
#cats .chip { font-weight: 500; }

/* ---------- лента ---------- */
.count { color: var(--muted); font-size: 13px; margin: 18px 0 0; }
.month {
  font: 700 20px/1.2 "Unbounded", sans-serif; text-transform: capitalize;
  margin: 28px 0 14px; letter-spacing: -.01em;
}
.month span { color: var(--muted); font-weight: 500; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
@media (max-width: 600px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; display: flex; flex-direction: column;
  outline: 2px solid transparent; transition: outline-color .15s, transform .15s;
}
.card:hover { transform: translateY(-2px); }
.card.is-selected { outline-color: var(--accent); }
.card.is-past { opacity: .72; }
.media { position: relative; aspect-ratio: 16 / 10; background: var(--chip); cursor: pointer; }
.media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cat {
  position: absolute; left: 10px; bottom: 10px;
  background: rgba(15, 20, 27, .72); color: #fff; backdrop-filter: blur(4px);
  font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
}
.cat.inline { position: static; display: inline-block; background: var(--accent-soft); color: var(--accent); }
.ai {
  position: absolute; right: 10px; bottom: 10px; font-size: 10px; font-weight: 800; letter-spacing: .05em;
  background: rgba(255, 255, 255, .85); color: #16202e; padding: 2px 6px; border-radius: 6px;
}
.pick { position: absolute; top: 10px; right: 10px; cursor: pointer; }
.pick input { position: absolute; opacity: 0; width: 0; height: 0; }
.pick span {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: rgba(255, 255, 255, .92); box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}
.pick span::after {
  content: ""; width: 14px; height: 14px; border-radius: 4px; border: 2px solid #8a94a3;
}
.pick input:checked + span { background: var(--accent); }
.pick input:checked + span::after {
  border: 0; width: 8px; height: 14px; border-radius: 0;
  border-right: 3px solid #fff; border-bottom: 3px solid #fff; transform: rotate(45deg) translate(-1px, -2px);
}
.pick input:focus-visible + span { outline: 2px solid var(--navy); outline-offset: 2px; }

.body { display: flex; gap: 12px; padding: 14px 16px 0; }
.datebadge {
  flex: none; width: 48px; text-align: center; border-radius: 10px; padding: 5px 0 4px;
  background: var(--accent-soft); color: var(--accent);
}
.datebadge b { display: block; font: 700 20px/1 "Unbounded", sans-serif; }
.datebadge span { font-size: 11px; font-weight: 700; text-transform: uppercase; }
.info { min-width: 0; }
.when { margin: 0; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.now { font-style: normal; color: #1b8a5a; margin-left: 4px; }
.card h3 { margin: 2px 0 0; font-size: 16.5px; line-height: 1.3; cursor: pointer; }
.card h3:hover { text-decoration: underline; text-underline-offset: 3px; }
.place { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.summary { margin: 10px 16px 0; font-size: 14px; color: var(--ink); opacity: .86; flex: 1; }
.foot-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px 16px 16px; }
.price { font-weight: 700; font-size: 13.5px; }
.actions { display: flex; gap: 6px; align-items: center; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
  padding: 9px 14px; font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.small { padding: 6px 11px; font-size: 13px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }

.calmenu { position: relative; }
.calmenu summary { list-style: none; }
.calmenu summary::-webkit-details-marker { display: none; }
.calmenu .menu {
  position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 5; min-width: 190px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  padding: 6px; display: flex; flex-direction: column;
}
.calmenu .menu a, .calmenu .menu button {
  text-align: left; padding: 9px 10px; border-radius: 8px; border: 0; background: none;
  text-decoration: none; font-size: 14px; font-weight: 600; cursor: pointer;
}
.calmenu .menu a:hover, .calmenu .menu button:hover { background: var(--chip); }

/* ---------- панель выбора ---------- */
.selbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--ink); color: var(--bg); padding: 12px 0;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, .15);
}
.selbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sel-actions { display: flex; gap: 8px; }
.selbar .btn { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 30%, transparent); }
.selbar .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
@media (max-width: 600px) {
  .sel-actions { width: 100%; }
  .sel-actions .btn { flex: 1; padding: 9px 8px; }
  body.has-selbar { padding-bottom: 120px; }
}

/* ---------- модалки ---------- */
dialog {
  border: 0; padding: 0; border-radius: 20px; background: var(--surface); color: var(--ink);
  width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
dialog::backdrop { background: rgba(10, 14, 20, .55); backdrop-filter: blur(2px); }
.modal-body { position: relative; }
.modal-img { width: 100%; max-height: 360px; object-fit: cover; display: block; }
.modal-text { padding: 20px 24px 24px; }
.modal-text h2 { font: 700 22px/1.25 "Unbounded", sans-serif; margin: 10px 0 14px; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0 0 14px; font-size: 14px; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 600; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.modal-actions .calmenu .menu { bottom: auto; top: calc(100% + 6px); left: 0; right: auto; }
.close {
  position: absolute; top: 12px; right: 12px; z-index: 2; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgba(15, 20, 27, .6); color: #fff; font-size: 22px; line-height: 1; cursor: pointer;
}
.help { padding: 24px; }
.help h2 { font: 700 20px/1.2 "Unbounded", sans-serif; margin: 0 40px 12px 0; }
.help .close { background: var(--chip); color: var(--ink); }

.empty { text-align: center; color: var(--muted); padding: 60px 0; }
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; padding-top: 40px; padding-bottom: 32px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--navy); text-decoration: underline; cursor: pointer; font-size: 13px; }
