/* Desktop shell and responsive portal layout. */

/* Phase 1: desktop portal shell and mobile app polish */
.desktop-shell{
  min-height:100vh;
}
.desktop-sidebar{
  display:none;
}
.desktop-main{
  min-width:0;
}
.page-head-actions{
  display:flex;
  flex-wrap:wrap;
  justify-content:flex-end;
  align-items:center;
  gap:8px;
}
@media (max-width:899px){
  .desktop-shell,
  .desktop-main{
    display:block;
  }
  .has-bottom-nav{
    background:#f5f7fb;
    padding-bottom:calc(68px + env(safe-area-inset-bottom))!important;
  }
  .has-bottom-nav .app-shell{
    max-width:560px;
    background:#f7f9fc;
  }
  .has-bottom-nav .topbar,
  .has-bottom-nav .ui-white-topbar{
    padding:8px 14px 7px!important;
    min-height:56px;
  }
  .has-bottom-nav .brand{
    gap:10px;
  }
  .has-bottom-nav .brand-left{
    gap:9px;
  }
  .has-bottom-nav .brand-mark{
    width:38px!important;
    height:38px!important;
    flex:0 0 38px!important;
    border-radius:13px!important;
  }
  .has-bottom-nav .brand-copy h1,
  .has-bottom-nav .brand h1{
    font-size:19px!important;
    line-height:1.1!important;
  }
  .has-bottom-nav .brand-copy small,
  .has-bottom-nav .brand small{
    margin-top:2px!important;
    font-size:11px!important;
    line-height:1.25!important;
  }
  .has-bottom-nav .settings-icon-btn,
  .has-bottom-nav .icon-btn{
    width:38px!important;
    height:38px!important;
    border-radius:14px!important;
    font-size:20px!important;
    box-shadow:0 8px 20px rgba(22,36,65,.08)!important;
  }
  .has-bottom-nav .page{
    padding-inline:16px;
  }
  .has-bottom-nav .v51-title{
    gap:10px;
    margin:0 0 12px;
  }
  .has-bottom-nav .create-page .v51-title-icon{
    display:grid;
    place-items:center;
    width:28px;
    height:28px;
    flex:0 0 28px;
    border-radius:10px;
    background:#eef4ff;
    color:#4261d8;
    font-size:15px;
    text-shadow:none;
  }
  .has-bottom-nav .create-page .v51-title h2{
    font-size:18px!important;
    line-height:1.25!important;
    font-weight:720!important;
  }
  .has-bottom-nav .create-page .v51-title p{
    margin-top:4px!important;
    font-size:12px!important;
    line-height:1.45!important;
  }
  .has-bottom-nav .v51-game-card,
  .has-bottom-nav .surface-card,
  .has-bottom-nav .v53-room-card,
  .has-bottom-nav .v53-record-card,
  .has-bottom-nav .weekly-rank-item{
    box-shadow:0 10px 26px rgba(24,39,75,.07)!important;
  }
  .has-bottom-nav .v51-game-card{
    border-radius:20px!important;
    gap:11px!important;
    padding:12px!important;
  }
  .has-bottom-nav .v51-game-thumb{
    height:128px!important;
    border-radius:15px!important;
  }
  .has-bottom-nav .v51-game-title-row h3{
    font-size:18px!important;
  }
  .has-bottom-nav .v51-game-title-row p{
    margin-top:5px!important;
    font-size:12.5px!important;
    line-height:1.45!important;
  }
  .has-bottom-nav .bottom-nav{
    height:calc(64px + env(safe-area-inset-bottom))!important;
    padding:6px 12px calc(6px + env(safe-area-inset-bottom))!important;
    gap:5px!important;
    border-radius:18px 18px 0 0!important;
    box-shadow:0 -10px 24px rgba(17,31,58,.1),0 -1px 0 rgba(255,255,255,.72) inset!important;
  }
  .has-bottom-nav .bottom-nav a{
    height:50px!important;
    min-height:0!important;
    gap:2px!important;
    padding:4px 2px!important;
    border-radius:14px!important;
    font-size:10px!important;
  }
  .has-bottom-nav .bottom-nav-icon{
    width:21px!important;
    height:21px!important;
  }
  .has-bottom-nav .bottom-nav-icon svg{
    width:20px!important;
    height:20px!important;
  }
  .has-bottom-nav .bottom-nav a b{
    font-size:10px!important;
    line-height:1.05!important;
  }
  .has-bottom-nav .room-summary-card .page-head{
    align-items:flex-start;
  }
  .has-bottom-nav .page-head-actions{
    flex-direction:column;
    align-items:flex-end;
  }
  .has-bottom-nav .records-rank-btn{
    height:32px;
    min-height:32px;
    padding:0 10px;
    border-radius:999px;
    font-size:11px;
    box-shadow:none;
  }
}

@media (min-width:900px){
  body.has-desktop-sidebar{
    min-height:100%;
    background:#f2f5fa!important;
  }
  body.has-desktop-sidebar{
    padding-bottom:0!important;
    color:#172033;
  }
  .has-desktop-sidebar .desktop-shell{
    width:100%;
    max-width:1480px;
    margin:0 auto;
    display:grid;
    grid-template-columns:240px minmax(0,1fr);
    align-items:start;
  }
  .has-desktop-sidebar .desktop-sidebar{
    position:sticky;
    top:0;
    height:100vh;
    display:flex;
    flex-direction:column;
    gap:22px;
    padding:24px 16px;
    background:#fff;
    border-right:1px solid #e3e9f4;
    box-shadow:8px 0 32px rgba(33,45,70,.04);
  }
  .desktop-brand{
    display:flex;
    align-items:center;
    gap:12px;
    padding:4px 8px 18px;
    color:#121a2c;
    text-decoration:none;
    border-bottom:1px solid #edf1f7;
  }
  .desktop-brand__mark{
    width:42px;
    height:42px;
    flex:0 0 42px;
    border-radius:14px;
    display:grid;
    place-items:center;
    overflow:hidden;
    color:#fff;
    font-size:13px;
    font-weight:800;
    background:linear-gradient(135deg,#4a8cff,#28c7f0 58%,#7c5cff);
    box-shadow:0 12px 24px rgba(43,105,220,.2);
  }
  .desktop-brand__mark img{
    width:100%;
    height:100%;
    object-fit:contain;
    background:#fff;
  }
  .desktop-brand__text{
    min-width:0;
    display:grid;
    gap:3px;
  }
  .desktop-brand__text b{
    color:#121a2c;
    font-size:18px;
    line-height:1.12;
    font-weight:760;
  }
  .desktop-brand__text small{
    color:#748097;
    font-size:12px;
    font-weight:500;
  }
  .desktop-nav{
    display:grid;
    gap:6px;
  }
  .desktop-nav a,
  .desktop-nav button,
  .desktop-settings{
    width:100%;
    min-height:54px;
    display:grid;
    grid-template-columns:32px minmax(0,1fr);
    align-items:center;
    column-gap:10px;
    padding:9px 10px;
    border:0;
    border-radius:14px;
    background:transparent;
    color:#46546c;
    text-align:left;
    text-decoration:none;
    cursor:pointer;
  }
  .desktop-nav a:hover,
  .desktop-nav button:hover,
  .desktop-settings:hover{
    background:#f3f6fb;
    color:#1d4ed8;
  }
  .desktop-nav a.active{
    color:#1d4ed8;
    background:#edf4ff;
    box-shadow:inset 0 0 0 1px rgba(73,126,245,.14);
  }
  .desktop-nav__icon{
    width:32px;
    height:32px;
    display:grid;
    place-items:center;
    border-radius:11px;
    background:#f0f4fb;
    color:currentColor;
  }
  .desktop-nav a.active .desktop-nav__icon{
    background:#dfeaff;
  }
  .desktop-nav__icon svg{
    width:20px;
    height:20px;
    display:block;
    fill:none;
    stroke:currentColor;
    stroke-width:1.9;
    stroke-linecap:round;
    stroke-linejoin:round;
  }
  .desktop-nav__copy{
    min-width:0;
    display:grid;
    gap:2px;
  }
  .desktop-nav__copy b{
    overflow:hidden;
    color:inherit;
    font-size:14px;
    line-height:1.15;
    font-weight:720;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
  .desktop-nav__copy small{
    overflow:hidden;
    color:#8a95a8;
    font-size:11px;
    line-height:1.2;
    font-weight:500;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
  .desktop-nav a.active .desktop-nav__copy small,
  .desktop-nav a:hover .desktop-nav__copy small,
  .desktop-nav button:hover .desktop-nav__copy small,
  .desktop-settings:hover .desktop-nav__copy small{
    color:#5c73a6;
  }
  .desktop-sidebar-bottom{
    margin-top:auto;
    display:grid;
    gap:14px;
  }
  .desktop-policy-links{
    display:flex;
    flex-wrap:wrap;
    gap:7px 10px;
    padding:0 10px 4px;
    color:#909aae;
    font-size:11px;
    line-height:1.4;
  }
  .desktop-policy-links a{
    color:inherit;
    text-decoration:none;
  }
  .desktop-policy-links a:hover{
    color:#1d4ed8;
  }
  .has-desktop-sidebar .desktop-main{
    min-height:100vh;
    padding:28px 34px 54px;
  }
  .has-desktop-sidebar .app-shell{
    max-width:none!important;
    min-height:auto;
    margin:0;
    background:transparent!important;
    box-shadow:none!important;
  }
  .has-desktop-sidebar .topbar,
  .has-desktop-sidebar .ui-white-topbar,
  .has-desktop-sidebar .bottom-nav{
    display:none!important;
  }
  .has-desktop-sidebar .legal-footer{
    position:static;
    max-width:none;
    padding:20px 0 0!important;
    background:transparent;
    color:#97a1b3;
  }
  .has-desktop-sidebar .page{
    width:100%;
    max-width:1120px;
    margin:0 auto;
    padding:0 0 34px!important;
  }
  .has-desktop-sidebar .create-page{
    max-width:1180px;
  }
  .has-desktop-sidebar .v51-title{
    margin:0 0 16px!important;
    padding:0!important;
  }
  .has-desktop-sidebar .create-page .v51-title{
    align-items:center;
  }
  .has-desktop-sidebar .create-page .v51-title-icon{
    display:grid;
    place-items:center;
    width:32px;
    height:32px;
    flex:0 0 32px;
    border-radius:11px;
    background:#eef4ff;
    color:#4261d8;
    font-size:17px;
    text-shadow:none;
  }
  .has-desktop-sidebar .create-page .v51-title h2{
    color:#111827;
    font-size:22px!important;
    line-height:1.22!important;
    font-weight:740!important;
  }
  .has-desktop-sidebar .create-page .v51-title p{
    max-width:560px;
    margin-top:5px!important;
    color:#69758b!important;
    font-size:13px!important;
    line-height:1.5!important;
  }
  .has-desktop-sidebar .page-head h2{
    color:#111827;
    font-size:32px!important;
    line-height:1.18!important;
    font-weight:780!important;
  }
  .has-desktop-sidebar .page-head p{
    max-width:680px;
    color:#69758b!important;
    font-size:15px!important;
    line-height:1.65!important;
  }
  .has-desktop-sidebar .surface-card,
  .has-desktop-sidebar .hero-panel,
  .has-desktop-sidebar .card{
    border:1px solid #e1e7f1!important;
    background:#fff!important;
    box-shadow:0 14px 34px rgba(31,45,70,.07)!important;
    color:#172033;
  }
  .has-desktop-sidebar .game-picker-grid{
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:16px;
  }
  .has-desktop-sidebar .v51-game-card{
    min-height:100%;
    gap:13px!important;
    padding:12px!important;
    border-radius:14px!important;
    box-shadow:0 10px 26px rgba(31,45,70,.07)!important;
    transition:transform .16s ease,border-color .16s ease,box-shadow .16s ease;
  }
  .has-desktop-sidebar .v51-game-card:hover{
    transform:translateY(-2px);
    border-color:#cbd8ec!important;
    box-shadow:0 18px 36px rgba(31,45,70,.1)!important;
  }
  .has-desktop-sidebar .v51-game-thumb{
    height:142px!important;
    border-radius:10px!important;
  }
  .has-desktop-sidebar .v51-game-info{
    gap:10px;
  }
  .has-desktop-sidebar .v51-game-title-row h3{
    font-size:18px!important;
    line-height:1.2!important;
  }
  .has-desktop-sidebar .v51-game-title-row p{
    font-size:13px!important;
  }
  .has-desktop-sidebar .create-page .v51-game-actions{
    grid-template-columns:minmax(0,1fr) 84px!important;
    gap:8px!important;
  }
  .has-desktop-sidebar .create-page .v51-create-btn,
  .has-desktop-sidebar .create-page .v51-guide-btn{
    height:38px!important;
    min-height:38px!important;
    border-radius:10px!important;
  }
  .has-desktop-sidebar .create-page .v51-create-btn{
    justify-content:flex-start!important;
    padding-inline:11px!important;
  }
  .has-desktop-sidebar .create-page .v51-create-btn b{
    margin-left:auto!important;
  }
  .has-desktop-sidebar .rooms-page,
  .has-desktop-sidebar .records-page{
    max-width:1040px;
  }
  .has-desktop-sidebar .room-summary-card{
    padding:20px 22px!important;
    border-radius:16px!important;
  }
  .has-desktop-sidebar .room-summary-card .page-head{
    align-items:center;
    margin-bottom:0!important;
  }
  .has-desktop-sidebar .section-title{
    margin:20px 0 12px!important;
  }
  .has-desktop-sidebar .section-title h3{
    color:#253047;
    font-size:16px!important;
    font-weight:760!important;
  }
  .has-desktop-sidebar .v53-room-list,
  .has-desktop-sidebar .v53-record-list,
  .has-desktop-sidebar .weekly-rank-list{
    gap:14px;
  }
  .has-desktop-sidebar .v53-room-card{
    grid-template-columns:104px minmax(0,1fr)!important;
    gap:16px!important;
    align-items:center;
    padding:14px 16px!important;
    border-radius:14px!important;
    box-shadow:0 8px 22px rgba(31,45,70,.06)!important;
  }
  .has-desktop-sidebar .v53-room-thumb{
    width:104px!important;
    min-height:82px!important;
    aspect-ratio:1.26/1!important;
    border-radius:11px!important;
  }
  .has-desktop-sidebar .v53-room-body{
    grid-template-columns:minmax(0,1fr) auto;
    grid-template-rows:auto auto;
    align-items:center;
    gap:8px 18px!important;
  }
  .has-desktop-sidebar .v53-room-top{
    grid-column:1/2;
  }
  .has-desktop-sidebar .v53-room-dates{
    grid-column:1/2;
  }
  .has-desktop-sidebar .v53-room-actions{
    grid-column:2/3;
    grid-row:1/3;
    align-self:center;
  }
  .has-desktop-sidebar .v53-record-card{
    grid-template-columns:96px minmax(0,1fr)!important;
    gap:16px!important;
    padding:14px 16px!important;
    border-radius:14px!important;
    box-shadow:0 8px 22px rgba(31,45,70,.06)!important;
  }
  .has-desktop-sidebar .v53-record-thumb{
    min-height:76px!important;
    border-radius:11px!important;
  }
  .has-desktop-sidebar .v53-record-body{
    align-items:center;
    grid-template-columns:minmax(0,1fr) 132px!important;
  }
  .has-desktop-sidebar .v53-room-title-area h4,
  .has-desktop-sidebar .v53-record-main h4{
    font-size:18px!important;
  }
  .has-desktop-sidebar .v53-action-btn{
    width:auto;
    min-width:92px;
    height:38px;
    padding-inline:14px;
    border-radius:10px;
    font-size:13px;
  }
  .has-desktop-sidebar .records-rank-btn{
    height:34px;
    min-height:34px;
    padding:0 12px;
    border-radius:10px;
    font-size:12px;
  }
  .has-desktop-sidebar .weekly-rank-page{
    max-width:980px;
  }
  .has-desktop-sidebar .weekly-game-tabs{
    overflow:visible!important;
    flex-wrap:wrap;
  }
  .has-desktop-sidebar .weekly-game-tabs a{
    flex:0 0 auto;
  }
  .has-desktop-sidebar .weekly-rank-item{
    grid-template-columns:54px minmax(0,1fr) 120px;
    padding:16px 18px!important;
    border-radius:16px!important;
  }
  .has-desktop-sidebar .weekly-rank-num{
    width:42px;
    height:42px;
    border-radius:14px;
  }
  .desktop-shell--plain{
    display:block;
    min-height:100vh;
  }
  .desktop-shell--plain .desktop-main{
    min-height:100vh;
  }
  .desktop-shell--plain .app-shell{
    max-width:760px!important;
    background:transparent!important;
    box-shadow:none!important;
  }
}

@media (min-width:1200px){
  .has-desktop-sidebar .game-picker-grid{
    grid-template-columns:repeat(3,minmax(0,1fr));
  }
  .has-desktop-sidebar .desktop-main{
    padding-inline:42px;
  }
}

@media (min-width:900px) and (max-width:1180px){
  .has-desktop-sidebar .desktop-shell{
    grid-template-columns:220px minmax(0,1fr);
  }
  .has-desktop-sidebar .desktop-main{
    padding:24px 24px 44px;
  }
  .has-desktop-sidebar .game-picker-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}
