:root {
  color-scheme: dark;
  --bg: #080b11;
  --bg-soft: #0c1119;
  --panel: #111824;
  --panel-2: #172131;
  --panel-3: #1d2a3e;
  --line: #2a3850;
  --line-soft: rgba(119, 142, 177, .18);
  --text: #f5f8fd;
  --muted: #9aa9bf;
  --accent: #62dda1;
  --accent-2: #54b9ff;
  --danger: #ff7c87;
  --warning: #ffcf70;
  --shadow: 0 24px 80px rgba(0, 0, 0, .46);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 85% -10%, rgba(84, 185, 255, .10), transparent 30%),
    radial-gradient(circle at 10% 0%, rgba(98, 221, 161, .08), transparent 26%),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
img { max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 68px;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(8, 11, 17, .88);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 19px; }
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #07130d;
  border-radius: 11px;
  background: linear-gradient(145deg, #7af0b6, #4ac98b);
  box-shadow: 0 10px 24px rgba(98, 221, 161, .22);
}
.version-chip {
  padding: 3px 7px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  border: 1px solid rgba(98, 221, 161, .3);
  border-radius: 999px;
  background: rgba(98, 221, 161, .08);
}
nav { display: flex; gap: 7px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
nav::-webkit-scrollbar { display: none; }
nav button, .ghost, .icon-button, .secondary {
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: color .16s ease, background .16s ease, border-color .16s ease, transform .16s ease;
}
nav button { padding: 10px 13px; white-space: nowrap; }
nav button:hover, nav button.active, .ghost:hover, .icon-button:hover, .secondary:hover {
  color: var(--text);
  border-color: var(--line);
  background: var(--panel-2);
}
.icon-button { width: 40px; height: 40px; padding: 0; }
.ghost, .secondary { padding: 10px 13px; }

main { min-height: calc(100vh - 68px); display: grid; grid-template-columns: 260px minmax(0, 1fr); }
#sidebar {
  position: sticky;
  top: 68px;
  height: calc(100vh - 68px);
  overflow-y: auto;
  padding: 22px 16px 28px;
  border-right: 1px solid var(--line-soft);
  background: rgba(14, 19, 29, .78);
}
.search {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .02);
}
.search:focus-within { border-color: rgba(98, 221, 161, .7); box-shadow: 0 0 0 3px rgba(98, 221, 161, .08); }
.search input { width: 100%; padding: 13px 0; color: var(--text); background: transparent; border: 0; outline: 0; }
.sidebar-title {
  margin: 24px 8px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.groups { display: grid; gap: 4px; }
.group-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  color: var(--muted);
  text-align: left;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
}
.group-button span { overflow: hidden; text-overflow: ellipsis; }
.group-button small { color: #8090a8; font-variant-numeric: tabular-nums; }
.group-button:hover, .group-button.active { color: var(--text); border-color: var(--line-soft); background: var(--panel-2); }
.group-button.active { box-shadow: inset 3px 0 0 var(--accent); }

.content { min-width: 0; padding: 28px clamp(16px, 2.5vw, 36px) 48px; }
.content-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
h1 { margin-bottom: 5px; font-size: clamp(25px, 3vw, 34px); letter-spacing: -.025em; }
.content-head p, .dialog-head p { margin-bottom: 0; color: var(--muted); }
.catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 17px; }

.card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(23, 33, 49, .92), rgba(14, 20, 30, .96));
  box-shadow: 0 12px 28px rgba(0, 0, 0, .16);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-4px); border-color: #49617f; box-shadow: 0 20px 36px rgba(0, 0, 0, .28); }
.poster {
  position: relative;
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 0;
  background: linear-gradient(145deg, #1b2940, #0b1019);
}
.movie .poster, .series .poster { aspect-ratio: 2 / 3; }
.poster img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease, filter .4s ease; }
.card:hover .poster img { transform: scale(1.035); filter: brightness(.78); }
.poster-fallback { color: #71829d; font-size: 38px; }
.poster-gradient { position: absolute; inset: auto 0 0; height: 48%; background: linear-gradient(transparent, rgba(7, 10, 16, .92)); pointer-events: none; }
.play-badge {
  position: absolute;
  right: 11px;
  bottom: 11px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: #07130d;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 8px 22px rgba(98, 221, 161, .28);
  transform: translateY(4px);
  opacity: .92;
  transition: transform .18s ease, opacity .18s ease;
}
.card:hover .play-badge { transform: translateY(0) scale(1.04); opacity: 1; }
.card-body { padding: 13px; }
.card-title { overflow: hidden; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { margin-top: 6px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.card-badges { min-height: 24px; display: flex; align-items: center; gap: 5px; margin-top: 8px; overflow: hidden; }
.mini-badge, .detail-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 4px 7px;
  color: #b8c5d8;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(9, 14, 22, .54);
}
.card-actions { display: flex; gap: 7px; margin-top: 11px; }
.card-actions button { min-width: 0; flex: 1; padding: 8px 10px; color: var(--text); border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); }
.card-actions .favorite { flex: 0 0 38px; }
.favorite.active { color: #ffd76c; border-color: rgba(255, 215, 108, .45); background: rgba(255, 215, 108, .08); }

.notice { margin-bottom: 18px; padding: 13px 15px; color: #c9d4e4; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.notice.error { color: #ffd6da; border-color: #70414a; background: #28171c; }
.notice.warning { color: #ffe2a3; border-color: #715b30; background: #2a2316; }
.hidden { display: none !important; }
.load-more { display: block; margin: 26px auto 0; padding: 11px 19px; color: var(--text); border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.empty { grid-column: 1 / -1; padding: 52px 20px; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 14px; background: rgba(17, 24, 36, .42); }

.primary {
  padding: 11px 16px;
  color: #07130d;
  font-weight: 850;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(145deg, #76ecb3, #51cb8e);
  box-shadow: 0 10px 24px rgba(98, 221, 161, .18);
}
.primary:hover { transform: translateY(-1px); filter: brightness(1.04); }

/* Dialogs and rich media details */
dialog {
  width: min(1120px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding: 0;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0, 0, 0, .8); backdrop-filter: blur(8px); }
.dialog-close {
  position: sticky;
  top: 14px;
  z-index: 20;
  float: right;
  width: 40px;
  height: 40px;
  margin: 14px 14px -54px 0;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 50%;
  background: rgba(7, 10, 16, .76);
  backdrop-filter: blur(10px);
}
.media-hero, .series-hero {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  background: radial-gradient(circle at 20% 20%, #263c58, transparent 42%), #0c1119 center / cover no-repeat;
}
.media-hero-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(7, 10, 16, .98) 5%, rgba(7, 10, 16, .82) 52%, rgba(7, 10, 16, .42)), linear-gradient(0deg, #111824 0, transparent 42%); }
.media-detail-grid, .series-detail-grid {
  position: relative;
  z-index: 2;
  min-height: 430px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: end;
  gap: 28px;
  padding: 56px 44px 38px;
}
.detail-poster-wrap { align-self: end; }
.detail-poster {
  width: 220px;
  aspect-ratio: 2 / 3;
  display: grid;
  place-items: center;
  object-fit: cover;
  color: #7c8da7;
  font-size: 52px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 14px;
  background: linear-gradient(145deg, #24324a, #101722);
  box-shadow: 0 24px 50px rgba(0, 0, 0, .42);
}
.detail-copy { min-width: 0; max-width: 760px; padding-bottom: 2px; }
.detail-copy h2 { max-width: 820px; margin-bottom: 10px; font-size: clamp(30px, 5vw, 52px); line-height: 1.03; letter-spacing: -.035em; }
.eyebrow { margin-bottom: 7px; color: var(--accent); font-size: 11px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.detail-badges { display: flex; flex-wrap: wrap; gap: 7px; min-height: 28px; margin: 12px 0; }
.detail-badge { padding: 5px 9px; color: #d3ddeb; background: rgba(9, 14, 22, .62); }
.detail-synopsis { max-width: 780px; margin: 16px 0 18px; color: #bec9d8; line-height: 1.65; }
.detail-facts { display: grid; gap: 8px; margin: 0; }
.detail-facts > div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; }
.detail-facts dt { color: #8292aa; }
.detail-facts dd { margin: 0; color: #d7dfeb; overflow-wrap: anywhere; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 23px; }
.action-play { min-width: 180px; }
.secondary { padding: 11px 15px; border-color: var(--line); background: rgba(17, 24, 36, .8); }
.player-area { padding: 0 22px 24px; background: #090c12; }
.player-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; }
.player-heading > div { display: grid; gap: 3px; }
.player-heading span { color: var(--muted); font-size: 12px; }
.player-area video { display: block; width: 100%; max-height: 68vh; aspect-ratio: 16 / 9; object-fit: contain; border: 1px solid #202a3b; border-radius: 12px; background: #000; }
.player-status { margin-top: 12px; padding: 10px 12px; color: #b8c5d8; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.error { margin-top: 12px; padding: 12px; color: #ffd6da; border: 1px solid #70414a; border-radius: 9px; background: #28171c; }

.series-content { padding: 22px; background: #0d121b; }
.series-toolbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; }
.series-toolbar h3 { margin-bottom: 4px; font-size: 23px; }
.series-toolbar p { margin-bottom: 0; color: var(--muted); }
.season-filters { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.season-filter { padding: 8px 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.season-filter.active { color: #07130d; border-color: var(--accent); background: var(--accent); }
.episodes { display: grid; gap: 9px; }
.episode-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 11px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: linear-gradient(110deg, var(--panel), #101722);
}
.episode-thumb { width: 110px; aspect-ratio: 16 / 9; overflow: hidden; display: grid; place-items: center; color: #7889a3; border-radius: 8px; background: #070a0f; }
.episode-thumb img { width: 100%; height: 100%; object-fit: cover; }
.episode-copy { min-width: 0; }
.episode-number { color: var(--accent); font-size: 11px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.episode-copy strong { display: block; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.episode-copy p { display: -webkit-box; margin: 5px 0 0; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.episode-actions { display: flex; gap: 7px; }
.episode-actions button { padding: 9px 12px; }

.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin-bottom: 4px; }
.settings-dialog { width: min(500px, calc(100vw - 28px)); }
.settings-dialog > label, .settings-dialog > button { margin: 18px 20px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 14px; }
input, select { width: 100%; padding: 11px 12px; color: var(--text); border: 1px solid var(--line); border-radius: 9px; outline: none; background: var(--bg); }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(98, 221, 161, .08); }

/* Sources */
.sources-layout { display: grid; grid-template-columns: repeat(2, minmax(250px, 1fr)); gap: 18px; }
.import-card, .source-list-card { padding: 21px; border: 1px solid var(--line-soft); border-radius: 15px; background: linear-gradient(145deg, var(--panel), #0f151f); }
.import-card { display: grid; align-content: start; gap: 15px; }
.import-card h2, .source-list-card h2 { margin-bottom: 2px; }
.source-list-card { grid-column: 1 / -1; }
.source-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.source-row small { display: block; margin-top: 5px; overflow-wrap: anywhere; color: var(--muted); }
.source-row button { padding: 8px 11px; color: #ffd6da; border: 1px solid #70414a; border-radius: 8px; background: #28171c; }

/* TV ao vivo + guide */
.guide-catalog { display: block; }
.tv-stage { display: grid; grid-template-columns: minmax(400px, 1.25fr) minmax(330px, .75fr); gap: 17px; margin-bottom: 18px; }
.live-screen { position: relative; min-height: 290px; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: #000; box-shadow: 0 18px 40px rgba(0, 0, 0, .24); }
.live-screen video { display: block; width: 100%; height: 100%; min-height: 290px; max-height: 440px; aspect-ratio: 16 / 9; object-fit: contain; background: #000; }
.live-placeholder { position: absolute; inset: 0; display: grid; place-content: center; gap: 8px; padding: 24px; color: var(--muted); text-align: center; pointer-events: none; background: radial-gradient(circle at 50% 35%, rgba(98, 221, 161, .14), transparent 44%), #06080c; }
.live-placeholder strong { color: var(--text); font-size: 20px; }
.player-inline-error { position: absolute; right: 13px; bottom: 13px; left: 13px; z-index: 3; padding: 10px 12px; color: #ffd6da; border: 1px solid #70414a; border-radius: 9px; background: rgba(40, 23, 28, .95); }
.now-panel { min-width: 0; display: flex; flex-direction: column; padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(145deg, #172233, #0e141e); }
.now-channel-head { display: flex; align-items: center; gap: 14px; }
.now-logo { width: 74px; height: 74px; display: grid; place-items: center; flex: 0 0 74px; overflow: hidden; color: var(--muted); font-weight: 900; border: 1px solid var(--line); border-radius: 12px; background: #080b10; }
.now-logo img { width: 100%; height: 100%; object-fit: contain; }
.now-panel h2 { margin: 0; font-size: clamp(20px, 2vw, 28px); }
.now-programme { margin-top: 22px; font-size: 20px; font-weight: 800; }
.now-description { min-height: 48px; margin: 9px 0 0; color: var(--muted); line-height: 1.5; }
.now-time { margin-top: auto; padding-top: 17px; color: var(--muted); font-variant-numeric: tabular-nums; }
.progress-track { height: 6px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: #29364a; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .3s ease; }
.now-actions { display: flex; gap: 8px; margin-top: 14px; }
.now-actions button { flex: 1; border-color: var(--line); }
.probe-result { display: grid; gap: 4px; margin-top: 12px; padding: 10px 12px; color: var(--muted); font-size: 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(0, 0, 0, .22); }
.probe-result strong { color: var(--text); }
.probe-result.error-text { color: #ffd6da; border-color: #70414a; }
.guide-card { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); }
.guide-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 15px 17px; border-bottom: 1px solid var(--line); }
.guide-nav { display: flex; gap: 8px; }
.guide-nav button { padding: 8px 11px; }
.guide-scroll { max-height: 58vh; overflow: auto; background: #0c1119; }
.guide-head, .guide-row { display: grid; grid-template-columns: 250px var(--timeline-width); width: max-content; min-width: 100%; }
.guide-head { position: sticky; top: 0; z-index: 8; min-height: 44px; border-bottom: 1px solid var(--line); background: #111824; }
.guide-channel-head, .guide-channel { position: sticky; left: 0; z-index: 4; width: 250px; border-right: 1px solid var(--line); background: #111824; }
.guide-channel-head { z-index: 10; display: flex; align-items: center; padding: 0 14px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.guide-times { display: flex; height: 44px; }
.guide-time-marker { display: flex; align-items: center; flex: 0 0 auto; padding-left: 9px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; border-right: 1px solid rgba(42, 56, 80, .7); }
.guide-row { min-height: 76px; border-bottom: 1px solid var(--line); }
.guide-row.selected .guide-channel { background: #172a21; box-shadow: inset 4px 0 0 var(--accent); }
.guide-channel { display: grid; grid-template-columns: 48px minmax(0, 1fr) 28px; align-items: center; gap: 10px; padding: 10px 12px; color: var(--text); text-align: left; border-top: 0; border-right: 0; border-bottom: 0; border-left: 0; }
.guide-channel:hover { background: var(--panel-2); }
.channel-logo { width: 48px; height: 48px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #080b10; }
.channel-logo img { width: 100%; height: 100%; object-fit: contain; }
.channel-logo-fallback, .channel-play { color: var(--accent); }
.channel-name { min-width: 0; display: grid; gap: 4px; }
.channel-name strong, .channel-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-name small { color: var(--muted); }
.guide-track { position: relative; height: 76px; background-image: repeating-linear-gradient(to right, transparent 0, transparent 89px, rgba(42, 56, 80, .7) 90px); }
.programme-block { position: absolute; top: 7px; height: 61px; min-width: 42px; overflow: hidden; display: grid; align-content: center; gap: 5px; padding: 7px 9px; color: var(--text); text-align: left; border: 1px solid #364763; border-radius: 7px; background: #1a273a; }
.programme-block:hover { z-index: 3; border-color: #657d9f; background: #24354e; }
.programme-block.current { border-color: var(--accent); background: #1b3d2d; }
.programme-block strong, .programme-block small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.programme-block small { color: var(--muted); font-size: 11px; }
.guide-empty-programme { position: absolute; inset: 0; display: flex; align-items: center; padding-left: 14px; color: #697a93; font-size: 12px; }

@media (max-width: 1020px) {
  .tv-stage { grid-template-columns: 1fr; }
  .live-screen video { max-height: 56vh; }
  .now-time { margin-top: 18px; }
  .media-detail-grid, .series-detail-grid { grid-template-columns: 180px minmax(0, 1fr); padding-right: 30px; padding-left: 30px; }
  .detail-poster { width: 180px; }
}

@media (max-width: 820px) {
  .topbar { grid-template-columns: 1fr auto; gap: 10px; padding: 10px 14px; }
  .topbar nav { grid-column: 1 / -1; order: 3; }
  main { grid-template-columns: 1fr; }
  #sidebar { position: static; width: 100%; height: auto; padding: 15px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .groups { display: flex; overflow-x: auto; }
  .group-button { width: auto; flex: 0 0 auto; gap: 12px; }
  .content { padding: 20px 14px 40px; }
  .catalog { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
  .sources-layout { grid-template-columns: 1fr; }
  .source-list-card { grid-column: auto; }
  .media-detail-grid, .series-detail-grid { grid-template-columns: 140px minmax(0, 1fr); align-items: center; min-height: 390px; gap: 20px; padding: 54px 20px 28px; }
  .detail-poster { width: 140px; }
  .detail-copy h2 { font-size: clamp(26px, 6vw, 38px); }
  .detail-facts > div { grid-template-columns: 78px minmax(0, 1fr); }
  .episode-row { grid-template-columns: 90px minmax(0, 1fr); }
  .episode-thumb { width: 90px; }
  .episode-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

@media (max-width: 620px) {
  .content-head { align-items: center; }
  .catalog { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-body { padding: 10px; }
  .card-actions .play { display: none; }
  .media-hero, .series-hero { min-height: 0; }
  .media-detail-grid, .series-detail-grid { grid-template-columns: 100px minmax(0, 1fr); align-items: start; min-height: 0; padding: 64px 16px 26px; }
  .detail-poster { width: 100px; border-radius: 10px; }
  .detail-copy h2 { font-size: 25px; }
  .detail-synopsis, .detail-facts { grid-column: 1 / -1; }
  .detail-copy { display: contents; }
  .detail-copy .eyebrow, .detail-copy h2, .detail-copy .detail-badges, .detail-copy .detail-actions { grid-column: 2; }
  .detail-actions { align-self: end; }
  .detail-actions button { width: 100%; }
  .player-area { padding: 0 10px 14px; }
  .series-toolbar { align-items: stretch; flex-direction: column; }
  .season-filters { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; }
  .tv-stage { gap: 10px; }
  .live-screen, .live-screen video { min-height: 210px; }
  .now-panel { padding: 15px; }
  .now-logo { width: 60px; height: 60px; flex-basis: 60px; }
  .now-actions, .guide-toolbar { align-items: stretch; flex-direction: column; }
  .guide-nav { width: 100%; }
  .guide-nav button { flex: 1; }
  .guide-head, .guide-row { grid-template-columns: 190px var(--timeline-width); }
  .guide-channel-head, .guide-channel { width: 190px; }
  .guide-channel { grid-template-columns: 40px minmax(0, 1fr) 20px; padding: 8px; }
  .channel-logo { width: 40px; height: 40px; }
}

/* Fluid 1.3 enhancements */
.kind-ribbon {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 5px 8px;
  color: #e8fff5;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .08em;
  border: 1px solid rgba(118, 236, 179, .32);
  border-radius: 999px;
  background: rgba(7, 19, 13, .82);
  backdrop-filter: blur(8px);
}

.cast-section { margin-top: 20px; }
.cast-section h3 { margin: 0 0 10px; font-size: 14px; }
.cast-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(96px, 112px);
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
}
.cast-card { min-width: 0; display: grid; justify-items: center; gap: 6px; text-align: center; }
.cast-card strong, .cast-card small { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cast-card strong { font-size: 12px; }
.cast-card small { color: var(--muted); font-size: 10px; }
.cast-avatar {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--accent);
  font-weight: 900;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: linear-gradient(145deg, #26374f, #111824);
}
.cast-avatar img { width: 100%; height: 100%; object-fit: cover; }

.source-help { margin: 6px 0 13px; color: var(--muted); line-height: 1.45; }
.sync-button { margin-bottom: 12px; }
.sync-status { margin-bottom: 12px; padding: 10px 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 9px; background: rgba(0, 0, 0, .18); }
.sync-status.error-text { color: #ffd6da; border-color: #70414a; }

.live-buffer-state {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  max-width: calc(100% - 24px);
  padding: 7px 10px;
  color: #dff9eb;
  font-size: 11px;
  font-weight: 750;
  border: 1px solid rgba(118, 236, 179, .28);
  border-radius: 999px;
  background: rgba(7, 19, 13, .8);
  backdrop-filter: blur(9px);
}

.guide-channel-cell {
  position: sticky;
  left: 0;
  z-index: 4;
  width: 250px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  align-items: stretch;
  border-right: 1px solid var(--line);
  background: #111824;
}
.guide-row.selected .guide-channel-cell { background: #172a21; box-shadow: inset 4px 0 0 var(--accent); }
.guide-channel-main {
  min-width: 0;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 10px;
  padding: 10px 8px 10px 12px;
  color: var(--text);
  text-align: left;
  border: 0;
  background: transparent;
}
.guide-channel-main:hover { background: var(--panel-2); }
.guide-favorite {
  align-self: center;
  width: 30px;
  height: 34px;
  padding: 0;
  color: #7f8da4;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
}
.guide-favorite:hover { color: #ffd76c; border-color: rgba(255, 215, 108, .25); background: rgba(255, 215, 108, .06); }
.guide-favorite.active { color: #ffd76c; }
.episode-actions .favorite { width: 38px; flex: 0 0 38px; color: #c6d0df; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); }
.episode-actions .favorite.active { color: #ffd76c; border-color: rgba(255, 215, 108, .45); }

@media (max-width: 620px) {
  .guide-channel-cell { width: 190px; grid-template-columns: minmax(0, 1fr) 30px; }
  .guide-channel-main { grid-template-columns: 40px minmax(0, 1fr) 18px; gap: 7px; padding: 8px 5px 8px 8px; }
  .cast-list { grid-auto-columns: 88px; }
  .cast-avatar { width: 56px; height: 56px; }
}
.field-help { display: block; margin-top: 6px; color: var(--muted); line-height: 1.45; }
