:root {
  --accent: #ffd84d; --button: #c8342a;
  --bg: #0b1424; --panel: rgba(12, 18, 30, .82); --line: rgba(255,255,255,.12);
  --text: #f2f5fa; --muted: rgba(242,245,250,.65);
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
html, body { margin: 0; height: 100%; color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
#bg { position: fixed; inset: 0; background: var(--bg) center/cover no-repeat; z-index: -2; }
#bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5,10,20,.35), rgba(5,10,20,.7)); }
.hidden { display: none !important; }
button, input { font: inherit; color: inherit; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: 0 1.2rem;
  border: 0; border-radius: 10px; background: var(--button); color: #fff; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn.ghost { background: rgba(255,255,255,.1); border: 1px solid var(--line); font-weight: 600; }
.btn:focus-visible, .tab:focus-visible, .card-item:focus-visible, .cat:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.msg { min-height: 1.4em; margin: .6rem 0 0; color: var(--muted); text-align: center; }
.msg.err { color: #ff8a80; }

/* LOGIN */
.screen { min-height: 100%; }
#login { display: grid; place-items: center; padding: 24px 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.login-card { width: min(380px, 100%); padding: 26px 22px; display: flex; flex-direction: column; gap: 12px; }
.login-card .brand-logo { height: 96px; object-fit: contain; margin: 0 auto 6px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }
.login-card input { height: 46px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.08); font-size: 16px; }
.login-card input:focus { outline: 2px solid var(--accent); }

/* APP */
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.top { display: flex; align-items: center; gap: 14px; padding: calc(10px + var(--safe-top)) 16px 10px; background: rgba(5,10,20,.7); border-bottom: 1px solid var(--line); }
.brand-logo.small { height: 40px; object-fit: contain; }
.tabs { display: flex; gap: 4px; }
.tab { background: none; border: 0; padding: 8px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tab.on { color: #fff; background: rgba(255,255,255,.12); box-shadow: inset 0 -2px 0 var(--accent); }
#search { flex: 1; min-width: 0; max-width: 360px; margin-left: auto; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.08); font-size: 16px; }
.icon-btn { background: none; border: 0; font-size: 22px; cursor: pointer; padding: 4px 6px; }
.body { flex: 1; display: flex; min-height: 0; }
.cats { width: 250px; overflow-y: auto; padding: 10px; border-right: 1px solid var(--line); background: rgba(5,10,20,.45); }
.cat { display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.cat .n { opacity: .6; font-size: .8rem; }
.cat.on { background: rgba(255,255,255,.12); color: #fff; }
.main { flex: 1; overflow-y: auto; padding: 14px 16px calc(24px + var(--safe-bottom)); }
.status { color: var(--muted); margin-bottom: 10px; min-height: 1.2em; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.grid.live { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.card-item { background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; text-align: left; padding: 0; color: inherit; }
.card-item:hover { border-color: var(--accent); }
.card-item .ph { aspect-ratio: 2/3; background: rgba(255,255,255,.05) center/cover no-repeat; }
.grid.live .ph { aspect-ratio: 16/9; background-size: contain; background-color: rgba(0,0,0,.25); }
.card-item .t { padding: 8px 10px; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.more { height: 40px; }

/* MODAIS */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.72); display: grid; place-items: center; z-index: 10; padding: 16px; }
.modal-box { position: relative; background: #111a2b; border: 1px solid var(--line); border-radius: 16px; padding: 22px; width: min(520px, 100%); max-height: 90vh; overflow: auto; }
.close { position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,.1); border: 0; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; color: #fff; }
.pin-box, .menu-box { display: flex; flex-direction: column; gap: 12px; width: min(360px, 100%); }
.pin-box input { height: 46px; text-align: center; letter-spacing: .4em; font-size: 20px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.08); }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.series-box { width: min(900px, 100%); }
.series-head { display: flex; gap: 16px; margin-bottom: 14px; }
.series-head img { width: 120px; border-radius: 10px; object-fit: cover; flex: none; }
.series-head h2 { margin: 0 0 6px; font-size: 1.3rem; }
.series-head p { margin: 0; max-height: 7.5em; overflow: auto; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; }
.chip { flex: none; background: rgba(255,255,255,.08); border: 1px solid var(--line); padding: 7px 14px; border-radius: 999px; cursor: pointer; color: var(--muted); }
.chip.on { background: var(--button); color: #fff; border-color: transparent; }
.episodes { display: flex; flex-direction: column; gap: 6px; }
.ep { display: flex; gap: 10px; align-items: center; text-align: left; background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 10px; padding: 10px; cursor: pointer; color: inherit; }
.ep b { color: var(--accent); min-width: 2.2em; }
.player-box { width: min(1100px, 100%); background: #000; border-radius: 14px; overflow: hidden; }
.player-top { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px 8px 14px; background: #0b1424; }
.player-top .close { position: static; }
video { display: block; width: 100%; max-height: 78vh; background: #000; }
.fallback { padding: 22px 18px; text-align: center; background: #0b1424; }
.fallback p { margin: 0 0 14px; }

/* CELULAR (iPhone) */
@media (max-width: 760px) {
  .top { flex-wrap: wrap; gap: 8px 10px; padding-left: 12px; padding-right: 12px; }
  .brand-logo.small { height: 32px; }
  .tabs { order: 3; width: 100%; justify-content: space-between; }
  .tab { flex: 1; }
  #search { order: 1; max-width: none; }
  #menuBtn { order: 2; }
  .body { flex-direction: column; }
  .cats { width: auto; display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; flex: none; }
  .cat { width: auto; flex: none; white-space: nowrap; background: rgba(255,255,255,.06); border-radius: 999px; padding: 7px 12px; }
  .cat .n { display: none; }
  .main { padding: 12px 12px calc(24px + var(--safe-bottom)); }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .grid.live { grid-template-columns: repeat(2, 1fr); }
  .card-item .t { font-size: .78rem; padding: 6px 7px; }
  .series-head img { width: 90px; }
  .modal { padding: 0; }
  .player-box { border-radius: 0; }
}
