:root {
  --bg: #0b0a14;
  --panel: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.12);
  --text: #f5f3ff;
  --muted: #b9b4d0;
  --gold: #f7c948;
  --radius: 28px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Outfit", system-ui, sans-serif;
  overflow-x: hidden; user-select: none;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.hidden { display: none !important; }

.bg-glow {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(60vw 60vh at 10% 0%, rgba(247, 201, 72, 0.18), transparent 60%),
    radial-gradient(60vw 60vh at 100% 100%, rgba(233, 30, 99, 0.18), transparent 60%),
    radial-gradient(50vw 50vh at 90% 10%, rgba(103, 58, 183, 0.22), transparent 60%);
  animation: drift 18s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: scale(1.08) translate(-1%, 1%); } }

/* Top bar */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 24px 48px; }
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand-te {
  font-family: "Noto Sans Telugu", sans-serif; font-weight: 900; font-size: 52px;
  background: linear-gradient(90deg, #ffd86b, #ff7a59); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-tv { font-weight: 800; font-size: 44px; letter-spacing: 2px; }
.clock { font-size: 36px; font-weight: 600; color: var(--muted); }

/* Views */
.view { display: none; padding: 0 48px 48px; animation: fade 0.35s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(12px); } }

.hero { text-align: center; margin: 8px 0 36px; }
.hero h1 { font-size: 44px; font-weight: 800; }
.tag { color: var(--gold); letter-spacing: 8px; font-weight: 600; margin-top: 8px; font-size: 20px; }

/* Home tiles */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 32px; }
.more-wrap { display: flex; justify-content: center; margin-top: 36px; }
.loader { display: flex; justify-content: center; gap: 14px; margin: 48px 0; }
.loader span { width: 22px; height: 22px; border-radius: 50%; background: var(--gold); animation: bounce 0.9s infinite ease-in-out; }
.loader span:nth-child(2) { animation-delay: 0.15s; }
.loader span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 50% { transform: translateY(-16px); opacity: 0.5; } }
.tile {
  position: relative; min-height: 46vh; border-radius: var(--radius);
  display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start;
  padding: 36px; text-align: left; overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.45), inset 0 0 0 1px var(--border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.45)); }
.tile > * { position: relative; z-index: 1; }
.tile:active { transform: scale(0.97); }
.tile:hover { transform: translateY(-6px); box-shadow: 0 28px 60px rgba(0,0,0,0.55), inset 0 0 0 2px rgba(255,255,255,0.35); }
.t-old  { background: linear-gradient(145deg, #b8860b, #6d3b07 70%); }
.t-new  { background: linear-gradient(145deg, #e91e63, #5b1a8c 75%); }
.t-news { background: linear-gradient(145deg, #1565c0, #0b2a55 75%); }
.tile-icon { font-size: 84px; margin-bottom: auto; }
.tile-title { font-size: 46px; font-weight: 800; }
.tile-sub { font-size: 24px; color: rgba(255,255,255,0.85); margin-top: 6px; }
.live-dot {
  position: absolute !important; top: 32px; right: 32px; padding: 8px 18px; border-radius: 999px;
  background: #e53935; font-weight: 800; font-size: 18px; letter-spacing: 2px;
}
.live-dot::before { content: "● LIVE"; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }

.quick { display: flex; justify-content: center; gap: 24px; margin-top: 36px; flex-wrap: wrap; }
.pill {
  padding: 22px 40px; font-size: 28px; font-weight: 600; border-radius: 999px;
  background: var(--panel); box-shadow: inset 0 0 0 1px var(--border); backdrop-filter: blur(12px);
  transition: background 0.2s;
}
.pill:hover, .pill:active { background: rgba(255,255,255,0.16); }

/* List */
.list-head, .player-bar { display: flex; align-items: center; gap: 24px; margin-bottom: 28px; }
.list-head h2, .player-bar h2 { font-size: 40px; font-weight: 800; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back, .fav-btn {
  padding: 18px 32px; font-size: 26px; font-weight: 600; border-radius: 999px;
  background: var(--panel); box-shadow: inset 0 0 0 1px var(--border);
}
.fav-btn.on { background: var(--gold); color: #1a1300; }

.search-wrap { margin-bottom: 28px; }
#search-input {
  width: 100%; padding: 24px 32px; font-size: 30px; border-radius: 20px; border: 0; outline: none;
  background: var(--panel); color: var(--text); box-shadow: inset 0 0 0 2px var(--border); font-family: inherit;
}
#search-input:focus { box-shadow: inset 0 0 0 2px var(--gold); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 28px; }
.card {
  border-radius: 22px; overflow: hidden; background: var(--panel); text-align: left;
  box-shadow: inset 0 0 0 1px var(--border); transition: transform 0.2s;
}
.card:hover { transform: translateY(-4px); }
.card:active { transform: scale(0.97); }
.thumb { aspect-ratio: 16/9; background: #222 center/cover; position: relative; display: grid; place-items: center; }
.thumb .ch-name { font-size: 34px; font-weight: 800; text-align: center; padding: 12px; }
.badge { position: absolute; top: 12px; left: 12px; background: #e53935; padding: 4px 12px; border-radius: 8px; font-weight: 800; font-size: 16px; }
.badge.soon { background: #555; }
.card-body { padding: 18px 22px 22px; }
.card-title { font-size: 26px; font-weight: 700; }
.card-meta { font-size: 20px; color: var(--muted); margin-top: 4px; }
.card.disabled { opacity: 0.5; }

.chips { grid-column: 1 / -1; display: flex; gap: 16px; flex-wrap: wrap; }
.chip {
  --chip: var(--gold);
  padding: 18px 30px; font-size: 24px; font-weight: 700; border-radius: 999px;
  background: var(--panel); box-shadow: inset 0 0 0 2px var(--chip); transition: background 0.2s, transform 0.15s;
}
.chip:active { transform: scale(0.95); }
.chip.on { background: var(--chip); color: #fff; }

.empty { text-align: center; font-size: 28px; color: var(--muted); margin-top: 10vh; line-height: 1.5; }

/* Player */
.player-frame {
  width: 100%; aspect-ratio: 16/9; max-height: calc(100vh - 220px); margin: 0 auto;
  border-radius: 22px; overflow: hidden; background: #000; box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.player-frame iframe, #player-slot { width: 100%; height: 100%; border: 0; display: block; }

/* Portrait (Echo Show 15 can be wall-mounted vertically) */
@media (orientation: portrait), (max-width: 900px) {
  .tiles { grid-template-columns: 1fr; }
  .tile { min-height: 20vh; flex-direction: row; align-items: center; gap: 24px; }
  .tile-icon { margin: 0; font-size: 64px; }
  .tile-sub { display: none; }
  .topbar, .view { padding-left: 24px; padding-right: 24px; }
}
