:root {
  --bg: #0a0a0a;
  --bg-soft: #12121a;
  --card: #1a1a24;
  --card-border: #ffffff1a;
  --text: #ffffff;
  --text-dim: #ffffffb3;
  --text-faint: #ffffff66;
  --p1: #9043d5;
  --p2: #893aaf;
  --p3: #682179;
  --p4: #450c49;
  --focus: #b47bf0;
}

* { box-sizing: border-box; }

button:focus, [tabindex="0"]:focus, input:focus {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.home-card:focus { outline: 3px solid var(--focus); }

html, body {
  margin: 0;
  padding: 0;
  /* Transparent all the way up: Tizen's AVPlay renders as a hardware
     video plane BEHIND the web content, and only shows through where
     the whole document is transparent, not just one element. Screens
     that don't need to show a video paint their own opaque background
     on their own wrapper instead (see .home, .topbar, .tv-sidebar, etc). */
  background: transparent;
  color: var(--text);
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  height: 100%;
  overflow: hidden;
}

#app { height: 100vh; width: 100vw; position: relative; background: transparent; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; }

/* ---------- Home ---------- */
.home {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 30%, #9043d533 0%, transparent 45%),
    radial-gradient(circle at 80% 70%, #450c4966 0%, transparent 50%),
    var(--bg);
  padding: 40px;
}

.home-logo {
  position: absolute;
  top: 40px;
  left: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.home-logo .icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--p1), var(--p4));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.home-logo .word { font-size: 26px; font-weight: 800; }
.home-logo .word .accent { color: var(--p1); }
.home-logo .tag { font-size: 11px; letter-spacing: 2px; color: var(--text-faint); margin-top: 2px; }

.home h1 { font-size: 40px; margin-bottom: 48px; text-align: center; }

.home-cards { display: flex; gap: 32px; align-items: center; }

.home-card {
  width: 320px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 40px 32px;
  text-align: center;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.home-card:focus, .home-card:hover { transform: translateY(-4px); border-color: var(--p1); outline: none; }

.home-card .glyph {
  width: 88px;
  height: 88px;
  margin: 0 auto 20px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}
.home-card.tv .glyph { background: #9043d51a; color: var(--p1); border: 1px solid #9043d54d; }
.home-card.vod .glyph { background: #450c491a; color: #c25fd6; border: 1px solid #450c494d; }

.home-card h2 { font-size: 24px; margin: 0 0 6px; }
.home-card p.sub { color: var(--text-dim); margin: 0 0 16px; }
.home-card ul { list-style: none; padding: 0; margin: 0 0 24px; color: var(--text-dim); font-size: 14px; text-align: left; display: inline-block; }
.home-card ul li { margin: 4px 0; }

.home-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}
.home-card.tv .home-cta { background: linear-gradient(135deg, var(--p1), var(--p2)); }
.home-card.vod .home-cta { background: linear-gradient(135deg, var(--p3), var(--p4)); }

.home-or {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--card-border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint); font-size: 13px;
}

/* ---------- Top bar (shared) ---------- */
.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  border-bottom: 1px solid var(--card-border);
  background: var(--bg-soft);
}
.topbar .back {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--card); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.topbar .brand { font-weight: 800; font-size: 18px; margin-right: 12px; }
.topbar .brand .accent { color: var(--p1); }
.topbar .tabs { display: flex; gap: 8px; }
.topbar .tab {
  padding: 8px 18px; border-radius: 10px; background: transparent;
  color: var(--text-dim); font-weight: 600; font-size: 14px;
}
.topbar .tab.active { background: linear-gradient(135deg, var(--p1), var(--p2)); color: #fff; }
.topbar .search {
  margin-left: auto;
  width: 320px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 8px 14px;
  color: var(--text);
  font-size: 14px;
}
.topbar .search:focus { outline: 1px solid var(--p1); }

/* ---------- TV layout ---------- */
.tv-layout { display: flex; height: calc(100% - 64px); }
.tv-sidebar {
  width: 340px;
  border-right: 1px solid var(--card-border);
  overflow-y: auto;
  padding: 16px;
  background: var(--bg);
}
.tv-sidebar h2 { font-size: 18px; margin: 0 0 12px; }
.tv-search {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--card-border); color: var(--text);
  margin-bottom: 12px; font-size: 14px;
}
.tv-cat {
  margin: 18px 0 8px;
  font-size: 12px; font-weight: 700; letter-spacing: 1px;
  color: var(--text-faint); text-transform: uppercase;
  display: flex; justify-content: space-between; align-items: center;
  border-left: 3px solid var(--p1); padding-left: 8px;
}
.tv-cat .count { background: var(--card); border-radius: 10px; padding: 1px 8px; font-size: 11px; }
.channel-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 10px; margin-bottom: 4px;
}
.channel-row:hover, .channel-row.active { background: var(--card); }
.channel-row .badge {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--p4); color: #fff; font-weight: 700; font-size: 12px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  flex-shrink: 0;
}
.channel-row .badge img { width: 100%; height: 100%; object-fit: cover; }
.channel-row .info { flex: 1; min-width: 0; }
.channel-row .info .name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-row .info .sub { font-size: 12px; color: var(--text-faint); }

.tv-player { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; background: transparent; }
.tv-player video { width: 100%; height: 100%; object-fit: contain; background: transparent; }
.tv-player .placeholder { text-align: center; color: var(--text-faint); }
.player-status {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  background: #000000b3; color: #fff; padding: 8px 16px; border-radius: 8px;
  font-size: 14px; pointer-events: none;
}
.player-status:empty { display: none; }
.tv-player .placeholder .play-icon {
  width: 96px; height: 96px; border: 2px solid var(--card-border); border-radius: 16px;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; font-size: 36px;
}
.tv-player .quality-bar {
  position: absolute; bottom: 16px; left: 16px; display: flex; gap: 8px;
}
.tv-player .quality-bar button {
  padding: 6px 12px; border-radius: 8px; background: #00000099; color: var(--text-dim); font-size: 12px;
}
.tv-player .quality-bar button.active { background: var(--p1); color: #fff; }

/* ---------- VOD (movies/series) ---------- */
.vod-layout { height: calc(100% - 64px); overflow-y: auto; padding: 20px 24px; background: var(--bg); }
.az-index { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.az-index button {
  width: 34px; height: 34px; border-radius: 50%; background: var(--card);
  color: var(--text-dim); font-size: 13px; font-weight: 700;
}
.az-index button.active { background: var(--p3); color: #fff; }
.vod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 18px;
}
.vod-card { cursor: pointer; }
.vod-card .poster {
  width: 100%; aspect-ratio: 2/3; border-radius: 10px; background: var(--card);
  display: flex; align-items: center; justify-content: center; color: var(--text-faint);
  font-size: 28px; font-weight: 700; overflow: hidden; margin-bottom: 8px;
  border: 1px solid var(--card-border);
}
.vod-card .poster img { width: 100%; height: 100%; object-fit: cover; }
.vod-card .title { font-size: 13px; color: var(--text-dim); line-height: 1.3; }
.vod-card:hover .poster { border-color: var(--p1); }

/* ---------- Series detail ---------- */
.series-detail { padding: 24px; background: var(--bg); height: calc(100% - 64px); overflow-y: auto; }
.series-detail h2 { margin-top: 0; }
.season-tabs { display: flex; gap: 8px; margin: 16px 0; flex-wrap: wrap; }
.season-tabs button { padding: 8px 16px; border-radius: 8px; background: var(--card); color: var(--text-dim); font-size: 13px; }
.season-tabs button.active { background: var(--p2); color: #fff; }
.episode-list { display: flex; flex-direction: column; gap: 6px; }
.episode-row { padding: 10px 14px; border-radius: 8px; background: var(--card); display: flex; justify-content: space-between; }
.episode-row:hover { background: var(--p4); }

/* ---------- Loading ---------- */
.loading { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--text-faint); font-size: 16px; }

/* scrollbars */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: var(--card); border-radius: 4px; }
