:root {
  color-scheme: dark;
  --bg: #080b14;
  --surface: #111726;
  --surface-2: #192238;
  --text: #f7f9ff;
  --muted: #9ba8be;
  --accent: #27b3ff;
  --accent-2: #765dff;
  --danger: #ff5d71;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 280px;
  min-height: 100dvh;
  background: radial-gradient(circle at 80% -10%, rgba(71, 79, 255, .22), transparent 36rem), var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  display: flex;
  min-height: 68px;
  align-items: center;
  gap: 28px;
  padding: 10px max(20px, calc((100vw - 1440px) / 2));
  background: rgba(8, 11, 20, .82);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.03em; }
.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px rgba(39, 179, 255, .28);
  overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-mark.has-image { background: transparent; border-radius: 0; box-shadow: none; }
.brand-mark.has-image img { object-fit: contain; }
.desktop-nav { display: flex; flex: 1; align-items: center; gap: 6px; }
.desktop-nav a, .ghost-button {
  min-height: 44px;
  padding: 11px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.desktop-nav a:hover, .desktop-nav a:focus-visible, .ghost-button:hover, .ghost-button:focus-visible {
  background: rgba(255, 255, 255, .07);
  color: var(--text);
  outline: none;
}

.page-shell { width: min(1440px, 100%); min-height: calc(100dvh - 68px); margin: 0 auto; padding: 28px 24px 70px; }
.mobile-nav { display: none; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 4.5rem); line-height: 1.02; letter-spacing: -.055em; }
h2 { margin: 0; font-size: clamp(1.25rem, 2.2vw, 2rem); letter-spacing: -.035em; }

.hero {
  display: grid;
  min-height: min(540px, 65dvh);
  align-items: end;
  padding: clamp(28px, 6vw, 74px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 28px;
  background:
    linear-gradient(90deg, rgba(8, 11, 20, .98) 0%, rgba(8, 11, 20, .78) 45%, rgba(8, 11, 20, .12) 100%),
    radial-gradient(circle at 85% 30%, rgba(39, 179, 255, .58), transparent 22rem),
    linear-gradient(135deg, #17244f, #0b1021 55%, #38246d);
  box-shadow: var(--shadow);
}
.hero > div { max-width: 760px; }
.hero p:not(.eyebrow) { max-width: 620px; color: #c2ccdc; font-size: clamp(1rem, 2vw, 1.25rem); }
.button-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.primary-button, .secondary-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border: 0;
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
}
.primary-button { background: linear-gradient(135deg, var(--accent), #3e7dff); color: #05101b; box-shadow: 0 10px 26px rgba(39, 179, 255, .22); }
.secondary-button { background: var(--surface-2); color: var(--text); border: 1px solid rgba(255, 255, 255, .09); }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.primary-button:focus-visible, .secondary-button:focus-visible, .chip:focus-visible, .poster-card:focus-visible, .channel-card:focus-visible { outline: 3px solid rgba(39, 179, 255, .55); outline-offset: 3px; }

.content-section { margin-top: 38px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-heading > a { color: var(--accent); font-weight: 700; }
.poster-rail {
  display: grid;
  grid-auto-columns: clamp(136px, 18vw, 190px);
  grid-auto-flow: column;
  gap: 16px;
  overflow-x: auto;
  padding: 4px 3px 18px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.poster-card { min-width: 0; scroll-snap-align: start; }
.poster-frame {
  display: grid;
  aspect-ratio: 2 / 3;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--surface-2), #0d1322);
  border: 1px solid rgba(255, 255, 255, .07);
  transition: transform .2s ease, border-color .2s ease;
}
.poster-frame img { width: 100%; height: 100%; object-fit: cover; }
.poster-card:hover .poster-frame { transform: translateY(-4px); border-color: rgba(39, 179, 255, .5); }
.poster-card strong { display: block; margin-top: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poster-card small { color: var(--muted); }
.poster-placeholder { color: var(--accent); font-size: 2rem; }

.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 44px; }
.quick-grid a { display: grid; min-height: 150px; padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid rgba(255, 255, 255, .07); }
.quick-grid a > span { color: var(--accent); font-size: 1.8rem; }
.quick-grid strong { align-self: end; font-size: 1.2rem; }
.quick-grid small { color: var(--muted); }

.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 12px 0 24px; }
.search-box input, .stack-form input, .stack-form select {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 13px;
  outline: none;
  background: var(--surface);
  color: var(--text);
}
.search-box { width: min(340px, 100%); }
.search-box input:focus, .stack-form input:focus, .stack-form select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(39, 179, 255, .14); }
.chip-row { display: flex; gap: 9px; overflow-x: auto; padding: 3px 2px 16px; scroll-snap-type: x proximity; }
.chip { min-height: 42px; padding: 10px 15px; border-radius: 999px; background: var(--surface); color: var(--muted); white-space: nowrap; scroll-snap-align: start; border: 1px solid rgba(255, 255, 255, .06); }
.chip.active { background: var(--accent); color: #06101a; font-weight: 800; }
.poster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: clamp(14px, 2vw, 24px); margin-top: 14px; }
.load-more { display: flex; justify-content: center; margin: 34px 0; }

.live-layout { display: grid; grid-template-columns: minmax(210px, 260px) minmax(0, 1fr); align-items: start; gap: 24px; }
.live-layout > .chip-row {
  position: sticky;
  top: 92px;
  flex-direction: column;
  max-height: calc(100dvh - 116px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: var(--radius);
  background: rgba(17, 23, 38, .86);
  box-shadow: var(--shadow);
  scrollbar-width: thin;
}
.live-layout > .chip-row .chip { width: 100%; border-radius: 12px; white-space: normal; }
.live-content { min-width: 0; }
.live-content .empty-state { margin-top: 0; }
.live-player { margin-bottom: 28px; scroll-margin-top: 92px; }
.live-player .section-heading { align-items: flex-start; }
.live-player .section-heading .ghost-button { flex: 0 0 auto; border: 1px solid rgba(255, 255, 255, .09); }
.epg-guide { margin-top: 18px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .08); border-radius: 16px; background: var(--surface); }
.epg-guide-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.epg-guide-heading .eyebrow { margin-bottom: 3px; }
.epg-guide-heading h3 { margin: 0; font-size: 1.1rem; }
.epg-guide-heading small { color: var(--muted); white-space: nowrap; }
.epg-list { max-height: 300px; overflow-y: auto; scrollbar-width: thin; }
.epg-program { display: grid; grid-template-columns: minmax(128px, auto) minmax(0, 1fr) auto; align-items: start; gap: 16px; padding: 14px 18px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.epg-program:last-child { border-bottom: 0; }
.epg-program.current { background: rgba(39, 179, 255, .09); }
.epg-time { display: flex; gap: 6px; color: var(--accent); font-size: .86rem; font-weight: 800; white-space: nowrap; }
.epg-copy { min-width: 0; }
.epg-copy strong { display: block; }
.epg-copy p { display: -webkit-box; margin: 4px 0 0; overflow: hidden; color: var(--muted); font-size: .88rem; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.epg-now { padding: 4px 7px; border-radius: 999px; background: var(--accent); color: #06101a; font-size: .62rem; font-weight: 900; letter-spacing: .08em; }
.epg-empty { margin: 0; padding: 22px 18px; color: var(--muted); text-align: center; }
.channel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-top: 0; }
.channel-card { position: relative; display: grid; grid-template-columns: 64px 1fr; min-height: 92px; align-items: center; gap: 13px; padding: 13px; border-radius: 16px; background: var(--surface); border: 1px solid rgba(255, 255, 255, .07); }
.channel-card:hover { border-color: rgba(39, 179, 255, .48); background: var(--surface-2); }
.channel-card.active { border-color: var(--accent); background: rgba(39, 179, 255, .1); box-shadow: 0 0 0 1px rgba(39, 179, 255, .2); }
.channel-logo { display: grid; width: 64px; height: 64px; place-items: center; overflow: hidden; border-radius: 14px; background: #fff; color: #111; }
.channel-logo img { width: 100%; height: 100%; object-fit: contain; }
.live-badge { position: absolute; right: 9px; bottom: 7px; color: #ff7588; font-size: .62rem; font-weight: 900; letter-spacing: .08em; }

.empty-state { grid-column: 1 / -1; margin: 50px auto; max-width: 620px; padding: 42px 24px; text-align: center; border-radius: var(--radius); background: var(--surface); }
.empty-state p { color: var(--muted); }
.detail-actions { margin: 4px 0 18px; }
.back-button { display: inline-flex; align-items: center; border: 1px solid rgba(255, 255, 255, .09); }
.detail-layout { display: grid; grid-template-columns: minmax(220px, 340px) 1fr; align-items: center; gap: clamp(28px, 6vw, 80px); min-height: 70dvh; padding: clamp(10px, 4vw, 56px); }
.detail-poster { display: grid; aspect-ratio: 2 / 3; place-items: center; overflow: hidden; border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.detail-poster img { width: 100%; height: 100%; object-fit: cover; }
.detail-copy { max-width: 780px; }
.detail-copy > p:not(.eyebrow) { color: #c0cad9; font-size: 1.05rem; }
.metadata { display: flex; flex-wrap: wrap; gap: 14px; margin: 18px 0; color: var(--muted); }
.series-heading { display: grid; grid-template-columns: 160px 1fr; align-items: center; gap: 28px; margin-bottom: 30px; }
.series-heading img { width: 160px; aspect-ratio: 2/3; object-fit: cover; border-radius: var(--radius); }
.series-heading p { color: var(--muted); }
.episode-list { display: grid; gap: 8px; }
.episode-list a { display: grid; grid-template-columns: 44px 1fr 24px; min-height: 66px; align-items: center; gap: 12px; padding: 10px 15px; border-radius: 14px; background: var(--surface); }
.episode-list a:hover { background: var(--surface-2); }
.episode-list small { display: block; color: var(--muted); }
.episode-number { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; background: var(--surface-2); }

.player-shell { width: min(1180px, 100%); margin: 0 auto; }
.player-shell h1 { font-size: clamp(1.35rem, 3vw, 2.2rem); }
.video-frame { overflow: hidden; aspect-ratio: 16 / 9; border-radius: 18px; background: #000; box-shadow: var(--shadow); }
.video-frame video { width: 100%; height: 100%; background: #000; object-fit: contain; }
.player-message { color: var(--muted); text-align: center; }

.account-card { width: min(620px, 100%); margin: 7vh auto; padding: clamp(24px, 5vw, 48px); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.account-card dl { margin: 26px 0; }
.account-card dl div { display: grid; grid-template-columns: 100px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.account-card dt { color: var(--muted); }
.account-card dd { margin: 0; overflow-wrap: anywhere; }
.account-notice { margin: -8px 0 22px; color: var(--muted); font-size: .9rem; }

.admin-page .page-shell { width: min(1180px, 100%); }
.admin-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 12px 0 24px; }
.admin-header h1 { font-size: clamp(2rem, 5vw, 3.8rem); }
.admin-toolbar { position: sticky; z-index: 40; top: 0; display: flex; align-items: center; gap: 8px; margin-bottom: 24px; padding: 9px; border: 1px solid rgba(255, 255, 255, .09); border-radius: 16px; background: rgba(17, 23, 38, .94); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.admin-toolbar a, .admin-toolbar button { display: inline-flex; min-height: 42px; align-items: center; padding: 9px 14px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 700; }
.admin-toolbar a.active { background: var(--accent); color: #06101a; }
.admin-toolbar form { margin-left: auto; }
.admin-toolbar button:hover, .admin-toolbar button:focus-visible { background: rgba(255, 255, 255, .07); color: var(--text); outline: none; }
.admin-panel { padding: clamp(22px, 4vw, 42px); border: 1px solid rgba(255, 255, 255, .08); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); scroll-margin-top: 84px; }
.admin-panel + .admin-panel { margin-top: 24px; }
.admin-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; scroll-margin-top: 84px; }
.admin-stats article { display: grid; gap: 8px; min-height: 116px; align-content: space-between; padding: 19px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 18px; background: var(--surface); }
.admin-stats span { color: var(--muted); font-size: .85rem; font-weight: 700; }
.admin-stats strong { overflow-wrap: anywhere; font-size: 1.75rem; }
.admin-stats strong.admin-date { font-size: .95rem; }
.admin-stats small { color: var(--muted); font-size: .9rem; }
.admin-panel-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.admin-panel-heading > p { max-width: 480px; margin: 0; color: var(--muted); text-align: right; }
.admin-panel code { color: #c8eaff; }
.admin-form { display: grid; gap: 10px; }
.admin-form > label, .admin-form fieldset label { margin-top: 8px; color: #cbd4e3; font-size: .9rem; font-weight: 700; }
.admin-form input, .admin-form textarea, .admin-form select { width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 13px; outline: none; background: #0d1322; color: var(--text); resize: vertical; }
.admin-form input:focus, .admin-form textarea:focus, .admin-form select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(39, 179, 255, .14); }
.admin-button-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 10px 0; }
.admin-button-fields fieldset { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 18px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 16px; }
.admin-button-fields legend { padding: 0 7px; font-weight: 800; }
.admin-form > .primary-button { justify-self: start; margin-top: 10px; }
.admin-heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.admin-heading-actions button, #refresh-users { cursor: pointer; }
.admin-global-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 12px; }
.admin-global-settings > div { display: grid; gap: 8px; }
.admin-global-settings label { color: #cbd4e3; font-size: .9rem; font-weight: 700; }
.admin-server-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 10px 0; }
.admin-server-card { display: grid; min-width: 0; gap: 8px; margin: 0; padding: 18px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 16px; background: rgba(8, 11, 20, .32); }
.admin-server-card legend { padding: 0 7px; font-weight: 800; }
.server-test-row { display: flex; min-height: 44px; align-items: center; gap: 12px; margin-top: 5px; }
.server-test-row .ghost-button { flex: 0 0 auto; border: 1px solid rgba(255, 255, 255, .09); }
.server-test-row output { font-size: .82rem; font-weight: 700; }
.test-ok { color: #79e8b2; }.test-error { color: #ff9aa8; }.test-muted { color: var(--muted); }
.json-panel { margin-top: 24px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .08); border-radius: 16px; background: #080b14; }
.json-panel[hidden] { display: none; }
.json-panel > div { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.json-panel pre { max-height: 420px; margin: 0; overflow: auto; padding: 18px; color: #94ddff; font-size: .86rem; white-space: pre-wrap; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 13px 14px; border-bottom: 1px solid rgba(255, 255, 255, .07); text-align: left; }
.admin-table th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.admin-table td { overflow-wrap: anywhere; }
.admin-empty { padding: 20px !important; color: var(--muted); text-align: center !important; }
.backup-list { display: grid; gap: 9px; }
.backup-list article { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px; border: 1px solid rgba(255, 255, 255, .07); border-radius: 14px; background: rgba(8, 11, 20, .32); }
.backup-list strong, .backup-list small { display: block; overflow-wrap: anywhere; }
.backup-list small { margin-top: 3px; color: var(--muted); }
.backup-list form { flex: 0 0 auto; }
.admin-security-form { max-width: 620px; }
.admin-brand-form { max-width: 720px; }
.brand-preview { display: inline-flex; width: fit-content; min-height: 58px; align-items: center; gap: 12px; margin-bottom: 8px; padding: 10px 16px; border: 1px solid rgba(255, 255, 255, .09); border-radius: 16px; background: #0d1322; font-size: 1.05rem; font-weight: 800; }
.brand-preview .brand-mark { flex: 0 0 auto; }
.admin-field-help { margin-top: -3px; color: var(--muted); font-size: .8rem; }
.success-message { margin: 0 0 20px; padding: 12px 14px; border: 1px solid rgba(62, 220, 151, .35); border-radius: 12px; background: rgba(62, 220, 151, .1); color: #baf5d8; }
.admin-return-link { display: inline-block; margin-top: 22px; color: var(--accent); font-weight: 700; }

.login-page { display: grid; place-items: center; padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom)); }
.login-page .page-shell { display: grid; min-height: calc(100dvh - 36px); place-items: center; padding: 0; }
.login-card { width: min(440px, 100%); padding: clamp(25px, 7vw, 48px); border: 1px solid rgba(255, 255, 255, .09); border-radius: 24px; background: rgba(17, 23, 38, .94); box-shadow: var(--shadow); }
.login-brand { margin-bottom: 28px; }
.login-card h1 { font-size: 2.5rem; }
.stack-form { display: grid; gap: 9px; margin-top: 24px; }
.stack-form label { margin-top: 5px; color: #cbd4e3; font-size: .9rem; font-weight: 700; }
.stack-form .primary-button { margin-top: 12px; }
.stack-form button:disabled { cursor: wait; opacity: .65; }
.catalog-search { display: flex; gap: 10px; align-items: center; }
.catalog-search .search-box { min-width: 0; flex: 1; }
.catalog-search .secondary-button { cursor: pointer; }
.catalog-status { min-height: 1.5em; margin: 0 0 8px; color: var(--muted); }
.catalog-count { color: var(--muted); margin: 12px 0 20px; }
.catalog-pagination { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; align-items: center; margin: 30px 0; }
[data-catalog-results][aria-busy="true"] { opacity: .65; }
.alert { margin-top: 20px; padding: 12px 14px; border: 1px solid rgba(255, 93, 113, .35); border-radius: 12px; background: rgba(255, 93, 113, .1); color: #ffc3cb; }

@media (max-width: 760px) {
  .topbar { position: relative; min-height: 58px; padding: 10px 16px; }
  .topbar .brand { flex: 1; }
  .topbar > form, .desktop-nav { display: none; }
  .brand-mark { width: 36px; height: 36px; }
  .page-shell { min-height: calc(100dvh - 58px); padding: 18px 14px calc(88px + env(safe-area-inset-bottom)); }
  .mobile-nav {
    position: fixed;
    z-index: 100;
    right: 10px;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 10px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    min-height: 66px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 20px;
    background: rgba(15, 20, 34, .92);
    box-shadow: 0 14px 35px rgba(0, 0, 0, .48);
    backdrop-filter: blur(18px);
  }
  .mobile-nav a { display: grid; min-width: 0; min-height: 54px; place-items: center; align-content: center; gap: 1px; border-radius: 14px; color: var(--muted); }
  .mobile-nav a:active { background: var(--surface-2); color: var(--text); }
  .mobile-nav span { font-size: 1.1rem; }
  .mobile-nav small { max-width: 100%; overflow: hidden; font-size: .65rem; text-overflow: ellipsis; white-space: nowrap; }
  .hero { min-height: 54dvh; padding: 26px 20px; border-radius: 22px; background: linear-gradient(0deg, rgba(8,11,20,.96), rgba(8,11,20,.32)), radial-gradient(circle at 70% 20%, #236da6, transparent 18rem), #131c35; }
  .hero h1 { font-size: clamp(2.1rem, 10vw, 3.4rem); }
  .button-row > * { flex: 1 1 150px; }
  .content-section { margin-top: 30px; }
  .poster-rail { grid-auto-columns: 138px; gap: 12px; }
  .poster-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
  .quick-grid { grid-template-columns: 1fr; gap: 10px; }
  .quick-grid a { min-height: 118px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; }
  .live-layout { display: block; }
  .live-layout > .chip-row {
    position: static;
    flex-direction: row;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 3px 2px 16px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .live-layout > .chip-row .chip { width: auto; border-radius: 999px; white-space: nowrap; }
  .live-player { scroll-margin-top: 18px; }
  .live-player .section-heading { align-items: stretch; flex-direction: column; }
  .live-player .section-heading .ghost-button { align-self: flex-start; }
  .epg-guide-heading { align-items: flex-start; }
  .epg-program { grid-template-columns: 1fr auto; gap: 8px 12px; padding: 13px 14px; }
  .epg-time { grid-column: 1 / -1; }
  .channel-grid { grid-template-columns: 1fr; }
  .detail-layout { grid-template-columns: 1fr; align-items: start; gap: 24px; min-height: 0; padding: 4px; }
  .detail-poster { width: min(230px, 64vw); margin: 0 auto; }
  .detail-copy h1 { font-size: clamp(2rem, 10vw, 3.2rem); }
  .series-heading { grid-template-columns: 90px 1fr; gap: 16px; align-items: start; }
  .series-heading img { width: 90px; border-radius: 12px; }
  .series-heading h1 { font-size: 1.65rem; }
  .series-heading p { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
  .video-frame { margin: 0 -14px; border-radius: 0; }
  .account-card { margin: 2vh auto; }
  .admin-header, .admin-panel-heading { align-items: stretch; flex-direction: column; }
  .admin-panel-heading > p { text-align: left; }
  .admin-toolbar { overflow-x: auto; }
  .admin-toolbar a, .admin-toolbar button { white-space: nowrap; }
  .admin-button-fields { grid-template-columns: 1fr; }
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-server-grid, .admin-global-settings { grid-template-columns: 1fr; }
  .admin-heading-actions { justify-content: flex-start; }
  .admin-table { min-width: 680px; }
}

@media (max-width: 430px) {
  .admin-stats { grid-template-columns: 1fr; }
  .backup-list article { align-items: stretch; flex-direction: column; }
}

@media (max-width: 360px) {
  .poster-grid { gap: 13px 9px; }
  .poster-card strong { font-size: .9rem; }
  .mobile-nav { right: 5px; left: 5px; }
  .mobile-nav small { font-size: .59rem; }
}

@media (hover: none) {
  .poster-card:hover .poster-frame, .primary-button:hover, .secondary-button:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
