:root {
  color-scheme: dark;
  font-family: Arial, Helvetica, sans-serif;
  background: #0b0c10;
  color: #f5f5f7;
  --surface: #17191f;
  --surface-raised: #20232b;
  --muted: #a1a5b0;
  --accent: #d8203b;
  --accent-dark: #8f1024;
  --focus: #fff;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-width: 800px;
  min-height: 100%;
  margin: 0;
  background: #0b0c10;
}

body {
  font-size: 18px;
  font-size: clamp(15px, 1.2vw, 19px);
  overflow: hidden;
}

button, input { font: inherit; }
button { color: inherit; }

#app {
  width: 100vw;
  height: 100vh;
  min-height: 600px;
  padding: 26px 4vw 22px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 18% -18%, rgba(42, 46, 58, .36), transparent 44%),
    #0b0c10;
}

.topbar {
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  font-size: 34px;
  font-size: clamp(25px, 3vw, 38px);
  font-weight: 800;
  letter-spacing: -.04em;
}

.brand > * { margin-right: 15px; }
.brand > *:last-child { margin-right: 0; }

.brand-mark {
  width: 43px;
  height: 43px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid var(--accent);
  border-radius: 50%;
  color: #fff;
  font-size: 22px;
  line-height: 1;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .02em;
}
.brand-logo {
  width: 112px;
  height: 82px;
  display: block;
  object-fit: contain;
}

.server-status {
  display: flex;
  align-items: center;
  color: #8ee3aa;
  font-size: 15px;
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
}

.msx-back {
  min-height: 42px;
  margin-left: 18px;
  padding: 0 14px;
  border: 1px solid #343844;
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
}

.msx-back:hover, .msx-back:focus {
  border-color: #fff;
  background: var(--accent);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #50d276;
  box-shadow: 0 0 12px rgba(80, 210, 118, .55);
  margin-right: 9px;
}

.home-main {
  max-width: 1420px;
  margin: 28px auto 0;
  max-height: calc(100vh - 170px);
  overflow-y: auto;
  padding-bottom: 28px;
}

.home-grid {
  display: flex;
}

.home-card {
  flex: 1 1 0;
  min-width: 0;
  margin-right: 14px;
  height: 215px;
  height: clamp(190px, 28vh, 238px);
  border: 1px solid #252832;
  border-radius: 17px;
  background: linear-gradient(145deg, #1b1d24, #15171d);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

.home-card:last-child { margin-right: 0; }

.home-card:hover, .home-card:focus {
  background: linear-gradient(145deg, #bd1730, #711023);
  border-color: #fff;
  transform: scale(1.015);
}

.home-icon {
  font-size: 56px;
  font-size: clamp(44px, 5vw, 64px);
  line-height: 1;
  margin-bottom: 5px;
}

.home-card strong {
  font-size: 31px;
  font-size: clamp(25px, 3vw, 35px);
}

.home-card small {
  color: #c1c4cc;
  font-size: 15px;
}

.quick-actions {
  margin: 22px auto 0;
  display: flex;
  justify-content: center;
}

.quick-button + .quick-button { margin-left: 14px; }

.quick-button, .action-button {
  min-width: 170px;
  min-height: 58px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}

.quick-button:hover, .quick-button:focus, .action-button:hover, .action-button:focus {
  border-color: #fff;
  background: var(--accent);
}

.home-note {
  margin-top: 18px;
  color: #787d88;
  text-align: center;
  font-size: 14px;
}

.continue-section { margin: 20px 4px 0; }
.continue-section h2 { margin: 0 0 10px; font-size: 20px; }
.continue-row { display: flex; overflow-x: auto; padding: 2px 4px 10px; }
.continue-card {
  flex: 0 0 104px;
  margin: 0 12px 0 0;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.continue-card:hover, .continue-card:focus { border-color: #f21d35; background: #35151d; }
.continue-card:focus { outline: 3px solid #f21d35; outline-offset: 3px; box-shadow: 0 0 14px rgba(242, 29, 53, .55); transform: scale(1.02); }
.continue-poster {
  position: relative;
  width: 100%;
  height: 148px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 6px;
  background: linear-gradient(145deg, #384150, #17202a);
  color: #e8eaf0;
  font-size: 24px;
}
.continue-poster img { width: 100%; height: 100%; object-fit: cover; }
.continue-progress { position: absolute; right: 0; bottom: 0; left: 0; height: 4px; background: rgba(255,255,255,.45); }
.continue-progress > span { display: block; height: 100%; background: #f21d35; }
.continue-title { display: block; margin-top: 6px; overflow: hidden; color: #f5f5f7; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.continue-empty { margin: 0; color: var(--muted); font-size: 15px; }

.screen {
  height: calc(100vh - 140px);
  min-height: 450px;
}

.screen-heading {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 17px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.screen-heading strong { color: #f5f5f7; }

.login-screen { display: flex; flex-direction: column; }

.login-card {
  width: 100%;
  max-width: 620px;
  margin: 28px auto;
  padding: 28px 34px;
  border: 1px solid #292d37;
  border-radius: 14px;
  background: var(--surface);
}

.login-card > p:first-child { margin: 0 0 22px; color: var(--muted); }
.login-card > p:first-child strong { color: #f5f5f7; }
.login-card > label:not(.remember-option) { display: block; margin: 15px 0 7px; color: #d6d8df; }

.login-card input:not([type="checkbox"]) {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid #343844;
  border-radius: 8px;
  background: #0e1015;
  color: #fff;
}

.login-submit { width: 100%; margin-top: 22px; }

.remember-option {
  margin-top: 18px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.remember-option input {
  width: 24px;
  height: 24px;
  margin: 0 12px 0 0;
  accent-color: var(--accent);
}

.login-privacy, .form-message { font-size: 14px; line-height: 1.5; }
.login-privacy { margin: 10px 0 0; color: var(--muted); }
.form-message { margin: 14px 0 0; color: #ff8997; }

.live-layout {
  height: calc(100% - 48px);
  display: flex;
  align-items: stretch;
}

.live-layout > .side-list {
  flex: 0 0 23%;
  min-width: 0;
  min-height: 0;
  margin-right: 14px;
}

.live-layout > .channel-list {
  flex: 0 0 34%;
  min-width: 0;
  min-height: 0;
  margin-right: 14px;
}

.live-layout > .player-column {
  flex: 1 1 0;
  min-height: 0;
}

.side-list, .channel-list, .catalog-grid {
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #383c47 transparent;
}

.search-box {
  width: 100%;
  height: 48px;
  margin-bottom: 10px;
  padding: 0 15px;
  border: 1px solid #2a2e38;
  border-radius: 10px;
  outline: none;
  background: var(--surface);
  color: #fff;
}

.search-box:focus { border-color: #fff; }

.list-item {
  width: 100%;
  min-height: 48px;
  margin-bottom: 7px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.list-item:hover, .list-item:focus, .list-item.selected {
  border-color: var(--accent);
  background: #35151d;
}

.channel-row {
  width: 100%;
  min-height: 58px;
  margin-bottom: 7px;
  padding: 9px 13px;
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.channel-row > * + * { margin-left: 14px; }

.channel-row:hover, .channel-row:focus, .channel-row.selected {
  border-color: var(--accent);
  background: #35151d;
}

.channel-number {
  min-width: 42px;
  color: var(--muted);
  font-size: 14px;
}

.channel-logo {
  position: relative;
  width: 35px;
  height: 35px;
  overflow: hidden;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #313540;
  color: #dedfe4;
  font-size: 12px;
  font-weight: 800;
}
.channel-logo img { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.channel-logo-fallback { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: none; align-items: center; justify-content: center; background: #313540; }

.player-column {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.video-frame {
  width: 100%;
  height: 260px;
  max-height: 44vh;
  border: 1px solid #20232b;
  border-radius: 11px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aeb2bc;
  text-align: center;
}

.stream-video {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  background: #000;
}

.standalone-player .video-frame {
  height: 52vh;
  max-height: 620px;
}

.playback-status {
  min-height: 20px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.playback-status.playback-error { color: #ff8997; }

.video-placeholder {
  max-width: 80%;
  line-height: 1.55;
}

.video-placeholder strong {
  display: block;
  margin-bottom: 8px;
  color: #f4f4f6;
  font-size: 19px;
}

.player-meta { padding-top: 15px; }
.player-meta h2 { margin: 0 0 6px; font-size: 23px; }
.player-meta p { margin: 0; color: var(--muted); font-size: 15px; }
.epg-info { display: flex; flex-direction: column; align-items: flex-start; color: #d7dae2; font-size: 14px; line-height: 1.45; }
.epg-line { display: flex; flex-direction: column; align-items: stretch; width: 100%; margin-top: 8px; }
.epg-line strong { display: inline-block; min-width: 78px; color: #aab8d1; }
.epg-program-time { color: #aeb1ba; font-size: .85em; letter-spacing: .04em; text-transform: uppercase; }
.epg-program-title { margin-top: 2px; color: #f4f4f6; font-size: 1.05em; }
.epg-progress { display: block; width: 100%; height: 5px; margin-top: 7px; overflow: hidden; border-radius: 999px; background: #383a40; }
.epg-progress-fill { display: block; height: 100%; border-radius: inherit; background: #ed1c35; transition: width 1s linear; }
.epg-empty { display: block; color: var(--muted); font-size: 13px; }
.player-actions { margin-top: 15px; display: flex; }
.player-actions .action-button + .action-button { margin-left: 10px; }
.action-button { min-width: 0; min-height: 46px; padding: 0 18px; font-size: 15px; }

.catalog-layout {
  height: calc(100% - 48px);
  display: flex;
  align-items: stretch;
}

.catalog-layout > aside.side-list {
  flex: 0 0 24%;
  min-width: 0;
  min-height: 0;
  margin-right: 18px;
}

.catalog-layout > section.side-list {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.catalog-heading {
  display: flex;
  align-items: baseline;
  margin: 3px 0 14px;
}

.catalog-heading span { margin-left: 14px; }

.catalog-heading h2 { margin: 0; font-size: 22px; }
.catalog-heading span { color: var(--muted); font-size: 14px; }

.catalog-grid {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  min-height: 0;
  align-content: start;
  padding: 2px 4px 12px;
}

.media-card {
  flex: 0 0 calc(20% - 14px);
  min-width: 0;
  margin: 0 14px 16px 0;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 9px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.media-card:hover, .media-card:focus {
  border-color: #f21d35;
  background: #35151d;
}
.media-card:focus { outline: 3px solid #f21d35; outline-offset: 3px; box-shadow: 0 0 14px rgba(242, 29, 53, .55); transform: scale(1.02); }

.poster {
  width: 100%;
  height: 205px;
  overflow: hidden;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #384150, #17202a);
  color: #e8eaf0;
  font-size: 30px;
  font-weight: 800;
  position: relative;
}

.poster img {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 7px;
  object-fit: cover;
}

.media-card:nth-child(3n + 2) .poster { background: linear-gradient(145deg, #51413b, #251c21); }
.media-card:nth-child(3n) .poster { background: linear-gradient(145deg, #394737, #1b2520); }

.poster-badge {
  position: absolute;
  z-index: 1;
  left: 7px;
  bottom: 7px;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  letter-spacing: .04em;
}

.media-title {
  display: block;
  padding: 7px 2px 0;
  overflow: hidden;
  color: #dedfe4;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-panel {
  max-width: 900px;
  margin: 6px auto;
}

.setting-row {
  width: 100%;
  min-height: 62px;
  margin-bottom: 8px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--surface);
  color: inherit;
  font-size: inherit;
  text-align: left;
  cursor: pointer;
}

.setting-row span:last-child { margin-left: 20px; color: var(--muted); }
.setting-row:hover, .setting-row:focus { border-color: var(--accent); background: #35151d; }
.settings-screen { overflow: auto; }
.settings-panel { max-height: calc(100% - 55px); overflow-y: auto; padding: 4px 8px 16px; }
.settings-note { margin: -2px 20px 11px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.settings-message { margin: 12px 8px; color: #bfc3cd; font-size: 14px; }
.settings-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, .72);
}
.settings-dialog {
  width: 100%;
  max-width: 520px;
  padding: 25px 28px;
  border: 1px solid #383c47;
  border-radius: 14px;
  background: #17191f;
  box-shadow: 0 14px 48px rgba(0, 0, 0, .5);
}
.settings-dialog h2 { margin: 0 0 12px; }
.settings-dialog p { color: #c3c6cf; line-height: 1.45; }
.settings-dialog label { display: block; margin: 13px 0 6px; color: #d6d8df; }
.settings-dialog input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid #343844;
  border-radius: 8px;
  background: #0e1015;
  color: #fff;
}
.dialog-actions { display: flex; margin-top: 18px; }
.dialog-actions .action-button + .action-button { margin-left: 10px; }

.empty-state {
  padding: 28px;
  border: 1px solid #272a33;
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.remote-hint {
  position: fixed;
  right: 4vw;
  bottom: 18px;
  color: #777c87;
  font-size: 13px;
}

button:focus-visible, input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

@media (max-width: 1050px) {
  .live-layout > .side-list { flex-basis: 205px; margin-right: 10px; }
  .live-layout > .channel-list { flex-basis: 290px; margin-right: 10px; }
  .media-card { flex-basis: calc(25% - 14px); }
}

.video-frame { position: relative; }
.live-video-frame { height: 22.3vw; max-height: 44vh; }
.video-frame.player-fullscreen {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10000;
  display: block;
  width: 100vw;
  height: 100vh;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #000;
  text-align: left;
}
.video-frame.player-fullscreen .stream-video {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
}
.fullscreen-title {
  position: absolute;
  top: 22px;
  right: 28px;
  left: 28px;
  z-index: 3;
  padding: 13px 18px;
  border-radius: 7px;
  background: rgba(0, 0, 0, .68);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  text-align: left;
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
}
.video-frame.show-title .fullscreen-title { opacity: 1; }
.video-frame:fullscreen, .video-frame:-webkit-full-screen {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 9999;
  width: 100vw;
  height: 100vh;
  max-height: none;
  border: 0;
  border-radius: 0;
  background: #000;
}
.video-frame:fullscreen .stream-video, .video-frame:-webkit-full-screen .stream-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.player-controls {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 30px 32px 28px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .86));
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.player-controls.controls-visible {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}
.player-control-button {
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 8px;
  background: rgba(27, 29, 36, .94);
  color: #fff;
  font-size: clamp(15px, 1.35vw, 22px);
  font-weight: 700;
  white-space: nowrap;
}
.player-control-button.primary-action { background: #ea152c; }
.player-control-button:focus-visible {
  outline: 3px solid #f21d35;
  outline-offset: 3px;
  transform: scale(1.04);
}
.player-control-button:focus { border-color: #ff4058; background: #c9152b; outline: 3px solid #f21d35; outline-offset: 3px; box-shadow: 0 0 14px rgba(242, 29, 53, .55); }
.seek-control {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 5px;
}
.seek-control input[type="range"] {
  width: 100%;
  min-width: 90px;
  height: 28px;
  margin: 0;
  accent-color: #f21d35;
}
.seek-times {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #fff;
  font-size: clamp(14px, 1.15vw, 19px);
  font-variant-numeric: tabular-nums;
}
.playback-control-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.seek-control input[type="range"]:focus-visible {
  outline: 3px solid #f21d35;
  outline-offset: 4px;
}
.seek-control input[type="range"]:focus { outline: 3px solid #f21d35; outline-offset: 4px; }
.track-dialog-backdrop {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, .68);
}
.track-dialog {
  width: min(520px, 92%);
  max-height: 82%;
  padding: 24px;
  overflow: hidden;
  border: 1px solid #30313a;
  border-radius: 14px;
  background: #15151c;
  color: #fff;
  text-align: center;
}
.track-dialog h2 { margin: 0 0 16px; font-size: clamp(24px, 2.2vw, 34px); }
.track-options { max-height: 48vh; overflow-y: auto; }
.track-option {
  display: block;
  width: 100%;
  min-height: 50px;
  margin: 0 0 4px;
  padding: 12px 16px;
  border: 0;
  border-radius: 4px;
  background: #20212a;
  color: #fff;
  font-size: clamp(16px, 1.45vw, 22px);
  text-align: left;
}
.track-option.selected { background: #e91b32; font-weight: 700; }
.track-option:focus-visible, .track-dialog-close:focus-visible { outline: 3px solid #f21d35; outline-offset: 2px; }
.track-option:focus { border-color: #ff4058; background: #e91b32; outline: 3px solid #f21d35; outline-offset: 2px; box-shadow: 0 0 14px rgba(242, 29, 53, .55); }
.track-dialog-close:focus { border-color: #ff4058; background: #c9152b; outline: 3px solid #f21d35; outline-offset: 2px; }
.track-empty { margin: 12px 0; color: #b9bbc4; font-size: 16px; text-align: left; }
.track-dialog-close {
  margin-top: 12px;
  padding: 10px 18px;
  border: 1px solid #444651;
  border-radius: 7px;
  background: #22232c;
  color: #fff;
  font-size: 16px;
}
.live-key-guide {
  display: none;
  position: absolute;
  top: 18px;
  right: 24px;
  z-index: 6;
  padding: 8px 15px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .72);
  color: #f7f7f8;
  font-size: clamp(13px, 1.25vw, 21px);
  line-height: 1.25;
  white-space: nowrap;
  pointer-events: none;
}
.video-frame.player-fullscreen.show-live-info .live-key-guide { display: block; }
.live-video-frame .fullscreen-title { top: 72px; }
.live-info-overlay {
  position: absolute;
  top: auto;
  left: 24px;
  right: 24px;
  bottom: 22px;
  z-index: 4;
  max-width: none;
  padding: 30px 20px 18px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .58));
  color: #fff;
  text-align: left;
  visibility: hidden;
  opacity: 0;
  transition: opacity .18s ease;
  pointer-events: none;
}
.live-info-overlay.live-info-visible { visibility: visible; opacity: 1; }
.live-info-header { display: flex; align-items: center; gap: 18px; min-height: 50px; color: #fff; }
.live-info-header > strong { overflow: hidden; font-size: clamp(23px, 2vw, 36px); font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.live-info-number { color: #f21d35; font-size: clamp(27px, 2.35vw, 42px); font-weight: 800; }
.live-info-logo { width: 50px; height: 46px; flex: 0 0 50px; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 8px; background: rgba(255,255,255,.92); color: #171820; font-size: 25px; }
.live-info-logo img { max-width: 92%; max-height: 92%; object-fit: contain; }
.live-info-programs { margin-top: 14px; }
.live-info-programs .epg-info { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 32px; color: #e1e3e8; font-size: clamp(14px, 1.3vw, 22px); }
.live-info-programs .epg-line { margin-top: 4px; }

@media (max-width: 760px) {
  .player-controls { gap: 8px; padding: 18px 14px 17px; }
  .playback-control-row { gap: 7px; }
  .player-control-button { min-height: 40px; padding: 7px 9px; }
  .seek-control { gap: 3px; }
  .track-dialog { padding: 17px; }
  .live-key-guide { top: 10px; right: 10px; max-width: calc(100% - 20px); padding: 7px 9px; }
  .live-video-frame .fullscreen-title { top: 58px; }
  .live-info-overlay { top: auto; left: 12px; right: 12px; bottom: 12px; max-width: calc(100% - 24px); padding: 24px 8px 12px; }
  .live-info-programs .epg-info { gap: 14px; }
}

.details-screen {
  height: calc(100vh - 140px);
  overflow-y: auto;
  padding-bottom: 30px;
  scrollbar-width: thin;
  scrollbar-color: #383c47 transparent;
}
.details-hero {
  min-height: 350px;
  padding: 26px 36px;
  display: flex;
  align-items: center;
  background-color: #14151a;
  background-size: cover;
  background-position: center 28%;
  border-radius: 12px;
}
.details-poster {
  flex: 0 0 190px;
  width: 190px;
  height: 278px;
  margin-right: 32px;
  border-radius: 10px;
  background: #20232b;
  object-fit: cover;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .4);
}
.details-copy { min-width: 0; max-width: 990px; }
.details-category {
  margin-bottom: 7px;
  color: #ff3049;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .06em;
}
.details-copy h1 {
  margin: 0 0 10px;
  font-size: clamp(30px, 3.7vw, 46px);
  line-height: 1.08;
}
.details-metadata { display: flex; flex-wrap: wrap; align-items: center; margin-bottom: 11px; }
.details-metadata > span { margin: 0 14px 5px 0; color: #e0e2e8; font-size: 16px; }
.details-metadata .details-rating { color: #ffc33e; font-weight: 700; }
.details-metadata .details-age { padding: 2px 7px; border-radius: 4px; background: #e7a820; color: #111; font-weight: 800; }
.details-plot { max-width: 880px; margin: 8px 0; color: #e0e2e8; font-size: 17px; line-height: 1.45; }
.details-credit { margin: 7px 0; color: #adb4c4; font-size: 14px; }
.details-credit strong { color: #f5f5f7; }
.details-actions { display: flex; margin-top: 16px; }
.action-button:focus { border-color: #ff4058; background: #c9152b; outline: 3px solid #f21d35; outline-offset: 3px; box-shadow: 0 0 14px rgba(242, 29, 53, .55); }
.details-actions .action-button + .action-button { margin-left: 12px; }
.details-actions .primary-action { min-width: 176px; background: var(--accent); font-weight: 700; }
.details-error, .details-loading { margin: 10px 4px; color: var(--muted); font-size: 14px; }
.details-error { color: #ff8997; }
.episodes-section, .cast-section, .recommendations-section { margin: 17px 4px 0; }
.episodes-section h2, .cast-section h2, .recommendations-section h2 { margin: 0 0 9px; font-size: 21px; }
.series-season-list { display: flex; flex-wrap: wrap; margin-bottom: 10px; }
.season-button {
  min-height: 40px;
  margin: 0 8px 7px 0;
  padding: 0 18px;
  border: 1px solid #292c34;
  border-radius: 22px;
  background: var(--surface);
  cursor: pointer;
}
.season-button small { margin-left: 9px; color: #aeb2bc; }
.season-button.selected, .season-button:hover, .season-button:focus { border-color: var(--accent); background: var(--accent); }
.season-button:focus { outline: 3px solid #f21d35; outline-offset: 3px; box-shadow: 0 0 14px rgba(242, 29, 53, .55); }
.season-button.selected small { color: #fff; }
.episode-row, .people-row, .recommendation-row { display: flex; overflow-x: auto; padding: 2px 3px 10px; }
.episode-card {
  flex: 0 0 255px;
  min-height: 94px;
  margin-right: 11px;
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}
.episode-card > * + * { margin-top: 5px; }
.episode-card:hover, .episode-card:focus { border-color: #f21d35; background: #35151d; }
.episode-card:focus { outline: 3px solid #f21d35; outline-offset: 3px; box-shadow: 0 0 14px rgba(242, 29, 53, .55); transform: scale(1.02); }
.episode-card strong { color: #fff; font-size: 15px; line-height: 1.3; }
.episode-card > span:last-child { max-height: 38px; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.35; }
.episode-number { color: #aab8d1; font-size: 13px; }
.person-card {
  flex: 0 0 112px;
  margin-right: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.person-avatar {
  width: 78px;
  height: 78px;
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #383c47;
  border-radius: 50%;
  background: #252832;
  color: #e7e8ec;
  font-size: 22px;
  font-weight: 700;
  overflow: hidden;
}
.person-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.settings-screen .screen-heading { color: #fff; font-size: 27px; letter-spacing: 0; text-transform: none; }
.person-card strong { max-width: 108px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.person-card small { max-width: 108px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.recommendation-card { flex: 0 0 130px; margin: 0 12px 0 0; padding: 0; border: 2px solid transparent; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; }
.recommendation-card .poster { height: 170px; }
.recommendation-card:hover, .recommendation-card:focus { border-color: #f21d35; background: #35151d; }
.recommendation-card:focus { outline: 3px solid #f21d35; outline-offset: 3px; box-shadow: 0 0 14px rgba(242, 29, 53, .55); transform: scale(1.02); }
.favorites-screen { overflow-y: auto; }
.favorites-group { margin: 12px 4px 18px; }
.favorites-group h2 { margin: 0 0 8px; font-size: 19px; }
.favorites-channels { max-height: 180px; }
.favorites-media-grid { display: flex; flex-wrap: wrap; }
.favorites-media-grid .media-card { flex-basis: 130px; }
.favorites-media-grid .poster { height: 176px; }

@media (max-width: 1050px) {
  .details-hero { min-height: 320px; padding: 20px; }
  .details-poster { flex-basis: 160px; width: 160px; height: 238px; margin-right: 20px; }
  .details-plot { font-size: 15px; }
}
