/* Carry-on: one stylesheet, one self-hosted variable font, no framework. */

@font-face {
  font-family: "Archivo";
  src: url("/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* Night cabin: deep navy, lit by an amber reading light. */
  --night: #0f1526;
  --cabin: #161e33;
  --cabin-2: #1e2842;
  --seam: #2a3554;
  --text: #eef1f7;
  --muted: #8e98b2;
  --light: #f3b743;
  --light-hover: #ffc95e;
  --on-light: #1a1406;
  --ready: #5fd39a;
  --alert: #ff8a7a;

  --font: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --narrow: 72%;
  --sidebar: 236px;
  --gutter: clamp(16px, 3.2vw, 40px);
  --tabbar: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--night); }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--night);
  color: var(--text);
  font: 400 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 750; line-height: 1.1; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--light); outline-offset: 3px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Tabler Icons: 24-unit grid, 2-unit stroke. */
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- buttons ---------- */

/* Taps act at once (no double-tap-to-zoom wait) and show their own press
   state; hover effects are kept to devices with a real pointer, so they
   don't stick after a tap. */
a, button, label, select, input { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid var(--seam); border-radius: 999px;
  background: var(--cabin-2); color: var(--text);
  font-weight: 600; font-size: 15px; white-space: nowrap; cursor: pointer;
  transition: background-color .15s, border-color .15s, transform .1s;
}
@media (hover: hover) { .btn:hover { border-color: #3a4870; background: #243052; } }
.btn:active, .icon-btn:active { transform: scale(.96); }
.card:active .poster { transform: scale(.97); }
.btn-primary { background: var(--light); border-color: var(--light); color: var(--on-light); }
@media (hover: hover) { .btn-primary:hover { background: var(--light-hover); border-color: var(--light-hover); } }
.btn-ok { background: var(--ready); border-color: var(--ready); color: #06281a; }
@media (hover: hover) { .btn-ok:hover { background: #7ae2b0; border-color: #7ae2b0; } }
.btn-lg { min-height: 52px; padding: 0 26px; font-size: 16px; }
.btn-plex { background: #e5a00d; border-color: #e5a00d; color: #1a1406; min-height: 52px; padding: 0 28px; font-size: 16px; }
@media (hover: hover) { .btn-plex:hover { background: #f5b425; border-color: #f5b425; } }
.btn-note { color: var(--muted); font-weight: 450; font-size: 13.5px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border: 1px solid transparent; border-radius: 999px; background: transparent;
  color: var(--muted); cursor: pointer; transition: background-color .15s, color .15s;
}
@media (hover: hover) { .icon-btn:hover { background: var(--cabin-2); color: var(--text); } }
.icon-btn.act { border-color: var(--seam); color: var(--text); }
@media (hover: hover) { .icon-btn.act:hover { border-color: var(--light); color: var(--light); } }
.icon-btn.act-ok { background: var(--ready); border-color: var(--ready); color: #06281a; }
@media (hover: hover) { .icon-btn.act-ok:hover { background: #7ae2b0; color: #06281a; } }
.icon-btn.act-err { border-color: var(--alert); color: var(--alert); }
.link { border: 0; background: none; padding: 4px 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
@media (hover: hover) { .link:hover { color: var(--text); } }

/* ---------- sign in ---------- */

.login {
  min-height: 100dvh; display: grid; place-items: center; padding: 32px var(--gutter);
  background:
    radial-gradient(60rem 30rem at 85% -10%, rgba(243, 183, 67, .14), transparent 60%),
    radial-gradient(40rem 30rem at -10% 110%, rgba(95, 120, 220, .16), transparent 60%),
    var(--night);
}
.login-inner { max-width: 560px; }
.login h1 {
  margin: 40px 0 18px;
  font-size: clamp(36px, 7vw, 60px); font-stretch: var(--narrow); font-weight: 800; line-height: .98; letter-spacing: -.01em;
}
.login p { color: var(--muted); font-size: 17px; max-width: 46ch; margin-bottom: 32px; }
.login-error { margin-top: 20px !important; color: var(--alert) !important; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-stretch: var(--narrow); font-size: 22px; letter-spacing: .01em; }
.brand img { border-radius: 8px; }
.brand-lg { font-size: 30px; }

/* ---------- shell ---------- */

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 20;
  display: flex; flex-direction: column; gap: 28px; padding: 22px 14px;
  background: var(--cabin); border-right: 1px solid var(--seam);
}
.sidebar .brand { padding: 0 10px; }
.sidebar .nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar .nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 600; transition: background-color .15s, color .15s;
}
@media (hover: hover) { .sidebar .nav a:hover { color: var(--text); background: var(--cabin-2); } }
.sidebar .nav a[aria-current] { color: var(--text); background: var(--cabin-2); box-shadow: inset 3px 0 0 var(--light); }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 0 4px 0 8px; }
.user-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

.avatar {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%;
  background: var(--light); color: var(--on-light); font-weight: 800; font-size: 15px; border: 0;
}
.avatar-btn { cursor: pointer; display: none; }

.badge {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  display: inline-grid; place-items: center; background: var(--light); color: var(--on-light);
  font-size: 12.5px; font-weight: 800;
}

.main { margin-left: var(--sidebar); min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 12px;
  padding: 14px var(--gutter);
  background: rgba(15, 21, 38, .78); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid rgba(42, 53, 84, .6);
}
.brand-mobile { display: none; }
.search { position: relative; flex: 1; max-width: 520px; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; pointer-events: none; }
.search input {
  width: 100%; height: 44px; padding: 0 16px 0 44px; border-radius: 999px;
  border: 1px solid var(--seam); background: var(--cabin); outline: none;
  font-size: 16px; /* 16px stops iOS zooming on focus */
  transition: border-color .15s, background-color .15s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--light); background: var(--cabin-2); }

#view { padding: 0 var(--gutter) 64px; outline: none; }

.tabbar { display: none; }

/* ---------- loading, empty, toast ---------- */

.loading { display: flex; justify-content: center; gap: 8px; padding: 120px 0; animation: appear .2s both; } /* the script waits 150 ms before showing it */
.loading span { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite; }
.loading span:nth-child(2) { animation-delay: .15s; }
.loading span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 50% { opacity: .25; } }
@keyframes appear { from { opacity: 0; } }

.empty { max-width: 460px; margin: 72px auto; text-align: center; }
.empty h2 { font-size: 26px; font-stretch: var(--narrow); margin-bottom: 10px; }
.empty p { color: var(--muted); margin-bottom: 22px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 50; max-width: min(520px, calc(100vw - 32px));
  padding: 13px 20px; border-radius: 14px; background: #f4f6fb; color: #121a2e;
  font-weight: 550; box-shadow: 0 18px 50px -12px rgba(0, 0, 0, .6);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--alert); color: #2a0b06; }

/* ---------- home ---------- */

.hero {
  position: relative; display: block; margin: 20px 0 8px; border-radius: 22px; overflow: hidden;
  min-height: clamp(340px, 54vh, 560px); background: var(--cabin);
}
.hero-art, .hero-art img, .hero-art .img-empty { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-art img { transition: transform .8s ease; }
@media (hover: hover) { .hero:hover .hero-art img { transform: scale(1.025); } }
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(15, 21, 38, .94) 0%, rgba(15, 21, 38, .6) 42%, rgba(15, 21, 38, 0) 75%),
              linear-gradient(0deg, rgba(15, 21, 38, .85) 0%, rgba(15, 21, 38, 0) 45%);
}
.hero-text {
  position: absolute; z-index: 1; left: 0; bottom: 0; max-width: 640px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: clamp(24px, 4vw, 48px);
}
.hero-kicker { color: var(--light); font-weight: 650; font-size: 15px; }
.hero-title {
  font-size: clamp(44px, 7.4vw, 92px); font-stretch: 64%; font-weight: 850;
  line-height: .9; letter-spacing: -.012em; text-wrap: balance;
}
.hero-facts, .facts { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.hero-facts span, .facts li {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid rgba(238, 241, 247, .18); color: #d3d8e5; font-size: 13.5px; font-weight: 550;
}
.hero .btn { margin-top: 6px; pointer-events: none; }

.row { margin-top: 36px; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.row-head h2 { font-size: 24px; font-stretch: var(--narrow); }
.row-head a { color: var(--muted); font-weight: 600; font-size: 14.5px; }
@media (hover: hover) { .row-head a:hover { color: var(--light); } }
.scroller {
  display: grid; grid-auto-flow: column; grid-auto-columns: 152px; gap: 16px;
  overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
  margin: 0 calc(-1 * var(--gutter)); padding: 4px var(--gutter) 10px; scroll-padding: 0 var(--gutter);
}
.scroller::-webkit-scrollbar { display: none; }
.scroller .card { scroll-snap-align: start; }

/* ---------- cards & grid ---------- */

.card { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.poster {
  position: relative; aspect-ratio: 2 / 3; border-radius: 10px; overflow: hidden; margin-bottom: 7px;
  background: var(--cabin-2); box-shadow: 0 0 0 1px rgba(238, 241, 247, .06);
  transition: transform .18s ease, box-shadow .18s ease;
}
.poster img, .poster .img-empty { width: 100%; height: 100%; object-fit: cover; }
@media (hover: hover) { .card:hover .poster { transform: translateY(-3px); box-shadow: 0 0 0 2px var(--light), 0 16px 30px -14px rgba(0, 0, 0, .8); } }
.card-title { font-weight: 600; font-size: 14.5px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-sub { color: var(--muted); font-size: 13px; }
.packed {
  position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 26px; height: 26px;
  border-radius: 50%; background: var(--ready); color: #06281a;
}
.packed .i { width: 16px; height: 16px; stroke-width: 2.6; }

.img-empty {
  display: block; width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--cabin-2), var(--cabin));
}

.page-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; padding: 30px 0 22px; }
.page-head h1 { font-size: clamp(34px, 5vw, 48px); font-stretch: var(--narrow); font-weight: 800; letter-spacing: -.01em; }
.count { color: var(--muted); }
.filters { display: flex; gap: 10px; margin-left: auto; }
.select select {
  appearance: none; height: 40px; padding: 0 36px 0 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--seam); background: var(--cabin) no-repeat right 10px center / 20px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e98b2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6l6 -6'/%3E%3C/svg%3E"); /* Tabler chevron-down */
  font-size: 14.5px; font-weight: 550;
}
@media (hover: hover) { .select select:hover { border-color: #3a4870; } }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 26px 18px; }
.results { margin-bottom: 36px; }
.results h2 { font-size: 22px; font-stretch: var(--narrow); margin-bottom: 14px; }
.lede { max-width: 68ch; color: var(--muted); margin: -8px 0 26px; }
.lede strong { color: var(--text); font-weight: 650; }

/* ---------- detail ---------- */

.detail { position: relative; isolation: isolate; } /* keeps the z-index:-1 backdrop above the page background */
.backdrop {
  position: absolute; top: 0; left: calc(-1 * var(--gutter)); right: calc(-1 * var(--gutter)); height: 480px; z-index: -1;
  overflow: hidden; opacity: .5;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 100%);
}
.backdrop img, .backdrop .img-empty { width: 100%; height: 100%; object-fit: cover; }
.detail-head { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; padding-top: 72px; }
.detail-poster { aspect-ratio: 2 / 3; border-radius: 14px; overflow: hidden; background: var(--cabin-2); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .9); }
.detail-poster img, .detail-poster .img-empty { width: 100%; height: 100%; object-fit: cover; }
.detail-info { display: flex; flex-direction: column; gap: 14px; max-width: 760px; padding-top: 28px; }
.detail-info h1 { font-size: clamp(40px, 6vw, 76px); font-stretch: 64%; font-weight: 850; line-height: .92; letter-spacing: -.012em; text-wrap: balance; }
.facts .rating { color: var(--light); border-color: rgba(243, 183, 67, .35); }
.facts .rating .i { width: 15px; height: 15px; fill: currentColor; stroke-width: 0; }
.genres { color: var(--muted); font-weight: 550; }
.summary { max-width: 68ch; color: #cdd3e1; font-size: 16.5px; line-height: 1.6; }

.panel {
  margin-top: 10px; padding: 20px; border-radius: 18px;
  background: rgba(22, 30, 51, .78); border: 1px solid var(--seam);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; flex-direction: column; gap: 18px;
}
.q-title { margin-bottom: 10px; font-weight: 650; }
.q-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.q-opt {
  position: relative; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; cursor: pointer;
  border-radius: 12px; border: 1px solid var(--seam); background: var(--cabin);
  transition: border-color .15s, background-color .15s;
}
@media (hover: hover) { .q-opt:hover { border-color: #3a4870; } }
.q-opt input { position: absolute; opacity: 0; pointer-events: none; }
.q-opt:has(input:checked) { border-color: var(--light); background: rgba(243, 183, 67, .08); box-shadow: inset 0 0 0 1px var(--light); }
.q-opt:has(input:focus-visible) { outline: 2px solid var(--light); outline-offset: 3px; }
.q-label { font-weight: 700; }
.q-detail { color: var(--muted); font-size: 13.5px; }

.action { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.action-note { color: var(--muted); font-size: 14px; }
.status { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.status-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-weight: 600; }
.err-text { color: var(--alert); }

progress {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border: 0; border-radius: 999px;
  background: var(--cabin-2); overflow: hidden; color: var(--light);
}
progress::-webkit-progress-bar { background: var(--cabin-2); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--light); border-radius: 999px; transition: width .6s ease; }
progress::-moz-progress-bar { background: var(--light); border-radius: 999px; }
progress:indeterminate { background: linear-gradient(90deg, var(--cabin-2) 0 30%, #3a4870 50%, var(--cabin-2) 70% 100%) 0 0 / 300% 100%; animation: sweep 1.6s linear infinite; }
progress:indeterminate::-webkit-progress-bar { background: transparent; }
progress:indeterminate::-moz-progress-bar { background: transparent; }
@keyframes sweep { from { background-position: 100% 0; } to { background-position: -50% 0; } }

/* ---------- seasons ---------- */

.seasons { margin-top: 48px; }
.season-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.season-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 3px; margin: -3px; }
.season-tabs::-webkit-scrollbar { display: none; }
.season-tabs button {
  flex: none; min-height: 40px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--seam); background: transparent; color: var(--muted); font-weight: 600;
}
@media (hover: hover) { .season-tabs button:hover { color: var(--text); border-color: #3a4870; } }
.season-tabs button[aria-selected="true"] { background: var(--text); border-color: var(--text); color: var(--night); }

.episodes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ep {
  display: grid; grid-template-columns: 200px minmax(0, 1fr) auto; gap: 20px; align-items: center;
  padding: 14px 0; border-top: 1px solid var(--seam);
}
.ep-thumb { aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--cabin-2); }
.ep-thumb img, .ep-thumb .img-empty { width: 100%; height: 100%; object-fit: cover; }
.ep-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ep-body h3 { font-size: 17px; font-weight: 650; line-height: 1.3; }
.ep-code {
  display: inline-block; margin-right: 8px; padding: 1px 7px; border-radius: 6px; vertical-align: 1px;
  background: var(--cabin-2); color: var(--light); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.ep-meta { color: var(--muted); font-size: 14px; }
.ep-summary { color: #b8bfd0; font-size: 14.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 80ch; }

/* Progress ring for compact rows; --p is set from script (0–1). */
@property --p { syntax: "<number>"; inherits: false; initial-value: 0; }
.ring {
  --p: 0; display: inline-block; width: 44px; height: 44px; border-radius: 50%;
  background: conic-gradient(var(--ring, var(--light)) calc(var(--p) * 360deg), var(--cabin-2) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  transition: --p .6s;
}
.ring-wait { background: conic-gradient(var(--light) 0 60deg, var(--cabin-2) 0); animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
button.ring { border: 0; padding: 0; cursor: pointer; flex: none; }
.ring-save { --ring: var(--ready); }

/* Saving to the device is green throughout, so it never reads as converting. */
.progress-save::-webkit-progress-value { background: var(--ready); }
.progress-save::-moz-progress-bar { background: var(--ready); }
.icon-btn.act-done { border-color: rgba(95, 211, 154, .5); color: var(--ready); }
@media (hover: hover) { .icon-btn.act-done:hover { border-color: var(--ready); color: var(--ready); } }
/* One nudge when a file lands on the phone, pointing at the last step. */
.act-nudge { animation: nudge .5s ease 2; }
@keyframes nudge { 50% { transform: scale(1.06); } }
.tag-save { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 10px; }
.tag-save .status { max-width: 440px; }
.bulk { margin-bottom: 16px; }
.ring-save.ring-wait { background: conic-gradient(var(--ready) 0 60deg, var(--cabin-2) 0); }

/* ---------- downloads: luggage tags ---------- */

.tags { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.tag {
  --notch: 16px;
  position: relative; display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; align-items: center;
  background: var(--cabin);
  /* Clipped corners and a punched eyelet make each download read as a tag on a bag. */
  clip-path: polygon(var(--notch) 0, 100% 0, 100% 100%, var(--notch) 100%, 0 calc(100% - var(--notch)), 0 var(--notch));
  -webkit-mask: radial-gradient(circle 7px at 24px 50%, transparent 6.5px, #000 7px);
  mask: radial-gradient(circle 7px at 24px 50%, transparent 6.5px, #000 7px);
  border-radius: 0 16px 16px 0;
}
.tag::after { /* the perforation between stub and body */
  content: ""; position: absolute; top: 12px; bottom: 12px; left: 92px;
  border-left: 2px dashed var(--seam);
}
.tag-stub { align-self: stretch; display: grid; place-items: center; padding: 14px 10px 14px 40px; background: var(--cabin-2); }
.tag-stub img, .tag-stub .img-empty { width: 44px; aspect-ratio: 2 / 3; height: auto; border-radius: 5px; object-fit: cover; }
.tag-body { display: flex; flex-direction: column; gap: 5px; padding: 16px 20px 16px 26px; min-width: 0; }
.tag-body h3 { font-size: 21px; font-stretch: var(--narrow); font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-ep { color: #cdd3e1; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--muted); font-size: 14px; }
.tag-body progress { margin-top: 6px; max-width: 420px; }
.q-chip { padding: 2px 9px; border-radius: 999px; border: 1px solid var(--seam); color: var(--text); font-size: 13px; font-weight: 600; }
.tag-actions { display: flex; align-items: center; gap: 6px; padding-right: 14px; }
.tag-ready { background: linear-gradient(90deg, var(--cabin) 70%, rgba(95, 211, 154, .09)); }
.tag-ready .tag-stub { background: rgba(95, 211, 154, .16); }
.tag-failed .tag-stub { background: rgba(255, 138, 122, .14); }

/* ---------- settings ---------- */

.settings { max-width: 760px; display: flex; flex-direction: column; gap: 34px; }
.set { display: flex; flex-direction: column; }
.set h2 { font-size: 24px; font-stretch: var(--narrow); margin-bottom: 6px; }
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 18px 0; border-bottom: 1px solid var(--seam); cursor: pointer;
}
.set-text { display: flex; flex-direction: column; gap: 3px; }
.set-text strong { font-weight: 650; }
.set-help { color: var(--muted); font-size: 14.5px; max-width: 56ch; }
.set-usage { display: flex; flex-direction: column; gap: 10px; padding: 14px 0 18px; border-bottom: 1px solid var(--seam); color: #cdd3e1; }
.set-usage progress { max-width: 420px; }
.set-actions { display: flex; }

.unit { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); flex: none; }
.unit input {
  width: 92px; height: 40px; padding: 0 12px; border-radius: 10px; text-align: right;
  border: 1px solid var(--seam); background: var(--cabin); color: var(--text); outline: none; font-size: 16px; font-variant-numeric: tabular-nums;
}
.unit input:focus { border-color: var(--light); }

/* ---------- users ---------- */

.people { list-style: none; margin: 0 0 40px; padding: 0; display: grid; gap: 10px; max-width: 900px; }
.person {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px;
  padding: 16px 20px; border-radius: 16px; background: var(--cabin); border: 1px solid var(--seam);
}
.person-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.person-body h3 { display: flex; align-items: center; gap: 8px; font-size: 19px; font-stretch: var(--narrow); }
.person-meta { color: var(--muted); font-size: 14px; }
.person-usage { display: flex; flex-direction: column; align-items: flex-end; color: var(--muted); font-size: 13.5px; text-align: right; }
.person-usage strong { color: var(--text); font-size: 18px; font-variant-numeric: tabular-nums; }

.history { max-width: 900px; }
.history h2 { font-size: 24px; font-stretch: var(--narrow); margin-bottom: 6px; }
.history ol { list-style: none; margin: 0; padding: 0; }
.history li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--seam); }
.history li .i { align-self: center; color: var(--muted); }
.history li p { color: #cdd3e1; }
.history li strong { color: var(--text); font-weight: 650; }
.history time { color: var(--muted); font-size: 13.5px; white-space: nowrap; }

/* ---------- small screens ---------- */

@media (max-width: 960px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); }
  .topbar { padding-top: calc(10px + env(safe-area-inset-top)); padding-bottom: 10px; }
  .brand-mobile, .avatar-btn { display: inline-grid; }
  .search { max-width: none; }
  .tabbar {
    position: fixed; inset: auto 0 0 0; z-index: 20; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(22, 30, 51, .92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--seam);
  }
  .tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11.5px; font-weight: 600; }
  .tabbar a[aria-current] { color: var(--light); }
  .tabbar .badge { position: absolute; top: 6px; left: calc(50% + 6px); margin: 0; min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; }
  .toast { bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 14px); }
}

@media (max-width: 720px) {
  :root { --gutter: 16px; }
  .hero { margin-top: 12px; border-radius: 18px; min-height: 420px; }
  .hero::after { background: linear-gradient(0deg, rgba(15, 21, 38, .96) 8%, rgba(15, 21, 38, .2) 70%); }
  .scroller { grid-auto-columns: 116px; gap: 12px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 20px 12px; }
  .card-title { font-size: 13.5px; }
  .filters { margin-left: 0; width: 100%; }
  .filters .select { flex: 1; }
  .filters select { width: 100%; }
  .page-head { padding-top: 22px; }

  .detail-head { grid-template-columns: 1fr; gap: 0; padding-top: 120px; }
  .detail-poster { width: 132px; margin-bottom: -4px; border-radius: 10px; }
  .detail-info { padding-top: 18px; }
  .backdrop { height: 330px; opacity: .6; }
  .panel { padding: 16px; margin-left: -4px; margin-right: -4px; }
  .q-opts { grid-template-columns: 1fr; }
  .q-opt { flex-direction: row; align-items: baseline; justify-content: space-between; }
  .action .btn-lg { width: 100%; }

  .season-bar .btn { width: 100%; }
  .ep { grid-template-columns: 112px minmax(0, 1fr) auto; gap: 12px; align-items: start; }
  .ep-body h3 { font-size: 15.5px; }
  .ep-summary { display: none; }
  .ep .action { align-self: center; }

  .tag { grid-template-columns: 74px minmax(0, 1fr); --notch: 12px; }
  .tag::after { left: 74px; }
  .tag-stub { grid-row: span 2; padding-left: 30px; }
  .tag-stub img, .tag-stub .img-empty { width: 36px; }
  .tag { -webkit-mask: radial-gradient(circle 6px at 17px 50%, transparent 5.5px, #000 6px); mask: radial-gradient(circle 6px at 17px 50%, transparent 5.5px, #000 6px); }
  .tag-body { padding: 14px 44px 16px 18px; }
  .tag-body h3 { font-size: 19px; }
  .tag-actions { position: absolute; top: 4px; right: 2px; padding: 0; }
  .tag-save, .tag-save .btn, .bulk .btn { width: 100%; }

  .set-row { gap: 16px; }
  .person { grid-template-columns: auto minmax(0, 1fr); padding: 14px 16px; }
  .person-usage { grid-column: 2; flex-direction: row; align-items: baseline; gap: 8px; }
  .history li { grid-template-columns: auto minmax(0, 1fr); }
  .history time { grid-column: 2; }
  .set-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
