:root {
  --bg: #0b0e14;
  --bg2: #121623;
  --card: #171c2c;
  --card2: #1e2438;
  --border: #2a3148;
  --text: #e8ebf4;
  --muted: #8b93ab;
  --accent: #6c5ce7;
  --accent2: #8b7cf7;
  --green: #2ecc71;
  --red: #e74c3c;
  --orange: #f39c12;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--accent2); text-decoration: none; }
h1, h2, h3 { font-weight: 700; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

header.site {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: rgba(11,14,20,.85); backdrop-filter: blur(10px); z-index: 50;
}
.logo { font-size: 1.3rem; font-weight: 800; letter-spacing: .5px; }
.logo span { color: var(--accent2); }
nav { display: flex; gap: 12px; align-items: center; }

.btn {
  display: inline-block; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); cursor: pointer; font-size: .95rem; font-weight: 600;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--card2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent2); }
.btn.danger { border-color: var(--red); color: var(--red); background: transparent; }
.btn.danger:hover { background: rgba(231,76,60,.12); }
.btn.small { padding: 6px 12px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.hero { text-align: center; padding: 14px 20px 30px; }
.hero h1 {
  font-size: 2.5rem; line-height: 1.25; max-width: 820px; margin: 0 auto;
  background: linear-gradient(100deg, var(--text) 30%, var(--accent2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

/* minmax(0,1fr) (not bare 1fr) lets tracks shrink below content width so a long
   feature line wraps instead of blowing out the column and overlapping. */
.plans { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; padding: 30px 0 70px; align-items: stretch; }
@media (max-width: 1080px) { .plans { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px)  { .plans { grid-template-columns: 1fr; } }
.plan {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px 22px; display: flex; flex-direction: column; gap: 12px; position: relative;
  min-width: 0; overflow-wrap: anywhere; /* contain long words/lines inside the card */
  cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.plan:hover { border-color: var(--accent2); transform: translateY(-3px); }
.plan.selected { border-color: var(--accent); box-shadow: 0 0 30px rgba(108,92,231,.25); }
/* Best-value plan: accent border + a pill straddling the top edge. */
.plan.best { border-color: var(--accent); box-shadow: 0 0 24px rgba(108,92,231,.18); }
.plan-ribbon {
  position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; padding: 4px 12px; border-radius: 999px;
  white-space: nowrap; box-shadow: 0 4px 12px rgba(108,92,231,.4);
}
.plan h3 { font-size: 1.15rem; }
.plan .price { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.plan .price small { font-size: .95rem; color: var(--muted); font-weight: 400; white-space: nowrap; }
.plan .perconn { color: var(--muted); font-size: .88rem; margin: 0; }
.plan .desc { color: var(--muted); font-size: .95rem; margin: 0; }
/* "Everything included" reassurance — the shared feature set lives once, up in the
   #features section; this just links to it so every card says all plans are equal. */
.plan-included { color: var(--green); font-weight: 600; font-size: .92rem; text-decoration: none; display: inline-block; }
.plan-included:hover { text-decoration: underline; }
/* Per-plan UNIQUE features (backend plan.features) — rendered only when non-empty. */
.plan-extra { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 2px; }
.plan-extra-h { display: block; font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.plan-extra ul { list-style: none; color: var(--text); display: flex; flex-direction: column; gap: 7px; font-size: .9rem; }
/* hanging indent: the ✓ sits in its own gutter so wrapped lines align under the text */
.plan-extra ul li { padding-left: 1.5em; line-height: 1.45; }
.plan-extra ul li::before { content: "✓"; color: var(--green); font-weight: 700; display: inline-block; width: 1.5em; margin-left: -1.5em; }
.plan .btn { margin-top: auto; } /* pin CTA to the bottom so card bottoms align regardless of content */

.section-title { text-align: center; padding: 40px 0 10px; font-size: 1.7rem; }

/* feature tiles (public landing page, admin-editable) */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; padding: 20px 0 30px; }
.ftile {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; transition: transform .15s, border-color .15s;
}
.ftile:hover { transform: translateY(-3px); border-color: var(--accent); }
.ftile .ficon { font-size: 1.7rem; margin-bottom: 10px; }

/* contact cards (public landing page) */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; padding: 18px 0 50px; max-width: 780px; margin: 0 auto; }
.contact-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px 20px; color: var(--text); transition: transform .15s, border-color .15s;
}
.contact-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.contact-card .ficon { font-size: 1.9rem; margin-bottom: 4px; }
.contact-card span { font-size: .9rem; word-break: break-all; }
.ftile b { display: block; margin-bottom: 6px; font-size: 1.02rem; }
.ftile p { font-size: .88rem; line-height: 1.45; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; padding: 24px 0 70px; }
.step { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.step b { display: block; margin-bottom: 6px; }
.step .num { color: var(--accent2); font-weight: 800; font-size: 1.2rem; }

footer { border-top: 1px solid var(--border); color: var(--muted); text-align: center; padding: 26px; font-size: .9rem; }

/* modal */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none;
  align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.overlay.open { display: flex; }
.modal {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  width: 100%; max-width: 460px; padding: 26px; max-height: 90vh; overflow-y: auto;
}
.modal.wide { max-width: 640px; }
.modal h3 { margin-bottom: 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: .95rem; font-family: inherit;
}
.field textarea { min-height: 80px; resize: vertical; }
.form-error { color: var(--red); font-size: .88rem; min-height: 1.2em; margin-bottom: 10px; }
.form-ok { color: var(--green); font-size: .88rem; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tabs .tab { flex: 1; text-align: center; padding: 9px; border-radius: 8px; cursor: pointer; background: var(--card); border: 1px solid var(--border); font-weight: 600; }
.tabs .tab.active { background: var(--accent); border-color: var(--accent); }

/* badges + tables */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.badge.green { background: rgba(46,204,113,.15); color: var(--green); }
.badge.red { background: rgba(231,76,60,.15); color: var(--red); }
.badge.orange { background: rgba(243,156,18,.15); color: var(--orange); }
.badge.gray { background: rgba(139,147,171,.15); color: var(--muted); }

table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th { text-align: left; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--text); }
.pager { display: flex; align-items: center; gap: 12px; padding: 12px 2px; flex-wrap: wrap; }
.pager .spacer { flex: 1; }
.filter-input {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: .9rem; font-family: inherit;
}
.filter-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:hover td { background: rgba(255,255,255,.02); }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.muted { color: var(--muted); }

/* admin layout */
.admin-layout { display: flex; min-height: 100vh; }
.admin-side {
  width: 220px; flex-shrink: 0; border-right: 1px solid var(--border);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 4px; background: var(--bg2);
}
.admin-side .logo { padding: 0 10px 18px; }
.admin-side a.nav-item {
  padding: 10px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
}
.admin-side a.nav-item:hover { background: var(--card); color: var(--text); }
.admin-side a.nav-item.active { background: var(--accent); color: #fff; }
.admin-main { flex: 1; padding: 28px; min-width: 0; }
.admin-main h2 { margin-bottom: 18px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat .n { font-size: 2rem; font-weight: 800; }
.stat .l { color: var(--muted); font-size: .88rem; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }

/* ---------- player: shared pieces ---------- */
.player-shell { display: flex; height: calc(100vh - 61px); position: relative; overflow: hidden; }
.player-panel {
  width: 320px; flex-shrink: 0; display: flex; flex-direction: column; min-height: 0;
  background: var(--bg2); border-right: 1px solid var(--border);
}
.panel-search { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.panel-search input {
  width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--text);
}
.panel-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.panel-title {
  padding: 12px 14px 4px; font-size: .7rem; letter-spacing: .8px;
  text-transform: uppercase; color: var(--muted); font-weight: 700;
}
.cat-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 14px; cursor: pointer;
  font-size: .9rem; color: var(--muted); border-left: 3px solid transparent; user-select: none;
}
.cat-item:hover { background: var(--card); color: var(--text); }
.cat-item.active { color: #fff; background: var(--card2); border-left-color: var(--accent); }
.cat-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.star { cursor: pointer; color: var(--muted); font-size: .95rem; flex-shrink: 0; }
.star:hover { color: #f1c40f; }
.star.on { color: #f1c40f; }
.pin { cursor: pointer; opacity: .18; font-size: .8rem; flex-shrink: 0; filter: grayscale(1); }
.cat-item:hover .pin, .cat-select-bar .pin { opacity: .55; }
.pin.on { opacity: 1; filter: none; }
.cat-group {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; cursor: pointer;
  font-size: .78rem; font-weight: 700; letter-spacing: .5px; color: var(--muted);
  border-top: 1px solid rgba(42,49,72,.5); user-select: none;
}
.cat-group:hover { color: var(--text); background: var(--card); }
.cat-group .chev { transition: transform .15s; font-size: .7rem; }
.cat-group.open .chev { transform: rotate(90deg); }
.cat-group .gname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-group .gcount { background: var(--card2); border-radius: 999px; padding: 1px 8px; font-size: .7rem; font-weight: 600; }
.cat-item.grouped { padding-left: 26px; }
.cat-select-bar { display: flex; flex: 1; align-items: center; gap: 10px; }
.lock { cursor: pointer; opacity: .15; font-size: .72rem; flex-shrink: 0; filter: grayscale(1); }
.cat-item:hover .lock { opacity: .5; }
.lock.on { opacity: 1; filter: none; }
.cat-tag { color: var(--muted); font-size: .74rem; font-weight: 400; }
.control-bar .epg { flex-basis: 100%; font-size: .82rem; color: var(--text); }
.epg-row { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.epg-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45%; }
.epg-bar { height: 3px; background: var(--card2); border-radius: 2px; overflow: hidden; margin-top: 5px; }
.epg-bar div { height: 100%; background: var(--accent); }
.chan {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px; cursor: pointer;
  border-bottom: 1px solid rgba(42,49,72,.4); user-select: none; position: relative;
}
.chan:hover { background: var(--card); }
.chan.active { background: var(--card2); box-shadow: inset 3px 0 0 var(--accent); }
.chan img { width: 34px; height: 34px; object-fit: contain; border-radius: 6px; background: var(--card2); flex-shrink: 0; }
.chan .ph { width: 34px; height: 34px; border-radius: 6px; background: var(--card2); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .7rem; flex-shrink: 0; }
.chan .name { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.chan .star { margin-left: auto; }
.dragging { opacity: .35; }
.drag-over { box-shadow: inset 0 2px 0 var(--accent); }
.player-stage { flex: 1; display: flex; flex-direction: column; background: #000; min-width: 0; min-height: 0; }
.player-stage video { width: 100%; flex: 1; min-height: 0; background: #000; }
.control-bar {
  padding: 10px 14px; background: var(--bg2); border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.control-bar .now { flex: 1; min-width: 120px; color: var(--muted); font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.control-bar select { max-width: 150px; }
#btn-panel { display: none; }
.player-msg { color: var(--muted); display: flex; flex: 1; align-items: center; justify-content: center; text-align: center; padding: 30px; }
#chan-more:hover { color: var(--text); }
.layout-grid #chan-more { grid-column: 1 / -1; }

/* ---------- layout: grid ---------- */
.layout-grid.player-shell { flex-direction: column; height: auto; min-height: calc(100vh - 61px); overflow: visible; }
.layout-grid .player-stage { order: 0; height: 48vh; flex: none; }
.layout-grid .player-panel { order: 1; width: 100%; border-right: 0; border-top: 1px solid var(--border); }
.layout-grid .panel-scroll { overflow: visible; }
.layout-grid #cat-list { display: flex; overflow-x: auto; gap: 6px; padding: 10px 12px; }
.layout-grid .cat-item {
  border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px;
  white-space: nowrap; border-left-width: 1px; background: var(--card); flex-shrink: 0;
}
.layout-grid .cat-item.active { background: var(--accent); border-color: var(--accent); }
.layout-grid #chan-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 12px 14px 30px; }
.layout-grid .chan {
  flex-direction: column; text-align: center; gap: 8px; padding: 16px 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--card);
}
.layout-grid .chan.active { box-shadow: 0 0 0 2px var(--accent); }
.layout-grid .chan img, .layout-grid .chan .ph { width: 54px; height: 54px; }
.layout-grid .chan .name { white-space: normal; font-size: .82rem; line-height: 1.25; max-height: 2.6em; overflow: hidden; }
.layout-grid .chan .star { position: absolute; top: 6px; right: 9px; margin: 0; }

/* ---------- layout: theater ---------- */
.layout-theater .player-panel {
  position: absolute; right: 0; top: 0; bottom: 0; z-index: 30; width: 340px;
  transform: translateX(100%); transition: transform .25s ease;
  border-left: 1px solid var(--border); border-right: 0;
  box-shadow: -12px 0 34px rgba(0,0,0,.55);
}
.layout-theater .player-panel.open { transform: none; }
.layout-theater #btn-panel { display: inline-block; }

/* ---------- mode bar (Live / Movies / Series) ---------- */
.mode-bar { display: flex; gap: 6px; padding: 8px 14px; background: var(--bg2); border-bottom: 1px solid var(--border); align-items: center; flex-wrap: wrap; }
.mode-bar button {
  border: 1px solid var(--border); background: var(--card); color: var(--muted);
  padding: 7px 16px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: .88rem;
}
.mode-bar button:hover { color: var(--text); }
.mode-bar button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
#view-player .player-shell:not(.layout-grid) { height: calc(100vh - 61px - 47px); }

/* ---------- cinema browse (movies & series) ---------- */
#view-vod { min-height: calc(100vh - 61px); }
.container-wide { max-width: 1440px; margin: 0 auto; padding: 0 24px 70px; }
#vod-hero .hero { position: relative; display: flex; align-items: flex-end; gap: 26px; padding: 46px 44px 30px; min-height: 300px; overflow: hidden; text-align: left; }
.hero-bg { position: absolute; inset: -20px; background-size: cover; background-position: center 20%; filter: blur(22px) brightness(.4); transform: scale(1.1); }
.hero-fade { position: absolute; inset: 0; background: linear-gradient(to top, var(--bg) 2%, transparent 80%); }
.hero-poster { position: relative; width: 150px; border-radius: 10px; box-shadow: 0 14px 44px rgba(0,0,0,.65); }
.hero-meta { position: relative; flex: 1; min-width: 0; }
.hero-meta h2 { font-size: 2rem; text-shadow: 0 2px 12px rgba(0,0,0,.6); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-tag { color: var(--muted); margin: 6px 0 16px; }

.strip-title { font-size: 1.05rem; font-weight: 700; margin: 24px 0 10px; }
.cont-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.cont-card { flex: 0 0 210px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; cursor: pointer; transition: border-color .15s; }
.cont-card:hover { border-color: var(--accent); }
.cont-card img { width: 100%; height: 112px; object-fit: cover; display: block; }
.cont-card .cinfo { padding: 8px 10px; font-size: .84rem; }
.cbar { height: 3px; background: var(--card2); }
.cbar div { height: 100%; background: var(--accent); }

.vod-toolbar { display: flex; gap: 10px; margin: 22px 0 16px; flex-wrap: wrap; }
.vod-toolbar input {
  flex: 1; min-width: 200px; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
}
.poster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 14px; }
.pcard { cursor: pointer; min-width: 0; }
.pwrap {
  position: relative; aspect-ratio: 2/3; border-radius: 10px; overflow: hidden;
  background: var(--card); border: 1px solid var(--border);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
}
.pcard:hover .pwrap { transform: scale(1.05); box-shadow: 0 14px 34px rgba(0,0,0,.55); border-color: var(--accent); z-index: 2; }
.pwrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pwrap .noimg { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--muted); font-size: .8rem; padding: 12px; text-align: center; }
.pbadge { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.72); padding: 2px 8px; border-radius: 6px; font-size: .74rem; }
.pprog { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0,0,0,.55); }
.pprog div { height: 100%; background: var(--accent); }
.pname { margin-top: 8px; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pmeta { color: var(--muted); font-size: .76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* detail modal */
.modal.xwide { max-width: 860px; }
.detail { display: flex; gap: 22px; }
.detail .dposter { width: 175px; border-radius: 10px; align-self: flex-start; flex-shrink: 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.chip { background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 3px 11px; font-size: .76rem; color: var(--muted); }
.ep-row { display: flex; gap: 12px; padding: 10px; border-radius: 10px; cursor: pointer; align-items: center; }
.ep-row:hover { background: var(--card); }
.ep-num { color: var(--muted); width: 26px; text-align: right; flex-shrink: 0; }
.ep-body { flex: 1; min-width: 0; }

/* cinema playback overlay */
#cinema { position: fixed; inset: 0; z-index: 200; background: #000; display: flex; flex-direction: column; }
#cinema video { flex: 1; width: 100%; min-height: 0; }
.cinema-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; gap: 14px; align-items: center;
  padding: 14px 18px; background: linear-gradient(rgba(0,0,0,.85), transparent);
  opacity: 0; transition: opacity .25s;
}
#cinema:hover .cinema-top, .cinema-top:focus-within { opacity: 1; }
#cine-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
#cine-report { flex-shrink: 0; }

/* "Continue" flyout in the mode bar */
#continue-box { position: relative; }
.cont-count {
  background: rgba(0,0,0,.28); border-radius: 999px; padding: 0 7px;
  font-size: .72rem; margin-left: 2px; display: inline-block; min-width: 18px;
}
#continue-menu {
  position: absolute; top: 44px; left: 0; width: min(400px, 92vw); max-height: 60vh; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; z-index: 120;
  box-shadow: 0 16px 50px rgba(0,0,0,.6);
}

/* global search (lives in the mode bar, pushed to the right of the tabs) */
#gsearch-box { position: relative; margin-left: auto; }
#gsearch {
  width: min(340px, 38vw); padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: .88rem;
}
#gsearch:focus { border-color: var(--accent); outline: none; width: min(420px, 46vw); transition: width .2s; }
#gsearch-results {
  position: absolute; top: 46px; right: 0; width: min(460px, 92vw); max-height: 62vh; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; z-index: 120;
  box-shadow: 0 16px 50px rgba(0,0,0,.6);
}
.gsr-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px 6px;
  font-size: .74rem; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted);
  position: sticky; top: 0; background: var(--bg2);
}
.gsr-row { display: flex; align-items: center; gap: 10px; padding: 8px 14px; cursor: pointer; }
.gsr-row:hover { background: var(--card); }
.gsr-row img { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; background: var(--card2); flex-shrink: 0; }
.gsr-ph { width: 34px; height: 34px; border-radius: 6px; background: var(--card2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.gsr-name { flex: 1; min-width: 0; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gsr-meta { font-size: .74rem; flex-shrink: 0; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gsr-empty { padding: 20px; color: var(--muted); text-align: center; }

/* full-page search results */
#search-page {
  position: fixed; left: 0; right: 0; bottom: 0; top: 108px;
  background: var(--bg); z-index: 80; overflow-y: auto; padding: 16px 24px 70px;
}
.sp-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 1440px; margin: 0 auto 6px; }
.sp-head h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sp-body { max-width: 1440px; margin: 0 auto; }
.strip-title .gcount { background: var(--card2); border-radius: 999px; padding: 1px 9px; font-size: .72rem; margin-left: 6px; color: var(--muted); vertical-align: middle; }
.sr-chan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.sr-chan {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  padding: 16px 10px 12px; background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; transition: transform .15s, border-color .15s;
}
.sr-chan:hover { border-color: var(--accent); transform: translateY(-3px); }
.sr-chan img, .sr-chan .ph { width: 52px; height: 52px; object-fit: contain; border-radius: 8px; background: var(--card2); }
.sr-chan .ph { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .72rem; }
.sr-chan .name { font-size: .84rem; line-height: 1.25; max-height: 2.5em; overflow: hidden; }

/* monospace ids + floating row menu */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; }
#row-menu {
  position: fixed; z-index: 250; min-width: 200px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  box-shadow: 0 14px 40px rgba(0,0,0,.55);
}
#row-menu div { padding: 10px 14px; cursor: pointer; font-size: .88rem; white-space: nowrap; }
#row-menu div:hover { background: var(--card); }
#row-menu div.disabled { opacity: .4; cursor: default; }
#row-menu div.disabled:hover { background: none; }

/* support ticket chat threads */
.chat-thread { display: flex; flex-direction: column; gap: 10px; padding: 16px 0 6px; margin-top: 12px; border-top: 1px solid var(--border); }
.bubble { max-width: 78%; padding: 9px 13px 7px; border-radius: 14px; font-size: .92rem; }
.bubble.mine { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.bubble.theirs { align-self: flex-start; background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble .btext { white-space: pre-wrap; word-break: break-word; line-height: 1.45; }
.bubble .bmeta { font-size: .68rem; opacity: .65; margin-top: 5px; text-align: right; }
.bubble.theirs .bmeta { text-align: left; }
.unread-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); display: inline-block; }
.reply-box { display: flex; gap: 8px; margin-top: 12px; align-items: flex-start; }
.reply-box textarea {
  flex: 1; min-height: 64px; padding: 10px 12px; border-radius: 10px; resize: vertical;
  border: 1px solid var(--border); background: var(--card); color: var(--text); font-family: inherit;
}

/* toast */
#toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(16px);
  background: var(--bg2); border: 1px solid var(--border); padding: 10px 18px; border-radius: 10px;
  z-index: 300; opacity: 0; pointer-events: none; transition: .25s;
  box-shadow: 0 10px 34px rgba(0,0,0,.55); max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%); pointer-events: auto; }

@media (max-width: 760px) {
  #gsearch-box { margin-left: 0; flex-basis: 100%; }
  #gsearch, #gsearch:focus { width: 100%; }
  #vod-hero .hero { padding: 28px 20px 22px; min-height: 220px; }
  .hero-poster { width: 96px; }
  .hero-meta h2 { font-size: 1.3rem; }
  .detail { flex-direction: column; }
  .detail .dposter { width: 130px; }
  .player-shell { flex-direction: column; height: auto; overflow: visible; }
  .player-panel { width: 100%; max-height: 46vh; border-right: 0; border-top: 1px solid var(--border); order: 1; }
  .player-stage { order: 0; height: 40vh; flex: none; }
  .layout-theater .player-panel { position: fixed; top: auto; height: 70vh; max-height: none; width: 100%; transform: translateY(100%); }
  .layout-theater .player-panel.open { transform: none; }
  .admin-layout { flex-direction: column; }
  .admin-side { width: 100%; flex-direction: row; overflow-x: auto; align-items: center; }
  .admin-side .logo { padding: 0 14px 0 4px; }
  .hero h1 { font-size: 2rem; }
}
