/* 262C: desktop room polish on top of H4/H11.
   The phone room owns <=768px.  This layer starts at 769px and the complete
   desktop presentation is enabled by H4 at 1024px; the 769–1023 range keeps
   the incumbent tablet treatment until a dedicated tablet pass. */

@media (min-width: 769px) {
  :root {
    --room-262-ink: #f7f2ff;
    --room-262-muted: #c7bbd9;
    --room-262-line: rgba(255, 255, 255, .12);
    --room-262-glass: rgba(28, 21, 42, .58);
    --room-262-purple: #9b5cff;
  }

  /* H4's desktop grid is the only shell at this width.  Keep the room itself
     inside the viewport while allowing the bottom operation row to float below
     the portrait card. */
  body.watch:has(> .watch[data-h4]) {
    overflow: hidden;
    background: #0d0a14;
  }

  body.watch .watch[data-h4] {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    overflow: visible;
    font-family: var(--room-ui-font, "Inter Variable", Inter, "PingFang SC", "Noto Sans SC", sans-serif);
  }

  body.watch .watch[data-h4] > .watch-head {
    min-width: 0;
    min-height: 0;
  }

  body.watch .watch[data-h4] .stage-wrap,
  body.watch .watch[data-h4] section.chat,
  body.watch .watch[data-h4] > .shop {
    min-width: 0;
    min-height: 0;
  }

  /* The public mobile shell has a max-width:1024 rule.  At the exact 1024
     review width we restore one compact desktop row so the nav, search and
     language control share one baseline. */
  @media (min-width: 769px) and (max-width: 1199px) {
    body.watch .watch[data-h4] {
      grid-template-columns: clamp(244px, 25vw, 274px) minmax(0, 1fr) clamp(258px, 28vw, 292px);
      grid-template-rows: 60px minmax(0, 1fr);
      gap: 14px;
      padding: 0 12px 14px;
    }

    body.watch .watch[data-h4] > .watch-head {
      display: block !important;
      height: 60px !important;
      min-height: 60px !important;
      padding: 0 12px !important;
      background: rgba(13, 10, 20, .78) !important;
      border-bottom: 1px solid var(--room-262-line) !important;
      backdrop-filter: blur(18px);
      -webkit-backdrop-filter: blur(18px);
    }

    body.watch .watch[data-h4] > .watch-head .top-bar {
      display: grid !important;
      grid-template-columns: 120px minmax(230px, 1fr) minmax(152px, 205px) auto 56px;
      align-items: center;
      gap: 10px;
      width: 100%;
      height: 60px !important;
      min-height: 60px !important;
      padding: 0 !important;
      overflow: hidden;
    }

    body.watch .watch[data-h4] > .watch-head .wordmark {
      grid-column: 1;
      grid-row: 1;
      display: inline-flex !important;
      align-items: center;
      height: 44px;
      font-size: 25px;
      letter-spacing: .08em;
      white-space: nowrap;
    }

    body.watch .watch[data-h4] > .watch-head .primary-nav {
      grid-column: 2;
      grid-row: 1;
      display: flex !important;
      align-items: center;
      gap: clamp(8px, 1.25vw, 14px);
      min-width: 0;
      margin: 0 !important;
      overflow: hidden;
      white-space: nowrap;
    }

    body.watch .watch[data-h4] > .watch-head .primary-nav a {
      flex: 0 0 auto;
      min-width: 0;
      padding: 18px 0 12px;
      font-size: 13px;
      line-height: 1;
    }

    body.watch .watch[data-h4] > .watch-head .top-left {
      grid-column: 3;
      grid-row: 1;
      display: block !important;
      min-width: 0;
      width: auto;
      max-width: none;
      overflow: hidden;
    }

    body.watch .watch[data-h4] > .watch-head .header-search,
    body.watch .watch[data-h4] > .watch-head .header-search input {
      display: block !important;
      width: 100%;
      min-width: 0;
      box-sizing: border-box;
    }

    body.watch .watch[data-h4] > .watch-head .header-search input {
      height: 36px;
      padding-inline: 13px;
      font-size: 11px;
      border-radius: 999px;
      border: 1px solid rgba(255, 255, 255, .22);
      background: rgba(255, 255, 255, .02);
    }

    body.watch .watch[data-h4] > .watch-head .top-right {
      grid-column: 4;
      grid-row: 1;
      display: flex !important;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
      min-width: 0;
      margin: 0;
      overflow: hidden;
    }

    body.watch .watch[data-h4] > .watch-head .top-right .lang-switch {
      display: block !important;
      flex: 0 0 auto;
      width: auto;
      min-width: 98px;
      max-width: 114px;
      height: 44px;
      margin: 0;
    }

    body.watch .watch[data-h4] > .watch-head .lang-switch > summary {
      height: 44px;
      padding-inline: 10px;
      white-space: nowrap;
    }

    body.watch .watch[data-h4] > .watch-head .top-right .account-btn,
    body.watch .watch[data-h4] > .watch-head .head-bag {
      display: inline-grid !important;
      place-items: center;
      flex: 0 0 32px;
      width: 32px;
      min-width: 32px;
      height: 36px;
      padding: 0;
    }

    body.watch .watch[data-h4] > .watch-head .top-right .room-notification-154,
    body.watch .watch[data-h4] > .watch-head .top-right .room-favorite-154,
    body.watch .watch[data-h4] > .watch-head .mobile-header-actions,
    body.watch .watch[data-h4] > .watch-head .mobile-channel-tabs,
    body.watch .watch[data-h4] > .watch-head > .menu-btn {
      display: none !important;
    }

    body.watch .watch[data-h4] > .watch-head .head-bag > span:first-child { display: none; }
    body.watch .watch[data-h4] > .watch-head .head-bag svg,
    body.watch .watch[data-h4] > .watch-head .account-btn svg { width: 21px; height: 21px; }
  }

  /* Make H4's stage geometry read as a deliberate centre column at both review
     widths.  The portrait remains 9:16, while the operations row has a fixed
     clear band below it instead of being clipped by the viewport. */
  body.watch .watch[data-h4] .stage-wrap {
    overflow: visible;
    isolation: isolate;
    top: 0 !important;
    --h4-bar: 56px;
    --h4-gap: 16px;
  }

  /* mobile-222's <=1024 shell sets this offset with !important; restore the
     desktop stage origin after the shared header collapses back to 60px. */
  body.watch .watch[data-h4] .stage-wrap > .stage,
  body.watch .watch[data-h4] .stage-wrap > .peek {
    top: 0 !important;
  }

  body.watch .watch[data-h4] .stage-wrap > .stage {
    box-shadow: 0 28px 70px rgba(0, 0, 0, .48), 0 0 0 1px rgba(255, 255, 255, .10);
  }

  body.watch .watch[data-h4] .stage-wrap > .stage video,
  body.watch .watch[data-h4] .stage-wrap > .stage img.room-poster {
    object-position: 50% 32%;
  }

  body.watch .watch[data-h4] .stage-wrap > .room-overlay-composer {
    box-sizing: border-box;
    min-width: 0;
  }

  body.watch .watch[data-h4] .stage-wrap > .room-overlay-composer input {
    font-size: 15px;
  }

  body.watch .watch[data-h4] .stage-wrap > .room-overlay-composer button,
  body.watch .watch[data-h4] .h4-round,
  body.watch .watch[data-h4] .h4-follow,
  body.watch .watch[data-h4] .room-cart-154 {
    background: linear-gradient(135deg, #a46bff, #7a3cf0);
    box-shadow: 0 8px 22px rgba(122, 60, 240, .26);
  }

  body.watch .watch[data-h4] .stage-wrap > .room-overlay-composer button:focus-visible,
  body.watch .watch[data-h4] .h4-round:focus-visible,
  body.watch .watch[data-h4] .h4-follow:focus-visible {
    outline: 2px solid #d8bfff;
    outline-offset: 3px;
  }

  body.watch .watch[data-h4] section.chat,
  body.watch .watch[data-h4] > .shop {
    border-color: var(--room-262-line);
    background: var(--room-262-glass);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .05);
  }

  body.watch .watch[data-h4] section.chat .feed .line,
  body.watch .watch[data-h4] > .shop .room-product-154 {
    font-family: inherit;
  }

  body.watch .watch[data-h4] > .shop .room-product-copy b,
  body.watch .watch[data-h4] .room-now-154 .room-product-copy b {
    font-variant-numeric: tabular-nums lining-nums;
  }

  @media (prefers-reduced-motion: reduce) {
    body.watch .watch[data-h4] .h4-round,
    body.watch .watch[data-h4] .h4-like.is-pop,
    body.watch .watch[data-h4] .h4-dot { animation: none !important; transition: none !important; }
  }
}
