/* 264C: Roger feedback pass on the live room.
   The 262C/H11 composition stays intact; these rules tighten the stage,
   product surfaces, and mobile action rail without adding fake events. */

@media (min-width: 1024px) {
  body.watch .watch[data-h4] .stage-wrap {
    --h4-bar: 52px;
    --h4-gap: 12px;
    row-gap: 12px;
    top: -8px !important;
  }

  /* 1024–1199 has its own compact header grid in 262C. */
  @media (max-width: 1199px) {
    body.watch .watch[data-h4] .stage-wrap { row-gap: 10px; }
  }

  /* Move the portrait up with the tighter header-to-stage rhythm. */
  .watch[data-h4] .stage-wrap > .stage-purchase { bottom: calc(var(--h4-cb) + 8px); }

  /* The in-video product cue is a compact 58px strip, never a second panel. */
  .watch[data-h4] .room-now-154 .room-product-154 {
    min-height: 58px;
    padding: 6px 8px;
    gap: 8px;
    border-radius: 14px;
  }
  .watch[data-h4] .room-now-154 .room-product-open { gap: 8px; }
  .watch[data-h4] .room-now-154 .room-product-open img { width: 42px; height: 42px; flex-basis: 42px; border-radius: 10px; }
  .watch[data-h4] .room-now-154 .room-product-copy { gap: 2px; }
  .watch[data-h4] .room-now-154 .room-product-copy strong { font-size: 13px; font-weight: 550; line-height: 1.25; }
  .watch[data-h4] .room-now-154 .room-product-copy b { font-size: 15px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums lining-nums; }
  .watch[data-h4] .room-now-154 .room-cart-154 { width: 34px; height: 34px; }
  .watch[data-h4] .room-now-154 .room-now-label { top: -9px; font-size: 10px; font-weight: 600; }

  /* Keep the bottom interaction row light and proportionate. */
  .watch[data-h4] .stage-wrap > .room-overlay-composer { height: var(--h4-bar); gap: 6px; padding-inline: 14px 5px; }
  .watch[data-h4] .stage-wrap > .room-overlay-composer button { width: 38px; height: 38px; }
  .watch[data-h4] .h4-actions { right: var(--h4-bl); bottom: 0; gap: 8px; }
  .watch[data-h4] .h4-round { width: 44px; height: 44px; }

  /* Side shop cards use the same quiet type scale and tabular price treatment. */
  .watch[data-h4] .shop .room-product-open { gap: 9px; }
  .watch[data-h4] .shop .room-product-open img { width: 56px; height: 56px; flex-basis: 56px; border-radius: 12px; }
  .watch[data-h4] .shop .room-product-copy { gap: 3px; }
  .watch[data-h4] .shop .room-product-copy strong { font-size: 13px; font-weight: 550; line-height: 1.25; }
  .watch[data-h4] .shop .room-product-copy b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums lining-nums; }
  .watch[data-h4] .shop .room-cart-154 { width: 32px; height: 32px; }
}

@media (max-width: 768px) {
  .watch {
    --c264-action: clamp(32px, 8.4vw, 36px);
    --h11-now: 55px;
    --h11-row: 44px;
  }

  /* Roger's phone reference has three circles: share, gifts, like.  Favourite
     remains available in the public header, so the old bookmark proxy leaves
     the action rail entirely. */
  .watch .side-actions { right: calc(8px + var(--h11-pad)) !important; gap: 6px !important; }
  .watch .side-actions .h11-save { display: none !important; }
  .watch .side-actions #share-btn { order: 1; }
  .watch .side-actions .room-gift-toggle-221 { order: 2; }
  .watch .side-actions #heart-btn { order: 3; }
  .watch .side-actions .act,
  .watch .side-actions .room-gift-toggle-221 {
    width: var(--c264-action) !important;
    min-width: var(--c264-action) !important;
    height: var(--c264-action) !important;
    min-height: var(--c264-action) !important;
  }
  .watch .side-actions .act svg,
  .watch .side-actions .room-gift-toggle-221 svg { width: 19px !important; height: 19px !important; }
  .watch .side-actions #heart-btn { background: var(--pink) !important; }

  /* The composer gets the space freed by the removed bookmark. */
  .watch section.chat .composer {
    right: calc(8px + var(--h11-pad) + (var(--c264-action) * 3) + 18px) !important;
    height: var(--h11-row) !important;
    min-height: var(--h11-row) !important;
  }
  .watch section.chat .composer input { height: var(--h11-row) !important; min-height: var(--h11-row) !important; font-size: 15px !important; }

  /* Bottom product rail: 14% of the phone width, compact typography and one
     ellipsized product-name line. */
  .watch .room-now-154 { height: var(--h11-now) !important; }
  .watch .room-now-154 .room-now-label { width: 58px !important; min-width: 58px !important; padding-inline: 6px !important; font-size: 10px !important; font-weight: 500 !important; line-height: 13px !important; }
  .watch .room-now-154 .room-product-154 { min-height: var(--h11-now) !important; padding: 4px 44px 4px 4px !important; }
  .watch .room-now-154 .room-product-open { gap: 6px !important; }
  .watch .room-now-154 .room-product-open > img { width: 36px !important; height: 36px !important; border-radius: 9px !important; }
  .watch .room-now-154 .room-product-copy { gap: 1px !important; }
  .watch .room-now-154 .room-product-copy strong { display: block !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap !important; font-size: 12px !important; line-height: 15px !important; font-weight: 500 !important; }
  .watch .room-now-154 .room-product-copy b { font-size: 14px !important; line-height: 16px !important; font-weight: 600 !important; font-variant-numeric: tabular-nums lining-nums; }
  .watch .room-now-154 .room-product-154 .room-cart-154 { right: 5px !important; width: 34px !important; min-width: 34px !important; height: 34px !important; }
}

@media (prefers-reduced-motion: reduce) {
  .watch .side-actions .act,
  .watch .side-actions .room-gift-toggle-221 { transition: none !important; }
}

/* 264C-R3 (Roger, 2026-11-14): no channel row in the live room at any width.  room-154.js removes
   the nodes; this keeps a stale shell from showing them and lets the stage move up. */
body.watch .watch-head .primary-nav,
body.watch .watch-head .mobile-channel-tabs,
body.watch .watch-head .tabs { display: none !important; }
@media (max-width: 1024px) {
  body.watch .watch-head { min-height: 56px !important; }
}
@media (max-width: 768px) {
  /* the stage, its top bar and the overlays below it are all placed from this height */
  :root { --room-header-h: 56px; }
}

/* 264C-R2 (Roger reference 1113, 2026-11-14): phone room proportions.  Deal card ~37% of the screen,
   two thin title lines, price + struck compare price + discount on one row (only when the data has
   them), 26px buy button; 22px host pills; 20px category pill. */
@media (max-width: 768px) {
  html body.watch .watch .room-deal-154 { width: 37vw !important; max-width: 160px !important; min-width: 0 !important; }
  html body.watch .watch .room-deal-154 h2 { font-size: 12px !important; line-height: 1.2 !important; }
  html body.watch .watch .room-deal-154 .room-deal-body strong {
    display: -webkit-box !important; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
    white-space: normal !important; font-size: 13px !important; font-weight: 400 !important; line-height: 1.3 !important;
  }
  html body.watch .watch .room-deal-154 .room-deal-price {
    display: flex !important; flex-wrap: nowrap !important; align-items: baseline; gap: 4px; white-space: nowrap; min-height: 0 !important;
  }
  html body.watch .watch .room-deal-154 .room-deal-price b { font-size: 15px !important; line-height: 1.2 !important; }
  html body.watch .watch .room-deal-154 .room-deal-price del { font-size: 10px !important; opacity: .6; }
  html body.watch .watch .room-deal-154 .room-deal-discount {
    padding: 0 4px; border-radius: 999px; font-size: 10px !important; line-height: 16px; background: rgba(255, 71, 126, .14); color: #e8336d;
  }
  html body.watch .watch .room-deal-154 .room-buy-154 {
    height: 26px !important; min-height: 26px !important; padding: 0 8px !important; font-size: 12px !important; gap: 4px !important;
  }
  html body.watch .watch .room-deal-154 .room-buy-154 svg { width: 14px !important; height: 14px !important; }
  html body.watch .watch #desktop-follow-btn,
  html body.watch .watch #live-badge {
    height: 22px !important; min-height: 22px !important; padding: 0 10px !important; font-size: 12px !important; line-height: 22px !important;
  }
  html body.watch .watch .room-category-154 {
    height: 20px !important; min-height: 20px !important; padding: 0 8px !important; font-size: 11px !important; line-height: 20px !important;
  }
}

/* 264C-R4 (Roger, 2026-11-15): one compact host row (avatar 32 / name 14 / pills 20, ⋯ last), no category pill,
   the AI disclosure as a small "AI" badge after the name, no "正在讲解" button under the stage. */
body.watch .room-ai-badge-r4 {
  flex: none; height: 14px; padding: 0 4px; border: 0; border-radius: 4px;
  background: rgba(20, 16, 32, .45); color: rgba(255, 255, 255, .9); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28);
  font: 700 10px/14px "Inter Variable", sans-serif; letter-spacing: .02em; cursor: pointer;
}
body.watch .room-ai-badge-r4:focus-visible { outline: 2px solid #c184ff; outline-offset: 2px; }
html body.watch .watch .room-category-154,
html body.watch .watch .h4-host-category { display: none !important; }
@media (min-width: 769px) {
  /* the desktop host card already names the AI host; the badge is the phone's disclosure entry */
  html body.watch .watch .room-ai-badge-r4 { display: none !important; }
}
@media (max-width: 768px) {
  html body.watch .watch #stage-wrap > .top { align-items: center !important; gap: 6px !important; }
  html body.watch .watch #stage-wrap > .top .host-line {
    order: 1 !important; display: flex !important; align-items: center !important; gap: 6px !important; flex: 0 1 auto !important;
    min-width: 0 !important; min-height: 0 !important; height: 32px !important;
  }
  html body.watch .watch #stage-wrap > .top .host-avatar,
  html body.watch .watch #stage-wrap > .top .host-avatar img { width: 32px !important; height: 32px !important; min-width: 32px !important; flex: 0 0 32px !important; }
  html body.watch .watch #stage-wrap > .top .host-avatar { padding: 1px !important; box-sizing: border-box !important; }
  html body.watch .watch #stage-wrap > .top #host-name {
    align-self: center !important; margin: 0 !important; text-shadow: 0 1px 2px rgba(0, 0, 0, .55); font-size: 14px !important; line-height: 18px !important; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  html body.watch .watch #stage-wrap > .top .room-ai-badge-r4 { order: 2 !important; }
  html body.watch .watch #stage-wrap > .top .desktop-host-tools { order: 3 !important; height: 20px; align-items: center; margin: 0 !important; }
  html body.watch .watch #stage-wrap > .top #desktop-follow-btn,
  html body.watch .watch #stage-wrap > .top #live-badge {
    height: 20px !important; min-height: 20px !important; padding: 0 8px !important; font-size: 11px !important; line-height: 20px !important;
  }
  html body.watch .watch #stage-wrap > .top #live-badge { order: 4 !important; margin: 0 !important; }
  html body.watch .watch #stage-wrap > .top .room-more-154 { order: 99 !important; margin-left: auto !important; }
  /* the original "AI 生成内容 ⌄" row is replaced by the badge; its explanation still opens, under the host row */
  html body.watch .watch .ai-disclosure-group > summary { display: none !important; }
  html body.watch .watch #stage-wrap > .ai-disclosure-group {
    top: calc(var(--room-header-h) + 60px) !important; left: 14px !important; right: auto !important;
    width: min(260px, calc(100vw - 56px)) !important; writing-mode: horizontal-tb !important;
  }
  html body.watch .watch #stage-wrap > .ai-disclosure-group[open] > #ai-disclosure {
    display: flex !important; align-items: center; gap: 8px; width: 100% !important; box-sizing: border-box; padding: 8px 10px;
    border-radius: 10px; background: rgba(20, 16, 32, .82); color: #fff; font-size: 12px; line-height: 1.4;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
  }
  html body.watch .watch #stage-wrap > .ai-disclosure-group:not([open]) > #ai-disclosure { display: none !important; }
  /* bottom bar: no "正在讲解" button (kept for screen readers); the current card fills the row, a thin rule before
     the thumbnails, a fine outline while it is on air */
  html body.watch .watch .room-now-154 .room-now-label {
    position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important;
    overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important;
  }
  html body.watch .watch .room-now-154 > .room-product-154 { flex: 1 1 auto !important; min-width: 0 !important; margin-left: 0 !important; }
  html body.watch .watch .room-now-154 > .room-now-carousel {
    flex: 0 1 auto; margin-left: 8px !important; padding-left: 8px !important; border-left: 1px solid rgba(255, 255, 255, .35) !important;
  }
  html body.watch .watch .room-now-154[data-onair="1"] > .room-product-154 { box-shadow: 0 0 0 1px rgba(193, 132, 255, .9) !important; }
}
