.player-stage > .ai-hdr-canvas:not(.is-active),
.player-overlay.is-closing .player-stage > .ai-hdr-canvas {
  visibility: hidden;
}

:root:root .anime-app.anime-app.anime-app .player-shell .player-settings.anime4k-panel:has(> .ai-hdr-setting) {
  grid-template-areas: "mark slider value close" "hdr hdr hdr hdr" "note note note note" !important;
  border-radius: 24px !important;
}

.anime4k-panel > .ai-hdr-setting {
  grid-area: hdr;
  min-width: 0;
  padding: 0 2px 8px;
  border-top: 1px solid rgb(255 255 255 / 12%);
  color: #f6f8fb;
}
.ai-hdr-setting > small {
  display: block;
  margin: -3px 0 0;
  color: #cbd4e3;
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.player-stage > .ai-hdr-canvas { filter: none !important; }
.player-shell[data-ai-hdr-active] .player-stage > .anime4k-canvas:not(.ai-hdr-canvas) { visibility: hidden; }

.player-shell[data-ai-hdr-active] { --aulama-hdr-fullscreen-glow: brightness(1.16); }

/* Lift only the separate glow outside the picture; leave its fade and on/off state intact. */
.player-overlay.is-embedded:has(> .player-shell[data-ai-hdr-active]) > .player-ambient-canvas[data-ready="true"] {
  opacity: .68;
}

html[data-theme="light"] .player-overlay.is-embedded:has(> .player-shell[data-ai-hdr-active]) > .player-ambient-canvas[data-ready="true"] {
  opacity: .47;
}

.player-overlay:has(> .player-shell[data-ai-hdr-active]) > .player-edge-ambient[data-ambient-mode="soft"][data-fullscreen="false"]:not(:is(.player-edge-ambient-bloom, .player-edge-ambient-highlight)) {
  filter: blur(clamp(48px, 4.5vw, 80px)) saturate(1.12) brightness(1.19);
}

.player-overlay:has(> .player-shell[data-ai-hdr-active]) > .player-edge-ambient[data-ambient-mode="ambilight"][data-fullscreen="false"]:not(:is(.player-edge-ambient-bloom, .player-edge-ambient-highlight)) {
  filter: blur(var(--ambilight-blur, 20px)) contrast(.99) brightness(1.12);
}

/* Use the same four columns for both tracks, including when the displayed value changes. */
:root:root .anime-app.anime-app.anime-app .player-shell .player-settings.anime4k-panel:has(> .ai-hdr-setting) {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto auto !important;
  grid-template-areas:
    "mark slider value close"
    "divider divider divider divider"
    "hdr-mark hdr-slider hdr-value ."
    "hdr-status hdr-status hdr-status hdr-status"
    "note note note note" !important;
  align-items: center;
  row-gap: 0 !important;
  border-radius: 24px !important;
}
.anime4k-panel:has(> .ai-hdr-setting) > :is(header, .anime4k-level-control),
.anime4k-panel > .ai-hdr-setting,
.ai-hdr-setting > .ai-hdr-strength { display: contents; }
.anime4k-panel:has(> .ai-hdr-setting) > header > div { grid-area: mark; justify-self: center; }
.anime4k-panel:has(> .ai-hdr-setting) > header strong,
.anime4k-panel:has(> .ai-hdr-setting) > p:not(.is-error) { display: none; }
.anime4k-panel:has(> .ai-hdr-setting) > header > button { grid-area: close; justify-self: center; }
.anime4k-panel:has(> .ai-hdr-setting) .anime4k-level-track { grid-area: slider; }
.anime4k-panel:has(> .ai-hdr-setting) .anime4k-level-labels { grid-area: value; }
.anime4k-panel:has(> .ai-hdr-setting) > p.is-error { grid-area: note; }

.ai-hdr-setting::before {
  content: "";
  grid-area: divider;
  height: 1px;
  background: rgb(255 255 255 / 12%);
}
.ai-hdr-strength-label {
  grid-area: hdr-mark;
  justify-self: center;
  display: grid;
  place-items: center;
  width: 30px;
  height: 20px;
  border-radius: 5px;
  background: linear-gradient(120deg, #7fe1ff, #b48cff);
  color: #152030;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: -.025em;
}
:root:root .anime-app .player-shell .anime4k-panel > .ai-hdr-setting > .ai-hdr-strength > .ai-hdr-strength-track {
  grid-area: hdr-slider !important;
  min-width: 0;
}
.ai-hdr-strength-value {
  grid-area: hdr-value;
  justify-self: center;
  color: #f6f8fb;
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.ai-hdr-strength:has(input:disabled) > * { opacity: .58; }
.ai-hdr-setting > small { grid-area: hdr-status; margin: 0; }
.ai-hdr-setting > small:not(:empty) { padding-block: 0 6px; }

.player-shell:not(.is-fullscreen):not(.is-pseudo-fullscreen) .ai-hdr-strength-label {
  width: 26px;
  height: 17px;
  font-size: 9px;
}
.player-shell:not(.is-fullscreen):not(.is-pseudo-fullscreen) .ai-hdr-strength-value { font-size: 12.5px; }
