/* Only the new component; no existing template selectors are restyled. */
#nunu-app-desktop-entry{display:inline-flex;align-items:center;justify-content:center;gap:.35em;white-space:nowrap;color:inherit;text-decoration:none;flex-shrink:0}
#nunu-app-desktop-entry[hidden]{display:none!important}
/* Template navigation spans are often icons (10px); this span is a label. */
#nunu-app-desktop-entry>span:last-child{font:inherit;letter-spacing:inherit;line-height:inherit;color:#f3c968}
@supports((-webkit-background-clip:text) or (background-clip:text)){#nunu-app-desktop-entry>span:last-child{background:linear-gradient(100deg,#ff768b 5%,#f3c968 48%,#54cbd0 95%);-webkit-background-clip:text;background-clip:text;color:transparent}}
:root[data-portal-theme="light"] #nunu-app-desktop-entry>span:last-child{color:#876019}
@supports((-webkit-background-clip:text) or (background-clip:text)){:root[data-portal-theme="light"] #nunu-app-desktop-entry>span:last-child{background-image:linear-gradient(100deg,#bd2944 5%,#876019 48%,#087e83 95%);color:transparent}}
@media(forced-colors:active){#nunu-app-desktop-entry>span:last-child,:root[data-portal-theme="light"] #nunu-app-desktop-entry>span:last-child{background:none;color:LinkText}}
.keke-sidebar>#nunu-app-desktop-entry{display:flex;justify-content:flex-start}
#nunu-app-prompt{box-sizing:border-box;position:fixed;display:flex;align-items:center;gap:6px;min-height:48px;padding:2px 4px 2px 8px;border:1px solid #3b5947;border-radius:10px;background:#14251b;color:#eff9f2;font:14px/1.3 system-ui,sans-serif;box-shadow:0 2px 8px #0001}
#nunu-app-prompt[hidden],#nunu-app-prompt-spacer[hidden]{display:none!important}
#nunu-app-prompt img{display:block;flex:none;width:28px;height:28px;border-radius:7px}
#nunu-app-prompt .nunu-app-label{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:650}
#nunu-app-prompt .nunu-app-brand{display:block;font-size:14px;line-height:1.3;color:#ffd070}
#nunu-app-prompt .nunu-app-caption{display:block;font-size:11px;line-height:1.3;font-weight:500;color:#c3d4c9}
@supports((-webkit-background-clip:text) or (background-clip:text)){#nunu-app-prompt .nunu-app-brand{background:linear-gradient(100deg,#ff768b 5%,#f3c968 48%,#54cbd0 95%);-webkit-background-clip:text;background-clip:text;color:transparent}}
#nunu-app-prompt a{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;min-height:44px;font:inherit;text-decoration:none;white-space:nowrap;flex:none}
#nunu-app-prompt a{padding:0 12px;border:1px solid #79cfac30;border-radius:999px;color:#f0fff4;background:linear-gradient(110deg,#214936 0%,#367451 42%,#316267 78%,#1b3e36 100%);box-shadow:inset 0 0 8px 3px #14251bcc,0 0 4px #68c9a214;font-weight:700}
#nunu-app-prompt a:focus-visible,#nunu-app-desktop-entry:focus-visible{outline:2px solid currentColor;outline-offset:2px}
:root[data-portal-theme="light"] #nunu-app-prompt{background:#fff;color:#15271c;border-color:#cbded1}
:root[data-portal-theme="light"] #nunu-app-prompt .nunu-app-caption{color:#506358}
:root[data-portal-theme="light"] #nunu-app-prompt a{color:#18472f;border-color:#77b49530;background:linear-gradient(110deg,#e5f4ed 0%,#c4eaca 44%,#c6e9e6 76%,#eef8f2 100%);box-shadow:inset 0 0 8px 3px #ffffffcc,0 0 4px #64977d12}
@supports((-webkit-background-clip:text) or (background-clip:text)){:root[data-portal-theme="light"] #nunu-app-prompt .nunu-app-brand{background-image:linear-gradient(100deg,#bd2944 5%,#876019 48%,#087e83 95%)}}
@media(forced-colors:active){#nunu-app-prompt .nunu-app-brand{background:none;color:CanvasText}#nunu-app-prompt a,:root[data-portal-theme="light"] #nunu-app-prompt a{background:ButtonFace;color:ButtonText;border-color:ButtonText;box-shadow:none}}
@media(display-mode:standalone),(display-mode:fullscreen){#nunu-app-prompt,#nunu-app-prompt-spacer{display:none!important}}

/* R5: scoped corrections over the current skins. No card removal or cloning. */
html:root body.front.portal.tpl-iqiyi .portal-content-grid > *,
html:root body.front.portal.tpl-iqiyi .portal-main-flow,
html:root body.front.portal.tpl-iqiyi .portal-main-flow > .section-block {
  min-width: 0 !important; max-width: 100% !important; width: 100% !important;
  box-sizing: border-box !important;
}
html:root body.front.portal.tpl-iqiyi .channel-section-head { min-width: 0 !important; }
html:root body.front.portal.tpl-iqiyi .channel-heading { flex-shrink: 0 !important; }
html:root body.front.portal.tpl-iqiyi .channel-genre-tabs {
  min-width: 0 !important; max-width: 100% !important; overflow-x: auto !important;
}

/* A single geometry for peer header actions; labels may need more width. */
@media (min-width: 961px) {
  html:root body.front.portal[class][class] header:is(.ds3-head,.haoju-global-header,.iqiyi-header,.keke-topbar) :is(.ds3-head-right,.haoju-global-actions,.iqiyi-actions,.keke-actions) {
    align-items: center !important; gap: 8px !important;
  }
  html:root body.front.portal[class][class] header:is(.ds3-head,.haoju-global-header,.iqiyi-header,.keke-topbar) :is(.theme-toggle,.language-switcher,.language-switcher-trigger,.ds3-user,.ds3-menu,.haoju-action-menu,.iqiyi-login,[data-user-chip],.keke-actions > .keke-pill,.portal-search-chip) {
    box-sizing: border-box !important; height: 36px !important; min-height: 36px !important; max-height: 36px !important;
    display: inline-flex !important; align-items: center !important; justify-content: center !important;
    min-width: 36px !important; padding-block: 0 !important; line-height: 1 !important;
    border-radius: 999px !important; font-size: 13px !important; flex-shrink: 0 !important;
  }
  html:root body.front.portal[class][class] header .language-switcher { padding: 0 !important; }
  html:root body.front.portal[class][class] header .language-switcher-trigger { width: 36px !important; padding: 0 !important; }
  html:root body.front.portal[class][class] header :is(.ds3-user,.iqiyi-login,[data-user-chip],.keke-actions > a.keke-pill) {
    min-width: 52px !important; padding-inline: 10px !important;
  }
}

/* The icon, not the touch target, is reduced. ASCII SVG is encoding-safe. */
@media (max-width: 960px) {
  html:root body.front.portal[class][class] header:is(.ds3-head,.haoju-global-header,.iqiyi-header,.keke-topbar):is(.ds3-head,.haoju-global-header,.iqiyi-header,.keke-topbar) :is(.ds3-mobile-search,.portal-search-chip,.keke-search button) {
    position: relative !important; font-size: 0 !important;
  }
  html:root body.front.portal[class][class] header:is(.ds3-head,.haoju-global-header,.iqiyi-header,.keke-topbar):is(.ds3-head,.haoju-global-header,.iqiyi-header,.keke-topbar) :is(.ds3-mobile-search,.portal-search-chip,.keke-search button)::before {
    content: "" !important; position: absolute !important; inset: 50% auto auto 50% !important;
    width: 16px !important; height: 16px !important; margin: 0 !important; padding: 0 !important; border: 0 !important;
    transform: translate(-50%,-50%) !important; border-radius: 0 !important; background: currentColor !important;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='10' cy='10' r='6.5' fill='none' stroke='black' stroke-width='2.2'/%3E%3Cpath d='m15 15 6 6' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat !important;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='10' cy='10' r='6.5' fill='none' stroke='black' stroke-width='2.2'/%3E%3Cpath d='m15 15 6 6' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat !important;
  }
  html:root body.front.portal[class][class] header:is(.ds3-head,.haoju-global-header,.iqiyi-header,.keke-topbar):is(.ds3-head,.haoju-global-header,.iqiyi-header,.keke-topbar) :is(.ds3-mobile-search,.portal-search-chip,.keke-search button)::after { display: none !important; }
  html:root body.front.portal.tpl-keke.keke-template.keke-template .keke-topbar.keke-topbar {
    grid-template-rows: minmax(var(--mobile-header-control,32px),auto) !important;
    grid-auto-rows: auto !important; min-height: 52px !important;
  }
  html:root body.front.portal.tpl-keke.keke-template.keke-template .keke-topbar.keke-topbar:not(.is-search-open) {
    padding-bottom: 8px !important;
  }
  html:root body.front.portal.tpl-keke.keke-template.keke-template .keke-topbar.keke-topbar.is-search-open {
    height: auto !important; min-height: 94px !important; padding-bottom: 54px !important;
  }
}

/* R5B: the compact form is only the trigger's grid cell. The expanded input
   belongs to the sticky header, not that 32px cell. Keep the existing JS. */
@media (max-width: 900px) {
  html:root body.front.portal.tpl-keke.keke-template.keke-template .keke-topbar.keke-topbar .keke-search.keke-search {
    position: static !important; inset: auto !important; display: block !important;
    background: transparent !important; border: 0 !important; overflow: visible !important;
  }
  html:root body.front.portal.tpl-keke.keke-template.keke-template .keke-topbar.keke-topbar .keke-search.keke-search button {
    grid-area: auto !important; inset: auto !important; display: inline-flex !important;
  }
  html:root body.front.portal.tpl-keke.keke-template.keke-template .keke-topbar.keke-topbar .keke-search.is-open input {
    position: absolute !important; display: block !important; box-sizing: border-box !important;
    left: max(8px,env(safe-area-inset-left)) !important; right: max(8px,env(safe-area-inset-right)) !important;
    top: auto !important; bottom: 8px !important; width: auto !important;
    min-width: 0 !important; max-width: none !important; height: 38px !important;
    margin: 0 !important; padding: 0 12px !important; font-size: 16px !important;
    border: 1px solid #7b9e8c !important; border-radius: 12px !important;
    color: #18251f !important; background: #f5faf7 !important; z-index: 2 !important;
  }
  html:root[data-portal-theme="dark"] body.front.portal.tpl-keke.keke-template.keke-template .keke-topbar.keke-topbar .keke-search.is-open input {
    color: #e6f0eb !important; background: #182b23 !important; border-color: #779d88 !important;
  }
  html:root body.front.portal.tpl-keke.keke-template.keke-template .keke-topbar.keke-topbar .keke-search.is-open input::placeholder {
    color: inherit !important; opacity: .8 !important;
  }
}

/* R5C: one lens only. Legacy NUNU span glyphs must not sit beneath ::before.
   aria-label / real form semantics remain; desktop labels are untouched. */
@media (max-width: 960px) {
  html:root body.front.portal[class][class] header[class][class] :is(.ds3-mobile-search.ds3-mobile-search,.portal-search-chip.portal-search-chip,.keke-search.keke-search button) {
    font-size: 0 !important; text-shadow: none !important;
  }
  html:root body.front.portal[class][class] header[class][class] :is(.ds3-mobile-search.ds3-mobile-search,.portal-search-chip.portal-search-chip,.keke-search.keke-search button) > :is(span,em,svg) {
    display: none !important;
  }
  /* Card metadata only: titles/ratings and the detail synopsis remain intact. */
  html:root body.front.portal.tpl-keke.keke-template .keke-card > p {
    display: none !important;
  }
  /* NUNU search-result headers use haoju-global-search, not ds3-search.
     Keep both real inputs visibly bounded, without changing their layout. */
  html:root body.front.portal.tpl-haoju header :is(.haoju-global-search,.ds3-search) input[type="search"] {
    border: 1px solid #618674 !important; border-radius: 12px !important;
    color: #18251f !important; background-color: #f5faf7 !important;
    -webkit-text-fill-color: currentColor !important;
  }
  html:root[data-portal-theme="dark"] body.front.portal.tpl-haoju header :is(.haoju-global-search,.ds3-search) input[type="search"],
  html:root[data-theme="dark"] body.front.portal.tpl-haoju header :is(.haoju-global-search,.ds3-search) input[type="search"] {
    border-color: #82ab95 !important; color: #e6f0eb !important; background-color: #182b23 !important;
  }
  html:root body.front.portal.tpl-haoju header :is(.haoju-global-search,.ds3-search) input[type="search"]::placeholder {
    color: inherit !important; opacity: .8 !important;
  }
  html:root body.front.portal.tpl-haoju header :is(.haoju-global-search,.ds3-search) input[type="search"]:focus-visible {
    outline: 2px solid currentColor !important; outline-offset: 2px !important;
  }
}

/* Homepage hero only: preserve the current controller and real slide links. */
html:root body.front.portal.tpl-keke.keke-template.keke-home[class] .keke-hero {
  --r5-hero-ink: #18251f; --r5-hero-muted: #4b6359;
  position: relative !important; height: clamp(236px,22vw,320px) !important; min-height: 0 !important;
  padding: 0 !important; margin-block: 12px 20px !important;
  border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
  background: transparent !important; overflow: hidden !important; color: var(--r5-hero-ink) !important;
}
html:root[data-portal-theme="dark"] body.front.portal.tpl-keke.keke-template.keke-home[class] .keke-hero,
html:root[data-theme="dark"] body.front.portal.tpl-keke.keke-template.keke-home[class] .keke-hero {
  --r5-hero-ink: #e6f0eb; --r5-hero-muted: #adbfB6;
}
html:root body.front.portal.tpl-keke.keke-template.keke-home[class] .keke-hero::after,
html:root body.front.portal.tpl-keke.keke-template.keke-home[class] :is(.oletv-hero-poster,.keke-family-hero-poster)::after { display: none !important; }
html:root body.front.portal.tpl-keke.keke-template.keke-home[class] .keke-hero::before {
  content: "" !important; display: block !important; position: absolute !important; inset: 0 !important;
  background: radial-gradient(ellipse at 36% 50%,rgba(57,146,112,.20),rgba(121,167,140,.08) 46%,transparent 77%) !important;
  pointer-events: none !important; opacity: 1 !important; z-index: 0 !important; filter: none !important;
}
html:root[data-portal-theme="dark"] body.front.portal.tpl-keke.keke-template.keke-home[class] .keke-hero::before {
  background: radial-gradient(ellipse at 36% 50%,rgba(52,134,108,.38),rgba(33,89,69,.15) 46%,transparent 77%) !important;
}
html:root body.front.portal.tpl-keke.keke-template.keke-home[class] :is(.oletv-hero-slide,.keke-family-hero-slide) {
  display: block !important; height: 100% !important; min-height: 0 !important; padding: 0 !important; background: transparent !important; border: 0 !important;
  position: absolute !important; inset: 0 !important; width: 100% !important;
  opacity: 0 !important; visibility: hidden !important; pointer-events: none !important;
}
html:root body.front.portal.tpl-keke.keke-template.keke-home[class] :is(.oletv-hero-slide,.keke-family-hero-slide).active {
  opacity: 1 !important; visibility: visible !important; pointer-events: auto !important;
}
html:root body.front.portal.tpl-keke.keke-template.keke-home[class] :is(.oletv-hero-poster,.keke-family-hero-poster) {
  position: absolute !important; grid-area: auto !important; top: 0 !important; bottom: 0 !important;
  width: 36% !important; max-width: 260px !important; height: 100% !important;
  border: 0 !important; border-radius: 0 !important; background: transparent !important;
  -webkit-mask-image: none !important; mask-image: none !important;
}
html:root body.front.portal.tpl-keke.keke-template.keke-home[class] .oletv-hero-poster { left: 0 !important; right: auto !important; }
html:root body.front.portal.tpl-keke.keke-template.keke-home[class] .keke-family-hero-poster { left: 0 !important; right: auto !important; }
html:root body.front.portal.tpl-keke.keke-template.keke-home[class] :is(.oletv-hero-poster,.keke-family-hero-poster) :is(picture,img) {
  display: block !important; width: 100% !important; height: 100% !important; object-fit: contain !important; object-position: center !important; border-radius: 10px !important;
  -webkit-mask-image: none !important; mask-image: none !important;
}
html:root body.front.portal.tpl-keke.keke-template.keke-home[class] .oletv-hero-backdrop { display: none !important; }
html:root body.front.portal.tpl-keke.keke-template.keke-home[class] .oletv-hero-focus {
  position: absolute !important; inset: 0 !important; padding: 0 !important; margin: 0 !important;
  width: 100% !important; height: 100% !important;
}
html:root body.front.portal.tpl-keke.keke-template.keke-home[class] :is(.oletv-hero-copy,.keke-family-hero-copy) {
  position: absolute !important; grid-area: auto !important; top: 0 !important; bottom: 0 !important; width: auto !important;
  display: flex !important; flex-direction: column !important; justify-content: center !important;
  padding: 12px 8px !important; min-width: 0 !important; max-width: none !important; background: transparent !important;
  box-sizing: border-box !important; min-height: 0 !important; height: 100% !important; overflow: hidden !important;
  color: var(--r5-hero-ink) !important; text-shadow: none !important;
}
html:root body.front.portal.tpl-keke.keke-template.keke-home[class] .oletv-hero-copy { left: min(38%,276px) !important; right: 12px !important; }
html:root body.front.portal.tpl-keke.keke-template.keke-home[class] .keke-family-hero-copy { left: min(38%,276px) !important; right: 12px !important; }
@media (min-width: 961px) {
  html:root body.front.portal.tpl-keke.keke-template.keke-home[class] :is(.oletv-hero-poster,.keke-family-hero-poster) {
    left: 12px !important; right: auto !important; transform: none !important;
    top: 12px !important; bottom: 12px !important; height: calc(100% - 24px) !important;
    width: clamp(141px,13.2vw,197px) !important; max-width: none !important;
  }
  html:root body.front.portal.tpl-keke.keke-template.keke-home[class] :is(.oletv-hero-copy,.keke-family-hero-copy) {
    left: calc(clamp(141px,13.2vw,197px) + clamp(36px,6vw,100px)) !important; right: 24px !important;
  }
}
html:root body.front.portal.tpl-keke.keke-template.keke-home[class] :is(.oletv-hero-copy,.keke-family-hero-copy) :is(h1,h2) {
  color: var(--r5-hero-ink) !important; background: none !important; -webkit-text-fill-color: currentColor !important;
  font-size: clamp(24px,2.6vw,36px) !important; line-height: 1.25 !important; margin: 6px 0 10px !important;
}
html:root body.front.portal.tpl-keke.keke-template.keke-home[class] .keke-family-hero-copy h2 a { color: var(--r5-hero-ink) !important; background: none !important; -webkit-text-fill-color: currentColor !important; }
html:root body.front.portal.tpl-keke.keke-template.keke-home[class] .keke-family-hero-credits,
html:root body.front.portal.tpl-keke.keke-template.keke-home[class] .keke-family-hero-credits :is(p,strong,span,a) { color: var(--r5-hero-muted) !important; }
html:root body.front.portal.tpl-keke.keke-template.keke-home[class] :is(.oletv-hero-copy,.keke-family-hero-copy) > p {
  color: inherit !important; margin-block: 4px !important;
}
@media (max-width: 960px) {
  html:root body.front.portal.tpl-keke.keke-template.keke-home[class] .keke-hero { height: clamp(166px,49vw,218px) !important; margin-block: 8px 14px !important; }
  html:root body.front.portal.tpl-keke.keke-template.keke-home[class] :is(.oletv-hero-poster,.keke-family-hero-poster) { width: 38.2% !important; max-width: none !important; transform: none !important; }
  html:root body.front.portal.tpl-keke.keke-template.keke-home[class] .keke-family-hero-copy { left: calc(38.2% + 10px) !important; right: 8px !important; }
  html:root body.front.portal.tpl-keke.keke-template.keke-home[class] .oletv-hero-copy { left: calc(38.2% + 10px) !important; right: 8px !important; }
  html:root body.front.portal.tpl-keke.keke-template.keke-home[class] :is(.oletv-hero-copy,.keke-family-hero-copy) { padding: 8px 0 !important; }
  html:root body.front.portal.tpl-keke.keke-template.keke-home[class] :is(.oletv-hero-copy,.keke-family-hero-copy) :is(h1,h2) { font-size: clamp(18px,5vw,24px) !important; line-height: 1.22 !important; display: -webkit-box !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden !important; }
  html:root body.front.portal.tpl-keke.keke-template.keke-home[class] :is(.keke-eyebrow,.keke-family-hero-credits,.oletv-hero-copy > p) { font-size: clamp(11px,3vw,13px) !important; line-height: 1.45 !important; }
  html:root body.front.portal.tpl-keke.keke-template.keke-home[class] .oletv-hero-copy > p:not(.keke-eyebrow) { display: -webkit-box !important; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden !important; }
}

/* Poster keeps its aspect ratio; shorter text stretches, longer text aligns its
   final action row with the poster bottom instead of stretching the image. */
html:root body.front.portal.tpl-keke.keke-template.detail-page[class] .keke-detail { align-items: stretch !important; }
html:root body.front.portal.tpl-keke.keke-template.detail-page[class] .keke-detail > .keke-poster { align-self: end !important; }
html:root body.front.portal.tpl-keke.keke-template.detail-page[class] .keke-detail-copy { display: flex !important; flex-direction: column !important; min-width: 0 !important; }
html:root body.front.portal.tpl-keke.keke-template.detail-page[class] .keke-detail-toolbar {
  --r5-detail-action-ink: #246653;
  margin-top: auto !important; padding-top: 8px !important; display: grid !important;
  grid-template-columns: repeat(3,minmax(0,1fr)) !important; gap: 5px !important;
}
html:root[data-portal-theme="dark"] body.front.portal.tpl-keke.keke-template.detail-page[class] .keke-detail-toolbar,
html:root[data-theme="dark"] body.front.portal.tpl-keke.keke-template.detail-page[class] .keke-detail-toolbar { --r5-detail-action-ink: #ace9d5; }
html:root body.front.portal.tpl-keke.keke-template.detail-page[class] .keke-detail-toolbar > * { min-width: 0 !important; width: 100% !important; margin: 0 !important; }
html:root body.front.portal.tpl-keke.keke-template.detail-page[class] .keke-detail-toolbar :is(a,button) {
  color: var(--r5-detail-action-ink) !important; -webkit-text-fill-color: currentColor !important;
  box-sizing: border-box !important; min-height: 34px !important; height: 34px !important; padding: 0 2px !important;
  min-width: 0 !important; width: 100% !important; font-size: clamp(10px,2.8vw,14px) !important;
  display: inline-flex !important; align-items: center !important; justify-content: center !important; line-height: 1 !important; white-space: nowrap !important;
}
@media (max-width: 480px) {
  html:root body.front.portal.tpl-keke.keke-template.detail-page[class] .keke-detail { grid-template-columns: minmax(0,34%) minmax(0,1fr) !important; }
  html:root body.front.portal.tpl-keke.keke-template.detail-page[class] .keke-detail > .keke-poster { width: 100% !important; height: auto !important; aspect-ratio: 2 / 3 !important; }
}
/* CSS escapes survive legacy encoding overrides; rating values are untouched. */
html:root body.front.portal .moviecms-star-meter::before,
html:root body.front.portal .moviecms-star-meter::after { content: "\2605\2605\2605\2605\2605" !important; }
