:root {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --ink: #1d1b18;
  --muted: #6d675d;
  --line: #e2dccf;
  --accent: #d6452b;
  --accent-soft: #fbe3dc;
  --past: #a9a295;
  --gold: #b7791f;
  --gold-soft: #fdf1d8;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15140f;
    --surface: #1f1d18;
    --ink: #f0ebe0;
    --muted: #a39b8c;
    --line: #34312a;
    --accent: #ff6a4d;
    --accent-soft: #3a211b;
    --past: #5f5a50;
    --gold: #f2b84b;
    --gold-soft: #3b2f17;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 12px; }
h1 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }
.clock { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 600; }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.days { flex: 1; }
.groups { flex-basis: 100%; }
.chips button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 6px 12px;
  border-radius: 999px;
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}
.chips button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.toggle { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; cursor: pointer; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  padding: 16px;
  max-width: 1600px;
  margin: 0 auto;
}
.status { color: var(--muted); grid-column: 1 / -1; text-align: center; padding: 40px 0; }

.channel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  max-height: 560px;
  overflow: hidden;
}
.channel h2 {
  margin: 0;
  padding: 12px 14px;
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}
.channel h2 img { height: 22px; max-width: 60px; object-fit: contain; }
.list { list-style: none; margin: 0; padding: 4px 0; overflow-y: auto; }

.prog {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
  padding: 7px 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
}
.prog:hover { background: color-mix(in srgb, var(--line) 45%, transparent); }
.prog time { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.prog .title { overflow-wrap: anywhere; }
.prog.past { color: var(--past); }
.prog.past time { color: var(--past); }
.prog.now { background: var(--accent-soft); border-left-color: var(--accent); }
.prog.now time { color: var(--accent); }
.prog.now .title { font-weight: 600; }
.bar { height: 3px; background: var(--line); border-radius: 2px; margin-top: 5px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }
.left { font-size: 12px; color: var(--muted); }
.cat { font-size: 12px; color: var(--muted); }

dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  max-width: min(520px, calc(100vw - 32px));
  padding: 20px 22px;
}
dialog::backdrop { background: rgb(0 0 0 / 0.45); }
dialog h2 { margin: 4px 0 10px; }
.d-meta { margin: 0; color: var(--accent); font-weight: 600; font-size: 14px; }
.close {
  float: right;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 10px 16px 28px; }
.foot a { color: inherit; }

}

.groups button { font-size: 14px; padding: 4px 11px; }

.badge {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  vertical-align: 1px;
  color: var(--gold);
  background: var(--gold-soft);
  white-space: nowrap;
}
.badge.weak { opacity: 0.55; }
.badge.hot { background: var(--gold); color: var(--surface); }
.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 4px;
  vertical-align: 1px;
}

.tips { max-width: 1600px; margin: 0 auto; padding: 16px 16px 0; }
.tips h2 { margin: 0 0 10px; font-size: 18px; }
.tips-list {
  list-style: none;
  margin: 0;
  padding: 0 0 6px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 150px;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}
.tip { cursor: pointer; scroll-snap-align: start; }
.poster { position: relative; aspect-ratio: 2 / 3; border-radius: 10px; overflow: hidden; background: var(--line); }
.poster img, .poster .noimg { width: 100%; height: 100%; object-fit: cover; display: block; }
.poster .badge { position: absolute; top: 6px; left: 2px; box-shadow: 0 1px 4px rgb(0 0 0 / 0.3); }
.tip:hover .poster img { transform: scale(1.03); transition: transform 0.2s; }
.tip-body { padding: 6px 2px 0; }
.tip-when { font-size: 12px; font-weight: 600; color: var(--accent); }
.tip-title { font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.tip-meta { font-size: 12px; color: var(--muted); }

.d-wrap { display: flex; gap: 14px; align-items: flex-start; }
.d-poster { width: 96px; border-radius: 8px; flex-shrink: 0; }
.d-sub, .d-tags { margin: 0 0 4px; color: var(--muted); font-size: 14px; }
.scores { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.score {
  display: flex;
  flex-direction: column;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  min-width: 84px;
}
.score:hover { border-color: var(--accent); }
.score span { font-size: 11px; color: var(--muted); }
.score strong { font-size: 16px; }
.d-votes { margin: 0; font-size: 12px; color: var(--muted); }
.d-credits { white-space: pre-line; font-size: 14px; color: var(--muted); }

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; padding: 12px 16px; }
  .tips-list { grid-auto-columns: 124px; }
  .d-poster { width: 72px; }
  .channel { max-height: 420px; }
}
