/* Watchlist — styles translated from Vault/Design (Watchlist.dc.html). Colours come from js/themes.js as CSS variables. */
:root {
  --bg: #141318; --surface: #1f1d25; --card: #26232d; --text: #f2ede4; --muted: #a39d93; --line: #393441;
  --accent: #e6a53a; --onAccent: #1b1406; --accent2: #8aa4d6; --onAccent2: #0f1522;
  --fh: -apple-system, "SF Pro Display", system-ui, sans-serif;
  --fb: -apple-system, "SF Pro Text", system-ui, sans-serif;
  --fhw: 700; --fhls: -0.02em;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --tabbar: calc(74px + var(--sab));
}
@media (prefers-color-scheme: light) {
  :root:not([data-scheme]) { --bg: #eceee3; --surface: #dde2d0; --card: #f6f7f0; --text: #1c211a; --muted: #5c6556; --line: #c9d0bb; --accent: #4f6b45; --onAccent: #fff; --accent2: #c26f42; --onAccent2: #fff; }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
/* iOS 26 home-screen apps with a translucent status bar report a viewport that is short by the
   status-bar height, leaving a dead band under anything pinned to bottom:0. 100lvh is the one unit
   that still reports the full screen, so the whole app is laid out inside a box of that height. */
@media all and (display-mode: standalone) { html { height: 100lvh; } }
body {
  font-family: var(--fb); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none; transition: background .3s;
  position: relative; overflow: hidden;
}
button { font-family: inherit; border: 0; cursor: pointer; color: inherit; background: none; padding: 0; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
button:disabled { opacity: .45; cursor: default; }
input { font-family: inherit; }
input::placeholder { color: inherit; opacity: .55; }
::-webkit-scrollbar { display: none; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.h { font-family: var(--fh); font-weight: var(--fhw); letter-spacing: var(--fhls); }
.muted { color: var(--muted); }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#statusbar { position: absolute; top: 0; left: 0; right: 0; height: var(--sat); background: var(--bg); z-index: 30; transition: background .3s; }
#app { position: absolute; inset: 0; display: flex; flex-direction: column; }
#scroller { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; }
.boot { height: 100%; }

/* ---------- main screen ---------- */
.main { padding: calc(var(--sat) + 14px) 0 24px; max-width: 640px; margin: 0 auto; }
.head { padding: 0 20px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.head-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.head-sub { font-size: 13px; font-weight: 600; color: var(--muted); }
.head-title { font-size: 34px; line-height: 1.1; }
@media (max-width: 440px) { .head-title { font-size: 30px; } }
.avatar { border-radius: 999px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.avatar.accent { background: var(--accent); color: var(--onAccent); }
.avatar.accent2 { background: var(--accent2); color: var(--onAccent2); }
.avatar.text { background: var(--text); color: var(--bg); }
.avatar.lg { width: 44px; height: 44px; font-size: 17px; margin-top: 4px; }
.avatar.md { width: 48px; height: 48px; font-size: 19px; }
.avatar.xs { width: 18px; height: 18px; font-size: 10px; }
.avatar.xl { width: 76px; height: 76px; font-size: 30px; }

.chips { display: flex; gap: 8px; padding: 16px 20px 2px; overflow-x: auto; scrollbar-width: none; }
.chip { height: 38px; padding: 0 16px; border-radius: 999px; background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; flex: none; transition: background .2s, color .2s; }
.chip span { font-weight: 600; opacity: .6; }
.chip.on { background: var(--accent); color: var(--onAccent); box-shadow: 0 6px 16px -8px var(--accent); }
.chip.on span { opacity: .75; }

.sec { padding: 26px 20px 0; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sec .h { font-size: 21px; }
.sec .meta { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }

.upnext { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 12px 20px 0; }
.pin-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; text-align: left; }
.poster { position: relative; overflow: hidden; border-radius: 16px; aspect-ratio: 2 / 3; background: var(--surface); }
.poster.sq { aspect-ratio: 1; }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.poster .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.45) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,0) 60%, rgba(0,0,0,.55) 100%); }
.poster .over { position: absolute; inset: 0; padding: 10px; display: flex; flex-direction: column; justify-content: space-between; }
.poster .row { display: flex; justify-content: space-between; align-items: center; }
.poster .num { width: 22px; height: 22px; border-radius: 999px; background: rgba(255,255,255,.92); color: #1d1b1a; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.poster .type { font-size: 10px; font-weight: 700; letter-spacing: .06em; color: #fff; text-transform: uppercase; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.poster .ptitle { color: #fff; font-size: 15px; line-height: 1.1; text-wrap: balance; }
.pin-card .t { font-size: 13px; font-weight: 700; }
.pin-card .w { font-size: 12px; font-weight: 600; color: var(--muted); }
.pin-empty { aspect-ratio: 2 / 3; border-radius: 16px; border: 2px dashed var(--line); display: flex; align-items: center; justify-content: center; padding: 10px; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); }

.filters { display: flex; gap: 6px; padding: 12px 20px 6px; overflow-x: auto; scrollbar-width: none; }
.filter { height: 32px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); flex: none; }
.filter.on { background: var(--text); color: var(--bg); box-shadow: none; }

.row-item { display: flex; gap: 14px; align-items: center; padding: 10px 20px; cursor: pointer; width: 100%; text-align: left; }
.row-item:active { background: var(--card); }
@media (hover: hover) { .row-item:hover { background: var(--card); } }
.thumb { position: relative; width: 48px; height: 68px; border-radius: 10px; flex: none; overflow: hidden; background: var(--surface); }
.thumb.sq { height: 48px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-title { font-weight: 700; font-size: 16px; }
.row-sub { font-size: 13px; color: var(--muted); }
.row-by { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 0; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.wait { display: flex; align-items: baseline; gap: 2px; }
.wait .n { font-size: 19px; }
.wait .u { font-size: 12px; font-weight: 600; color: var(--muted); }
.pin-btn { width: 34px; height: 34px; border-radius: 999px; background: var(--surface); color: var(--muted); display: flex; align-items: center; justify-content: center; }
.pin-btn:active { color: var(--accent); }
.stars { font-size: 16px; letter-spacing: 2px; }
.stars .on { color: var(--accent); } .stars .off { color: var(--line); }
.empty { padding: 28px 20px; font-size: 15px; color: var(--muted); line-height: 1.45; }
.offline { margin: 12px 20px 0; padding: 10px 14px; border-radius: 14px; background: var(--surface); font-size: 13px; font-weight: 600; color: var(--muted); }

/* ---------- Plex / Radarr / Sonarr ---------- */
.av { flex: none; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; white-space: nowrap; margin-left: 2px; }
.av.plex { background: var(--accent2); color: var(--onAccent2); }
.av.soft { background: var(--surface); color: var(--text); }
.av.ring { box-shadow: inset 0 0 0 1.5px var(--line); color: var(--muted); }
.av.soon { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.soon-t { color: var(--accent); font-weight: 700; }
.av.get { background: var(--accent); color: var(--onAccent); height: 24px; padding: 0 10px; }
.plex-dot { display: inline-block; width: 7px; height: 7px; border-radius: 999px; background: var(--accent2); margin-right: 5px; vertical-align: 1px; }
.onplex { color: var(--text); font-weight: 700; }
.btn.plex { background: var(--accent2); color: var(--onAccent2); display: flex; align-items: center; justify-content: center; text-decoration: none; }
.head-right { display: flex; align-items: center; gap: 10px; flex: none; }
.head-right .avatar.lg { margin-top: 0; }
.head { align-items: center; }
.light { height: 28px; padding: 0 10px 0 8px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.light span { width: 9px; height: 9px; border-radius: 999px; }
.light.on span { background: #3fbf5f; box-shadow: 0 0 0 3px rgba(63,191,95,.22), 0 0 8px rgba(63,191,95,.7); }
.light.off span { background: #e0483e; box-shadow: 0 0 0 3px rgba(224,72,62,.2); }
.banner { margin: 16px 20px 0; width: calc(100% - 40px); display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 16px; background: var(--accent2); color: var(--onAccent2); font-size: 14px; font-weight: 700; text-align: left; }
.banner span:last-child { flex: none; opacity: .8; }
.res .x-btn { width: 32px; height: 32px; }

/* ---------- tab bar ---------- */
#tabbar[hidden] { display: none; }
.tabbar {
  flex: none; z-index: 20;
  display: flex; align-items: center; justify-content: space-around;
  padding: 8px 28px calc(var(--sab) + 10px); background: var(--bg); border-top: 1.5px solid var(--line);
  transition: background .3s;
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; width: 64px; padding: 4px 0; color: var(--muted); }
.tab.on { color: var(--text); }
.fab { width: 56px; height: 56px; border-radius: 999px; background: var(--accent); color: var(--onAccent); display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(0,0,0,.18); transition: transform .12s; }
.fab:active { transform: scale(.94); }
svg.i { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- sheet ---------- */
#backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.4); opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 40; }
#backdrop.open { opacity: 1; pointer-events: auto; }
#sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 45; max-height: 88%; overflow-y: auto; overscroll-behavior: contain;
  max-width: 640px; margin: 0 auto;
  background: var(--card); color: var(--text); border-radius: 30px 30px 0 0;
  padding: 10px 22px calc(var(--sab) + 28px);
  transform: translateY(105%); transition: transform .34s cubic-bezier(.2,.8,.2,1);
}
#sheet.open { transform: translateY(0); }
/* Search / add-yourself: full height below the status bar, header + search box fixed, results scroll */
#sheet.full { top: calc(var(--sat) + 8px); max-height: none; overflow: hidden; display: flex; flex-direction: column; padding-bottom: 0; }
#sheet.full #sheet-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#sheet.full #results, #sheet.full .form-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: calc(var(--sab) + 24px); -webkit-overflow-scrolling: touch; }
html.kb #sheet.full { top: calc(var(--vvtop, 0px) + var(--sat) + 8px); bottom: auto; height: calc(var(--vvh, 100%) - var(--sat) - 8px); }
html.kb #sheet.full #results, html.kb #sheet.full .form-scroll { padding-bottom: 16px; }
#sheet .handle { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 16px; cursor: pointer; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sheet-head .h { font-size: 24px; }
.x-btn { width: 36px; height: 36px; border-radius: 999px; background: var(--surface); color: var(--text); display: flex; align-items: center; justify-content: center; flex: none; }
.btn { height: 54px; border-radius: 999px; font-size: 17px; font-weight: 700; width: 100%; }
.btn.primary { background: var(--accent); color: var(--onAccent); }
.btn.soft { background: var(--surface); color: var(--text); }
.btn.ghost { height: 44px; color: var(--muted); font-size: 15px; font-weight: 600; }
.btn.danger { height: 44px; color: #d0574a; font-size: 15px; font-weight: 600; }
.btns { display: flex; flex-direction: column; gap: 10px; }

.item-top { display: flex; gap: 16px; align-items: flex-end; }
.item-top .thumb { width: 96px; height: 140px; border-radius: 16px; }
.item-top .thumb.sq { height: 96px; }
.item-top .kind { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.item-top .h { font-size: 26px; line-height: 1.1; text-wrap: balance; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 22px 0; font-size: 15px; align-items: center; }
.facts .v { font-weight: 600; min-width: 0; }
.where-edit { display: flex; gap: 8px; align-items: center; }
.where-edit button.edit { font-size: 13px; font-weight: 700; color: var(--accent); }
.inline-input { height: 36px; border-radius: 10px; border: 0; background: var(--surface); color: var(--text); padding: 0 10px; font: 600 16px var(--fb); min-width: 0; flex: 1; outline: none; }

.rate-stars { display: flex; gap: 6px; margin: 26px 0 8px; }
.star-btn { width: 56px; height: 56px; border-radius: 999px; background: var(--surface); color: var(--muted); display: flex; align-items: center; justify-content: center; }
.star-btn.on { color: var(--accent); }
.star-btn svg { fill: none; stroke: currentColor; stroke-width: 2.25; stroke-linejoin: round; }
.star-btn.on svg { fill: currentColor; }
.rate-word { font-size: 14px; font-weight: 600; color: var(--muted); height: 20px; }

.searchbox { display: flex; align-items: center; gap: 10px; height: 50px; border-radius: 999px; background: var(--surface); padding: 0 18px; margin-top: 16px; color: var(--muted); }
.searchbox input { flex: 1; min-width: 0; border: 0; background: none; font: 600 16px var(--fb); color: var(--text); outline: none; }
.sheet-filters { display: flex; gap: 6px; margin: 12px 0 6px; overflow-x: auto; }
.res-label { font-size: 12px; font-weight: 600; color: var(--muted); margin: 10px 0 2px; }
.res { display: flex; gap: 14px; align-items: center; padding: 9px 0; }
.res .thumb { width: 44px; height: 62px; border-radius: 9px; }
.res .thumb.sq { height: 44px; }
.res .t { font-weight: 700; font-size: 15px; }
.res .s { font-size: 13px; color: var(--muted); }
.add-btn { height: 36px; padding: 0 16px; border-radius: 999px; font-size: 14px; font-weight: 700; background: var(--accent); color: var(--onAccent); flex: none; }
.add-btn.added { background: var(--surface); color: var(--muted); }
.link-btn { font-size: 14px; font-weight: 700; color: var(--accent); padding: 14px 0 4px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input { height: 48px; border-radius: 14px; border: 0; background: var(--surface); color: var(--text); padding: 0 14px; font: 600 16px var(--fb); outline: none; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }

.person { width: 100%; display: flex; align-items: center; gap: 14px; padding: 10px 0; text-align: left; }
.person .n { font-weight: 700; font-size: 17px; }
.person .s { font-size: 13px; color: var(--muted); }
.person .tick { width: 28px; height: 28px; border-radius: 999px; box-shadow: inset 0 0 0 2px var(--line); display: flex; align-items: center; justify-content: center; color: var(--onAccent); flex: none; }
.person .tick.on { background: var(--accent); box-shadow: none; }
.label-cap { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 26px 0 10px; }
.schemes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.scheme { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 18px; background: var(--bg); text-align: left; box-shadow: 0 0 0 1.5px var(--line); transition: box-shadow .2s; }
.scheme.on { box-shadow: 0 0 0 2.5px var(--text); }
.scheme .sw { height: 48px; border-radius: 12px; display: flex; align-items: flex-end; gap: 5px; padding: 8px; }
.scheme .sw span { width: 18px; height: 18px; border-radius: 999px; }
.scheme .sw.split { background: linear-gradient(135deg, #141318 50%, #eceee3 50%); }
.scheme b { font-size: 14px; }
.scheme small { font-size: 12px; color: var(--muted); line-height: 1.3; }
.me-card { display: flex; align-items: center; gap: 16px; }
.me-card .h { font-size: 26px; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1.5px solid var(--line); width: 100%; text-align: left; }
.list-row b { font-size: 16px; }
.list-row small { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---------- toast ---------- */
#toast {
  position: absolute; left: 50%; bottom: calc(var(--tabbar) + 22px); z-index: 60; pointer-events: none;
  transform: translate(-50%, 10px); opacity: 0; transition: opacity .25s, transform .25s;
  background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 22px; font-size: 14px; font-weight: 700; line-height: 1.35; text-align: center; width: max-content; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- sign in ---------- */
.login { min-height: 100%; display: flex; flex-direction: column; padding: calc(var(--sat) + 48px) 24px calc(var(--sab) + 24px); max-width: 440px; margin: 0 auto; }
.login .h.big { font-size: 44px; line-height: 1.05; }
.login p { font-size: 16px; line-height: 1.5; color: var(--muted); margin: 10px 0 28px; }
.who { display: flex; flex-direction: column; gap: 4px; }
.who .person { padding: 12px 0; }
.pin-head { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.dots { display: flex; gap: 16px; margin: 18px 0 6px; }
.dots span { width: 14px; height: 14px; border-radius: 999px; box-shadow: inset 0 0 0 2px var(--muted); transition: background .15s; }
.dots span.on { background: var(--text); box-shadow: none; }
.dots.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.pin-msg { min-height: 20px; font-size: 14px; font-weight: 600; color: var(--muted); }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 16px 24px; justify-content: center; margin-top: 18px; }
.key { width: 76px; height: 76px; border-radius: 999px; background: var(--surface); font-size: 28px; font-weight: 600; }
.key:active { background: var(--line); }
.key.blank { background: none; }
.key.fn { background: none; font-size: 15px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
