/* Pickle Flix Web — dark theme matching the app skin:
   bg #0B0B12, panels #17171F, purple borders #7C3AED, icons #C084FC,
   neon green #57FF2E used sparingly (primary actions, live accents). */
:root {
  --bg: #0B0B12;
  --panel: #17171F;
  --panel2: #1F1F2B;
  --border: #2C2C40;
  --purple: #7C3AED;
  --icon: #C084FC;
  --neon: #57FF2E;
  --text: #F2F2F7;
  --muted: #9A9AB0;
  --danger: #FF6B6B;
}
* { box-sizing: border-box; }
/* The `hidden` attribute must ALWAYS win. An author `display` rule
   (e.g. .modal's display:flex, .more-btn's display:block) outranks the
   UA stylesheet's [hidden] rule in the cascade, so without this guard
   any element that is shown/hidden via `hidden` AND carries a display
   class can never be hidden. That was the stuck APP ONLY modal bug
   (2026-11-24): the modal rendered over the sign-in screen from load
   and "Got it" set hidden=true to no visual effect. Do not remove. */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; cursor: pointer; }
input { font: inherit; }
.view { min-height: 100dvh; }
.web-tag {
  font-size: 0.55em; vertical-align: super; color: var(--neon);
  border: 1px solid var(--neon); border-radius: 6px; padding: 1px 5px;
  letter-spacing: 0.08em;
}

/* ---------- login ---------- */
.login-wrap { max-width: 420px; margin: 0 auto; padding: 40px 22px 30px; text-align: center; }
.login-logo { width: min(240px, 70vw); border-radius: 18px; box-shadow: 0 8px 40px rgba(124,58,237,.35); }
.login-wrap h1 { margin: 18px 0 6px; font-size: 30px; }
.login-sub { color: var(--muted); margin: 0 0 22px; line-height: 1.45; }
#login-form { text-align: left; display: grid; gap: 14px; }
#login-form label { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
#login-form input {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); padding: 14px; min-height: 50px;
}
#login-form input:focus { outline: 2px solid var(--purple); border-color: var(--purple); }
#login-btn, .primary-btn {
  background: var(--neon); color: #06130A; font-weight: 700; border: none;
  border-radius: 12px; padding: 14px 20px; min-height: 52px;
}
.error { color: var(--danger); margin: 0; }
.login-note { color: var(--muted); font-size: 13px; line-height: 1.5; margin-top: 26px; }

/* ---------- chrome ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  background: rgba(11,11,18,.92); backdrop-filter: blur(8px);
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px; border-bottom: 1px solid var(--border);
}
.topbar-logo { width: 34px; height: 34px; border-radius: 8px; }
.topbar-title { font-weight: 700; font-size: 18px; }
.topbar-account { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.ghost-btn {
  background: none; border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 8px 12px; min-height: 40px;
}
.apponly-bar { border-bottom: 1px solid var(--border); background: var(--panel); padding: 8px 14px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.apponly-state { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.switch-row input[type="checkbox"] { width: 26px; height: 26px; accent-color: var(--neon); flex: none; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; background: rgba(11,11,18,.96); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; background: none; border: none; color: var(--muted);
  padding: 12px 2px; font-size: 13px; min-height: 52px;
}
.tab.active { color: var(--neon); font-weight: 700; }
#tab-pages { padding: 14px 14px 90px; max-width: 1100px; margin: 0 auto; }

/* ---------- shelves & grids ---------- */
.shelf { margin-bottom: 26px; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 10px; }
.shelf-head h2 { font-size: 18px; margin: 0; }
.see-all { background: none; border: none; color: var(--icon); font-size: 14px; padding: 8px; }
.shelf-row {
  display: grid; grid-auto-flow: column; grid-auto-columns: 118px; gap: 12px;
  overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 14px 12px;
}
.card { position: relative; scroll-snap-align: start; }
.card-poster {
  position: relative; aspect-ratio: 2/3; border-radius: 12px; overflow: hidden;
  background: var(--panel2); border: 1px solid var(--border);
}
.card-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.poster-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 800; color: var(--icon); background: var(--panel2);
}
.card-name { font-size: 13px; margin-top: 6px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-sub { font-size: 11px; color: var(--muted); }
.badge-apponly {
  position: absolute; top: 6px; left: 6px; z-index: 2;
  background: #000; color: var(--neon); border: 1px solid var(--neon);
  font-size: 10px; font-weight: 800; letter-spacing: .06em;
  padding: 3px 6px; border-radius: 6px;
}
.progress {
  position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.25); z-index: 2;
}
.progress > i { display: block; height: 100%; background: var(--neon); }
.fav-btn {
  position: absolute; top: 4px; right: 4px; z-index: 2; width: 38px; height: 38px;
  border-radius: 50%; border: 1px solid var(--border); background: rgba(11,11,18,.75);
  color: #fff; font-size: 18px; line-height: 1;
}
.fav-btn.on { color: var(--neon); border-color: var(--neon); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; -webkit-overflow-scrolling: touch; }
.chip {
  flex: none; background: var(--panel); color: var(--text); border: 1px solid var(--border);
  border-radius: 999px; padding: 10px 14px; min-height: 44px; font-size: 14px;
}
.chip.active { border-color: var(--neon); color: var(--neon); font-weight: 700; }
.search-row input {
  width: 100%; background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); padding: 13px 14px; min-height: 50px; margin-bottom: 10px;
}
.search-row input:focus { outline: 2px solid var(--purple); }
.more-btn {
  display: block; margin: 18px auto 4px; background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; padding: 13px 26px; min-height: 50px;
}
.empty { color: var(--muted); text-align: center; padding: 26px 10px; line-height: 1.5; }
.loading { color: var(--muted); text-align: center; padding: 30px 0; }

/* ---------- live list ---------- */
.live-list { display: grid; gap: 8px; }
.live-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; color: var(--text); min-height: 60px; position: relative;
}
.live-row img, .live-row .poster-fallback { width: 44px; height: 44px; border-radius: 8px; object-fit: contain; background: var(--panel2); flex: none; position: static; font-size: 18px; }
.live-row .live-name { font-size: 15px; }
.live-row .badge-apponly { position: static; margin-left: auto; }

/* ---------- detail / player ---------- */
.overlay-view { background: var(--bg); }
.subbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  background: rgba(11,11,18,.94); backdrop-filter: blur(8px);
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px; border-bottom: 1px solid var(--border);
}
.subbar-title { font-weight: 700; font-size: 16px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back-btn { background: none; border: none; color: var(--icon); font-size: 16px; padding: 10px 6px; min-height: 44px; }
.subbar .fav-btn { position: static; }
.detail-head { display: flex; gap: 14px; padding: 16px 14px 4px; max-width: 900px; margin: 0 auto; }
.detail-cover { width: 110px; aspect-ratio: 2/3; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); background: var(--panel2); }
.detail-meta { color: var(--icon); margin: 2px 0 8px; font-size: 13px; }
.detail-plot { color: var(--muted); line-height: 1.5; font-size: 14px; margin: 0; }
#season-chips, #episode-list { padding-left: 14px; padding-right: 14px; max-width: 900px; margin: 0 auto; }
.episode-list { display: grid; gap: 8px; padding-bottom: 40px; }
.ep-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; color: var(--text); min-height: 58px; position: relative;
}
.ep-num { color: var(--icon); font-weight: 800; min-width: 34px; }
.ep-title { flex: 1; font-size: 15px; }
.ep-dur { color: var(--muted); font-size: 12px; }
.ep-row .badge-apponly { position: static; }
.ep-resume { color: var(--neon); font-size: 12px; font-weight: 700; }

.player-box { background: #000; }
#video { width: 100%; max-height: 78dvh; aspect-ratio: 16/9; background: #000; display: block; }
.player-msg { padding: 34px 22px; text-align: center; background: var(--panel); }
.player-msg-title { font-size: 19px; font-weight: 700; margin: 0 0 10px; }
.player-msg p { color: var(--muted); line-height: 1.55; }
.player-sub { color: var(--muted); text-align: center; padding: 10px 16px; font-size: 13px; }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  background: var(--panel); border: 1px solid var(--purple); border-radius: 18px;
  padding: 24px 20px; max-width: 420px; width: 100%; text-align: center;
}
.modal-card h2 { margin: 8px 0 12px; font-size: 20px; }
.modal-card p { color: var(--muted); line-height: 1.55; }
.modal-badge {
  display: inline-block; color: var(--neon); border: 1px solid var(--neon);
  border-radius: 6px; padding: 3px 8px; font-size: 11px; font-weight: 800; letter-spacing: .06em; margin: 0;
}
.modal-card .primary-btn { width: 100%; margin-top: 8px; }
