/* AcadionPlay web — mirrors the Android player (ui/theme/Theme.kt, PlayerScreen.kt, ChannelSheet.kt). */
:root {
  --bg: #080b0e;
  --text: #f6f7f7;
  --muted: #929ba3;
  --accent: #62d7c7;
  --accent-deep: #25423f;
  --accent-ink: #70e5d8;
  --dock: rgba(15, 19, 24, 0.82);
  --border: rgba(255, 255, 255, 0.17);
  --gold: #e5d18d;
  --guide: #a270fb;
  --g-left: 180px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
body { font-family: Inter, "Segoe UI", Roboto, system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:disabled { cursor: default; opacity: 0.45; }
button:focus-visible, input:focus-visible, .row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { display: block; fill: currentColor; }
[hidden] { display: none !important; }

#stage { position: fixed; inset: 0; background: var(--bg); }
#stage.idle { cursor: none; }
#video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
#touch { position: absolute; inset: 0; touch-action: none; }

#scrim {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 450ms;
  background: linear-gradient(to bottom, #00000088 0%, transparent 22%, transparent 75%, #00000088 100%);
}
#stage.chrome:not(.idle) #scrim { opacity: 1; }

/* ---------- top bar ---------- */
#topbar {
  position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: flex-start;
  padding: calc(12px + var(--safe-t)) calc(22px + var(--safe-r)) 4px calc(22px + var(--safe-l));
  pointer-events: none; transition: opacity 250ms;
}
#topbar button { pointer-events: auto; }
#stage:not(.chrome) #topbar { opacity: 0; }
#stage:not(.chrome) #topbar button { pointer-events: none; }
.clock { color: #d4e0e4; font-size: 13px; padding-top: 6px; text-shadow: 0 2px 12px rgba(0,0,0,.85); }
#stage.idle .clock { visibility: hidden; }
.title-block { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; max-width: min(440px, 70vw); }
.brand-row { display: flex; align-items: center; max-width: 100%; }
.brand { font-size: 20px; font-weight: 800; letter-spacing: -1.1px; white-space: nowrap; text-shadow: 0 2px 12px rgba(0,0,0,.85); }
.brand .dot { color: var(--accent); letter-spacing: 0; }
.divider { width: 1px; height: 18px; margin: 0 10px; background: rgba(255,255,255,.48); flex: none; }
.channel-name { font-size: 16px; font-weight: 700; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 8px; text-shadow: 0 2px 12px rgba(0,0,0,.85); }
.program-name { color: #d5d9dc; font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 2px 12px rgba(0,0,0,.85); margin-top: 2px; }
.now-badge { margin-top: 6px; background: var(--accent); color: #092321; font-size: 10px; font-weight: 800; letter-spacing: .6px; padding: 3px 8px; border-radius: 5px; }
#stage.idle .now-badge { display: none; }

/* ---------- now / next card ---------- */
.nownext {
  position: absolute; top: calc(var(--safe-t) + 56px); left: calc(22px + var(--safe-l)); width: min(420px, 52vw);
  background: rgba(13, 17, 23, .78); border: 1px solid rgba(255,255,255,.1); border-radius: 14px; padding: 12px 14px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: opacity 250ms;
}
#stage:not(.chrome) .nownext, #stage.idle .nownext { opacity: 0; pointer-events: none; }
.nn-label { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .8px; }
.nn-title { font-size: 15px; font-weight: 700; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nn-range { color: var(--muted); font-size: 12px; margin-top: 2px; }
.nn-progress { height: 3px; background: rgba(88,98,105,.4); border-radius: 3px; margin-top: 8px; overflow: hidden; }
#nn-fill { height: 100%; width: 0; background: var(--accent); }
.nn-next { color: #b0b4bb; font-size: 12px; margin-top: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nn-guide { margin-top: 10px; font-size: 12px; font-weight: 600; color: var(--text); background: #915af6; padding: 6px 12px; border-radius: 8px; }

/* ---------- center messages ---------- */
#center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
#center > * { pointer-events: auto; }
#center > .spinner-pill { pointer-events: none; }
.spinner-pill { background: rgba(8, 13, 18, .74); border: 1px solid rgba(255,255,255,.13); border-radius: 100px; padding: 11px 16px; }
.spinner { width: 21px; height: 21px; border-radius: 50%; border: 2px solid rgba(98,215,199,.25); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.spinner.big { width: 28px; height: 28px; border-width: 3px; margin: 16px auto 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.splash { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px; pointer-events: none; }
.splash.dramatic { background: radial-gradient(circle, #233236 0%, #11191d 55%, #080b0e 100%); }
.splash .mono { font-size: 96px; font-weight: 800; letter-spacing: -6px; color: #1f3b38; line-height: 1; }
.splash img { width: 72px; height: 72px; }
.splash h1 { font-size: 22px; font-weight: 600; margin: 12px 0 6px; }
.splash p { color: #a6b1b7; font-size: 14px; margin: 0; }
.card { background: rgba(13, 17, 23, .95); border: 1px solid rgba(255,255,255,.16); border-radius: 15px; padding: 20px 24px; text-align: center; max-width: min(420px, 88vw); }
.card p { margin: 0 0 12px; font-size: 15px; font-weight: 500; }
.card button { color: var(--accent); font-weight: 600; padding: 8px 12px; border-radius: 8px; }

/* ---------- notice ---------- */
.notice {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(80px + var(--safe-b)); width: min(520px, calc(100% - 36px));
  display: flex; align-items: center; gap: 8px; background: #192226; border: 1px solid #526567; border-radius: 9px; padding: 10px 6px 10px 14px; font-size: 12px; z-index: 7;
}
.notice span { flex: 1; }
.notice button { font-size: 20px; color: var(--muted); width: 32px; height: 32px; }

/* ---------- dock ---------- */
.dock {
  position: absolute; left: calc(10px + var(--safe-l)); right: calc(10px + var(--safe-r)); bottom: calc(10px + var(--safe-b));
  display: flex; align-items: center; gap: 4px; padding: 5px 8px; background: var(--dock); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.45); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: opacity 250ms, transform 250ms; z-index: 2;
}
#stage:not(.chrome) .dock, #stage.idle .dock { opacity: 0; transform: translateY(24px); pointer-events: none; }
.tool { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.tool svg { width: 22px; height: 22px; }
.tool:hover:not(:disabled) { background: rgba(255,255,255,.06); }
.tool.accent { background: var(--accent-deep); color: var(--accent-ink); }
.tool.accent:hover:not(:disabled) { background: #2e524e; }
.tool .i-pause, .tool .i-mute { display: none; }
#btn-play.playing .i-play { display: none; }
#btn-play.playing .i-pause { display: block; }
#btn-volume.muted .i-vol { display: none; }
#btn-volume.muted .i-mute { display: block; color: var(--muted); }
#btn-refresh.loading svg { animation: spin .9s linear infinite; color: var(--accent); }
.label { height: 38px; padding: 0 12px; border-radius: 9px; font-size: 13px; font-weight: 600; flex: none; }
.label:hover:not(:disabled) { background: rgba(255,255,255,.06); }
.label.active { background: var(--accent-deep); color: var(--accent-ink); }
.grow { flex: 1; }
.quality { color: #c9d3d6; font-size: 11px; border: 1px solid rgba(255,255,255,.15); border-radius: 6px; padding: 4px 8px; margin-left: 4px; }
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-size: 11px; font-weight: 800; padding: 6px 4px; margin-left: 4px; white-space: nowrap; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.volume-wrap { flex: 1; display: flex; align-items: center; padding: 0 8px; min-width: 90px; }
.dock.volume-open .grow, .dock.volume-open .quality, .dock.volume-open .live { display: none !important; }
#volume { width: 100%; accent-color: var(--accent); }

/* ---------- channel sheet ---------- */
#sheet-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.28); z-index: 3; }
.sheet {
  position: absolute; left: calc(18px + var(--safe-l)); top: calc(72px + var(--safe-t)); bottom: calc(78px + var(--safe-b)); width: 366px;
  display: flex; flex-direction: column; padding: 18px 12px 10px 16px; border-radius: 22px; border: 1px solid rgba(255,255,255,.09);
  background: linear-gradient(to bottom, rgba(20,22,26,.8) 0%, rgba(16,18,21,.96) 52%, rgba(13,15,18,.96) 100%);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 20px 50px rgba(0,0,0,.5);
  transform: translateX(calc(-100% - 60px)); opacity: 0; visibility: hidden;
  transition: transform 240ms cubic-bezier(.4,0,.2,1), opacity 240ms, visibility 0s linear 240ms; z-index: 4;
}
.sheet.open { transform: none; opacity: 1; visibility: visible; transition: transform 240ms cubic-bezier(.4,0,.2,1), opacity 240ms; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; }
.sheet-head h2, .guide-head h2 { margin: 0; font-size: 22px; font-weight: 700; }
.sheet-count { color: var(--muted); font-size: 12px; margin-top: 2px; }
.round { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.08); font-size: 20px; line-height: 1; color: var(--text); flex: none; }
.round:hover { background: rgba(255,255,255,.14); }
.search { display: flex; align-items: center; gap: 8px; height: 41px; margin-top: 12px; padding: 0 12px; border-radius: 12px; background: #1d2026; border: 1px solid rgba(255,255,255,.06); flex: none; }
.search svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text); font: inherit; font-size: 13px; }
.search input::placeholder { color: var(--muted); }
.tabs { display: flex; gap: 8px; overflow-x: auto; margin-top: 12px; padding-bottom: 6px; scrollbar-width: none; flex: none; }
.tabs::-webkit-scrollbar { display: none; }
.pill { flex: none; font-size: 12px; padding: 8px 13px; border-radius: 30px; background: rgba(255,255,255,.07); white-space: nowrap; }
.pill:hover { background: rgba(255,255,255,.12); }
.pill.active { background: var(--accent); color: #15191a; font-weight: 600; }
.list { flex: 1; overflow-y: auto; margin-top: 8px; padding-right: 4px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #2b3138 transparent; }
.row { position: relative; display: flex; align-items: center; min-height: 64px; padding: 9px 2px 9px 8px; border-radius: 13px; border: 1px solid transparent; cursor: pointer; margin-bottom: 2px; }
.row:hover { background: rgba(255,255,255,.04); }
.row.selected { background: rgba(98,215,199,.1); border-color: #70e2d3; }
.row.selected::before { content: ""; position: absolute; left: 0; top: 50%; width: 3px; height: 28px; transform: translateY(-50%); border-radius: 0 4px 4px 0; background: #79ecdb; }
.row .num { width: 28px; color: #8e979d; font-size: 12px; text-align: right; flex: none; }
.row.selected .num { color: var(--accent); }
.row .logo { width: 40px; height: 30px; margin-left: 11px; object-fit: contain; flex: none; border-radius: 4px; }
.row .logo.blank { display: grid; place-items: center; background: #1b2026; color: var(--muted); font-size: 12px; font-weight: 700; }
.row .info { flex: 1; min-width: 0; margin-left: 11px; }
.row .name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .prog { color: #b0b4bb; font-size: 11px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .bar { height: 2px; border-radius: 3px; background: rgba(88,98,105,.4); margin-top: 6px; overflow: hidden; }
.row .bar i { display: block; height: 100%; background: var(--accent); }
.row .fav { width: 40px; height: 40px; display: grid; place-items: center; color: #879297; flex: none; border-radius: 50%; }
.row .fav svg { width: 18px; height: 18px; }
.row .fav.on { color: var(--gold); }
.empty { text-align: center; color: #96a0a6; font-size: 13px; padding: 32px 12px; }
.empty strong { display: block; color: var(--text); font-size: 16px; font-weight: 500; margin-bottom: 4px; }

/* ---------- guide ---------- */
.guide {
  position: absolute; inset: calc(14px + var(--safe-t)) calc(14px + var(--safe-r)) calc(14px + var(--safe-b)) calc(14px + var(--safe-l));
  display: flex; flex-direction: column; background: rgba(12, 13, 18, .97); border: 1px solid rgba(162,112,251,.25); border-radius: 20px; z-index: 6; overflow: hidden;
}
.guide-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 18px 12px; }
.guide-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.guide-body { flex: 1; overflow: auto; position: relative; overscroll-behavior: contain; }
.g-grid { position: relative; }
.g-times { position: sticky; top: 0; z-index: 3; display: flex; height: 30px; background: #0c0d12; border-bottom: 1px solid rgba(255,255,255,.07); }
.g-corner { position: sticky; left: 0; z-index: 4; width: var(--g-left); flex: none; background: #0c0d12; color: var(--guide); font-size: 11px; font-weight: 800; letter-spacing: .6px; display: flex; align-items: center; padding-left: 14px; }
.g-ticks { position: relative; flex: none; }
.g-tick { position: absolute; top: 0; height: 30px; display: flex; align-items: center; padding-left: 6px; color: var(--muted); font-size: 11px; border-left: 1px solid rgba(255,255,255,.08); white-space: nowrap; }
.g-row { display: flex; height: 58px; border-bottom: 1px solid rgba(255,255,255,.05); }
.g-row.selected .g-chan { color: var(--accent); }
.g-chan { position: sticky; left: 0; z-index: 2; width: var(--g-left); flex: none; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 14px; background: #0f1016; font-size: 12px; font-weight: 600; cursor: pointer; border-right: 1px solid rgba(255,255,255,.06); text-align: left; }
.g-chan img { width: 34px; height: 24px; object-fit: contain; flex: none; }
.g-chan span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-track { position: relative; flex: none; }
.g-prog { position: absolute; top: 5px; bottom: 5px; border-radius: 9px; background: #1a1c25; border: 1px solid rgba(255,255,255,.05); padding: 6px 9px; overflow: hidden; cursor: pointer; text-align: left; }
.g-prog:hover { background: #232634; }
.g-prog.now { background: rgba(145,90,246,.24); border-color: rgba(162,112,251,.55); }
.g-prog b { display: block; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-prog small { display: block; color: var(--muted); font-size: 10.5px; margin-top: 3px; white-space: nowrap; }
.g-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--guide); z-index: 1; pointer-events: none; }
.g-loading { padding: 40px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- swipe level bars (as in ycMob) ---------- */
.levelbar { position: absolute; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; opacity: 0; transition: opacity 300ms; pointer-events: none; z-index: 5; }
.levelbar.show { opacity: 1; transition-duration: 120ms; }
.levelbar.left { left: calc(28px + var(--safe-l)); }
.levelbar.right { right: calc(28px + var(--safe-r)); }
.levelbar svg { width: 20px; height: 20px; fill: #fff; filter: drop-shadow(0 1px 4px rgba(0,0,0,.6)); }
.levelbar .track { position: relative; width: 6px; height: clamp(110px, 37vh, 260px); border-radius: 3px; background: rgba(204,204,204,.5); overflow: hidden; }
.levelbar .fill { position: absolute; left: 0; right: 0; bottom: 0; height: 50%; background: #fff; border-radius: 3px; }

/* ---------- small screens ---------- */
@media (max-width: 719px) {
  :root { --g-left: 128px; }
  .sheet { left: calc(10px + var(--safe-l)); right: calc(10px + var(--safe-r)); width: auto; }
  .nownext { width: min(420px, calc(100vw - 44px)); top: calc(var(--safe-t) + 92px); }
  #btn-pip { display: none !important; }
  .label { padding: 0 9px; }
}
@media (max-width: 460px) {
  .quality { display: none !important; }
  .brand { font-size: 17px; }
  .channel-name { font-size: 14px; max-width: 150px; }
  .tool { width: 34px; }
  .live { font-size: 10px; }
}
@media (max-height: 480px) {
  .sheet { top: calc(8px + var(--safe-t)); bottom: calc(66px + var(--safe-b)); }
  .nownext { display: none !important; }
}
