*{box-sizing:border-box}
body{margin:0;color:#f2f2f2;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
/* Glass theme: dark gradient like the reference sidebar menu — deep
   slate at the top fading to a warm dark brown at the bottom. */
background:linear-gradient(180deg,#1c2436 0%,#232326 45%,#3a2718 100%) fixed;
background-attachment:fixed}
a{color:#ff8a6b}
/* Glass panel: translucent, frosted, thin light border. */
.glass{background:rgba(255,255,255,.08);-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px);border:1px solid rgba(255,255,255,.14);box-shadow:0 8px 30px rgba(0,0,0,.35)}
/* Layout: sidebar on the left, content on the right (desktop). */
.layout{display:flex;min-height:100vh;align-items:flex-start}
.sidebar{position:sticky;top:0;height:100vh;width:250px;flex:0 0 250px;padding:20px 16px;display:flex;flex-direction:column;gap:16px;border-right:1px solid rgba(255,255,255,.12);border-radius:0 20px 20px 0}
.sidebar .brand{font-weight:900;letter-spacing:2px;font-size:22px;padding:4px 8px}
.sidebar .brand span{color:#ff5a3c}
.sidebar input[type=search]{width:100%;padding:11px 12px;border-radius:12px;border:1px solid rgba(255,255,255,.16);background:rgba(255,255,255,.08);color:#fff}
.sidebar input[type=search]::placeholder{color:#bbb}
.side-nav{display:flex;flex-direction:column;gap:4px}
/* Home sidebar items are <button>s, but detail/show/settings sidebar
   items are <a> links — the old rule only styled buttons, so links on
   other pages fell back to plain orange underlined text. This rule
   styles both, so every page's sidebar looks the same. */
.side-nav button,.side-nav a,.side-bottom button,.side-bottom a{display:flex;align-items:center;gap:10px;width:100%;text-align:left;padding:11px 14px;border:0;border-radius:12px;background:transparent;color:#ddd;font-weight:600;font-size:15px;cursor:pointer;text-decoration:none}
.side-nav button:hover,.side-nav a:hover,.side-bottom button:hover,.side-bottom a:hover{background:rgba(255,255,255,.12);color:#fff}
/* Active menu item: white pill, black text — like Discover in the reference. */
.side-nav button.on,.side-nav a.on{background:#fff;color:#111}
.side-bottom{margin-top:auto;display:flex;flex-direction:column;gap:4px;border-top:1px solid rgba(255,255,255,.12);padding-top:14px}
.side-bottom button{background:rgba(255,255,255,.08)}
.main{flex:1;min-width:0;padding:8px 8px 40px}
.top{display:flex;gap:12px;align-items:center;padding:14px 16px;flex-wrap:wrap}
.brand{font-weight:900;letter-spacing:2px;font-size:22px}.brand{display:flex;align-items:center;gap:10px}.brand-logo{width:36px;height:36px;border-radius:9px;flex:0 0 36px}.brand span{color:#ff5a3c}
.top input[type=search]{flex:1;min-width:180px;padding:10px;border-radius:12px;border:1px solid rgba(255,255,255,.16);background:rgba(255,255,255,.08);color:#fff}
button,.logout{padding:10px 14px;border:0;border-radius:12px;background:#ff5a3c;color:#fff;font-weight:700;cursor:pointer;text-decoration:none}
button.secondary{background:rgba(255,255,255,.12)}button.small{padding:6px 10px;font-size:13px}button.danger{background:#7a1f1f}
.filters{display:flex;gap:8px;overflow-x:auto;padding:0 16px 8px}.filters button{background:rgba(255,255,255,.08)}.filters button.on{background:#fff;color:#111}
.status,.muted{color:#bbb;padding:0 16px}.small{font-size:13px}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:14px;padding:8px 16px 40px}
.grid[hidden]{display:none !important}
.card{cursor:pointer;text-decoration:none;color:inherit}
.poster{position:relative;aspect-ratio:2/3;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.12);border-radius:14px;overflow:hidden;display:flex;align-items:center;justify-content:center}
.poster img{width:100%;height:100%;object-fit:cover}.initial{font-size:64px;font-weight:900;color:#ff5a3c}
.badge{position:absolute;left:8px;bottom:8px;background:rgba(0,0,0,.65);color:#fff;font-size:11px;padding:3px 7px;border-radius:20px}
.card h4{margin:8px 0 2px;font-size:15px}.meta{margin:0;color:#bbb;font-size:13px}
.folders{padding:8px 16px}.folder{display:flex;gap:10px;align-items:center;flex-wrap:wrap;background:rgba(255,255,255,.08);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);border:1px solid rgba(255,255,255,.12);border-radius:14px;padding:12px;margin:6px 0}
.folder .muted{padding:0}.empty{text-align:center;padding:30px 16px}
.modal{position:fixed;inset:0;background:rgba(0,0,0,.7);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);display:flex;align-items:flex-start;justify-content:center;padding:20px;overflow:auto;z-index:10}
.modal[hidden]{display:none !important}
.sheet{background:rgba(28,28,38,.92);-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);border:1px solid rgba(255,255,255,.16);border-radius:16px;padding:20px;width:100%;max-width:560px}.sheet.wide{max-width:820px}
.sheet input,.sheet select{width:100%;padding:10px;margin:8px 0 14px;border-radius:10px;border:1px solid rgba(255,255,255,.16);background:rgba(255,255,255,.08);color:#fff}
.browser{max-height:220px;overflow:auto;background:rgba(0,0,0,.35);border-radius:10px;padding:8px;margin-bottom:12px}
.browser button{display:block;width:100%;text-align:left;background:transparent;padding:8px;border-radius:6px}
.row{display:flex;gap:10px;flex-wrap:wrap}
.auth{max-width:420px;margin:80px auto;padding:20px;text-align:center}.auth input{width:100%;padding:12px;margin:8px 0;border-radius:12px;border:1px solid rgba(255,255,255,.16);background:rgba(255,255,255,.08);color:#fff}
.auth button{width:100%}.err{color:#ff7a6b}
.toast{position:fixed;left:50%;bottom:20px;transform:translateX(-50%);background:#222;color:#fff;padding:12px 18px;border-radius:20px;z-index:20}
video,audio,img.player-img{width:100%;border-radius:14px;background:#000}
/* Plex-style home sections + detail page */
.home-section{padding:8px 16px}.home-section h3{margin:14px 0 8px}
.row-scroll{display:flex;gap:14px;overflow-x:auto;padding:4px 2px 14px}
.row-scroll .card{flex:0 0 150px;text-decoration:none;color:inherit}
.row-scroll .card h4{font-size:14px}
.row-scroll .card .meta{padding:0}
.detail-page{padding:8px 16px 40px;max-width:1100px;margin:0 auto}
.detail-hero{display:flex;gap:24px;flex-wrap:wrap}
.poster.large{width:260px;flex:0 0 260px}
.detail-info{flex:1;min-width:280px}.detail-info h1{margin:0 0 8px;font-size:32px}
.detail-info .meta{padding:0}.chips{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0}
.chip{background:rgba(255,255,255,.12);border:1px solid rgba(255,255,255,.16);border-radius:20px;padding:4px 12px;font-size:13px}
.desc{font-size:16px;line-height:1.5}
a.card-link{text-decoration:none;color:inherit}
.sortbar{display:flex;gap:10px;flex-wrap:wrap;padding:0 16px 12px;align-items:center}
.sortbar[hidden]{display:none !important}
.sortbar label{color:#bbb;font-size:13px}
.sortbar select{padding:8px;border-radius:10px;border:1px solid rgba(255,255,255,.16);background:rgba(255,255,255,.08);color:#fff}
.progress-bar{height:6px;background:rgba(255,255,255,.2);border-radius:3px;margin-top:6px;overflow:hidden}
.progress-bar i{display:block;height:100%;background:#ff5a3c}
/* Full-screen player: fills the screen, controls fade away. */
.fs-player{position:fixed;inset:0;background:#000;z-index:100;display:flex;flex-direction:column;align-items:center;justify-content:center}
.fs-player[hidden]{display:none !important}
.fs-media{width:100%;height:100%;object-fit:contain;background:#000}
.fs-poster{max-width:320px;max-height:40vh;border-radius:14px;margin-bottom:20px}
.fs-top{position:absolute;top:0;left:0;right:0;display:flex;justify-content:space-between;align-items:center;padding:16px 20px;background:linear-gradient(180deg,rgba(0,0,0,.8),transparent);transition:opacity .3s;z-index:2}
.fs-controls{position:absolute;bottom:0;left:0;right:0;display:flex;gap:10px;align-items:center;padding:16px 20px;background:linear-gradient(0deg,rgba(0,0,0,.85),transparent);transition:opacity .3s;z-index:2}
.fs-btn{background:rgba(255,255,255,.14);color:#fff;border:0;border-radius:12px;padding:10px 14px;font-weight:700;cursor:pointer;white-space:nowrap}
.fs-center{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:84px;height:84px;border-radius:50%;background:rgba(255,255,255,.9);color:#111;border:0;font-size:32px;cursor:pointer;z-index:2}
.fs-center[hidden]{display:none !important}
.fs-next{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);background:rgba(28,28,38,.94);-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);border:1px solid rgba(255,255,255,.16);border-radius:16px;padding:24px;max-width:90vw;text-align:center;z-index:3}
.fs-next[hidden]{display:none !important}
.fs-player.controls-hidden .fs-top,.fs-player.controls-hidden .fs-controls{opacity:0;pointer-events:none}
.fs-player.controls-hidden{cursor:none}
#fsSeek{flex:1;accent-color:#ff5a3c}
#fsVolume{width:100px;accent-color:#ff5a3c}
#fsTime{white-space:nowrap;font-size:14px;color:#ddd}
/* Hamburger button: hidden on desktop, so the desktop left sidebar
   is completely unchanged. It only appears on a narrow screen. */
.hamburger{display:none}
/* App-style mobile navigation: bottom bar + profile bubble.
   Both are hidden on desktop — desktop keeps the left sidebar
   exactly as it is. They only appear on a narrow screen. */
.bottom-nav{display:none}
.profile-bubble{display:none}
.profile-menu{display:none}
/* Phone: sidebar becomes a compact bar (brand + hamburger) at the
   top, and the full menu is hidden until the hamburger is tapped.
   The old horizontal scrolling bar only ever showed the first few
   items (Home, Add library) and the rest were easy to miss. */
@media (max-width:900px){
  .layout{flex-direction:column}
  .sidebar{position:sticky;top:0;z-index:50;height:auto;width:100%;flex:none;border-right:0;border-radius:0;padding:12px 16px}
  .sidebar .brand{padding-right:56px}
  .hamburger{display:none}
  .sidebar .profile-chip,.sidebar input[type=search],.side-nav,.side-bottom{display:none}
  .sidebar.menu-open .profile-chip,.sidebar.menu-open input[type=search],.sidebar.menu-open .side-nav,.sidebar.menu-open .side-bottom{display:flex}
  .sidebar.menu-open .side-nav{flex-direction:column;overflow:visible}
  .sidebar.menu-open .side-nav button,.sidebar.menu-open .side-nav a{flex:none;white-space:normal;width:100%}
  .sidebar.menu-open .side-bottom{flex-direction:column;overflow:visible;margin-top:14px}
  .sidebar.menu-open .side-bottom button,.sidebar.menu-open .side-bottom a{flex:none;white-space:normal;width:100%}
  .main{width:100%;padding-bottom:96px}
  .toast{bottom:88px}
  /* Profile bubble, top right of the mobile top bar. Tapping it
     opens the profile menu (Settings / Log out). */
  .profile-bubble{display:flex;position:absolute;top:9px;right:14px;background:transparent;border:0;border-radius:50%;padding:0;cursor:pointer;z-index:2}
  .profile-bubble .profile-avatar.small{width:38px;height:38px;font-size:18px;border:2px solid rgba(255,255,255,.35)}
  .profile-menu{display:block;position:absolute;top:56px;right:14px;width:220px;background:rgba(28,28,38,.96);-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px);border:1px solid rgba(255,255,255,.16);border-radius:14px;padding:8px;z-index:60;box-shadow:0 8px 30px rgba(0,0,0,.45)}
  .profile-menu[hidden]{display:none !important}
  .profile-menu-name{padding:10px 12px;font-weight:700;border-bottom:1px solid rgba(255,255,255,.12);margin-bottom:4px}
  .profile-menu a{display:flex;align-items:center;gap:10px;padding:11px 12px;border-radius:10px;color:#ddd;font-weight:600;font-size:15px;text-decoration:none}
  .profile-menu a:hover{background:rgba(255,255,255,.12);color:#fff}
  /* Player controls on a phone: the bar was too crowded (seek +
     time + mute + a 100px volume slider), so the volume slider is
     hidden — phones use the hardware volume buttons — leaving room
     for the new full-screen button. */
  .fs-controls{gap:6px;padding:12px 12px calc(12px + env(safe-area-inset-bottom))}
  #fsVolume{display:none}
  .fs-btn{padding:10px}
  #fsTime{font-size:12px}
  /* Bottom app bar: fixed, five sections, thumb-reachable. */
  .bottom-nav{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:60;background:rgba(28,28,38,.94);-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px);border-top:1px solid rgba(255,255,255,.14);padding:6px 4px calc(6px + env(safe-area-inset-bottom));justify-content:space-around}
  .bottom-nav a{flex:1;display:flex;flex-direction:column;align-items:center;gap:2px;padding:6px 0;color:#bbb;text-decoration:none;font-size:11px;font-weight:600}
  .bottom-nav a .nav-icon{font-size:21px;line-height:1}
  .bottom-nav a.on{color:#fff}
  .bottom-nav a.on .nav-icon{color:#ff5a3c}
}
/* User profiles */
.profile-grid{display:flex;gap:16px;flex-wrap:wrap;justify-content:center;margin:20px 0}
.profile-card{display:flex;flex-direction:column;align-items:center;gap:8px;text-decoration:none;color:#fff;padding:12px;min-width:110px}
.profile-avatar{display:flex;align-items:center;justify-content:center;width:84px;height:84px;border-radius:50%;font-size:36px;font-weight:900;color:#fff}
.profile-avatar.small{width:32px;height:32px;font-size:16px}
.profile-chip{display:flex;align-items:center;gap:10px;padding:8px 12px;font-weight:700}

.auth-logo{width:100%;max-width:340px;height:auto;border-radius:14px;display:block;margin:0 auto 16px}
.home-logo{display:none}
@media (min-width:901px){.home-logo{display:block;text-align:center;padding:16px 16px 0}.home-logo img{width:100%;max-width:480px;height:auto;border-radius:14px}}
/* Watched checkmark on a cover: green circle, top right of the
   poster. Shown on a movie (or episode) card when it is marked
   watched, and on a TV show card when every downloaded episode
   of that show is watched. */
.watched-check{position:absolute;top:8px;right:8px;width:28px;height:28px;border-radius:50%;background:#16a34a;color:#fff;display:flex;align-items:center;justify-content:center;font-size:16px;font-weight:900;box-shadow:0 2px 8px rgba(0,0,0,.55);z-index:1}
/* Tracker: aired-but-not-downloaded episodes, like the Watch List
   reference — show name with a count badge, episode rows with a
   circle to mark watched, and a "Show N more episodes" expander. */
.tracker-show{padding:8px 16px 20px;border-bottom:1px solid rgba(255,255,255,.12)}
.tracker-head{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap}
.tracker-head h2{margin:10px 0 4px;font-size:24px}
.tracker-badge{display:inline-flex;align-items:center;justify-content:center;min-width:28px;height:28px;border-radius:50%;background:#e5484d;color:#fff;font-size:15px;font-weight:800;padding:0 6px}
.tracker-badge.done{background:#16a34a}
.tracker-upcoming{color:#bbb;font-size:14px;margin:2px 0 8px;line-height:1.6}
.tracker-ep{display:flex;align-items:center;gap:14px;padding:12px 0;border-bottom:1px solid rgba(255,255,255,.08)}
.tracker-circle{flex:0 0 34px;width:34px;height:34px;border-radius:50%;border:2px solid #e5484d;background:transparent;color:#e5484d;font-size:18px;line-height:1;padding:0;cursor:pointer}
.tracker-circle:hover{background:rgba(229,72,77,.15)}
.tracker-ep-text{flex:1;min-width:0}
.tracker-se{display:block;color:#999;font-size:13px}
.tracker-title{font-size:17px}
.tracker-aired{color:#999;font-size:13px;white-space:nowrap}
.tracker-more{display:block;background:none;border:0;color:#ff8a6b;font-size:16px;font-weight:600;padding:12px 0;cursor:pointer;text-align:left}
.tracker-add{display:flex;gap:8px;flex-wrap:wrap;padding:0 16px}
.tracker-add input{flex:1;min-width:200px;padding:11px 12px;border-radius:12px;border:1px solid rgba(255,255,255,.16);background:rgba(255,255,255,.08);color:#fff}
.tracker-result{display:flex;gap:12px;align-items:center;padding:10px 0;border-bottom:1px solid rgba(255,255,255,.08)}
.tracker-result img{width:44px;height:66px;object-fit:cover;border-radius:8px;background:rgba(255,255,255,.08)}
.tracker-result-noimg{flex:0 0 44px;width:44px;height:66px;border-radius:8px;background:rgba(255,255,255,.08);display:flex;align-items:center;justify-content:center;color:#ff5a3c;font-size:24px;font-weight:900}

/* Schedule view (Tracker): day-by-day airings, like a TV guide. */
.sched-day{font-size:22px;font-weight:800;margin:22px 0 10px}
.sched-day .muted{font-size:15px;font-weight:400}
.sched-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}
@media (min-width:700px){ .sched-grid{grid-template-columns:repeat(auto-fill,minmax(140px,1fr));} }
.sched-card{display:block;text-decoration:none;color:inherit}
.sched-poster{position:relative;display:block;aspect-ratio:2/3;border-radius:10px;overflow:hidden;background:#1c1c1e}
.sched-poster img{width:100%;height:100%;object-fit:cover;display:block}
.sched-poster-noimg{display:flex;align-items:center;justify-content:center;height:100%;padding:10px;text-align:center;font-weight:700;color:#aaa}
.sched-tv{position:absolute;top:8px;left:8px;background:#e5484d;color:#fff;font-weight:800;font-size:12px;padding:4px 8px;border-radius:6px}
.sched-time{display:block;font-size:18px;font-weight:700;margin-top:8px}
.sched-se{display:block;color:#888;font-size:14px}
.sched-name{display:block;color:#888;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
