/* GoonTV web: colours and look follow design/goontv-mockup.html in the Android project. */
:root {
  --bg: #0a0c11; --panel: #10131a; --panel2: #161a23; --line: #222837;
  --text: #e9ecf3; --muted: #8891a5; --dim: #5b6376; --soft: #b9c0cf;
  --acc: #3ea6ff; --accInk: #03121f; --live: #ff4d5e; --bad: #ff6b6b;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.4 "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
svg.i { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; width: 20px; height: 20px; flex: none; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 13px; }

.brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; letter-spacing: .3px; }
.brand img { width: 32px; height: 32px; }
.brand.big { font-size: 26px; justify-content: center; margin-bottom: 4px; }
.brand.big img { width: 52px; height: 52px; }

.btn { background: var(--acc); color: var(--accInk); border: 0; border-radius: 10px; padding: 12px 16px; font-weight: 600; cursor: pointer; }
.btn:disabled { opacity: .6; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--text); }
.iconbtn { background: none; border: 0; color: var(--muted); padding: 8px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.iconbtn:hover { color: var(--text); background: var(--panel2); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* Sign in */
.signin { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px; display: grid; gap: 14px; }
.card p { margin: 0; text-align: center; }
.card label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.card input { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font-size: 16px; color: var(--text); width: 100%; }
.card input:focus { border-color: var(--acc); outline: none; }
.error { color: var(--bad); font-size: 14px; }

/* App frame */
.app { height: 100%; display: grid; grid-template-columns: 200px 1fr; }
.side { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 22px 10px; }
.side .brand { padding: 0 8px 26px; }
.nav { display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: 10px; font-size: 15px; color: var(--muted); text-decoration: none; }
.nav.sel { color: var(--text); background: var(--panel2); }
.nav.sel::after { content: ""; margin-left: auto; width: 5px; height: 5px; border-radius: 50%; background: var(--acc); }
.side-foot { margin-top: auto; padding: 0 8px; display: grid; gap: 6px; font-size: 13px; overflow-wrap: anywhere; }

.main { display: flex; flex-direction: column; padding: 20px 24px 20px; min-width: 0; min-height: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.top h1 { margin: 0; font-size: 22px; font-weight: 600; }
.clock { color: var(--muted); font-size: 15px; }

/* Live TV */
.live { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(180px, 220px) minmax(260px, 340px) 1fr; gap: 16px; }
.col { background: var(--panel); border-radius: 12px; padding: 6px; display: flex; flex-direction: column; min-height: 0; }
.col-title { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--dim); padding: 8px 10px 6px; }
.list { overflow-y: auto; min-height: 0; flex: 1; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

.cat { display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 8px; font-size: 14px; color: var(--muted); cursor: pointer; }
.cat span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat span:last-child { color: var(--dim); font-size: 12px; flex: none; }
.cat:hover { background: var(--panel2); color: var(--text); }
.cat.sel { background: var(--panel2); color: var(--text); }
.cat.sel span:last-child { color: var(--acc); }

.search { display: flex; align-items: center; gap: 8px; margin: 4px 4px 6px; padding: 0 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; color: var(--dim); }
.search:focus-within { border-color: var(--acc); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; padding: 9px 0; font-size: 15px; }

.ch { display: grid; grid-template-columns: 30px 44px 1fr; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; padding: 7px 8px; border-radius: 8px; cursor: pointer; content-visibility: auto; contain-intrinsic-size: auto 46px; }
.ch:hover { background: var(--panel2); }
.ch.sel { background: var(--acc); color: var(--accInk); }
.ch.sel .num { color: var(--accInk); }
.ch .num { color: var(--dim); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.ch .nm { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { width: 44px; height: 32px; border-radius: 6px; display: grid; place-items: center; overflow: hidden; font-weight: 800; font-size: 12px; color: #fff; letter-spacing: .4px; background: var(--panel2); }
.logo img { width: 100%; height: 100%; object-fit: contain; background: #1b2030; }
.empty { color: var(--muted); padding: 16px 12px; font-size: 14px; }

.preview { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow-y: auto; }
.video { position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; background: #000; flex: none; }
.video video { width: 100%; height: 100%; display: block; background: #000; }
.badge { position: absolute; top: 12px; left: 12px; background: var(--live); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 5px; letter-spacing: 1px; pointer-events: none; }
.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(5, 6, 10, .55); border: 0; color: var(--text); cursor: pointer; font-size: 15px; }
.overlay svg { width: 64px; height: 64px; padding: 16px; border-radius: 50%; background: var(--acc); fill: var(--accInk); }
.overlay.msg { cursor: default; padding: 24px; text-align: center; color: var(--soft); background: rgba(5, 6, 10, .8); }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .15); border-top-color: var(--acc); animation: spin .8s linear infinite; }
.video .spinner { position: absolute; left: 50%; top: 50%; margin: -18px 0 0 -18px; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); }

.pv-info { padding: 14px 2px 8px; }
.pv-channel { color: var(--acc); font-size: 13px; font-weight: 600; min-height: 18px; }
.pv-info h2 { margin: 2px 0 4px; font-size: 20px; font-weight: 600; }
.meta { color: var(--muted); font-size: 14px; }
.bar { height: 3px; background: #2a3040; border-radius: 2px; overflow: hidden; margin-top: 8px; max-width: 320px; }
.bar i { display: block; height: 100%; width: 0; background: var(--acc); }
.pv-info p { color: var(--soft); font-size: 14px; line-height: 1.5; margin: 10px 0 0; }
.next { margin-top: 12px; }
.next:not(:empty) { border-top: 1px solid var(--line); padding-top: 6px; }
.next div { display: flex; gap: 14px; font-size: 14px; padding: 5px 0; color: var(--soft); }
.next b { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; flex: none; }

/* TV Guide */
.guide { flex: 1; min-height: 0; display: flex; flex-direction: column; --chw: 220px; }
.ginfo { background: var(--panel); border-radius: 12px; padding: 14px 18px; margin-bottom: 12px; display: flex; gap: 16px; align-items: center; min-height: 96px; flex: none; }
.ginfo > .logo { width: 72px; height: 52px; font-size: 18px; border-radius: 10px; flex: none; }
.ginfo .hint { color: var(--muted); margin: 0; font-size: 14px; }
.gi-text { flex: 1; min-width: 0; }
.gi-text h2 { margin: 0 0 3px; font-size: 19px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gi-text p { margin: 6px 0 0; color: var(--soft); font-size: 14px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta .state { color: var(--acc); }
.gi-acts { display: flex; align-items: center; gap: 6px; flex: none; }
.gi-acts .btn { padding: 9px 20px; }
.gi-close { font-size: 22px; line-height: 1; width: 36px; height: 36px; padding: 0; }
.ginfo:not(.open) .gi-close { display: none; }

.gbar { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.gbar .cat-select { display: block; width: auto; max-width: 300px; padding: 8px 10px; font-size: 14px; }
.gtog { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); cursor: pointer; }
.gtog input { accent-color: var(--acc); width: 16px; height: 16px; margin: 0; }
.gcount { color: var(--dim); font-size: 13px; }
.gnav { display: flex; gap: 6px; margin-left: auto; }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 6px 14px; font-size: 14px; color: var(--soft); cursor: pointer; white-space: nowrap; }
.chip:hover:not(:disabled) { color: var(--text); background: var(--panel2); }
.chip:disabled { opacity: .4; cursor: default; }

.gbody { flex: 1; min-height: 0; overflow-y: auto; background: var(--panel); border-radius: 12px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.gtimes { display: flex; position: sticky; top: 0; z-index: 3; background: var(--panel); border-bottom: 1px solid var(--line); height: 34px; }
.gday { width: var(--chw); flex: none; padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--text); }
.gticks { position: relative; flex: 1; overflow: hidden; }
.gticks span { position: absolute; top: 8px; font-size: 13px; color: var(--muted); transform: translateX(5px); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gticks .nowline::before { content: ""; position: absolute; bottom: -1px; left: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--live); }
.grow { display: flex; height: 60px; border-bottom: 1px solid var(--line); content-visibility: auto; contain-intrinsic-size: auto 60px; }
.gch { width: var(--chw); flex: none; display: grid; grid-template-columns: 28px 44px 1fr; align-items: center; gap: 9px; padding: 0 10px 0 6px; background: none; border: 0; text-align: left; cursor: pointer; color: var(--muted); font-size: 14px; }
.gch:hover { color: var(--text); background: var(--panel2); }
.gch .num { color: var(--dim); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.gch .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gtrack { position: relative; flex: 1; min-width: 0; }
.gcell { position: absolute; top: 5px; bottom: 5px; left: 0; width: calc(100% - 4px); background: var(--panel2); border: 0; border-radius: 7px; padding: 7px 10px; overflow: hidden; white-space: nowrap; text-align: left; cursor: pointer; font-size: 14px; color: var(--text); }
.gcell .t { display: block; overflow: hidden; text-overflow: ellipsis; }
.gcell small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.gcell:hover { background: #1f2738; }
.gcell.now { background: #1d2433; }
.gcell.past { color: var(--dim); }
.gcell.none { color: var(--muted); }
.gcell.sel { background: var(--acc); color: var(--accInk); }
.gcell.sel small { color: var(--accInk); opacity: .75; }
.gcell.gap { background: none; color: var(--dim); cursor: default; font-size: 13px; padding-top: 14px; }
.gcell.wait { cursor: default; background: linear-gradient(90deg, var(--panel2) 30%, #1c2130 50%, var(--panel2) 70%) 0 0 / 300% 100%; animation: wait 1.4s linear infinite; }
@keyframes wait { from { background-position: 100% 0; } to { background-position: 0 0; } }
.nowline { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--live); z-index: 2; pointer-events: none; }

.tabs { display: none; }
.mobile-only { display: none; }

/* Narrower PCs: drop the category column into a dropdown */
@media (max-width: 1100px) {
  .live { grid-template-columns: minmax(240px, 300px) 1fr; grid-template-rows: auto 1fr; }
  .cats-col { display: none; }
  .cat-select { display: block; grid-column: 1; }
  .chans-col { grid-column: 1; grid-row: 2; }
  .preview { grid-column: 2; grid-row: 1 / span 2; }
}
.cat-select { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 15px; width: 100%; }

/* Phones */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; height: auto; min-height: 100%; }
  .side, .desktop-only { display: none; }
  .mobile-only { display: flex; }
  .main { padding: 0 0 env(safe-area-inset-bottom); }
  .top { padding: calc(10px + env(safe-area-inset-top)) 16px 10px; margin: 0; }
  .live { display: flex; flex-direction: column; gap: 10px; }
  .preview { order: -1; position: sticky; top: 0; z-index: 2; background: var(--bg); overflow: visible; }
  .video { border-radius: 0; }
  .pv-info { padding: 10px 16px 4px; }
  .pv-info p, .next { display: none; }
  .cat-select { display: block; margin: 0 16px; width: auto; }
  .chans-col { margin: 0 8px 16px; }
  .list { overflow: visible; }
  .ch { padding: 9px 8px; }
  .ch .nm { font-size: 15px; }

  /* Tabs along the bottom */
  .main { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; height: calc(56px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--panel); border-top: 1px solid var(--line); }
  .tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--muted); text-decoration: none; }
  .tab.sel { color: var(--acc); }

  /* Guide: narrow channel column, the page scrolls, programme details slide up from the bottom */
  .guide { --chw: 72px; }
  .gbar { padding: 0 16px; gap: 10px; }
  .gbar .cat-select { flex: 1; max-width: none; margin: 0; padding: 10px 12px; font-size: 15px; }
  .gcount { display: none; }
  .gnav { margin-left: 0; width: 100%; }
  .gnav .chip { flex: 1; padding: 8px 6px; }
  .gbody { overflow: visible; border-radius: 0; }
  .gday { padding: 8px 6px; font-size: 12px; text-align: center; }
  .grow { height: 64px; }
  .gch { grid-template-columns: 1fr; justify-items: center; align-content: center; gap: 3px; padding: 4px; }
  .gch .num { display: none; }
  .gch .nm { font-size: 10px; max-width: 100%; }
  .gch .logo { width: 44px; height: 30px; }
  .gcell { padding: 7px 8px; font-size: 13px; }
  .ginfo { display: none; }
  .ginfo.open { display: flex; position: fixed; left: 8px; right: 8px; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 9; margin: 0; flex-wrap: wrap; border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(0, 0, 0, .6); padding: 12px 14px; gap: 12px; }
  .ginfo > .logo { width: 52px; height: 38px; font-size: 14px; }
  .gi-text h2 { font-size: 16px; white-space: normal; }
  .gi-text p { -webkit-line-clamp: 3; }
  .gi-acts { position: absolute; top: 8px; right: 8px; }
  .gi-text { padding-right: 90px; }
}
