/* RainDotTV / RainDotCity - Roku SceneGraph Web Theme */
:root {
  --bg-color: #141414;
  --bg-darker: #0c0c0c;
  --bg-panel: #1b1b1b;
  --bg-panel-hover: #262626;
  --cyan: #00d2ff;
  --cyan-glow: rgba(0, 210, 255, 0.4);
  --cyan-dim: rgba(0, 210, 255, 0.15);
  --green-match: #46d369;
  --gold-vip: #ffd700;
  --red-live: #ff3344;
  --text-white: #ffffff;
  --text-gray: #aaaaaa;
  --text-light-gray: #dddddd;
  --border-dark: #262626;
  --border-focus: #ffffff;
  --focus-glow: 0 0 16px rgba(0, 210, 255, 0.8), 0 0 4px #00d2ff;
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  color: var(--text-white);
  font-family: var(--font-family);
  overflow: hidden;
  background-image: radial-gradient(circle at 50% 20%, #1c1d29 0%, #101015 60%, #050508 100%);
}

#app-container {
  width: 100vw;
  height: 100vh;
  position: relative;
  display: flex;
  overflow: hidden;
}

/* ==========================================================================
   LEFT TOOLBAR (Roku LeftToolbar)
   ========================================================================== */
#left-toolbar {
  width: 80px;
  height: 100%;
  background-color: rgba(18, 18, 18, 0.96);
  border-right: 1px solid rgba(40, 40, 40, 0.65);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 100;
  position: relative;
  transition: width 0.2s ease;
}

.toolbar-brand {
  margin-top: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.toolbar-brand img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.toolbar-items {
  margin-top: auto;
  margin-bottom: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  align-items: center;
}

.toolbar-tab {
  width: 64px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.18s ease;
}

.toolbar-tab .indicator {
  position: absolute;
  left: 4px;
  width: 4px;
  height: 24px;
  background-color: var(--cyan);
  border-radius: 2px;
  display: none;
  box-shadow: 0 0 8px var(--cyan);
}

.toolbar-tab.active .indicator {
  display: block;
}

.toolbar-tab .tab-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  filter: brightness(0.65);
  transition: filter 0.18s ease, transform 0.18s ease;
}

.toolbar-tab:hover,
.toolbar-tab.focused {
  background-color: rgba(255, 255, 255, 0.12);
}

.toolbar-tab:hover .tab-icon,
.toolbar-tab.focused .tab-icon,
.toolbar-tab.active .tab-icon {
  filter: brightness(1);
  transform: scale(1.1);
}

.toolbar-pill {
  position: absolute;
  left: 88px;
  background-color: rgba(32, 32, 32, 0.98);
  border-left: 4px solid var(--cyan);
  padding: 10px 18px;
  border-radius: 0 6px 6px 0;
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  pointer-events: none;
  white-space: nowrap;
  display: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
  z-index: 105;
}

/* ==========================================================================
   VIEW HOST & VIEWS
   ========================================================================== */
#view-host {
  flex: 1;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.view {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
}

.view.active-view {
  display: block;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #333333;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--cyan);
}

/* ==========================================================================
   KEYAUTH VIEW (Exact Roku KeyAuthView.xml layout)
   ========================================================================== */
#keyauth-view {
  background-color: var(--bg-color);
  padding: 36px 80px;
  display: none;
  flex-direction: column;
}

#keyauth-view.active-view {
  display: flex;
}

.keyauth-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-dark);
}

.keyauth-header .logo {
  height: 42px;
  object-fit: contain;
}

.keyauth-header .divider {
  font-size: 26px;
  color: #444444;
  font-weight: 300;
}

.keyauth-header h1 {
  font-size: 26px;
  font-weight: 700;
  color: #ffffff;
}

.keyauth-body {
  display: flex;
  margin-top: 30px;
  gap: 40px;
  flex: 1;
}

.keyauth-left {
  width: 540px;
  display: flex;
  flex-direction: column;
}

.key-input-container {
  margin-bottom: 20px;
}

.key-input {
  width: 100%;
  height: 52px;
  background-color: #1e1e1e;
  border: 2px solid #333333;
  border-radius: 6px;
  color: #ffffff;
  font-size: 18px;
  font-weight: 600;
  padding: 0 16px;
  letter-spacing: 1px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.key-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 12px var(--cyan-glow);
}

/* On-screen virtual keyboard (Roku MiniKeyboard replica) */
.virtual-keyboard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #181818;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #282828;
}

.keyboard-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.vk-key {
  flex: 1;
  height: 44px;
  background-color: #242424;
  color: #ffffff;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid #333333;
  transition: all 0.15s ease;
}

.vk-key:hover,
.vk-key.focused {
  background-color: var(--cyan);
  color: #000000;
  box-shadow: 0 0 8px var(--cyan);
}

.vk-key.key-wide {
  flex: 2;
  background-color: #2a2a2a;
}

.btn-activate-container {
  margin-top: 24px;
}

.btn-primary {
  width: 100%;
  height: 52px;
  background-color: #222222;
  border: 2px solid #444444;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
}

.btn-primary:hover,
.btn-primary.focused {
  background-color: var(--cyan);
  border-color: var(--cyan);
  color: #000000;
  box-shadow: 0 0 16px var(--cyan);
}

.keyauth-right {
  flex: 1;
  background-color: rgba(27, 27, 27, 0.96);
  border-radius: 8px;
  border-top: 4px solid var(--cyan);
  padding: 40px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.badge-membership {
  display: inline-block;
  padding: 4px 12px;
  background-color: var(--cyan-dim);
  color: var(--cyan);
  font-weight: 800;
  font-size: 12px;
  border-radius: 4px;
  margin-bottom: 14px;
  letter-spacing: 1px;
}

.badge-active {
  background-color: rgba(70, 211, 105, 0.15);
  color: var(--green-match);
}

.keyauth-right h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 12px;
  color: #ffffff;
}

.keyauth-right p.detail {
  font-size: 15px;
  color: var(--text-gray);
  line-height: 1.5;
  margin-bottom: 24px;
}

.keyauth-divider {
  width: 100%;
  height: 1px;
  background-color: rgba(255, 255, 255, 0.1);
  margin-bottom: 24px;
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 30px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 15px;
  color: var(--text-light-gray);
}

.feature-dot {
  color: var(--cyan);
  font-size: 20px;
}

.auth-spinner {
  color: var(--cyan);
  font-size: 16px;
  font-weight: 700;
  margin-top: 10px;
  display: none;
}

.auth-actions {
  display: flex;
  gap: 16px;
  margin-top: 20px;
}

.auth-actions .btn-primary {
  width: auto;
  padding: 0 28px;
  height: 48px;
}

.keyauth-hwid {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: #777777;
}

.keyauth-hwid span.val {
  color: #999999;
  font-family: monospace;
}

/* ==========================================================================
   HOME VIEW (Hero Spotlight + RowLists)
   ========================================================================== */
#home-view {
  padding-bottom: 80px;
}

.hero-spotlight {
  width: 100%;
  height: 560px;
  position: relative;
  overflow: hidden;
}

.hero-backdrop-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  position: absolute;
  top: 0;
  left: 0;
  transition: opacity 0.4s ease;
}

.hero-scrim-left {
  position: absolute;
  top: 0;
  left: 0;
  width: 70%;
  height: 100%;
  background: linear-gradient(to right, rgba(20, 20, 20, 0.98) 0%, rgba(20, 20, 20, 0.75) 45%, rgba(20, 20, 20, 0) 100%);
  pointer-events: none;
}

.hero-scrim-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 380px;
  background: linear-gradient(to top, rgba(20, 20, 20, 1) 0%, rgba(20, 20, 20, 0.7) 40%, rgba(20, 20, 20, 0) 100%);
  pointer-events: none;
}

.hero-content {
  position: absolute;
  bottom: 40px;
  left: 50px;
  max-width: 900px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero-title {
  font-size: 44px;
  font-weight: 800;
  line-height: 1.15;
  color: #ffffff;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.8);
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 700;
}

.hero-match {
  color: var(--green-match);
  font-weight: 800;
}

.hero-year, .hero-duration, .hero-genres {
  color: #cccccc;
}

.badge-tag {
  background-color: #333333;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.hero-desc {
  font-size: 15px;
  color: #dddddd;
  line-height: 1.5;
  max-width: 800px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.btn-hero {
  padding: 12px 28px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.18s ease;
}

.btn-hero-play {
  background-color: #ffffff;
  color: #000000;
}

.btn-hero-play:hover,
.btn-hero-play.focused {
  background-color: var(--cyan);
  box-shadow: 0 0 16px var(--cyan);
  transform: scale(1.05);
}

.btn-hero-list {
  background-color: rgba(60, 60, 60, 0.8);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-hero-list:hover,
.btn-hero-list.focused {
  background-color: rgba(255, 255, 255, 0.2);
  border-color: #ffffff;
  transform: scale(1.05);
}

/* ==========================================================================
   ROWS & POSTER CARDS (Roku PosterItem replica)
   ========================================================================== */
.rows-container {
  display: flex;
  flex-direction: column;
  gap: 36px;
  padding: 0 50px;
  margin-top: -10px;
  position: relative;
  z-index: 20;
}

.row-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.row-title {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.2px;
}

.row-scroller {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 4px;
  scroll-behavior: smooth;
}

.row-scroller::-webkit-scrollbar {
  display: none;
}

/* Standard Poster Card */
.poster-card {
  flex: 0 0 200px;
  height: 300px;
  background-color: #181818;
  border-radius: 6px;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.2s cubic-bezier(0.25, 1, 0.5, 1);
  overflow: hidden;
}

.poster-card img.poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster-card .card-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background-color: #333333;
}

.poster-card .card-progress-fill {
  height: 100%;
  background-color: var(--cyan);
}

.poster-card:hover,
.poster-card.focused {
  transform: scale(1.08);
  box-shadow: 0 0 20px var(--cyan-glow), 0 0 0 3px #ffffff;
  z-index: 30;
}

/* Top 10 Card (Roku rank_1 to rank_10 layout) */
.top10-card {
  flex: 0 0 270px;
  height: 300px;
  display: flex;
  align-items: flex-end;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.top10-rank-img {
  width: 100px;
  height: 200px;
  object-fit: contain;
  margin-right: -30px;
  z-index: 5;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.9));
  pointer-events: none;
}

.top10-poster-box {
  flex: 0 0 200px;
  width: 200px;
  height: 300px;
  background-color: #181818;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.top10-poster-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.top10-card:hover,
.top10-card.focused {
  transform: scale(1.08);
  z-index: 30;
}

.top10-card:hover .top10-poster-box,
.top10-card.focused .top10-poster-box {
  box-shadow: 0 0 20px var(--cyan-glow), 0 0 0 3px #ffffff;
}

/* ==========================================================================
   DETAILS VIEW (Exact Roku DetailsView.xml layout)
   ========================================================================== */
#details-view {
  background-color: #0c0c0c;
  display: none;
}

#details-view.active-view {
  display: block;
}

.details-backdrop-container {
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1;
}

.details-backdrop-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.35;
}

.details-content-wrapper {
  position: relative;
  z-index: 10;
  padding: 50px 80px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.details-hero-box {
  display: flex;
  gap: 40px;
}

.details-poster-card {
  width: 280px;
  height: 420px;
  flex-shrink: 0;
  background-color: #181818;
  border-radius: 8px;
  border: 2px solid rgba(0, 210, 255, 0.4);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

.details-poster-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.details-meta-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.details-brand-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.details-brand-header img {
  height: 28px;
  object-fit: contain;
}

.details-title {
  font-size: 38px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.15;
}

.details-submeta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 16px;
  font-weight: 700;
}

.details-match {
  color: var(--green-match);
  font-weight: 800;
}

.details-genres {
  color: var(--cyan);
  font-weight: 700;
  font-size: 15px;
}

.details-desc {
  font-size: 16px;
  color: #eeeeee;
  line-height: 1.6;
  max-width: 900px;
}

.details-cast {
  font-size: 13px;
  color: #aaaaaa;
}

.details-actions {
  display: flex;
  gap: 20px;
  margin-top: 10px;
}

.details-btn {
  min-width: 220px;
  height: 50px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.details-btn-play {
  background-color: var(--cyan);
  color: #000000;
}

.details-btn-play:hover,
.details-btn-play.focused {
  background-color: #ffffff;
  box-shadow: 0 0 16px #ffffff;
  transform: scale(1.05);
}

.details-btn-list {
  background-color: #222222;
  border: 1px solid #444444;
  color: #ffffff;
}

.details-btn-list:hover,
.details-btn-list.focused {
  border-color: var(--cyan);
  color: var(--cyan);
  transform: scale(1.05);
}

/* Movie Feature Strip (Roku 3-Box Quality Cards) */
.movie-feature-strip {
  display: flex;
  gap: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.feature-box {
  flex: 1;
  background-color: rgba(24, 24, 24, 0.85);
  border-radius: 6px;
  padding: 16px 22px;
  position: relative;
  overflow: hidden;
  border: 1px solid #262626;
}

.feature-box .line {
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.feature-box.box-cyan .line { background-color: var(--cyan); }
.feature-box.box-green .line { background-color: var(--green-match); }
.feature-box.box-gold .line { background-color: var(--gold-vip); }

.feature-box .label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}

.feature-box.box-cyan .label { color: var(--cyan); }
.feature-box.box-green .label { color: var(--green-match); }
.feature-box.box-gold .label { color: var(--gold-vip); }

.feature-box .value {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
}

/* Episodes Grid (Roku Series Section) */
.series-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 10px;
}

.season-selector-bar {
  display: flex;
  align-items: center;
  gap: 24px;
}

.season-select-btn {
  background-color: #222222;
  border: 2px solid #333333;
  color: #ffffff;
  padding: 10px 24px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}

.season-select-btn:hover,
.season-select-btn.focused {
  border-color: var(--cyan);
  color: var(--cyan);
}

.episodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.episode-item {
  background-color: #1a1a1a;
  border-radius: 6px;
  padding: 14px;
  display: flex;
  gap: 16px;
  cursor: pointer;
  border: 1px solid #282828;
  transition: all 0.18s ease;
}

.episode-item:hover,
.episode-item.focused {
  border-color: var(--cyan);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--cyan-glow);
}

.episode-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--cyan);
  min-width: 32px;
}

.episode-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.episode-name {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.episode-synopsis {
  font-size: 12px;
  color: #888888;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   CATEGORIES VIEW (Roku CategoriesView.xml 18+ Genres + Kids)
   ========================================================================== */
#categories-view {
  padding: 40px 60px;
  display: none;
}

#categories-view.active-view {
  display: block;
}

.categories-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-dark);
}

.categories-header h1 {
  font-size: 28px;
  font-weight: 800;
  color: #ffffff;
}

.categories-header p {
  color: var(--cyan);
  font-size: 14px;
  font-weight: 600;
  margin-top: 4px;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-width: 1400px;
}

.cat-tile {
  height: 64px;
  background-color: #1a1a1a;
  border: 2px solid #282828;
  border-radius: 6px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.18s ease;
}

.cat-tile.cat-highlight {
  background-color: #222222;
  border-left: 6px solid var(--cyan);
}

.cat-tile:hover,
.cat-tile.focused {
  background-color: var(--cyan);
  border-color: var(--cyan);
  color: #000000;
  box-shadow: 0 0 16px var(--cyan);
  transform: translateX(4px);
}

/* ==========================================================================
   SEARCH VIEW (Roku SearchView.xml)
   ========================================================================== */
#search-view {
  padding: 40px 60px;
  display: none;
}

#search-view.active-view {
  display: block;
}

.search-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-dark);
}

.search-header h1 {
  font-size: 26px;
  font-weight: 800;
}

.search-body {
  display: flex;
  gap: 40px;
}

.search-left {
  width: 440px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.search-input {
  width: 100%;
  height: 52px;
  background-color: #1e1e1e;
  border: 2px solid #333333;
  border-radius: 6px;
  color: #ffffff;
  font-size: 18px;
  font-weight: 600;
  padding: 0 16px;
  outline: none;
}

.search-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 12px var(--cyan-glow);
}

.search-results-btn {
  height: 50px;
  background-color: #242424;
  border: 2px solid #383838;
  color: #ffffff;
  border-radius: 6px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-results-btn:hover,
.search-results-btn.focused {
  background-color: var(--cyan);
  border-color: var(--cyan);
  color: #000000;
}

.search-right {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.search-right h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  color: #ffffff;
}

.search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

/* ==========================================================================
   ACCOUNT VIEW (Roku AccountView.xml)
   ========================================================================== */
#account-view {
  padding: 50px 80px;
  display: none;
}

#account-view.active-view {
  display: block;
}

.account-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-dark);
}

.account-header h1 {
  font-size: 26px;
  font-weight: 800;
}

.account-header p {
  color: var(--cyan);
  font-size: 13px;
  font-weight: 700;
  margin-top: 4px;
}

.account-body {
  display: flex;
  gap: 40px;
}

.account-card {
  width: 650px;
  background-color: #1a212e;
  border-left: 6px solid var(--cyan);
  border-radius: 8px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.account-row {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 15px;
}

.account-row .lbl {
  color: #8899aa;
  font-weight: 700;
  min-width: 190px;
}

.account-row .val {
  color: #ffffff;
  font-weight: 700;
}

.account-actions {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.account-actions button {
  width: 100%;
  height: 52px;
  background-color: #222222;
  border: 2px solid #383838;
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.account-actions button:hover,
.account-actions button.focused {
  background-color: var(--cyan);
  border-color: var(--cyan);
  color: #000000;
}

/* ==========================================================================
   PLAYER VIEW (Roku PlayerView.xml)
   ========================================================================== */
#player-view {
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background-color: #000000;
  z-index: 1000;
  display: none;
  overflow: hidden;
}

#player-view.active-player {
  display: block;
}

.player-frame-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.player-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background-color: #000000;
}

/* Buffering / Loading Overlay */
.player-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  z-index: 1010;
}

.loading-cyan-bar {
  width: 320px;
  height: 4px;
  background-color: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
  animation: pulseBar 1.5s infinite ease-in-out;
}

@keyframes pulseBar {
  0% { transform: scaleX(0.2); opacity: 0.5; }
  50% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(0.2); opacity: 0.5; }
}

.player-loading-title {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
}

.player-loading-status {
  font-size: 15px;
  font-weight: 600;
  color: #cccccc;
}

.btn-player-cancel {
  margin-top: 10px;
  padding: 10px 30px;
  background-color: #222222;
  border: 1px solid #444444;
  color: #ffffff;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
}

.btn-player-cancel:hover {
  background-color: var(--cyan);
  color: #000000;
}

/* Player Floating HUD (Top bar and bottom controls) */
.player-top-hud {
  position: absolute;
  top: 20px;
  left: 30px;
  right: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  z-index: 1020;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#player-view:hover .player-top-hud,
.player-hud-visible .player-top-hud {
  opacity: 1;
}

/* REMOVE ALL TOP TEXT BUTTONS ON IOS / ANDROID */
body.is-mobile-device .player-top-hud {
  display: none !important;
}

@media (max-width: 900px) {
  .player-top-hud {
    display: none !important;
  }
}

@media (pointer: coarse) and (hover: none) {
  .player-top-hud {
    display: none !important;
  }
}

.player-mobile-back-btn {
  display: none;
}

body.is-mobile-device .player-mobile-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(18, 18, 18, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  z-index: 1030;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.15s ease;
}

@media (max-width: 900px) {
  .player-mobile-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: max(14px, env(safe-area-inset-top));
    left: max(14px, env(safe-area-inset-left));
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(18, 18, 18, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    z-index: 1030;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.15s ease;
  }
}

@media (pointer: coarse) and (hover: none) {
  .player-mobile-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: max(14px, env(safe-area-inset-top));
    left: max(14px, env(safe-area-inset-left));
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(18, 18, 18, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    z-index: 1030;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.15s ease;
  }
}

#player-view.player-hud-visible .player-mobile-back-btn {
  opacity: 1;
  pointer-events: auto;
}

.player-mobile-back-btn:active {
  transform: scale(0.9);
  background: rgba(0, 0, 0, 0.95);
}

.player-back-btn {
  background-color: rgba(20, 20, 20, 0.85);
  border: 1px solid #333333;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.player-back-btn:hover {
  background-color: var(--cyan);
  color: #000000;
}

.player-source-selector {
  display: flex;
  gap: 10px;
}

.source-btn {
  background-color: rgba(20, 20, 20, 0.85);
  border: 1px solid #444444;
  color: #cccccc;
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.source-btn.active-source,
.source-btn:hover {
  background-color: var(--cyan);
  border-color: var(--cyan);
  color: #000000;
}

/* Toast Notification (Roku ToastGroup) */
.toast-pill {
  position: fixed;
  bottom: 30px;
  right: 40px;
  background-color: rgba(32, 32, 32, 0.98);
  border-left: 5px solid var(--cyan);
  padding: 14px 28px;
  border-radius: 4px;
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
  z-index: 9999;
  display: none;
  animation: slideToast 0.3s ease;
}

@keyframes slideToast {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   LOCKED VIEW (PWFauth Remote Kill-Switch Screen)
   ========================================================================== */
#locked-view {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100vw;
  background: radial-gradient(circle at center, #1b2838 0%, #0d1117 100%);
  text-align: center;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 500;
}

#locked-view.active-view {
  display: flex !important;
}

.locked-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 580px;
  padding: 30px;
}

.locked-logo {
  height: 52px;
  margin-bottom: 24px;
}

.locked-card {
  background: rgba(20, 20, 20, 0.9);
  border: 1px solid rgba(255, 75, 75, 0.4);
  box-shadow: 0 0 35px rgba(255, 75, 75, 0.25);
  border-radius: 12px;
  padding: 35px 30px;
  width: 100%;
}

.locked-icon {
  font-size: 50px;
  margin-bottom: 15px;
}

.locked-card h2 {
  font-size: 24px;
  color: #ff5555;
  margin-bottom: 12px;
  font-weight: 700;
}

.locked-card p {
  font-size: 15px;
  color: #ccc;
  line-height: 1.6;
  margin-bottom: 10px;
}

.locked-card .locked-sub {
  font-size: 13px;
  color: #888;
  margin-bottom: 20px;
}

.locked-card code {
  color: #00d2ff;
  background: #111;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE SUITE (iOS Safari & Android Chrome)
   Supports Portrait & Landscape with notch / safe-area insets
   ========================================================================== */

:root {
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

/* Base Mobile Optimizations */
html, body {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior-y: none;
}

.row-scroller, .view, .search-grid, .mylist-grid, .categories-grid {
  -webkit-overflow-scrolling: touch;
}

/* --------------------------------------------------------------------------
   PORTRAIT MOBILE (< 820px)
   -------------------------------------------------------------------------- */
@media (max-width: 820px) {
  #app-container {
    flex-direction: column-reverse;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  /* Bottom Navigation Bar on Mobile */
  #left-toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: calc(56px + var(--sab));
    padding-bottom: var(--sab);
    flex-direction: row;
    border-right: none;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background-color: rgba(16, 16, 16, 0.96);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.85);
  }

  .toolbar-brand {
    display: none !important;
  }

  .toolbar-items {
    flex-direction: row;
    justify-content: space-around;
    width: 100%;
    margin: 0;
    gap: 0;
    align-items: center;
  }

  .toolbar-tab {
    width: auto;
    flex: 1;
    height: 52px;
    padding: 4px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .toolbar-tab .indicator {
    bottom: 2px;
    top: auto;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    border-radius: 2px;
  }

  .toolbar-tab .tab-icon {
    width: 22px;
    height: 22px;
  }

  .toolbar-pill {
    display: none !important;
  }

  /* View Host */
  #view-host {
    width: 100vw;
    height: calc(100vh - 56px - var(--sab));
    height: calc(100dvh - 56px - var(--sab));
  }

  .view {
    padding-bottom: calc(75px + var(--sab));
  }

  /* Hero Spotlight */
  .hero-spotlight {
    height: 48vh;
    min-height: 280px;
  }

  .hero-scrim-left {
    width: 100%;
    background: linear-gradient(to right, rgba(20, 20, 20, 0.95) 0%, rgba(20, 20, 20, 0.6) 60%, rgba(20, 20, 20, 0.1) 100%);
  }

  .hero-scrim-bottom {
    height: 240px;
  }

  .hero-content {
    bottom: 14px;
    left: 14px;
    right: 14px;
    max-width: 100%;
    gap: 8px;
  }

  .hero-title {
    font-size: 22px;
    line-height: 1.2;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
  }

  .hero-meta {
    font-size: 12px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .hero-desc {
    font-size: 13px;
    -webkit-line-clamp: 2;
    line-height: 1.4;
  }

  .hero-actions {
    gap: 8px;
    margin-top: 4px;
  }

  .btn-hero {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 5px;
  }

  /* Row Lists & Cards */
  .rows-container {
    padding: 0 14px;
    gap: 22px;
    margin-top: -6px;
  }

  .row-title {
    font-size: 16px;
    font-weight: 700;
  }

  .row-scroller {
    gap: 10px;
    padding: 6px 2px;
    scroll-snap-type: x proximity;
  }

  .poster-card {
    flex: 0 0 115px;
    height: 172px;
    border-radius: 5px;
    scroll-snap-align: start;
  }

  .top10-card {
    flex: 0 0 160px !important;
    height: 172px !important;
    display: flex !important;
    align-items: flex-end !important;
    scroll-snap-align: start;
  }

  .top10-rank-img {
    width: 60px !important;
    height: 120px !important;
    margin-right: -15px !important;
    z-index: 5 !important;
    pointer-events: none;
  }

  .top10-poster-box {
    flex: 0 0 115px !important;
    width: 115px !important;
    height: 172px !important;
    border-radius: 5px !important;
  }

  /* Details View */
  .details-content-wrapper {
    padding: 16px 14px calc(80px + var(--sab)) 14px;
    gap: 18px;
  }

  .details-hero-box {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
  }

  .details-poster-card {
    width: 150px;
    height: 225px;
    margin: 0 auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.9);
  }

  .details-meta-column {
    align-items: center;
    gap: 10px;
    width: 100%;
  }

  .details-title {
    font-size: 22px;
    text-align: center;
    line-height: 1.2;
  }

  .details-submeta {
    font-size: 13px;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .details-desc {
    font-size: 13px;
    text-align: center;
    line-height: 1.5;
  }

  .details-cast {
    font-size: 12px;
    text-align: center;
  }

  .details-actions {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .details-btn {
    width: 100%;
    min-width: unset;
    height: 44px;
    font-size: 14px;
  }

  .details-features-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
  }

  .episodes-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* Categories View */
  #categories-view {
    padding: 16px 14px 80px 14px;
  }

  .categories-header h1 {
    font-size: 22px;
  }

  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .cat-tile {
    height: 50px;
    padding: 0 12px;
  }

  .cat-name {
    font-size: 13px;
  }

  /* Search View */
  #search-view {
    padding: 16px 14px 80px 14px;
  }

  .search-body {
    flex-direction: column;
    gap: 14px;
  }

  .search-left {
    width: 100%;
  }

  .search-input {
    height: 48px;
    font-size: 16px;
    border-radius: 6px;
  }

  .virtual-keyboard {
    display: none !important;
  }

  .search-grid {
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    gap: 10px;
  }

  /* My List & Account */
  #mylist-view {
    padding: 16px 14px 80px 14px;
  }

  .mylist-grid {
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    gap: 10px;
  }

  #account-view {
    padding: 20px 14px 80px 14px;
  }

  .account-card {
    padding: 20px 16px;
    width: 100%;
  }

  /* Player View Mobile Portrait */
  .player-top-hud {
    display: none !important;
  }

  .loading-cyan-bar {
    width: 220px;
  }
}

/* --------------------------------------------------------------------------
   LANDSCAPE MOBILE & COMPACT SCREENS (Max Height 520px)
   -------------------------------------------------------------------------- */
@media (max-height: 520px) and (orientation: landscape) {
  #app-container {
    flex-direction: row;
    height: 100vh;
    height: 100dvh;
  }

  #left-toolbar {
    position: relative;
    width: 60px;
    height: 100%;
    padding-left: var(--sal);
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    border-top: none;
    box-shadow: none;
  }

  .toolbar-brand {
    display: flex !important;
    margin-top: 8px;
  }

  .toolbar-brand img {
    width: 24px;
    height: 24px;
  }

  .toolbar-items {
    flex-direction: column;
    gap: 6px;
    margin: auto 0;
  }

  .toolbar-tab {
    width: 48px;
    height: 34px;
  }

  .toolbar-tab .indicator {
    left: 2px;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
  }

  .toolbar-tab .tab-icon {
    width: 18px;
    height: 18px;
  }

  .toolbar-pill {
    display: none !important;
  }

  #view-host {
    padding-right: var(--sar);
    width: calc(100vw - 60px);
    height: 100vh;
    height: 100dvh;
  }

  .view {
    padding-bottom: 20px;
  }

  .hero-spotlight {
    height: 80vh;
    min-height: 200px;
  }

  .hero-content {
    bottom: 12px;
    left: 20px;
    right: 20px;
    gap: 6px;
  }

  .hero-title {
    font-size: 20px;
  }

  .hero-desc {
    -webkit-line-clamp: 2;
    font-size: 12px;
    line-height: 1.3;
  }

  .btn-hero {
    padding: 6px 14px;
    font-size: 12px;
  }

  .rows-container {
    padding: 0 20px;
    gap: 18px;
  }

  .poster-card {
    flex: 0 0 115px;
    height: 172px;
  }

  .top10-card {
    flex: 0 0 160px !important;
    height: 172px !important;
    display: flex !important;
    align-items: flex-end !important;
  }

  .top10-rank-img {
    width: 55px !important;
    height: 115px !important;
    margin-right: -12px !important;
    pointer-events: none;
  }

  .top10-poster-box {
    flex: 0 0 115px !important;
    width: 115px !important;
    height: 172px !important;
  }

  .details-content-wrapper {
    padding: 16px 20px;
    gap: 14px;
  }

  .details-hero-box {
    flex-direction: row;
    align-items: flex-start;
    text-align: left;
    gap: 20px;
  }

  .details-poster-card {
    width: 115px;
    height: 172px;
    margin: 0;
  }

  .details-meta-column {
    align-items: flex-start;
    text-align: left;
    gap: 8px;
  }

  .details-title {
    font-size: 20px;
    text-align: left;
  }

  .details-desc {
    text-align: left;
    font-size: 13px;
  }

  .details-actions {
    flex-direction: row;
    width: auto;
    gap: 10px;
  }

  .details-btn {
    width: auto;
    min-width: 150px;
    height: 38px;
    font-size: 13px;
  }

  .episodes-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  /* Full viewport player in landscape */
  #player-view {
    padding-left: var(--sal);
    padding-right: var(--sar);
    padding-top: var(--sat);
  }
}
