:root {
  --ink: #071018;
  --paper: #f3f7f8;
  --mist: #c5d5df;
  --focus: #07a4fd;
  --live: #0e3a52;
  --film: #3a2a16;
  --series: #123028;
  --danger: #ffb4a8;
  color: var(--paper);
  background: var(--ink);
  font-family: "LG Smart UI", "Segoe UI", sans-serif;
  font-size: 1.35rem;
  line-height: 1.35;
}

* { box-sizing: border-box; }
html, body, #app { margin: 0; height: 100%; background: var(--ink); }
body { overflow: hidden; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus { outline: none; }

[data-f]:focus {
  box-shadow: 0 0 0 3px var(--focus);
  position: relative;
  z-index: 2;
}

#screen-login {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 6vw;
}

#login-form {
  width: min(36rem, 92vw);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

h1 {
  margin: 0 0 0.2rem;
  font-size: 4.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.95;
}

.lead, .quiet { color: var(--mist); margin: 0; }
.error { color: var(--danger); margin: 0; }

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--mist);
  font-size: 1.05rem;
}

input {
  min-height: 3.4rem;
  padding: 0.4rem 0.8rem;
  border: 2px solid rgba(243, 247, 248, 0.28);
  border-radius: 0.4rem;
  background: #0c1822;
}

button {
  min-height: 3.4rem;
  border: 0;
  border-radius: 0.45rem;
  background: #143044;
  color: var(--paper);
  padding: 0.4rem 1rem;
  text-align: left;
  cursor: pointer;
}

#f-go { background: var(--focus); color: #041018; font-weight: 700; text-align: center; }

#saved-go {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  min-height: 4.6rem;
  background: var(--focus);
  color: #041018;
  text-align: center;
}
#saved-go b { font-size: 1.45rem; line-height: 1.1; }
#saved-go span { font-size: 0.95rem; font-weight: 600; }

#screen-home, #screen-browse, #screen-detail {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 2.2vh 2.2vw 2vh;
  gap: 1.2rem;
}

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.2rem;
  gap: 1rem;
}
.topbar strong { font-size: 1.6rem; letter-spacing: -0.03em; }
.top-end { display: flex; align-items: center; gap: 0.7rem; }
.top-end button { width: auto; min-height: 2.8rem; background: transparent; }
.top h1 { font-size: 2.4rem; }
.account { color: var(--mist); text-align: right; }

.home-main {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.libraries {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.8rem;
}

.tile {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  min-height: 6.4rem;
  padding: 1rem 1.2rem;
  border-radius: 0.7rem;
  border: 0;
  text-align: left;
  background: #141c24;
}
.tile-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; }
.tile b { font-size: 1.85rem; letter-spacing: -0.03em; color: var(--paper); }
.tile span { color: var(--mist); font-size: 1.05rem; }
.tile:focus {
  background: var(--focus);
  box-shadow: none;
  transform: scale(1.03);
}
.tile:focus b, .tile:focus span { color: #041018; }

#remote-anchor {
  position: fixed;
  left: 0;
  top: 0;
  width: 4px;
  height: 4px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0.01;
  z-index: 2;
}

.home-cards {
  margin-top: auto;
  display: flex;
  align-items: stretch;
  gap: 0.8rem;
}
.hcard {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  border-radius: 0.7rem;
  color: #f8fafc;
  background: #0f172a;
}
.hcard-fx {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0.5;
}
.hcard-fx::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.42);
}
.hcard-solar[data-solar-sky="sun"] .hcard-fx { background-image: url("/assets/img/weather/solar-sun.gif?v=1"); }
.hcard-solar[data-solar-sky="moon"] .hcard-fx { background-image: url("/assets/img/weather/solar-moon.gif?v=1"); }
.hcard-solar[data-solar-sky="rain"] .hcard-fx { background-image: url("/assets/img/weather/solar-rain.gif?v=1"); }
.hcard-wx[data-sky="sun"] .hcard-fx { background-image: url("/assets/img/weather/sun.gif?v=4"); }
.hcard-wx[data-sky="cloud"] .hcard-fx { background-image: url("/assets/img/weather/cloud.gif?v=4"); }
.hcard-wx[data-sky="rain"] .hcard-fx { background-image: url("/assets/img/weather/rain.gif?v=4"); }
.hcard-wx[data-sky="wind"] .hcard-fx { background-image: url("/assets/img/weather/wind.gif?v=4"); }
.hcard-wx[data-sky="storm"] .hcard-fx { background-image: url("/assets/img/weather/storm.gif?v=4"); }
.hcard-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  padding: 0.32rem 0.55rem 0.38rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}
.hcard header { display: flex; align-items: baseline; justify-content: space-between; gap: 0.4rem; }
.hcard h2 { margin: 0; font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; }
.hcard header span, .hcard-feels, .hcard-line { color: #fde68a; font-size: 0.72rem; }
.hcard-hero { display: flex; align-items: baseline; justify-content: space-between; gap: 0.4rem; }
.hcard-hero b { font-size: 1.25rem; line-height: 1; }
.hcard-line { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hcard-chart { display: flex; align-items: flex-end; gap: 2px; height: 1.25rem; }
.hcard-bar { flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; }
.hcard-bar i { display: block; width: 100%; height: 4%; border-radius: 2px 2px 0 0; background: #fde68a; }
.hcard-bar.is-now i { background: #fff; }
.hcard-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.15rem; }
.hcard-solar .hcard-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hcard-metrics div {
  min-width: 0;
  padding: 0.05rem 0.15rem;
  border-radius: 0.3rem;
  background: rgba(0, 0, 0, 0.28);
  text-align: center;
}
.hcard-metrics span {
  display: block;
  font-size: 0.55rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(248, 250, 252, 0.78);
}
.hcard-metrics strong {
  display: block;
  font-size: 0.68rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shelf { min-height: 0; }
.col-label {
  margin: 0 0 0.55rem;
  color: var(--mist);
  font-size: 1.15rem;
}

.continue {
  display: flex;
  gap: 0.8rem;
  overflow: auto;
  padding-bottom: 0.4rem;
}

.resume {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 18rem;
  min-width: 18rem;
  min-height: 12rem;
  padding: 0;
  overflow: hidden;
  background: #141c24;
  border-radius: 0.55rem;
}
.resume .ph, .resume img {
  width: 100%;
  height: 10.2rem;
  object-fit: cover;
  background: #1c3142;
}
.resume-copy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem 0.7rem 0.7rem;
}
.resume b { font-size: 1.15rem; color: var(--paper); }
.resume .resume-copy span { color: var(--mist); font-size: 0.95rem; }
.resume .prog {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0.28rem;
  background: rgba(243, 247, 248, 0.28);
}
.resume .prog i { display: block; height: 100%; background: var(--focus); }
.resume .kind {
  position: absolute;
  top: 0.45rem;
  left: 0.45rem;
  padding: 0.12rem 0.45rem;
  background: rgba(4, 8, 12, 0.78);
  color: var(--paper);
  font-size: 0.85rem;
  font-weight: 650;
}
.resume:focus { box-shadow: 0 0 0 4px var(--focus); transform: scale(1.04); }

.warn { color: #f3d7a1; margin: 0; }

.browse-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 18rem 1fr;
  gap: 1rem;
}
.browse-body.is-live { grid-template-columns: 15rem minmax(16rem, 22rem) minmax(18rem, 1fr); }
.grid.channels { display: block; }
.guide {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #101820;
  border-radius: 0.7rem;
  overflow: hidden;
}
.guide-stage {
  position: relative;
  width: 100%;
  height: 0;
  padding-top: 56.25%;
  background: #000;
}
.guide-stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
#guide-full { border-radius: 0; background: #163044; text-align: center; }
.guide-meta {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.85rem 1rem 1rem;
}
#guide-name { margin: 0 0 0.7rem; font-size: 1.45rem; }
.epg-now, .epg-next { margin: 0 0 0.7rem; }
.epg-when { margin: 0; color: var(--focus); font-size: 0.95rem; }
.epg-title { margin: 0.15rem 0 0.35rem; font-size: 1.2rem; }
.epg-desc {
  margin: 0.35rem 0 0;
  color: var(--mist);
  font-size: 0.95rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.epg-next p { margin: 0.2rem 0; color: var(--mist); font-size: 1rem; }
.epg-next b { color: var(--paper); font-weight: 650; }
.guide .prog {
  display: block;
  height: 0.28rem;
  background: rgba(243, 247, 248, 0.28);
}
.guide .prog i { display: block; height: 100%; background: var(--focus); }
.channel.on { box-shadow: inset 0.28rem 0 0 var(--focus); }

.cats, .grid, .episodes {
  overflow: auto;
  min-height: 0;
  scrollbar-width: none;
}

.cats button, .episodes button, .seasons button {
  display: block;
  width: 100%;
  margin-bottom: 0.45rem;
  background: transparent;
  border-radius: 0.6rem;
}

.cats button.on,
.cats button:focus {
  background: var(--focus);
  color: #041018;
  box-shadow: none;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: 0.7rem;
  align-content: start;
}

.poster {
  display: flex;
  flex-direction: column;
  min-height: 16rem;
  padding: 0;
  overflow: hidden;
  background: #121820;
  border-radius: 0.7rem;
}

.poster:focus {
  box-shadow: 0 0 0 4px var(--focus);
  transform: scale(1.04);
}

.poster img, .poster .ph {
  width: 100%;
  height: 13rem;
  object-fit: cover;
  background: #183041;
}

.poster span, .row-name {
  padding: 0.45rem 0.6rem 0.7rem;
  font-size: 1.05rem;
}

.more { grid-column: 1 / -1; background: #163044; font-weight: 700; }

.channel {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  margin-bottom: 0.4rem;
  background: #121820;
  border-radius: 0.6rem;
}

.channel:focus { background: var(--focus); color: #041018; box-shadow: none; }

.channel img, .channel .ph { width: 4rem; height: 2.6rem; object-fit: contain; background: #071018; flex: none; }

.tools { display: flex; gap: 0.6rem; }
.tools input { flex: 1; }
.hint { color: var(--mist); font-size: 0.95rem; margin: 0; }

.detail {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 18rem 1fr;
  gap: 1.4rem;
}

.detail img, .detail .ph {
  width: 100%;
  height: 26rem;
  object-fit: cover;
  background: #183041;
  border-radius: 0.5rem;
}

.plot {
  color: var(--mist);
  max-width: 62rem;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.meta { color: var(--mist); font-size: 1rem; }

.actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.actions button { width: auto; min-width: 9rem; }
.actions .primary { background: var(--focus); color: #041018; font-weight: 700; }
.top > button, .tools button, .actions button, .cats button[data-id="favoritos"] {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.cats button[data-id="favoritos"] { width: 100%; }
.ico {
  width: 1.35rem;
  height: 1.35rem;
  flex: none;
  fill: currentColor;
  stroke: none;
}
.tile .ico { width: 2.7rem; height: 2.7rem; }
.top-end .ico { width: 1.2rem; height: 1.2rem; }

.season-split {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 14rem 1fr;
  gap: 1.2rem;
}
.season-col, .episode-col { min-height: 0; overflow: auto; scrollbar-width: none; }
.season-btn {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-bottom: 0.45rem;
  background: #121820;
  border-radius: 0.7rem;
}
.season-btn b { font-size: 1.8rem; }
.season-btn span { color: var(--mist); font-size: 0.95rem; }
.season-btn.on, .season-btn:focus {
  background: var(--focus);
  color: #041018;
  box-shadow: none;
}
.season-btn.on span, .season-btn:focus span { color: #083044; }
.episode-row {
  display: grid;
  grid-template-columns: 4.2rem 1fr;
  align-items: center;
  width: 100%;
  min-height: 4.4rem;
  margin-bottom: 0.4rem;
  background: #121820;
  border-radius: 0.7rem;
}
.ep-num { font-size: 1.7rem; text-align: center; }
.episode-row strong, .episode-row em { display: block; }
.episode-row em { color: var(--mist); font-style: normal; font-size: 0.95rem; }
.episode-row:focus { background: #12344a; box-shadow: 0 0 0 3px var(--focus); }
.episode-row:focus em { color: #d7f1ff; }

#screen-player {
  position: fixed;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  padding: 0;
  background: #000;
}
#player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
#player-catch {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}
#player-error, #zap {
  position: absolute;
  left: 4vw;
  right: 4vw;
}
#chrome {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 1.1rem 3vw 1.3rem;
  background: linear-gradient(transparent, rgba(4, 8, 12, 0.94));
}
#chrome-title { font-size: 1.8rem; margin: 0 0 0.55rem; }
#chrome-row { display: flex; align-items: center; gap: 1rem; }
#chrome-play {
  min-width: 8.5rem;
  text-align: center;
  background: var(--focus);
  color: #041018;
  font-weight: 700;
}
#chrome-track {
  flex: 1;
  height: 0.55rem;
  background: rgba(243, 247, 248, 0.28);
  border-radius: 999px;
  position: relative;
}
#chrome-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: var(--focus);
  border-radius: inherit;
}
#chrome-time { margin: 0; min-width: 9rem; text-align: right; }
#player-error { bottom: 8vh; font-size: 1.6rem; }
#zap {
  top: 18vh;
  font-size: 8rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

#confirm {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 12, 0.72);
}
.confirm-box {
  width: min(32rem, 88vw);
  padding: 1.5rem 1.6rem 1.3rem;
  background: #0c1a24;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
}
.confirm-box h2 {
  margin: 0 0 0.45rem;
  font-size: 2rem;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.confirm-box p { margin: 0 0 1.15rem; color: var(--mist); }
.confirm-actions { display: flex; gap: 0.7rem; justify-content: flex-end; }
.confirm-actions button { width: auto; min-width: 8.5rem; text-align: center; }
#confirm-leave { background: var(--danger); color: #3a1210; font-weight: 700; }

#trailer {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 12, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}
#trailer iframe { width: 86vw; height: 78vh; border: 0; background: #000; }
#toast {
  position: fixed;
  left: 2vw;
  bottom: 2vh;
  margin: 0;
  color: var(--mist);
}

.bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  width: 35%;
  background: var(--focus);
  animation: load 0.9s ease-out infinite alternate;
}
@keyframes load { from { width: 12%; } to { width: 70%; } }
