/* Channel comparison screen. --c1..--c8 are the channel colours, in this order, checked for colour-blind safety. */
:root { --c1: #eda100; --c2: #2a78d6; --c3: #e34948; --c4: #1baf7a; --c5: #eb6834; --c6: #6250d6; --c7: #e87ba4; --c8: #008300; }
@media (prefers-color-scheme: dark) { :root { --c1: #c98500; --c2: #3987e5; --c3: #e66767; --c4: #199e70; --c5: #d95926; --c6: #9085e9; --c7: #d55181; --c8: #0ca30c; } }

#compare { display: none; }
.comparing #compare { display: block; }
.comparing #status { display: none; } /* belongs to the main search */
.comparing main > :not(#compare) { display: none; }
.nav-link { color: #fff; font-weight: 600; text-decoration: none; padding: 6px 12px; border-radius: 8px; border: 1px solid #555; flex: none; }
.nav-link:hover { border-color: var(--yellow); }
.comparing .nav-link { background: var(--yellow); border-color: var(--yellow); color: #1c1c1c; }

.cmp-body { padding: 18px 20px; }
.cmp-form { display: grid; gap: 16px; }
.cmp-channels { display: grid; gap: 12px; grid-template-columns: repeat(4, 1fr); }
.cmp-field { position: relative; display: grid; gap: 4px; min-width: 0; }
.cmp-channels label { color: var(--muted); font-size: 12.5px; }
.cmp-input-row { position: relative; }
.cmp-input-row input { padding-right: 36px; }
.cmp-remove { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); height: 30px; width: 30px; padding: 0; background: none; color: var(--muted); font-size: 15px; font-weight: 400; }
.cmp-remove:hover:not(:disabled) { background: var(--chip); color: var(--text); }
.cmp-add { justify-self: start; }
.cmp-field .suggest { min-width: min(300px, 80vw); }
.cmp-field:nth-child(4n) .suggest { left: auto; right: 0; }
.cmp-channels input { width: 100%; font-size: 14px; }
.cmp-dates { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cmp-dates label { color: var(--muted); }
.cmp-dates button[type="submit"] { margin-left: auto; }
#cmpStatus:not(:empty) { margin: 0 0 16px; }
#cmpResult.stale { opacity: .45; }
.cmp-body > p:last-child { margin: 12px 0 0; max-width: 95ch; }

.key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 8px; flex: none; }
.cmp-table { width: 100%; border-collapse: collapse; }
.cmp-table th, .cmp-table td { padding: 8px 16px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.cmp-table th:first-child { text-align: left; font-weight: 500; white-space: nowrap; }
.cmp-table thead th { font-weight: 600; }
.cmp-table.main { min-width: 560px; }
.cmp-table.main td { white-space: nowrap; }
.cmp-table tbody tr:last-child > * { border-bottom: 0; }
.cmp-table .group th { background: var(--sunken); color: var(--muted); font-size: 12.5px; font-weight: 600; }
.cmp-table .best { background: var(--videos-bg); color: var(--videos); font-weight: 700; }
.star { color: inherit; }
.cmp-ch { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.cmp-ch img { width: 48px; height: 48px; border-radius: 50%; border: 3px solid; background: var(--card); }

/* Channel logos and names stay in view while the table scrolls. --top-h is the page header's height. */
.cmp-body > .table-wrap:has(> .main) { overflow: visible; border-radius: 0 0 10px 10px; }
.cmp-table.main { border-collapse: separate; border-spacing: 0; }
.cmp-table.main thead > tr > * { position: sticky; top: var(--top-h, 65px); z-index: 2; background: var(--card); box-shadow: 0 6px 8px -6px rgb(0 0 0 / .18); }
.cmp-table.main tbody tr:last-child > :last-child { border-bottom-right-radius: 10px; }

.charts { display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.chart h3 { margin: 0; font-size: 14px; }
.chart > p { margin: 0 0 12px; }
.bar-row { padding: 5px 0; }
.bar-name { display: block; font-size: 12.5px; color: var(--muted); }
.bar-track { display: flex; align-items: center; gap: 8px; padding-right: 64px; height: 20px; border-left: 1px solid var(--line); }
.bar { display: block; height: 16px; border-radius: 0 4px 4px 0; flex: none; }
.bar-val { font-weight: 600; white-space: nowrap; margin-right: -64px; }
.bar-row:hover .bar, .col:hover span { filter: brightness(1.1); }

.hours-grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.hours h4, .top-grid h4 { margin: 0 0 10px; font-size: 14px; display: flex; align-items: center; }
.cols { position: relative; display: flex; align-items: stretch; height: 110px; border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); }
.y-max { position: absolute; right: 0; top: -20px; font-size: 11.5px; color: var(--muted); pointer-events: none; }
.col { flex: 1; display: flex; align-items: flex-end; justify-content: center; padding: 0 1px; }
.col:hover { background: var(--chip); }
.col span { display: block; width: 100%; max-width: 24px; border-radius: 3px 3px 0 0; }
.ticks { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
details summary { cursor: pointer; color: var(--muted); margin-top: 16px; }
details .table-wrap { margin-top: 10px; }

.top-grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.top-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.top-list button { width: 100%; height: auto; display: flex; gap: 12px; padding: 6px; text-align: left; background: none; color: inherit; font-weight: 400; align-items: center; }
.top-list button:hover:not(:disabled) { background: var(--chip); }
.top-list img { width: 88px; height: 50px; object-fit: cover; border-radius: 6px; background: var(--chip); flex: none; }
.top-list button > span { min-width: 0; }
.top-list b { font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }

.tip { position: fixed; z-index: 20; pointer-events: none; background: #262626; color: #fff; border: 1px solid #555; border-radius: 8px; padding: 6px 10px; font-size: 12.5px; max-width: 240px; }
.tip b { display: block; font-size: 14px; }

@media (max-width: 900px) { .cmp-channels { grid-template-columns: 1fr 1fr; } .cmp-field .suggest { right: auto; left: 0; } .cmp-field:nth-child(2n) .suggest { left: auto; right: 0; } }
@media (max-width: 760px) {
  .cmp-table th, .cmp-table td { padding: 8px 12px; }
  /* Small screens: the table scrolls both ways inside its own box */
  .cmp-body > .table-wrap:has(> .main) { overflow: auto; max-height: 80vh; }
  .cmp-table.main thead > tr > * { top: 0; }
  .cmp-table.main thead > tr > :first-child { left: 0; z-index: 3; }
  .cmp-table.main tbody th:first-child { position: sticky; left: 0; background: var(--card); }
  .cmp-table.main .group th:first-child { background: var(--sunken); }
  .cmp-dates button[type="submit"] { margin-left: 0; width: 100%; }
  .nav-link { text-align: center; }
}
