/* Approved PHNX Play palette, scoped to channel pages. */
#main-content:has(#app-content > .channel-studio) {
  background-color: #101013;
}

html[data-theme="light"] #main-content:has(#app-content > .channel-studio) {
  background-color: #f7f7f9;
}

.profile-page.channel-studio {
  --studio-hero: #101013;
  --studio-surface: #161619;
  --studio-raised: #222227;
  --studio-border: #2e2e35;
  --studio-text: #f4f3f6;
  --studio-muted: #aaa9b4;
  --studio-accent: #fa6476;
  --studio-live: var(--studio-accent);
  --studio-selection: var(--studio-raised);
  --studio-critical: #c02037;
  --studio-action-text: #101013;
  --bg: var(--studio-hero);
  --surface: var(--studio-surface);
  --surface-2: var(--studio-raised);
  --line: var(--studio-border);
  --border: var(--studio-border);
  --text: var(--studio-text);
  --muted: var(--studio-muted);
  --subtle: var(--studio-muted);
  --accent: var(--studio-accent);
  --accent-2: var(--studio-critical);
  color: var(--studio-text);
}

html[data-theme="light"] .profile-page.channel-studio {
  --studio-hero: #f7f7f9;
  --studio-surface: #fff;
  --studio-raised: #f1f1f4;
  --studio-border: #e1e1e6;
  --studio-text: #18181c;
  --studio-muted: #575762;
  --studio-accent: #b91e34;
  --studio-action-text: #fff;
}

.profile-page.channel-studio .studio-masthead {
  margin-bottom: 9px;
  border: 1px solid var(--studio-border);
  border-radius: 11px;
  background: var(--studio-surface);
  box-shadow: none;
}

.profile-page.channel-studio .studio-masthead::before {
  content: none;
}

.profile-page.channel-studio .studio-masthead-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 20px;
  padding: 16px clamp(13px, 2vw, 22px);
}

.profile-page.channel-studio .studio-creator {
  gap: 12px;
}

.profile-page.channel-studio .studio-avatar {
  padding: 2px;
  border: 1px solid var(--studio-border);
  background: var(--studio-hero);
}

.profile-page.channel-studio .studio-avatar .avatar {
  width: 54px;
  height: 54px;
  font-size: 19px;
}

.profile-page.channel-studio .studio-creator h1 {
  margin: 0 0 6px;
  font-size: clamp(22px, 2.6vw, 31px);
  line-height: 1.14;
  letter-spacing: -.04em;
}

.profile-page.channel-studio .studio-creator-details {
  gap: 5px 8px;
}

.profile-page.channel-studio .studio-creator-details .platform-badge {
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--studio-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.profile-page.channel-studio .studio-creator-details .platform-badge::before {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.profile-page.channel-studio .studio-presence {
  padding: 3px 7px;
  border-color: var(--studio-border);
  background: var(--studio-raised);
}

.profile-page.channel-studio :is(.studio-actions .subscribe-button, .studio-history) {
  min-height: 44px;
  border: 1px solid var(--studio-border);
  border-radius: 9px;
  box-shadow: none;
}

.profile-page.channel-studio .studio-actions .subscribe-button {
  background: var(--studio-text);
  color: var(--studio-action-text);
  border-color: transparent;
}

.profile-page.channel-studio .studio-actions .subscribe-button.subscribed,
.profile-page.channel-studio .studio-history {
  border-color: var(--studio-border);
  background: transparent;
  color: var(--studio-text);
}

.profile-page.channel-studio .studio-history:hover,
.profile-page.channel-studio .studio-actions .subscribe-button.subscribed:hover {
  background: var(--studio-raised);
}

.profile-page.channel-studio .studio-facts {
  padding: 0;
  background: var(--studio-surface);
}

.profile-page.channel-studio .studio-facts > div {
  padding: 8px 7px;
}

.profile-page.channel-studio .studio-nav.profile-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0 clamp(4px, 1.6vw, 18px);
  margin: 0 0 13px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--studio-border);
  border-radius: 0;
  background: transparent;
}

.profile-page.channel-studio .studio-nav.profile-tabs button {
  flex: none;
  flex-direction: row;
  gap: 6px;
  min-height: 46px;
  margin-bottom: -1px;
  padding: 6px 9px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--studio-muted);
  font-size: 13px;
  line-height: 1.2;
}

.profile-page.channel-studio .studio-nav.profile-tabs button:hover,
.profile-page.channel-studio .studio-nav.profile-tabs button[aria-selected="true"] {
  color: var(--studio-text);
  background: transparent;
}

.profile-page.channel-studio .studio-nav.profile-tabs button[aria-selected="true"] {
  border-bottom-color: var(--studio-accent);
}

.profile-page.channel-studio .studio-nav.profile-tabs button[aria-selected="true"] svg {
  color: var(--studio-accent);
}

.profile-page.channel-studio #profile-panel-direct > .studio-panel-heading {
  justify-content: flex-end;
  margin: 0 0 9px;
}

.profile-page.channel-studio #profile-panel-direct > .studio-panel-heading:not(:has(.creator-recorder-state)) {
  margin: 0;
}

.profile-page.channel-studio #profile-panel-direct > .studio-panel-heading > div:first-child {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.profile-page.channel-studio #profile-panel-direct .creator-recorder-state {
  color: var(--studio-muted);
}

.profile-page.channel-studio #profile-panel-direct .creator-recorder-state.is-recording {
  border-color: var(--studio-border);
  background: var(--studio-raised);
  color: var(--studio-live);
}

.profile-page.channel-studio #profile-panel-direct .creator-recorder-state.is-recording i,
.profile-page.channel-studio #profile-panel-direct .live-now i {
  background: var(--studio-critical);
}

.profile-page.channel-studio #profile-panel-direct .live-chat-form button {
  background: var(--studio-critical);
  border-color: transparent;
  color: #fff;
  box-shadow: none;
}

.profile-page.channel-studio #profile-panel-direct :is(.yl-live-track, .yl-live-track i, .yl-live-button:not(.is-behind) i) {
  background: var(--studio-critical);
}

@media (max-width: 720px) {
  .profile-page.channel-studio .studio-masthead-main {
    grid-template-columns: minmax(0, 1fr);
    gap: 11px;
    padding-block: 13px;
  }

  .profile-page.channel-studio .studio-avatar .avatar { width: 43px; height: 43px; }
  .profile-page.channel-studio .studio-creator { gap: 9px; }
  .profile-page.channel-studio .studio-creator h1 { font-size: clamp(19px, 5.5vw, 24px); }
  .profile-page.channel-studio .studio-actions { justify-content: flex-start; gap: 6px; }
  .profile-page.channel-studio .studio-facts > div { gap: 2px; padding-inline: 5px; }
  .profile-page.channel-studio .studio-facts dd { font-size: 14px; }
  .profile-page.channel-studio .studio-facts dt { font-size: 10px; }

  .profile-page.channel-studio .studio-nav.profile-tabs { flex-wrap: nowrap; gap: 0 3px; }
  .profile-page.channel-studio .studio-nav.profile-tabs button {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: 2px;
    font-size: 11px;
    white-space: normal;
  }
}

@media (max-width: 440px) {
  .profile-page.channel-studio .studio-actions :is(.subscribe-button, .studio-history) { padding-inline: 9px; }
  .profile-page.channel-studio .studio-actions .subscribe-button { min-width: 76px; }
  .profile-page.channel-studio .studio-nav.profile-tabs button svg { display: none; }
}

/* Player and chat share the same footprint in the channel’s Direct tab. */
.channel-studio #profile-panel-direct [data-studio-live-content] {
  container: channel-direct / inline-size;
}

.channel-studio #profile-panel-direct .live-room:has(.yt-live-player) {
  --direct-panel-height: clamp(390px, 44cqw, 460px);
  --direct-panel-radius: 11px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  margin: 0;
}

@container channel-direct (min-width: 731px) {
  .channel-studio #profile-panel-direct .live-room:has(> .live-chat):has(.yt-live-player) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.channel-studio #profile-panel-direct .live-room:has(.yt-live-player) > .live-mobile-tabs {
  display: none;
}

.channel-studio #profile-panel-direct [data-studio-live-content] > .live-room:has(.yt-live-player) > .live-video-column {
  display: block;
  min-width: 0;
}

.channel-studio #profile-panel-direct .live-video-column > .yt-live-player {
  container: channel-live-player / inline-size;
}

.channel-studio #profile-panel-direct .live-video-column > .yt-live-player:not(:fullscreen) {
  box-sizing: border-box;
  height: var(--direct-panel-height) !important;
  aspect-ratio: auto !important;
  border: 1px solid var(--line);
  border-radius: var(--direct-panel-radius) !important;
  box-shadow: none;
}

.channel-studio #profile-panel-direct [data-studio-live-content] > .live-room:has(.yt-live-player) > .live-chat {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: var(--direct-panel-height);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--direct-panel-radius);
  background: var(--surface);
  box-shadow: none;
}

.channel-studio #profile-panel-direct .live-room > .live-chat > :is(header, .live-chat-legend, .live-chat-form) {
  flex-shrink: 0;
  background: var(--surface);
}

.channel-studio #profile-panel-direct .live-room > .live-chat .live-chat-messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.channel-studio #profile-panel-direct .live-room > .live-chat .live-chat-message {
  padding-block: 9px;
  margin-bottom: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.channel-studio #profile-panel-direct .live-room > .live-chat .live-chat-message:last-child {
  border-bottom: 0;
}

.channel-studio #profile-panel-direct .live-room:has(.yt-live-player) .live-video-meta {
  margin-top: 0;
  padding: 10px 1px 0;
  border: 0;
  background: transparent;
}

.channel-studio #profile-panel-direct .live-video-meta :is(h2, h3) {
  margin-top: 4px;
  font-size: clamp(17px, 2.2cqw, 24px);
  letter-spacing: -.025em;
}

@media (min-width: 1001px) {
  body.live-cinema-mode .channel-studio #profile-panel-direct .live-room:has(.yt-live-player) {
    --direct-panel-height: max(440px, calc(100dvh - 140px));
  }

  body.live-cinema-mode .channel-studio #profile-panel-direct [data-studio-live-content] > .live-room:has(.yt-live-player) > .live-chat {
    display: none;
  }
}

.channel-studio #profile-panel-direct .yl-framing-enabled > .yl-live-backdrop {
  position: absolute;
  z-index: 0;
  top: -14px;
  left: -14px;
  width: calc(100% + 28px);
  height: calc(100% + 28px);
  object-fit: cover;
  filter: blur(8px) brightness(.42) saturate(.82);
  pointer-events: none;
}

.channel-studio #profile-panel-direct .yl-framing-enabled > video {
  z-index: 1;
  background: transparent;
  transform: translate(var(--yl-zoom-x, 0%), var(--yl-zoom-y, 0%)) scale(var(--yl-zoom, 1));
  transform-origin: top left;
}

.channel-studio #profile-panel-direct .yl-framing-enabled > video.yl-video-fill {
  object-fit: cover;
  object-position: center;
}

.channel-studio #profile-panel-direct .yl-framing-enabled.is-audio-only > :is(.yl-framing, .yl-live-backdrop) {
  display: none;
}

.channel-studio #profile-panel-direct .yl-framing {
  position: absolute;
  z-index: 10;
  top: max(11px, env(safe-area-inset-top));
  right: max(11px, env(safe-area-inset-right));
  display: grid;
  justify-items: end;
  color: #f4f3f6;
  cursor: auto;
}

.channel-studio #profile-panel-direct .yt-live-player:fullscreen.yl-chat-docked > .yl-framing {
  right: calc(var(--yl-chat-width, 320px) + 30px);
}

.channel-studio #profile-panel-direct .yl-zoom-button {
  min-width: 56px;
  min-height: 34px;
  padding: 4px 8px;
  border: 1px solid #ffffff26;
  border-radius: 8px;
  background: #101013d9;
  color: inherit;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.channel-studio #profile-panel-direct .yl-zoom-button:is(:hover, [aria-expanded="true"]) {
  background: #222227;
}

.channel-studio #profile-panel-direct .yl-zoom-panel {
  position: absolute;
  inset: calc(100% + 6px) 0 auto auto;
  display: grid;
  gap: 3px;
  width: min(215px, calc(100cqw - 24px));
  padding: 12px;
  border: 1px solid #2e2e35;
  border-radius: 10px;
  background: #161619;
  box-shadow: 0 10px 26px #0006;
  font-size: 13px;
}

.channel-studio #profile-panel-direct .yl-zoom-panel input {
  width: 100%;
  min-height: 40px;
  margin: 0;
  accent-color: #fa6476;
  cursor: pointer;
}

.channel-studio #profile-panel-direct .yl-fit-button {
  min-height: 40px;
  padding: 6px 8px;
  border: 1px solid #2e2e35;
  border-radius: 7px;
  background: #222227;
  color: inherit;
  font-size: 12px;
  cursor: pointer;
}

.channel-studio #profile-panel-direct .yl-fit-button[aria-pressed="true"] {
  background: #2e2e35;
}

@container channel-live-player (max-width: 415px) {
  .channel-studio #profile-panel-direct .yt-live-player .yl-controls { padding-inline: 6px; }
  .channel-studio #profile-panel-direct .yt-live-player .yl-control-row { gap: 0; }
  .channel-studio #profile-panel-direct .yt-live-player .yl-volume input { display: none; }
  .channel-studio #profile-panel-direct .yt-live-player .yl-live-button { margin-inline: 0; padding-inline: 4px; }
}

@media (pointer: coarse), (max-width: 720px) {
  .channel-studio #profile-panel-direct :is(.yl-zoom-button, .yl-zoom-panel input, .yl-fit-button) {
    min-height: 44px;
  }
  .channel-studio #profile-panel-direct .live-room > .live-chat .live-chat-form textarea {
    font-size: 16px;
  }
}
