/* Sleepy Dog Sports Desk — "Sleepy Dog, refined".
   TV mode is the `html.tv` class: bigger type, safe margins, single column. */

:root {
    --ink: #070b16; --ink-2: #0b1224; --surface: #111a30; --surface-2: #16203c;
    --line: #1f2b48; --line-soft: #18243f;
    --text: #eef2fb; --muted: #7e8db0; --muted-2: #5a6788;
    --cyan: #28e0e8; --blue: #4b8cff;
    --live: #ff4d5e; --soon: #f4b740; --sched: #36d399; --final: #f4b740; --gold: #ffd23f;
    --mono: "DM Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    background-color: var(--ink);
    background-image:
        radial-gradient(1100px 600px at 78% -8%, rgba(75,140,255,0.12), transparent 60%),
        radial-gradient(900px 500px at 8% 0%, rgba(40,224,232,0.10), transparent 55%);
    background-attachment: fixed;
    color: var(--text);
    font-family: "Hanken Grotesk", system-ui, sans-serif;
    min-height: 100vh;
    padding: 1.2rem clamp(1rem, 4vw, 3rem) 4rem;
}
.wrap { max-width: 1400px; margin: 0 auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---- header ---- */
.hdr { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap;
       padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.brand .dot { font-size: 1.8rem; filter: drop-shadow(0 0 12px rgba(40,224,232,0.45)); }
.brand .name { font-family: "Anton", sans-serif; font-size: 1.5rem; letter-spacing: 0.02em; text-transform: uppercase; }
.brand .name b { font-weight: 400; color: var(--cyan); }
.tabs { display: flex; gap: 0.3rem; }
.tabs a { text-decoration: none; color: var(--muted); font-weight: 700; font-size: 0.92rem;
          padding: 0.45rem 0.95rem; border-radius: 999px; }
.tabs a:hover { color: var(--text); }
.tabs a.active { background: var(--text); color: var(--ink); }
.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
.clock { display: none; font-family: var(--mono); color: var(--muted); }
.tvbtn { background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
         padding: 0.35rem 0.8rem; font-size: 0.8rem; color: var(--muted); cursor: pointer; }
.tvbtn.on { border-color: var(--cyan); color: var(--text); }

/* sync status (same rules as before: amber/red when stale or a feed fails) */
.health { position: relative; font-family: var(--mono); font-size: 0.76rem; color: var(--muted-2); }
.health summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 0.45rem; }
.health summary::-webkit-details-marker { display: none; }
.health .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sched); }
.health.warn .dot { background: var(--soon); } .health.bad .dot { background: var(--live); }
.health.warn .issue { color: var(--soon); } .health.bad .issue { color: var(--live); }
.feeds { position: absolute; right: 0; top: calc(100% + 0.5rem); z-index: 20; width: max-content;
         max-width: min(36rem, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line);
         border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,0.45); padding: 0.5rem 0.8rem;
         display: grid; grid-template-columns: auto auto 1fr; gap: 0.3rem 0.9rem; }
.feeds .st { font-size: 0.66rem; font-weight: 800; text-transform: uppercase; }
.feeds .st.ok { color: var(--sched); } .feeds .st.quiet { color: var(--muted-2); }
.feeds .st.failing { color: var(--soon); } .feeds .st.down { color: var(--live); }
@media (max-width: 600px) { .feeds { left: 0; right: auto; } }

/* ---- filters ---- */
.filters { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.3rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.chip { background: var(--surface); border: 1px solid var(--line); color: var(--muted);
        padding: 0.45rem 0.9rem; border-radius: 999px; cursor: pointer; font-weight: 600;
        font-size: 0.84rem; white-space: nowrap; }
.chip:hover { color: var(--text); }
.chip.active { color: var(--ink); background: linear-gradient(135deg, var(--cyan), var(--blue)); border-color: transparent; }
.chip.sub { padding: 0.3rem 0.72rem; font-size: 0.77rem; }
.chip.sub.active { color: var(--text); background: rgba(40,224,232,0.08); border-color: var(--cyan); }
.chip.sub .n { font-family: var(--mono); font-size: 0.7rem; color: var(--muted-2); margin-left: 0.35rem; }

/* ---- networks (sub-project A styling) ---- */
.net { display: inline-flex; align-items: center; font-family: var(--mono); background: var(--surface-2);
       color: #9fd0ff; font-size: 0.7rem; padding: 0.18rem 0.48rem; border-radius: 5px; }
.net.rights { background: transparent; border: 1px dashed var(--line); color: var(--muted); }
.net .fl { margin-right: 0.3rem; }
.nets { display: flex; flex-wrap: wrap; gap: 0.3rem; }

.credit { margin-top: 2rem; font-size: 0.72rem; color: var(--muted-2); font-family: var(--mono); }
.credit a { color: var(--muted); }

/* ---- focus (remote / keyboard): only after an arrow key was pressed ---- */
html.keys :focus { outline: 3px solid var(--cyan); outline-offset: 2px;
                   box-shadow: 0 0 24px rgba(40,224,232,0.35); border-radius: 10px; }

/* ---- TV mode ---- */
html.tv { font-size: 22px; }
html.tv body { padding: 5vh 5vw; }
html.tv .wrap { max-width: none; }
html.tv .clock { display: inline; }

/* Phones: the sport chips become one swipeable strip instead of four rows. */
@media (max-width: 700px) {
    .filters > .chips:first-child { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
    .filters > .chips:first-child::-webkit-scrollbar { display: none; }
}

/* ---- Home ---- */
.block { margin-bottom: 1.1rem; }
.sec { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
       font-weight: 800; margin: 0.4rem 0 0.5rem; }
.day { font-family: "Anton", sans-serif; font-weight: 400; font-size: 1.35rem; letter-spacing: 0.03em;
       text-transform: uppercase; margin: 1.6rem 0 0.6rem; padding-bottom: 0.35rem; border-bottom: 1px solid var(--line); }
.live { color: var(--live); } .soon { color: var(--soon); }

.strip { display: flex; gap: 0.7rem; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: thin; }
.tile { flex: 0 0 auto; width: 15.5rem; background: var(--surface); border: 1px solid var(--line);
        border-radius: 12px; padding: 0.7rem 0.85rem; cursor: pointer; }
.tile.is-live { border-color: rgba(255,77,94,0.55); }
.tile .t-top { font-size: 0.72rem; color: var(--muted); font-weight: 700; margin-bottom: 0.35rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .t-title { font-weight: 700; font-size: 0.98rem; line-height: 1.25; }

.row { display: grid; grid-template-columns: 4.2rem 1fr; gap: 0.9rem; align-items: start;
       padding: 0.7rem 0.6rem; border-radius: 10px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.row:hover { background: rgba(22,32,60,0.55); }
.row .when { font-family: var(--mono); color: var(--cyan); font-size: 0.92rem; padding-top: 0.1rem; }
.row .title { font-weight: 700; font-size: 1.02rem; line-height: 1.3; overflow-wrap: anywhere; }
.row .nets { margin-top: 0.4rem; }
.score { font-family: var(--mono); font-weight: 600; margin-left: 0.6rem; color: var(--muted); white-space: nowrap; }
.score.live { color: var(--live); }
.tile .score { display: block; margin: 0.3rem 0 0; }
.badge { font-size: 0.62rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em;
         padding: 0.22rem 0.45rem; border-radius: 5px; font-family: "Hanken Grotesk", sans-serif; }
.badge.live { background: rgba(255,77,94,0.14); color: var(--live); }
.badge.final { background: rgba(244,183,64,0.14); color: var(--final); }
.team { cursor: pointer; }
.team .star { opacity: 0.35; font-size: 0.8em; margin-left: 0.2rem; }
.team:hover .star { opacity: 1; }
.team.fav { color: var(--gold); } .team.fav .star { opacity: 1; }

.more { display: block; margin: 1.2rem auto; background: var(--surface); border: 1px solid var(--line);
        color: var(--text); border-radius: 999px; padding: 0.6rem 1.4rem; font-weight: 700; cursor: pointer; }
.empty { text-align: center; padding: 3rem 1.5rem; color: var(--muted); background: var(--surface);
         border: 1px dashed var(--line); border-radius: 16px; }
.empty .big { font-family: "Anton", sans-serif; font-size: 1.4rem; margin-bottom: 0.5rem; }

@media (max-width: 600px) {
    .row { grid-template-columns: 3.4rem 1fr; gap: 0.6rem; padding: 0.65rem 0.2rem; }
    .tile { width: 13rem; }
}
html.tv .row { padding: 0.9rem 0.8rem; }
html.tv .tile { width: 17rem; }

/* ---- details panel: centred; a bottom sheet on phones ---- */
.details-root { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.d-backdrop { position: absolute; inset: 0; background: rgba(3,6,14,0.72); backdrop-filter: blur(3px); }
.panel { position: relative; width: min(46rem, 92vw); max-height: 88vh; overflow-y: auto; background: var(--ink-2);
         border: 1px solid var(--line); border-radius: 18px; padding: 1.4rem 1.5rem 1.2rem; box-shadow: 0 24px 64px rgba(0,0,0,0.6); }
.d-close { position: absolute; top: 0.8rem; right: 0.8rem; background: var(--surface); border: 1px solid var(--line);
           border-radius: 50%; width: 2.2rem; height: 2.2rem; cursor: pointer; }
.d-comp { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; color: var(--muted); font-weight: 700;
          font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; padding-right: 2.6rem; }
.d-divstar, .d-team { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.75rem;
                      cursor: pointer; font-size: 0.8rem; text-transform: none; letter-spacing: 0; color: var(--text); }
.d-divstar.on, .d-team.on { border-color: var(--gold); color: var(--gold); }
.d-title { font-size: 1.5rem; line-height: 1.25; margin: 0.6rem 0 0.7rem; }
.d-teams { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.d-when { color: var(--muted); font-size: 0.92rem; margin-bottom: 0.4rem; }
.d-when .score { margin-left: 0.2rem; }
.d-venue { color: var(--muted); font-size: 0.88rem; }
.d-h { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 1.2rem 0 0.5rem; }
.d-country { display: grid; grid-template-columns: 11rem 1fr; gap: 0.6rem; padding: 0.45rem 0; border-top: 1px solid var(--line-soft); }
.d-cname { font-weight: 700; font-size: 0.88rem; }
.d-legend { margin-top: 1rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.d-none { color: var(--muted); }
@media (max-width: 700px) {
    .details-root { align-items: flex-end; }
    .panel { width: 100vw; max-height: 85vh; border-radius: 18px 18px 0 0; }
    .d-country { grid-template-columns: 1fr; gap: 0.3rem; }
}
.badge.scheduled { background: rgba(54,211,153,0.13); color: var(--sched); }

/* ---- Guide ---- */
.g-controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.g-range { font-family: var(--mono); color: var(--muted); font-size: 0.85rem; margin: 0 0.6rem; }
.g-days { flex-basis: 100%; }
.g-grid { --label: 11rem; --lane-h: 3.4rem; }
.g-head, .g-row { display: grid; grid-template-columns: var(--label) 1fr; gap: 0.5rem; }
.g-times { position: relative; height: 1.4rem; border-bottom: 1px solid var(--line); }
.g-times span { position: absolute; top: 0; font-family: var(--mono); font-size: 0.75rem; color: var(--muted); transform: translateX(2px); }
.g-row { border-bottom: 1px solid var(--line-soft); padding: 0.3rem 0; }
.g-label { font-weight: 700; font-size: 0.82rem; color: #9fb0d0; padding: 0.5rem 0.4rem; background: var(--surface);
           border-radius: 8px; align-self: stretch; }
.g-track { position: relative; height: calc(var(--lanes) * var(--lane-h)); }
.g-lane { position: absolute; left: 0; right: 0; top: calc(var(--lane) * var(--lane-h)); height: var(--lane-h); }
.g-now { position: absolute; top: -0.3rem; bottom: -0.3rem; width: 2px; background: var(--live); z-index: 2;
         box-shadow: 0 0 8px rgba(255,77,94,0.6); }
.g-block { position: absolute; top: 2px; bottom: 2px; background: var(--surface-2); border: 1px solid var(--line);
         border-radius: 7px; padding: 0.25rem 0.45rem; overflow: hidden; cursor: pointer; min-width: 2.2rem; }
.g-block.is-live { box-shadow: inset 3px 0 0 var(--live); }
.g-block.clipped { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 2px dashed var(--muted-2); }
.g-block .b-title { font-size: 0.78rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-block .b-meta { font-size: 0.72rem; white-space: nowrap; overflow: hidden; }
.g-block .score { margin-left: 0; font-size: 0.72rem; }
.g-item { padding: 0.65rem 0.3rem; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.g-item .title { font-weight: 700; }
.g-sub { color: var(--muted); font-size: 0.8rem; margin: 0.2rem 0 0.35rem; font-family: var(--mono); }
.g-slot { margin-top: 1.2rem; color: var(--cyan); }
html.tv .g-grid { --label: 13rem; --lane-h: 3.6rem; }

/* ---- Favourites ---- */
.feed-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.feed-row input { flex: 1 1 18rem; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
                  color: var(--muted); font-family: var(--mono); font-size: 0.74rem; padding: 0.45rem 0.6rem; }
.feed-row a.chip { text-decoration: none; }
