/* 3.7.31 (T396): /tv living room. The account button and Pair / phone-remote never sit on the channel
   name; phones in portrait get a 16:9 player pinned under the top row with now/next and the lineup below.
   Loaded only by tv.html (embedded players keep tv.css alone). TV mode (html.ptv-tv-mode) is unchanged. */

/* Top row: account (left) and Pair / phone remote (right) on every screen. */
main > #header-auth.tv-auth{top:max(12px,env(safe-area-inset-top));left:max(12px,env(safe-area-inset-left));z-index:25}
#tv-top-actions{position:fixed;z-index:24;top:max(12px,env(safe-area-inset-top));right:max(12px,env(safe-area-inset-right));display:flex;align-items:flex-start;gap:8px}
#tv-top-actions .tv-more-menu{display:flex;align-items:center;gap:8px}
#tv-top-actions .tv-more-menu>.tv-phone-remote,#tv-top-actions .tv-more-menu>.tv-pair-link{position:static;inset:auto;display:inline-flex;align-items:center;min-height:40px;padding:8px 14px;border:1px solid #405066;border-radius:999px;background:#172232e6;color:#fff;font:inherit;font-size:13px;font-weight:800;white-space:nowrap;text-decoration:none;cursor:pointer}
#tv-more-button{display:none}
.ptv-tv-mode #tv-top-actions{display:none!important}

/* Larger screens: the now bar starts below the top row; the status chip sits above the remote, not under the buttons. */
.living-room .tv-now-bar{padding-top:calc(max(12px,env(safe-area-inset-top)) + 56px)}
.living-room .tv-status-pill{top:auto;right:auto;left:max(24px,env(safe-area-inset-left),calc(50% - 340px));bottom:calc(max(22px,env(safe-area-inset-bottom) + 12px) + 80px)}
#tv-next-title:empty{display:none}
/* No lineup yet (welcome screen): the status chip is centred near the bottom with the rest of the screen. */
.living-room:not(.is-tuned) .tv-status-pill{left:0;right:0;bottom:max(24px,calc(env(safe-area-inset-bottom) + 16px));width:max-content;max-width:calc(100% - 32px);margin:0 auto;text-align:center}
.living-room .tv-lineup,.living-room .tv-lineup[hidden]{display:none}

/* Phones (portrait and landscape): Pair / phone remote collapse into one options button. */
@media (max-width:680px),(max-height:500px){
  #tv-more-button{display:grid;place-items:center;width:40px;height:40px;padding:0;border:1px solid #405066;border-radius:50%;background:#172232e6;color:#fff;font-size:22px;font-weight:900;line-height:1;cursor:pointer}
  #tv-top-actions .tv-more-menu{display:none;position:absolute;top:48px;right:0;flex-direction:column;align-items:stretch;gap:2px;min-width:230px;padding:6px;border:1px solid #394552;border-radius:14px;background:#080d13f7;box-shadow:0 18px 60px #000c}
  #tv-top-actions.is-open .tv-more-menu{display:flex}
  #tv-more-button[aria-expanded=true]{border-color:#b6ff3b;background:#b6ff3b;color:#061000}
  #tv-top-actions .tv-more-menu>.tv-pair-link{box-shadow:0 -1px 0 #233040}
  #tv-top-actions .tv-more-menu>.tv-phone-remote,#tv-top-actions .tv-more-menu>.tv-pair-link{min-height:44px;justify-content:flex-start;border:0;border-radius:10px;background:transparent;font-size:14px}
  #tv-top-actions .tv-more-menu>.tv-phone-remote:hover,#tv-top-actions .tv-more-menu>.tv-pair-link:hover{background:#151d27}
  main > #header-auth.tv-auth.is-signed-in{width:40px;flex-basis:40px}
}

/* Phone landscape: picture stays full screen; the now bar shares the top row between account and options. */
@media (max-height:500px) and (orientation:landscape){
  .living-room{min-height:0}
  .living-room .tv-now-bar{grid-template-columns:auto minmax(0,1fr);gap:12px;padding:max(10px,env(safe-area-inset-top)) calc(max(12px,env(safe-area-inset-right)) + 54px) 30px calc(max(12px,env(safe-area-inset-left)) + 90px)}
  .living-room .tv-now-bar>.tv-brand,.living-room .tv-guide-open{display:none}
  .living-room .tv-channel-number{min-width:40px;padding-left:0;border:0}
  .living-room .tv-channel-number b{font-size:20px}
  .living-room .tv-now-copy>strong{font-size:16px}
  .living-room .tv-now-copy>span,.living-room .tv-now-copy>small{font-size:12px}
  .living-room .tv-remote{bottom:max(8px,env(safe-area-inset-bottom));padding:5px;width:min(560px,calc(100% - 32px));grid-template-columns:repeat(5,minmax(0,1fr))}
  .living-room .tv-remote button{min-height:48px}
  .living-room .tv-status-pill{left:max(12px,env(safe-area-inset-left),calc(50% - 280px));bottom:calc(max(8px,env(safe-area-inset-bottom)) + 70px)}
  .living-room .tv-now-bar{background:linear-gradient(#020406f2 0%,#020406cc 62%,transparent 100%)}
}

/* Phone portrait while a channel is on: header row, 16:9 player, status, now/next, lineup, remote. */
@media (max-width:680px) and (orientation:portrait){
  .living-room.is-tuned{display:flex;flex-direction:column;box-sizing:border-box;min-height:0;padding-top:calc(max(8px,env(safe-area-inset-top)) + 52px);padding-bottom:calc(max(8px,env(safe-area-inset-bottom)) + 72px)}
  .living-room.is-tuned .tv-stage{position:relative;inset:auto;order:1;flex:none;width:100%;height:auto;aspect-ratio:16/9;overflow:visible}
  .living-room.is-tuned .tv-stage iframe{position:absolute;inset:0}
  .living-room.is-tuned .tv-status-pill{top:calc(100% + 10px);right:auto;bottom:auto;left:max(16px,env(safe-area-inset-left));padding:5px 10px;font-size:11px;backdrop-filter:none}
  .living-room.is-tuned .tv-now-bar{position:static;order:2;flex:none;grid-template-columns:auto minmax(0,1fr);gap:12px;align-items:start;padding:48px max(16px,env(safe-area-inset-right)) 12px max(16px,env(safe-area-inset-left));background:none}
  .living-room.is-tuned .tv-channel-number{min-width:40px;padding:2px 0 0;border:0}
  .living-room.is-tuned .tv-channel-number b{font-size:22px}
  .living-room.is-tuned .tv-now-copy{gap:4px}
  .living-room.is-tuned .tv-now-copy>strong{font-size:19px;line-height:1.2;white-space:normal;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
  .living-room.is-tuned .tv-now-copy>span{font-size:13px}
  .living-room.is-tuned .tv-now-copy>small{font-size:12px}
  .living-room.is-tuned .tv-lineup:not([hidden]){order:3;display:flex;flex-direction:column;flex:1 1 auto;min-height:0;border-top:1px solid #1d2731;padding:10px 4px 0}
  .living-room .tv-lineup h2{margin:0 12px 6px;color:#8f9aa7;font-size:11px;font-weight:850;letter-spacing:.08em;text-transform:uppercase}
  .living-room .tv-lineup-list{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;padding:0 4px 8px;scrollbar-width:none}
  .living-room .tv-lineup-list .tv-guide-row{min-height:56px}
}
