/* VW_WATCH_TOGETHER_PREMIUM_CLEAN_PLAYER_FINAL_V3_15R3
   Additive refinement over V3.15R1.

   Locked by A5 -> A9 audit chain:
   - clean video by default; no permanent rail over the movie;
   - Room "Player" trigger lives with Android Videos / Music / Room menu;
   - existing V3.15R1 premium drawer opens only on request;
   - PM keeps four header grid cells: back | avatar | title | right action cluster;
   - right cluster = Player | Video | Chats;
   - Hide Video slides the SAME stage left, collapses it to 0 and expands PM to composer;
   - Show Video restores the SAME stage/video nodes and parents;
   - tight keyboard gets a small Show video chip because the PM header is intentionally hidden.
*/

:root{
  --vw-clean-accent:#7768ff;
  --vw-clean-accent-2:#5ba9ff;
  --vw-clean-ease:cubic-bezier(.2,.82,.18,1);
}

/* The R1 rail remains as an internal API dependency, but is never painted. */
#vwPlayerPremiumRail{
  display:none!important;
}

/* ---------- Room bar: Player beside Videos / Music ---------- */
@media(max-width:980px){
  body.vw-android-room-shell .vw-android-presence-bar{
    overflow:hidden!important;
  }

  body.vw-android-room-shell .vw-android-presence-main{
    max-width:calc(100% - 211px)!important;
    min-width:96px!important;
  }

  body.vw-android-room-shell .vw-premium-room-player-action{
    position:relative;
    overflow:hidden;
    isolation:isolate;
  }

  body.vw-android-room-shell .vw-premium-room-player-action::after{
    content:"";
    position:absolute;
    inset:0;
    pointer-events:none;
    background:radial-gradient(circle at 50% 0%,rgba(119,104,255,.18),transparent 68%);
    opacity:0;
    transition:opacity .18s ease;
  }

  body.vw-android-room-shell .vw-premium-room-player-action.active{
    border-color:rgba(132,119,255,.30)!important;
    background:linear-gradient(180deg,rgba(119,104,255,.16),rgba(255,255,255,.035))!important;
    box-shadow:0 8px 22px rgba(64,54,205,.16)!important;
  }

  body.vw-android-room-shell .vw-premium-room-player-action.active::after{opacity:1}

  body.vw-android-room-shell .vw-premium-room-player-action .vw-android-media-icon svg{
    width:17px;
    height:17px;
    display:block;
  }

  /* ---------- PM four-column header with one right action cluster ---------- */
  body.vw-android-room-shell.vw-private-thread-open .private-thread-head.vw-premium-clean-thread-head{
    box-sizing:border-box!important;
    display:grid!important;
    grid-template-columns:44px 42px minmax(0,1fr) auto!important;
    align-items:center!important;
    gap:7px!important;
    min-height:58px!important;
    height:auto!important;
    padding:6px 8px!important;
  }

  body.vw-android-room-shell .vw-premium-pm-actions{
    display:flex!important;
    align-items:center!important;
    justify-content:flex-end!important;
    justify-self:end!important;
    gap:5px!important;
    min-width:0!important;
    width:auto!important;
  }

  body.vw-android-room-shell .vw-premium-pm-icon{
    box-sizing:border-box!important;
    width:34px!important;
    min-width:34px!important;
    max-width:34px!important;
    height:36px!important;
    min-height:36px!important;
    display:grid!important;
    place-items:center!important;
    padding:0!important;
    margin:0!important;
    border:1px solid rgba(255,255,255,.09)!important;
    border-radius:11px!important;
    background:rgba(255,255,255,.045)!important;
    color:#eef2ff!important;
    box-shadow:inset 0 1px 0 rgba(255,255,255,.025)!important;
    cursor:pointer;
    -webkit-tap-highlight-color:transparent;
    transition:transform .15s ease,background .17s ease,border-color .17s ease,box-shadow .17s ease!important;
  }

  body.vw-android-room-shell .vw-premium-pm-icon svg{
    width:16px;
    height:16px;
    display:block;
  }

  body.vw-android-room-shell .vw-premium-pm-icon:hover,
  body.vw-android-room-shell .vw-premium-pm-icon:focus-visible{
    outline:none!important;
    background:rgba(119,104,255,.14)!important;
    border-color:rgba(137,125,255,.28)!important;
    box-shadow:0 7px 20px rgba(61,56,188,.15)!important;
  }

  body.vw-android-room-shell .vw-premium-pm-icon:active{
    transform:scale(.91);
  }

  body.vw-android-room-shell .vw-premium-pm-player.active{
    background:linear-gradient(135deg,rgba(119,104,255,.92),rgba(78,124,255,.88))!important;
    border-color:rgba(159,150,255,.30)!important;
  }

  body.vw-android-room-shell .vw-premium-pm-video.vw-video-hidden{
    color:#fff!important;
    background:linear-gradient(135deg,rgba(119,104,255,.94),rgba(75,127,255,.90))!important;
    border-color:rgba(161,152,255,.32)!important;
    box-shadow:0 8px 22px rgba(68,65,216,.18)!important;
  }

  body.vw-android-room-shell .vw-premium-pm-actions .private-thread-close{
    box-sizing:border-box!important;
    position:static!important;
    grid-area:auto!important;
    width:auto!important;
    min-width:42px!important;
    max-width:none!important;
    height:36px!important;
    min-height:36px!important;
    margin:0!important;
    padding:0 8px!important;
    border-radius:11px!important;
    flex:0 0 auto!important;
  }

  /* R1 owns the visible PM player lane. R3 only owns the hidden state. */
  body.vw-android-room-shell.vw-player-premium-ready.vw-private-messages-open.vw-private-thread-open.vw-premium-video-hidden .stage{
    transform:translate3d(-108%,0,0)!important;
    opacity:0!important;
    pointer-events:none!important;
    height:0!important;
    min-height:0!important;
    max-height:0!important;
    overflow:hidden!important;
    box-shadow:none!important;
    border-width:0!important;
    transition:
      transform .32s var(--vw-clean-ease),
      opacity .20s ease,
      height .32s var(--vw-clean-ease),
      max-height .32s var(--vw-clean-ease),
      box-shadow .20s ease!important;
    will-change:transform,height,opacity;
  }

  body.vw-android-room-shell.vw-player-premium-ready.vw-private-messages-open.vw-private-thread-open.vw-premium-video-hidden .private-messages-surface{
    top:var(--vw-clean-hidden-top,0px)!important;
    bottom:auto!important;
    height:var(--vw-clean-hidden-height,100dvh)!important;
    max-height:none!important;
    transition:
      top .30s var(--vw-clean-ease),
      height .30s var(--vw-clean-ease),
      opacity .18s ease!important;
  }

  /* Tight keyboard deliberately hides the PM header in the existing product.
     Keep a tiny restore affordance inside the conversation only in that state. */
  #vwPremiumPmShowVideoChip{
    box-sizing:border-box;
    position:fixed;
    left:50%;
    top:calc(var(--vw-private-vv-top,0px) + 6px);
    z-index:2147482860;
    min-height:31px;
    display:flex;
    align-items:center;
    gap:5px;
    padding:0 11px;
    border:1px solid rgba(255,255,255,.11);
    border-radius:999px;
    background:linear-gradient(180deg,rgba(13,18,29,.97),rgba(8,12,20,.97));
    color:#f0f3ff;
    box-shadow:0 9px 28px rgba(0,0,0,.38),inset 0 1px 0 rgba(255,255,255,.035);
    backdrop-filter:blur(16px) saturate(130%);
    -webkit-backdrop-filter:blur(16px) saturate(130%);
    font:800 9px/1 system-ui,sans-serif;
    transform:translate3d(-50%,-12px,0);
    opacity:0;
    pointer-events:none;
    transition:transform .24s var(--vw-clean-ease),opacity .18s ease;
  }

  #vwPremiumPmShowVideoChip svg{
    width:14px;
    height:14px;
    display:block;
  }

  body.vw-premium-video-hidden.vw-android-keyboard-open.vw-android-keyboard-tight #vwPremiumPmShowVideoChip{
    transform:translate3d(-50%,0,0);
    opacity:1;
    pointer-events:auto;
  }
}

@media(max-width:390px){
  body.vw-android-room-shell .vw-android-presence-bar{gap:5px!important}
  body.vw-android-room-shell .vw-android-presence-main{
    max-width:calc(100% - 190px)!important;
    min-width:86px!important;
  }
}

@media(max-width:380px){
  body.vw-android-room-shell.vw-private-thread-open .private-thread-head.vw-premium-clean-thread-head{
    grid-template-columns:40px minmax(0,1fr) auto!important;
    gap:6px!important;
    min-height:54px!important;
    padding:6px!important;
  }

  body.vw-android-room-shell .vw-premium-clean-thread-head .private-thread-avatar{
    display:none!important;
  }

  body.vw-android-room-shell .vw-premium-clean-thread-head .private-surface-back{
    box-sizing:border-box!important;
    width:38px!important;
    min-width:38px!important;
    height:38px!important;
    min-height:38px!important;
  }

  body.vw-android-room-shell .vw-premium-pm-actions{gap:4px!important}

  body.vw-android-room-shell .vw-premium-pm-icon{
    width:32px!important;
    min-width:32px!important;
    max-width:32px!important;
    height:34px!important;
    min-height:34px!important;
    border-radius:10px!important;
  }

  body.vw-android-room-shell .vw-premium-pm-actions .private-thread-close{
    min-width:40px!important;
    height:34px!important;
    min-height:34px!important;
    padding:0 6px!important;
  }
}

@media(max-width:345px){
  body.vw-android-room-shell .vw-android-media-action{
    width:40px!important;
    min-width:40px!important;
  }
  body.vw-android-room-shell .vw-android-media-action small{display:none!important}
  body.vw-android-room-shell .vw-android-presence-main{
    min-width:78px!important;
    max-width:calc(100% - 180px)!important;
  }
}

/* Existing Android keyboard mode keeps ownership of header visibility/height.
   R3 only compacts the right cluster while the header is visible. */
@media(max-width:980px){
  body.vw-android-room-shell.vw-android-keyboard-open.vw-private-thread-open .private-thread-head.vw-premium-clean-thread-head{
    grid-template-columns:34px minmax(0,1fr) auto!important;
    gap:5px!important;
    min-height:42px!important;
    height:auto!important;
    padding:4px 6px!important;
  }

  body.vw-android-room-shell.vw-android-keyboard-open .vw-premium-clean-thread-head .private-thread-avatar{
    display:none!important;
  }

  body.vw-android-room-shell.vw-android-keyboard-open .vw-premium-clean-thread-head .private-surface-back{
    width:32px!important;
    min-width:32px!important;
    height:32px!important;
    min-height:32px!important;
  }

  body.vw-android-room-shell.vw-android-keyboard-open .vw-premium-pm-icon{
    width:30px!important;
    min-width:30px!important;
    max-width:30px!important;
    height:30px!important;
    min-height:30px!important;
    border-radius:9px!important;
  }

  body.vw-android-room-shell.vw-android-keyboard-open .vw-premium-pm-actions .private-thread-close{
    min-width:36px!important;
    height:30px!important;
    min-height:30px!important;
    padding:0 5px!important;
  }
}

@media(prefers-reduced-motion:reduce){
  body.vw-android-room-shell.vw-player-premium-ready.vw-private-messages-open.vw-private-thread-open.vw-premium-video-hidden .stage,
  body.vw-android-room-shell.vw-player-premium-ready.vw-private-messages-open.vw-private-thread-open.vw-premium-video-hidden .private-messages-surface,
  #vwPremiumPmShowVideoChip,
  .vw-premium-pm-icon,
  .vw-premium-room-player-action{
    transition:none!important;
  }
}

/* V3.15R8R9D1 */
#vwPremiumPmDeleteAllBtn>span{font-size:18px;line-height:1;font-weight:800}
