/* Tablet / desktop layouts (the frame that is wider than a phone).
   Same breakpoint the rest of the app uses for "the phone becomes a tablet".
   Rule of thumb: navigation on the LEFT (collapsible), the main thing and its actions on the RIGHT. */

/* labels + collapse buttons only exist for the rails, so hide them everywhere else */
.tkdock .dl,.tkdock .dtog,.sg-tog{display:none}
/* Menu (collapse) buttons are for the tablet rail only. Other rules set display on every dock button, so force-hide below the tablet breakpoint */
@media not all and (min-width:768px) and (min-height:520px){
  html:root #appview .tkdock .dtog,html:root .sg-nav .sg-tog,.sg-wrap>.sg-nav .sg-tog{display:none!important}
}
.sg-main{flex:1;min-height:0;min-width:0;display:flex;flex-direction:column;overflow:hidden}
.sg-wrap{min-width:0;overflow:hidden}

/* Songify queue: opens right under the Queue button (never on top of it) on every screen size */
.np-q{position:static!important;transform:none!important;bottom:auto!important;left:auto!important;right:auto!important;
  max-height:min(46vh,340px);margin:12px 0 4px;border-radius:16px!important;padding:12px 14px!important;box-shadow:none!important;background:rgba(0,0,0,.34)!important;flex:none}
.sg-np.qopen .np-q{animation:npqFade .2s ease-out}
@keyframes npqFade{from{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:none}}
.np-qbtn{position:relative;z-index:3}

@media (min-width:768px) and (min-height:520px){

  /* ================= P-Gist: left rail, feed in the middle, actions on the right ================= */
  #appview{--rail:196px}
  #appview.navc{--rail:68px}
  html:root #appview.pgist-social{padding-left:var(--rail)}
  html:root #appview.pgist-social.rlmode.rlfull{padding-left:var(--rail)!important}

  html:root #appview.pgist-social.pgist-social.pgist-social .tkdock.gicons,
  html:root #appview.pgist-social.pgist-social.pgist-social.rlfull .tkdock.gicons{
    display:flex!important;position:absolute;left:0;right:auto;top:0;bottom:0;transform:none;width:var(--rail);height:auto;max-width:none;margin:0;
    padding:12px 8px;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:6px;overflow:hidden;z-index:8;
    background:var(--g-bg,#fff);border:0;border-right:1px solid var(--g-line,#e7eaee);border-radius:0;box-shadow:none;transition:width .22s ease}
  html:root #appview.pgist-social.pgist-social.pgist-social.rlfull .tkdock.gicons{padding-top:58px}
  html:root #appview.pgist-social.pgist-social.pgist-social .tkdock.gicons button{
    flex:none;width:100%;height:46px;min-width:0;display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:14px;padding:0 14px;
    border-radius:14px;color:var(--g-mut,#667085);font:700 14px 'Plus Jakarta Sans',system-ui,sans-serif;white-space:nowrap;position:relative}
  html:root #appview.pgist-social.pgist-social.pgist-social .tkdock.gicons button i{font-size:19px;width:22px;text-align:center;flex:none}
  html:root #appview.pgist-social.pgist-social.pgist-social .tkdock.gicons button .dl{display:inline}
  html:root #appview.pgist-social.pgist-social.pgist-social .tkdock.gicons button.on{color:var(--g-ink,#14171c);background:var(--g-chip,#eef1f4)}
  html:root #appview.pgist-social.pgist-social.pgist-social .tkdock.gicons .mk{background:var(--g-acc,#d8f23c);color:var(--g-acc-ink,#14170a);min-width:0}
  html:root #appview.pgist-social.pgist-social.pgist-social .tkdock.gicons .dtog{display:flex;color:var(--g-ink,#14171c);margin-bottom:6px}
  html:root #appview.pgist-social.pgist-social.pgist-social .tkdock.gicons .gdot{position:absolute;left:30px;top:10px}
  /* collapsed = icons only */
  html:root #appview.navc.pgist-social.pgist-social.pgist-social .tkdock.gicons button{justify-content:center;padding:0}
  html:root #appview.navc.pgist-social.pgist-social.pgist-social .tkdock.gicons button .dl{display:none}

  /* ================= Reels: left rail (starts collapsed), actions open on the right ================= */
  html:root #appview.pgist-social.rlmode .rl-v{object-fit:contain}
  html:root #appview.pgist-social.rlmode .rl-info{right:104px}
  html:root #appview.pgist-social.rlmode .rl-act{right:18px;bottom:max(22px,calc(env(safe-area-inset-bottom) + 20px))}
  html:root #appview.pgist-social.rlmode .rl-act .rl-more-btn{display:none}
  html:root #appview.pgist-social.rlmode .rl-act .rl-actions-menu{display:flex!important;position:static;width:auto;max-width:none;padding:0;border:0;border-radius:0;
    background:none;box-shadow:none;-webkit-backdrop-filter:none;backdrop-filter:none;flex-direction:column;align-items:center;gap:11px}
  html:root #appview.pgist-social.rlmode .rl-actions-menu button{width:60px;min-height:0;padding:0;flex-direction:column;justify-content:flex-start;align-items:center;gap:3px;background:none;text-shadow:0 1px 3px rgba(0,0,0,.7)}
  html:root #appview.pgist-social.rlmode .rl-actions-menu button>i,html:root #appview.pgist-social.rlmode .rl-actions-menu button .rl-like-ico{
    width:44px;height:44px;border-radius:50%;background:rgba(0,0,0,.42);display:grid;place-items:center;font-size:19px;color:#fff}
  html:root #appview.pgist-social.rlmode .rl-actions-menu button .rl-like-ico i{font-size:19px}
  html:root #appview.pgist-social.rlmode .rl-actions-menu button.lk.on .rl-like-ico{color:#ffc933}
  html:root #appview.pgist-social.rlmode .rl-actions-menu button em{margin:0;color:#fff;font:700 11px system-ui}
  html:root #appview.pgist-social.rlmode .rl-actions-menu button[data-action="sound"]{display:none}

  /* ================= Songify: left rail (collapsible), everything else on the right ================= */
  .sg-wrap{flex-direction:row}
  .sg-wrap>.sg-nav{order:-1;flex:none;width:176px;flex-direction:column;justify-content:flex-start;gap:4px;padding:12px 8px;border-top:0;
    border-right:1px solid rgba(255,255,255,.08);background:#0b0b0b;transition:width .22s ease;overflow:hidden}
  html .sg-dark .sg-wrap>.sg-nav{background:#0b0b0b;border-top:0}
  .sg-wrap>.sg-nav button{flex:none;flex-direction:row;justify-content:flex-start;gap:14px;padding:12px 14px;border-radius:12px;font-size:14px;white-space:nowrap}
  .sg-wrap>.sg-nav button i{width:20px;text-align:center;font-size:18px}
  .sg-wrap>.sg-nav button.on{background:rgba(255,255,255,.09)}
  .sg-wrap>.sg-nav .sg-tog{display:flex;margin-bottom:6px;color:#fff}
  .sg-wrap.sgc>.sg-nav{width:64px}
  .sg-wrap.sgc>.sg-nav button{justify-content:center;padding:12px 0}
  .sg-wrap.sgc>.sg-nav button span{display:none}
  .sg-body{overflow-x:hidden}
  .sg-body .songify-results{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:20px}
  .sg-body .songify-result{min-width:0;overflow:hidden}
  .sg-body .songify-result>span{min-width:0;flex:1}
  .sg-body .songify-result b,.sg-body .songify-result small{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .sg-body .songify-head,.sg-body .songify-search,.sg-body .songify-player{min-width:0;max-width:100%;box-sizing:border-box}

  /* Now Playing: record / video on the LEFT, details + controls + queue on the RIGHT */
  .sg-np{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);column-gap:44px;grid-auto-rows:min-content;align-content:center;padding:calc(58px + env(safe-area-inset-top,0px)) 44px 26px}
  .sg-np>*{grid-column:2;min-width:0}
  .sg-np>.np-top{grid-column:1 / -1;margin-bottom:6px}
  .sg-np>.np-stage,.sg-np>.np-youtube{grid-column:1;grid-row:2 / span 9;align-self:center;margin:0}
  .sg-np>.np-provider-note{grid-column:1;grid-row:11}
  .sg-np .np-disc{width:min(88%,340px)}
  .sg-np .np-youtube{min-height:0}
  .sg-np .np-q{max-height:min(34vh,260px)}

  /* ================= Style: avatar (drag to spin) on the LEFT, options on the RIGHT ================= */
  html:root .screen.light .appview .abody.stx{display:grid;grid-template-columns:minmax(230px,38%) minmax(0,1fr);column-gap:22px;align-items:start;max-width:none;padding:12px 20px 18px}
  .abody.stx>.stleft{grid-column:1;grid-row:1 / span 2;position:sticky;top:8px}
  .abody.stx .stpv{width:min(320px,100%)}
  .abody.stx>.sttabs{grid-column:2;grid-row:1;flex-wrap:wrap;overflow:visible;padding:4px 0 8px;position:static}
  .abody.stx>#stBody{grid-column:2;grid-row:2;padding:0}
}

/* wrappers added for the Jobs and Bot (pet) screens: invisible on a phone, two columns on a tablet */
.jcols,.jleft,.jright,.pcols,.pleft,.pright{display:contents}
@media (min-width:768px) and (min-height:520px){
  /* ================= Jobs: your job on the LEFT, the jobs you can switch to on the RIGHT ================= */
  html:root .screen.light .appview .abody.jobsx{max-width:none}
  .jobsx .jcols{display:grid;grid-template-columns:minmax(260px,38%) minmax(0,1fr);column-gap:22px;align-items:start}
  .jobsx .jleft{display:block;position:sticky;top:6px}
  .jobsx .jright{display:block}

  /* ================= Bot / pet: the pet room on the LEFT, needs + actions on the RIGHT ================= */
  html:root .screen.light .appview .abody.pet{max-width:none}
  .pet .pcols{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);column-gap:22px;align-items:start}
  .pet .pleft{display:block;position:sticky;top:6px}
  .pet .pright{display:flex;flex-direction:column;gap:4px}
  .pet .pstage{height:clamp(220px,46vh,400px)}
  .pet .pright .pmode.seg2{margin:8px 0 0;max-width:none}
  .pet .pright .qr,.pet .pright .cin{max-width:none;margin-left:0;margin-right:0;width:100%}
  .pet .pright .qr{margin-top:6px}
  .pet .pright .cin{margin-top:6px}
}

/* phones: the Songify queue spans the full width of the now-playing screen (small side padding only) */
@media not all and (min-width:768px) and (min-height:520px){
  .sg-np .np-q{margin:12px -22px 4px!important;padding:12px 10px!important;border-radius:16px 16px 0 0!important}
}
