:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #efebe4;
  --line: #e2ddd4;
  --text: #1d1f24;
  --muted: #6b6f78;
  --accent: #d0602b;
  --accent-ink: #ffffff;
  --accent-soft: #fbe6da;
  --good: #1f8a4c;
  --good-soft: #dff3e6;
  --warn: #a15c00;
  --warn-soft: #fdf0d9;
  --bad: #b3261e;
  --bad-soft: #fbe3e1;
  --info-soft: #e3ecfb;
  --info: #2756a8;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgb(20 20 30 / 6%), 0 6px 20px rgb(20 20 30 / 6%);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161c;
    --surface: #1c1f27;
    --surface-2: #252935;
    --line: #2f3442;
    --text: #eceef3;
    --muted: #9aa0ad;
    --accent: #f0814a;
    --accent-ink: #1a0d06;
    --accent-soft: #3a2418;
    --good: #5fd08f;
    --good-soft: #17301f;
    --warn: #f0b45a;
    --warn-soft: #33270f;
    --bad: #ff8a80;
    --bad-soft: #3a1a18;
    --info-soft: #1b2740;
    --info: #9dbcff;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--sans);
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
img { display: block; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 10px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; letter-spacing: -0.01em; }
.brand svg { width: 26px; height: 26px; fill: var(--accent); }
.brand svg .play { fill: var(--accent-ink); }
.tabs { display: flex; gap: 4px; }
.tabs a {
  text-decoration: none; padding: 7px 12px; border-radius: 999px; color: var(--muted); font-weight: 550;
}
.tabs a[aria-current="page"] { background: var(--text); color: var(--bg); }
.meta { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.who { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 16ch; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; background: var(--surface-2); font-size: 13px; white-space: nowrap;
}
.chip.low { background: var(--warn-soft); color: var(--warn); }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 8px 12px; padding-top: max(10px, env(safe-area-inset-top)); }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  .tabs a { flex: 1; text-align: center; padding: 7px 8px; font-size: 14px; }
}

main { max-width: 1120px; margin: 0 auto; padding: 18px 16px 64px; outline: none; }

/* ---------- search ---------- */
.searchbar { display: flex; gap: 8px; margin: 6px 0 18px; }
.searchbar input {
  flex: 1; min-width: 0;
  padding: 14px 16px; font-size: 17px;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface);
  box-shadow: var(--shadow);
}
.searchbar input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.hint { color: var(--muted); }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
@media (max-width: 480px) { .results { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
.card {
  display: flex; flex-direction: column; text-decoration: none;
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--line);
  transition: transform .12s ease;
}
.card:hover { transform: translateY(-2px); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.poster { aspect-ratio: 2 / 3; background: var(--surface-2); width: 100%; object-fit: cover; }
.poster.blank { display: grid; place-items: center; color: var(--muted); font-size: 32px; }
.card .body { padding: 10px 11px 12px; display: flex; flex-direction: column; gap: 6px; }
.card .t { font-weight: 650; line-height: 1.25; }
.card .y { color: var(--muted); font-size: 13px; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.badge {
  font-size: 11.5px; font-weight: 650; letter-spacing: .02em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted);
}
.badge.movie { background: var(--info-soft); color: var(--info); }
.badge.tv { background: var(--good-soft); color: var(--good); }
.badge.anime { background: var(--accent-soft); color: var(--accent); }
.badge.lib { background: var(--text); color: var(--bg); }
.badge.sub { background: var(--warn-soft); color: var(--warn); }

/* ---------- title page ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; margin-bottom: 12px; }
.hero { display: grid; grid-template-columns: 140px 1fr; gap: 18px; align-items: start; margin-bottom: 18px; }
.hero .poster { border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.hero h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.02em; line-height: 1.15; }
.hero p { margin: 8px 0 0; color: var(--muted); max-width: 70ch; }
@media (max-width: 560px) {
  .hero { grid-template-columns: 96px 1fr; gap: 12px; }
  .hero h1 { font-size: 21px; }
  .hero p { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
}
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 10px; font-size: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seasons { display: flex; flex-wrap: wrap; gap: 8px; }
.seasons a {
  text-decoration: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 600;
}
.seasons a[aria-current="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.seasons a small { font-weight: 450; opacity: .8; margin-left: 4px; }
.episodes { list-style: none; margin: 0; padding: 0; }
.episodes li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.episodes li:first-child { border-top: 0; }
.episodes .num { font: 600 13px var(--mono); color: var(--muted); width: 3.2em; flex: none; }
.episodes .name { flex: 1; min-width: 0; }
.episodes .name small { display: block; color: var(--muted); }
.have { color: var(--good); font-weight: 650; font-size: 13px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 7px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 13.5px; }
.btn.icon { width: 38px; padding: 0; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.on { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

/* ---------- releases ---------- */
.rel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 6px 0 10px; }
.rel-head h2 { margin: 0; font-size: 18px; }
.rel-head .hint { font-size: 13px; }
.sortbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.sortbar button {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 11px; font-size: 13px; cursor: pointer;
}
.sortbar button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.rels { display: flex; flex-direction: column; gap: 8px; }
.rel {
  display: grid; align-items: center; gap: 4px 14px;
  grid-template-columns: 92px 70px minmax(0, 1fr) auto;
  grid-template-areas: "size seed title actions" "size seed meta actions";
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px;
}
.rel.rejected { background: color-mix(in srgb, var(--surface) 70%, var(--bad-soft)); }
.rel .size { grid-area: size; font: 700 19px/1.1 var(--sans); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.rel .size small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.rel .seed { grid-area: seed; font-variant-numeric: tabular-nums; font-size: 13.5px; line-height: 1.25; }
.rel .seed b { color: var(--good); font-size: 15px; }
.rel .seed span { color: var(--muted); display: block; }
.rel .title { grid-area: title; font-size: 13.5px; word-break: break-word; font-weight: 550; }
.rel .metaline { grid-area: meta; display: flex; flex-wrap: wrap; gap: 4px 6px; font-size: 12.5px; color: var(--muted); }
.rel .metaline .tag { background: var(--surface-2); border-radius: 5px; padding: 1px 6px; }
.rel .metaline .tag.q { color: var(--text); font-weight: 600; }
.rel .metaline .tag.rej { background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.rel .actions { grid-area: actions; display: flex; gap: 6px; }
@media (max-width: 640px) {
  .rel {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "size seed sub" "title title title" "meta meta meta" "actions actions actions";
    gap: 6px 10px;
  }
  .rel .seed span { display: inline; margin-left: 6px; }
  .rel .actions { justify-content: flex-end; }
  .rel .actions .btn { flex: 1; }
  .rel .actions .btn.icon { flex: none; }
}

/* ---------- downloads / subscriptions ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.item .top { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.item .what { font-weight: 650; }
.item .what small { color: var(--muted); font-weight: 500; margin-left: 6px; }
.item .sub { color: var(--muted); font-size: 13px; word-break: break-word; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.state { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 2px 8px; border-radius: 6px; }
.state.imported { background: var(--good-soft); color: var(--good); }
.state.downloading, .state.queued { background: var(--info-soft); color: var(--info); }
.state.failed, .state.warning { background: var(--bad-soft); color: var(--bad); }
.state.waiting { background: var(--surface-2); color: var(--muted); }
h1.page { font-size: 22px; margin: 4px 0 14px; letter-spacing: -0.01em; }
h2.section { font-size: 15px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 26px 0 10px; }

/* ---------- dialog, toasts, states ---------- */
dialog {
  border: 0; border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 24px));
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgb(0 0 0 / 35%);
}
dialog::backdrop { background: rgb(10 10 15 / 55%); }
.dlg { padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 12px; max-height: 85vh; overflow: auto; }
.dlg h3 { margin: 0; font-size: 17px; word-break: break-word; }
.dlg dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
.dlg dt { color: var(--muted); }
.dlg dd { margin: 0; word-break: break-word; }
.dlg .reasons { margin: 0; padding: 10px 12px 10px 28px; background: var(--bad-soft); color: var(--bad); border-radius: var(--radius-sm); }
.dlg .ok { padding: 10px 12px; background: var(--good-soft); color: var(--good); border-radius: var(--radius-sm); }
.dlg .buttons { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.dlg label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; }
.dlg input, .dlg select { padding: 9px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); font-weight: 400; }
#toasts { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; width: min(520px, calc(100vw - 24px)); }
.toast { background: var(--text); color: var(--bg); padding: 11px 14px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 550; }
.toast.err { background: var(--bad); color: #fff; }
.empty, .loading, .error {
  padding: 28px 16px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
}
.error { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.loading::before {
  content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px;
  border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .card, .loading::before { transition: none; animation: none; } }
.textlink { margin-top: 4px; }
.rel .metaline a.tag { color: inherit; }

/* ---------- bundles ---------- */
.rel .metaline .tag.bundle { background: var(--info-soft); color: var(--info); font-weight: 600; }
dialog:has(.dlg.wide) { width: min(820px, calc(100vw - 24px)); }
.grow { flex: 1; }
.filelist { max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.fgroup + .fgroup { border-top: 1px solid var(--line); }
.fdir { position: sticky; top: 0; background: var(--surface-2); padding: 6px 10px; font-size: 12.5px; font-weight: 650; word-break: break-all; }
.frow { display: grid !important; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 6px 10px; font-weight: 400 !important; font-size: 13.5px !important; cursor: pointer; }
.frow:hover { background: var(--surface-2); }
.frow input { width: 18px; height: 18px; }
.fname { word-break: break-all; }
.fsize { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.maprows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 70px; }
.maprow { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 6px 14px; align-items: center; }
.maprow.done { opacity: .75; }
.maprow .fname { font-weight: 600; font-size: 13.5px; }
.maprow .sub { color: var(--muted); font-size: 12.5px; }
.mpick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mpick select, .mpick input { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); max-width: 100%; }
.pick { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.pick[hidden] { display: none; }
.msearch { width: 12em; }
.warns { grid-column: 1 / -1; }
.warn { color: var(--warn); background: var(--warn-soft); border-radius: 6px; padding: 3px 8px; font-size: 12.5px; margin-top: 4px; }
.mresult.ok { color: var(--good); font-size: 13.5px; }
.buttons.sticky { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px max(10px, env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 92%, transparent); border-top: 1px solid var(--line); justify-content: center; }
.report { padding-left: 18px; margin: 0; font-size: 13.5px; display: flex; flex-direction: column; gap: 4px; }
.report li.failed { color: var(--bad); }
.report li.imported { color: var(--good); }
@media (max-width: 640px) { .maprow { grid-template-columns: 1fr; } }

/* =================== hube.us portal (added on top of the request.hube.us styles) =================== */
main { max-width: 1100px; margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-left)) 40px; }
.landing { min-height: 70vh; display: grid; place-items: center; text-align: center; }
.landing .logo { width: 72px; height: 72px; margin: 0 auto 14px; }
.landing h1 { font-size: clamp(30px, 7vw, 44px); margin: 0 0 6px; letter-spacing: -0.02em; }
.landing p { color: var(--muted); margin: 0 0 22px; }
.landing .row { justify-content: center; }
.landing .note { margin-top: 18px; font-size: 13.5px; color: var(--muted); max-width: 46ch; }
.note.good { color: var(--good); }
.note.bad { color: var(--bad); }

h2.sec { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tile {
  position: relative; display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 44px 14px 14px; text-decoration: none; color: inherit; min-height: 84px; transition: transform .12s;
}
a.tile:hover { transform: translateY(-2px); }
a.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile .ic { width: 44px; height: 44px; border-radius: 11px; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 750; font-size: 19px; overflow: hidden; }
.tile .ic img { width: 44px; height: 44px; }
.tile .tx { min-width: 0; }
.tile .nm { font-weight: 680; line-height: 1.25; }
.tile .ds { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.tile .nolink { font-size: 12px; color: var(--muted); margin-top: 6px; }
.star {
  position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 9px; border: 0;
  background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center;
}
.star:hover { background: var(--surface-2); }
.star svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.star[aria-pressed="true"] { color: var(--warn); }
.star[aria-pressed="true"] svg { fill: currentColor; }

.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px;
  border-radius: 999px; background: var(--bad); color: #fff; font-size: 12px; font-weight: 700; }
.panel2 { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.reqs { display: flex; flex-direction: column; gap: 10px; }
.req { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.req .who2 { min-width: 0; }
.req .who2 b { display: block; overflow-wrap: anywhere; }
.req .who2 span { color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.req select { min-height: 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); padding: 4px 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 24px; font-weight: 720; letter-spacing: -0.01em; }
.stat .s { color: var(--muted); font-size: 12.5px; }
.meter { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; background: var(--good); }
.meter i.warn { background: var(--warn); }
.meter i.bad { background: var(--bad); }
table.t2 { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t2 th, table.t2 td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t2 th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.scroll { overflow-x: auto; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 650; white-space: nowrap; }
.pill.up { background: var(--good-soft); color: var(--good); }
.pill.down { background: var(--bad-soft); color: var(--bad); }
.pill.na { background: var(--surface-2); color: var(--muted); }
.notices { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.notices li { padding: 8px 11px; border-radius: 10px; font-size: 14px; }
.notices li.bad { background: var(--bad-soft); color: var(--bad); }
.notices li.warn { background: var(--warn-soft); color: var(--warn); }
.notices li.info { background: var(--info-soft); color: var(--info); }
.small-muted { color: var(--muted); font-size: 12.5px; }
@media (max-width: 560px) { .tiles { grid-template-columns: 1fr; } .tabs a { padding: 6px 9px; } }
.mt { margin-top: 12px; }

/* the hidden attribute must win over component display rules (topbar, admin tab, badge) */
[hidden] { display: none !important; }
/* phones: stack table rows as cards so every column stays visible */
@media (max-width: 640px) {
  table.t2 thead { display: none; }
  table.t2, table.t2 tbody, table.t2 tr, table.t2 td { display: block; width: 100%; }
  table.t2 tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.t2 td { border: 0; padding: 2px 4px; }
  table.t2 td:empty { display: none; }
}
