/* kanasastream — dark, RTL-first streaming layout.
   Arabic text sets the direction; Latin titles sit inside it, so every
   flex row that mixes the two is laid out logically (start/end), never
   left/right. */

:root {
  --bg: #0b0d12;
  --bg-raised: #141821;
  --bg-hover: #1b2130;
  --line: #232a38;
  --text: #eef1f7;
  --text-dim: #98a1b3;
  --text-faint: #6b7488;
  --accent: #ff3d57;
  --accent-soft: rgba(255, 61, 87, 0.14);
  --gold: #f5c518;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --header-h: 116px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: "Segoe UI", "Noto Kufi Arabic", "Noto Sans Arabic", Tahoma, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--header-h);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- header ---------- */

.site-header {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: 50;
  background: rgba(11, 13, 18, 0.92);
  backdrop-filter: blur(14px);
  border-block-end: 1px solid var(--line);
}

.header-top {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 20px;
  max-width: 1500px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.4px;
  white-space: nowrap;
}

/* logo.png is 2x its display size so it stays sharp on phone screens. */
.brand-logo { display: block; height: 44px; width: auto; }

@media (max-width: 600px) {
  .brand-logo { height: 34px; }
}

.search {
  flex: 1;
  display: flex;
  gap: 8px;
  max-width: 620px;
  margin-inline: auto;
}

.search input {
  flex: 1;
  min-width: 0;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.search input::placeholder { color: var(--text-faint); }

.search input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-hover);
}

.search button {
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  color: #fff;
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: filter 0.15s;
}

.search button:hover { filter: brightness(1.1); }

.chips {
  display: flex;
  gap: 8px;
  padding: 0 20px 12px;
  max-width: 1500px;
  margin: 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s;
}

.chip:hover { background: var(--bg-hover); color: var(--text); }

.chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #ff8a99;
}

/* ---------- page ---------- */

.page {
  max-width: 1500px;
  margin: 0 auto;
  padding: 26px 20px 70px;
}

.section-head { margin-bottom: 22px; }

.section-head h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.section-head p {
  margin: 0;
  color: var(--text-dim);
  font-size: 15px;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-faint);
}

.source-pill {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
}

.source-pill.failed { color: #ff8a99; border-color: rgba(255, 61, 87, 0.4); }

/* ---------- poster grid ---------- */

.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 20px 16px;
}

.poster-card { position: relative; }

.poster-card > a { display: block; }

.poster-frame {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-raised);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.poster-card:hover .poster-frame {
  transform: translateY(-5px);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.6);
}

.poster-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster-frame::after {
  content: "";
  position: absolute;
  inset-block-end: 0;
  inset-inline: 0;
  height: 55%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
  opacity: 0;
  transition: opacity 0.18s;
}

.poster-card:hover .poster-frame::after { opacity: 1; }

.poster-placeholder {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  font-size: 44px;
  font-weight: 800;
  color: var(--text-faint);
  background: linear-gradient(140deg, #1b2130, #0f131b);
}

.poster-frame.broken .poster-placeholder { display: grid; }

.play-badge {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.18s;
  z-index: 2;
}

.poster-card:hover .play-badge { opacity: 1; }

.play-badge span {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 61, 87, 0.94);
  display: grid;
  place-items: center;
  font-size: 19px;
  color: #fff;
  padding-inline-start: 3px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.kind-tag {
  position: absolute;
  inset-block-start: 9px;
  inset-inline-start: 9px;
  z-index: 3;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(11, 13, 18, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  backdrop-filter: blur(4px);
}

.kind-tag.movie { color: #7fd4ff; }
.kind-tag.series { color: #ffc46b; }
.kind-tag.anime { color: #d3a2ff; }

.source-count {
  position: absolute;
  inset-block-start: 9px;
  inset-inline-end: 9px;
  z-index: 3;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(245, 197, 24, 0.9);
  color: #1a1400;
}

.site-tags {
  position: absolute;
  inset-block-end: 9px;
  inset-inline-start: 9px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: calc(100% - 18px);
}

.site-tag {
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.5;
  background: rgba(11, 13, 18, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text);
  backdrop-filter: blur(4px);
  white-space: nowrap;
}

.site-tag.site-topcinema,
.site-filter-chip.site-topcinema { border-color: rgba(255, 61, 87, 0.7); color: #ff8a99; }
.site-tag.site-3shq,
.site-filter-chip.site-3shq { border-color: rgba(255, 120, 200, 0.7); color: #ff9ad5; }

.poster-copy { padding: 10px 2px 0; }

.poster-copy h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.show-summary {
  margin: 6px 0 0;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.35;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 7px;
}

.badge.year { color: var(--gold); border-color: rgba(245, 197, 24, 0.3); }
.badge.final { color: #ff8a99; border-color: rgba(255, 61, 87, 0.35); }

.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 16px;
}

.more-row { display: flex; justify-content: center; margin-top: 34px; }

.more-button {
  padding: 11px 30px;
  border-radius: 999px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 15px;
  transition: all 0.15s;
}

.more-button:hover { background: var(--bg-hover); border-color: var(--accent); }

/* ---------- show ---------- */

.show-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.show-poster {
  width: 160px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  flex: 0 0 auto;
}

.show-meta { min-width: 0; }

.show-meta h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.25;
}

.show-meta p {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
}

.season-disclosures {
  display: grid;
  gap: 12px;
}

.season-block {
  border-block-end: 1px solid var(--line);
  padding-block-end: 12px;
}

.season-header {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.episode-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-block: 8px 4px;
}

.episode-chip {
  min-width: 42px;
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--text);
  font-weight: 800;
}

.episode-chip:hover,
.episode-chip:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.season-fallback-link {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-dim);
}

.episode-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-block-start: 1px solid var(--line);
}

.episode-row { border-block-end: 1px solid var(--line); }

.episode-row a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 10px 4px;
}

.episode-row a:hover { background: var(--bg-raised); }

.episode-number {
  width: 34px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  flex: 0 0 auto;
}

.episode-copy {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.episode-title {
  color: var(--text-dim);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.episode-season {
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  flex: 0 0 auto;
}

.episode-final {
  color: #ff8a99;
  border: 1px solid rgba(255, 61, 87, 0.35);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 700;
}

/* ---------- watch ---------- */

.watch-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.watch-poster {
  width: 120px;
  aspect-ratio: 2 / 3;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-raised);
  box-shadow: var(--shadow);
}

.watch-meta { flex: 1; min-width: 0; }

.watch-meta h1 {
  margin: 0 0 6px;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.25;
}

.watch-raw {
  margin: 0;
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.5;
}

.player-shell {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  box-shadow: var(--shadow);
  max-width: 900px;
  margin: 0 auto 22px;
  margin-inline: auto;
}

.player-shell video,
.player-shell iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* The display:block above beats the UA's [hidden] rule, so without this the
   fallback iframe sat below a still-"visible" video, clipped out of sight. */
.player-shell > [hidden] { display: none; }

.server-head {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.server-head h2 { margin: 0; font-size: 17px; font-weight: 700; }

/* The rows are built by watch.html's script; the CSS follows its markup. */

.server-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}

.server-row {
  display: flex;
  align-items: stretch;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  transition: all 0.15s;
}

.server-row:hover { background: var(--bg-hover); border-color: #33405a; }

.server-row button {
  padding: 9px 16px;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.server-row button:hover:not(:disabled) { color: var(--text); }
.server-row button:disabled { opacity: 0.45; cursor: default; }

.server-row button.active {
  background: var(--accent-soft);
  color: #ff8a99;
}

.watch-status .spinner,
.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
  margin-inline-end: 6px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.fallback-panel {
  padding: 16px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.6;
}

.notice {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 18px;
}

.notice.warn {
  border-color: rgba(245, 197, 24, 0.35);
  color: #f0d68a;
}

.back-link {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
}

.back-link:hover { color: var(--text); }

/* ---------- responsive ---------- */

@media (max-width: 760px) {
  :root { --header-h: 148px; }

  .header-top { flex-wrap: wrap; gap: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .poster-grid,
  .mixed-listing { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 16px 12px; }
  .poster-copy h2 { font-size: 13px; }
  .section-head h1 { font-size: 21px; }
  .show-meta h1 { font-size: 21px; }
  .show-poster { width: 112px; }
  .watch-poster { width: 64px; }
  .watch-meta h1 { font-size: 18px; }
}

.source-block { margin-bottom: 26px; }
.source-block .server-list { margin-bottom: 0; }

.mixed-listing {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 20px 16px;
}

.subcategory-chips,
.site-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 22px;
}

.subcategory-chip,
.site-filter-chip {
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
}

.subcategory-chip.active,
.site-filter-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #ff8a99;
}

.hub-link-row {
  grid-column: 1 / -1;
}

.hub-link-row > a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text);
}

.hub-link-row > a:hover {
  background: var(--bg-hover);
}

.hub-link-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: #ff8a99;
  font-size: 22px;
  line-height: 1;
}

.hub-link-copy {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.hub-link-title {
  font-weight: 700;
}

.hub-link-host {
  color: var(--text-faint);
  font-size: 13px;
}

.mixed-episode-list {
  grid-column: 1 / -1;
  margin: 0;
}

.chip.disabled {
  opacity: 0.42;
  cursor: default;
}

.site-browse {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 20px 12px;
  max-width: 1500px;
  margin: -4px auto 0;
  color: var(--text-dim);
  font-size: 13px;
}

.site-browse-label,
.site-browse-site {
  color: var(--text-faint);
}

.site-browse-link {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
}

.watch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.watch-now,
.watch-series-link {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.watch-now {
  background: var(--accent);
  color: #fff;
}

.watch-series-link {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--text);
}

.watch-navigator {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

/* --- download panel ------------------------------------------------------ */

.watch-download {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  background: var(--bg-raised);
  color: var(--text);
}

.download-panel {
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: var(--bg-raised);
}

.download-panel h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.download-rows {
  display: grid;
  gap: 6px;
}

.download-row {
  display: grid;
  grid-template-columns: minmax(120px, 2fr) repeat(5, minmax(64px, 1fr)) minmax(200px, auto);
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 0.9rem;
}

/* A server that fails to resolve stays listed and greyed: 23 of 34 fail, and
   hiding them would misrepresent how many servers exist. */
.download-row.unavailable {
  opacity: 0.55;
}

/* A whole file and a playlist are opposite outcomes for a download, so they
   must not look alike: the row that hands over one self-contained file is the
   one the panel lists first. */
.download-row.whole-file {
  border-inline-start: 3px solid var(--accent);
}

.download-row.playlist {
  border-inline-start: 3px solid var(--line);
}

.download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.download-btn {
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.download-btn.direct {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}

@media (max-width: 720px) {
  .download-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------- player controls (web/static/player.js) ----------
   Laid out LTR like every video player; the page around it stays RTL. */

.kp { direction: ltr; outline: none; }
.kp:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.kp video { cursor: pointer; }

.kp-big-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 76px;
  height: 76px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 30px;
  cursor: pointer;
  box-shadow: var(--shadow);
  z-index: 3;
}
.kp.kp-started .kp-big-play { display: none; }

.kp-bar {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: 26px 12px 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  transition: opacity 0.25s;
  z-index: 2;
}
.kp.kp-idle { cursor: none; }
.kp.kp-idle .kp-bar { opacity: 0; pointer-events: none; }

.kp-seek {
  position: relative;
  height: 6px;
  margin-bottom: 8px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.18);
}
.kp-buffered,
.kp-played {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  border-radius: 3px;
}
.kp-buffered { background: rgba(255, 255, 255, 0.45); }
.kp-played { background: var(--accent); }
.kp-seek-input {
  position: absolute;
  left: 0;
  top: -7px;
  width: 100%;
  height: 20px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.kp-row { display: flex; align-items: center; gap: 10px; color: #fff; }
.kp-row button {
  min-width: 32px;
  padding: 4px 6px;
  border: 0;
  background: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}
.kp-row button svg { display: block; }
.kp-time { font-size: 13px; font-variant-numeric: tabular-nums; }
.kp-volume { width: 80px; accent-color: var(--accent); }
.kp-spacer { flex: 1; }

.kp-menu {
  position: absolute;
  right: 12px;
  bottom: 64px;
  min-width: 200px;
  max-height: 70%;
  overflow: auto;
  padding: 6px 0;
  direction: rtl;
  background: rgba(20, 24, 33, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  z-index: 4;
}
.kp-menu-title { padding: 6px 14px; font-size: 12px; color: var(--text-faint); }
.kp-menu-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: start;
  cursor: pointer;
}
.kp-menu-item:hover { background: var(--bg-hover); }
.kp-menu-item.current { color: var(--accent); font-weight: 700; }
.kp-menu-item.current::before { content: "✓ "; }
.kp-menu-note { padding: 8px 14px; font-size: 13px; color: var(--text-dim); }

.kp.kp-off .kp-bar,
.kp.kp-off .kp-big-play,
.kp.kp-off .kp-menu { display: none; }

.kp:fullscreen { max-width: none; border-radius: 0; }

@media (max-width: 600px) {
  .kp-volume { display: none; }
}
/* ---------- watch page: servers | player | episodes ----------
   The page is RTL, so the first grid column (servers) sits on the right. */

.watch-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.watch-bar .watch-meta { flex: 1; min-width: 200px; }
.watch-bar .watch-meta h1 { margin: 0 0 4px; font-size: 19px; }

.watch-grid {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.watch-grid.has-episodes { grid-template-columns: 200px minmax(0, 1fr) 280px; }

.watch-servers .server-head h2 {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  text-align: center;
}
.watch-servers .server-list {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 8px;
  max-height: calc(100vh - 220px);
  overflow: auto;
  margin: 0;
}
.watch-servers .server-row button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: start;
}
.server-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--line);
  color: #fff;
  font-size: 10px;
}
.watch-servers .server-row button.active { background: var(--accent); color: #fff; }
.server-row.failed { opacity: 0.45; }

.watch-main .player-shell { max-width: none; margin: 0 0 12px; }

.episode-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
}
.episode-nav a,
.episode-nav span {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  font-weight: 600;
  text-align: center;
}
.episode-nav a:hover { background: var(--bg-hover); }
.episode-nav .current { background: var(--accent-soft); color: #ff8a99; }
.episode-nav .disabled { opacity: 0.4; }

.watch-navigator.watch-episodes {
  margin-top: 0;
  padding: 10px;
  border-top: 0;
  border-radius: var(--radius);
  background: var(--bg-raised);
}
.season-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.season-tab {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.season-tab[aria-selected="true"] { background: var(--accent); border-color: transparent; color: #fff; }
.watch-episode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  max-height: calc(100vh - 260px);
  overflow: auto;
}
.watch-episode-grid[hidden] { display: none; }
.watch-episode-grid .episode-chip { padding: 9px 12px; text-align: start; }
.episode-chip.active { background: var(--accent); color: #fff; }

@media (max-width: 999px) {
  .watch-grid,
  .watch-grid.has-episodes { grid-template-columns: minmax(0, 1fr); }
  .watch-main { order: -1; }
  .watch-servers .server-list { flex-direction: row; flex-wrap: wrap; max-height: none; }
  .watch-servers .server-row button { width: auto; }
  .watch-episode-grid { max-height: 50vh; }
}

/* ---------- accounts ---------- */

.account-card {
  max-width: 440px;
  margin: 24px auto;
  padding: 24px 22px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.account-card.account-wide { max-width: 760px; }
.account-card h1 { margin: 0 0 18px; font-size: 22px; }
.account-who { color: var(--text-dim); margin: 0 0 18px; overflow-wrap: anywhere; }

.account-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-block: 14px;
  border-block-start: 1px solid var(--line);
}

.account-card > .account-form:first-of-type { border-block-start: 0; padding-block-start: 0; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-dim);
  font-size: 14px;
}

.field input {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  width: 100%;
}

.field input:focus { outline: none; border-color: var(--accent); }
.field-note { margin: 0; color: var(--text-dim); font-size: 14px; }

.btn {
  display: inline-block;
  align-self: flex-start;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: #fff;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.btn:hover { filter: brightness(1.1); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--bg-hover); filter: none; }
.btn-danger { background: transparent; border-color: var(--accent); color: var(--accent); }

.form-error,
.form-ok {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin: 0 0 14px;
}

.form-error { background: var(--accent-soft); color: #ffb3bf; }
.form-ok { background: rgba(80, 200, 120, 0.12); color: #a8e6bd; }

.account-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin: 16px 0 0;
  font-size: 14px;
  color: var(--text-dim);
}

.account-links a:hover { color: var(--text); }

/* off-screen, not display:none, so simple bots still fill it */
.honeypot { position: absolute; inset-inline-start: -10000px; width: 1px; height: 1px; overflow: hidden; }

.danger-zone .field { color: #ffb3bf; }

.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th,
.admin-table td { padding: 8px 6px; border-block-end: 1px solid var(--line); text-align: start; white-space: nowrap; }
.admin-table th { color: var(--text-dim); font-weight: 600; }
.admin-table tr.is-disabled td { color: var(--text-faint); }
.admin-actions { display: flex; gap: 6px; }
.admin-actions .btn { padding: 5px 12px; font-size: 12px; }

@media (max-width: 600px) {
  .account-card { margin: 12px 0; padding: 18px 16px; }
}

.account-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  white-space: nowrap;
}

.account-link {
  color: var(--text-dim);
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.account-link:hover { color: var(--text); }
.logout-form { margin: 0; }
.notification-menu { position: relative; }
.bell {
  position: relative;
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}
.bell-count {
  position: absolute;
  inset-block-start: -6px;
  inset-inline-end: -10px;
  min-width: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.notification-panel {
  position: absolute;
  z-index: 30;
  inset-block-start: calc(100% + 10px);
  inset-inline-end: 0;
  width: min(360px, calc(100vw - 24px));
  max-height: min(420px, 70vh);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  box-shadow: var(--shadow);
}
.notification-panel[hidden] { display: none; }
.notification-item, .notification-empty {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  white-space: normal;
}
.notification-item:hover { background: var(--bg-hover); }
.notification-empty { color: var(--text-dim); }

@media (max-width: 760px) {
  .account-nav { order: 2; margin-inline-start: auto; gap: 10px; font-size: 13px; }
  .notification-panel { position: fixed; inset-inline: 12px; inset-block-start: 68px; width: auto; }
}

/* --- library: favourite / watch-later controls and the /library page ------------ */

.lib-controls { display: flex; gap: 6px; }
.lib-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(11, 13, 18, 0.78);
  color: var(--text-dim);
  font: inherit;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;  /* a visitor gets these controls as login links */
  backdrop-filter: blur(6px);
}
.lib-btn:hover, .lib-btn:focus-visible { color: var(--text); border-color: var(--text-faint); }
.lib-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.lib-btn.lib-later.active { color: var(--gold); border-color: var(--gold); background: rgba(245, 197, 24, 0.14); }
.lib-label { font-size: 13px; }

/* on a poster the controls sit over the top corner and appear on hover/focus */
.poster-card > .lib-controls {
  position: absolute;
  inset-block-start: 8px;
  inset-inline-start: 8px;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.poster-card:hover > .lib-controls,
.poster-card:focus-within > .lib-controls,
.poster-card > .lib-controls:has(.active) { opacity: 1; }

/* no hover on touch: keep them visible, with a 44px tap target */
@media (hover: none) {
  .poster-card > .lib-controls { opacity: 1; }
  .lib-btn { min-width: 44px; height: 44px; }
}

.show-meta .lib-controls, .watch-actions .lib-controls { margin-block: 10px; }
.watch-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.watch-actions .lib-controls { margin: 0; }
.watch-actions .lib-btn { min-height: 44px; }

.library-title { margin: 0 0 12px; font-size: 22px; }
.library-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.library-tab {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-dim);
  background: var(--bg-raised);
}
.library-tab:hover { color: var(--text); background: var(--bg-hover); }
.library-tab.active { color: #fff; background: var(--accent); border-color: var(--accent); }

.history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.history-row { display: flex; gap: 8px; align-items: stretch; }
.history-row a {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
}
.history-row a:hover { background: var(--bg-hover); }
.history-title { font-weight: 600; }
.history-series, .history-progress { color: var(--text-dim); font-size: 13px; }
.history-progress { margin-inline-start: auto; }

.kanasa-toast {
  position: fixed;
  inset-block-end: 24px;
  inset-inline: 16px;
  margin-inline: auto;
  width: fit-content;
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1px solid var(--accent);
  box-shadow: var(--shadow);
  z-index: 100;
}

/* --- progress: resume bar, continue row, episode marks, history ------------------ */
.resume-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  margin-bottom: 10px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-raised);
}
.resume-text { flex: 1 1 140px; font-weight: 700; }
.resume-bar button, .history-delete, .history-clear button {
  min-height: 44px; padding: 0 16px; font: inherit; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; color: var(--text); background: var(--bg-hover);
}
.resume-bar .resume-go { background: var(--accent); border-color: var(--accent); color: #fff; }
.resume-bar[hidden], .next-offer[hidden] { display: none; }
.next-offer { margin-top: 10px; }
.next-offer-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; font-weight: 800;
  border-radius: 999px; background: var(--accent); color: #fff;
}

.continue-row { margin-bottom: 22px; }
.continue-head { margin: 0 0 10px; font-size: 18px; }
.continue-scroller { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; }
.continue-card { flex: 0 0 150px; display: grid; gap: 4px; scroll-snap-align: start; }
.continue-poster {
  position: relative; display: block; aspect-ratio: 2 / 3; overflow: hidden;
  border-radius: var(--radius-sm); background: var(--bg-raised); border: 1px solid var(--line);
}
.continue-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.continue-bar { position: absolute; inset-inline: 0; inset-block-end: 0; height: 5px; background: rgba(0, 0, 0, 0.6); }
.continue-fill { display: block; height: 100%; background: var(--accent); }
.continue-title { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.continue-sub { color: var(--text-dim); font-size: 12px; }

.episode-chip { position: relative; overflow: hidden; }
.episode-chip.watched { color: var(--text-dim); }
.episode-check { margin-inline-start: 6px; color: var(--gold); font-size: 12px; }
.episode-progress { position: absolute; inset-inline-start: 0; inset-block-end: 0; height: 3px; background: var(--accent); }

.history-delete { padding: 0 14px; color: var(--text-dim); }
.history-clear { margin-top: 16px; }
