/* Home 0.8.12: viewport-sized application shell from the approved desktop reference. */
:root { --shell-rail: 224px; --shell-top: 68px; --shell-gap: 12px; }
body { overscroll-behavior: none; }
body.home-view-active { font-family: "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif; }
.home-sponsor-card { text-decoration: none; color: #fff; cursor: pointer; }
.home-sponsor-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.home-sponsor-card::before { background: linear-gradient(180deg,rgba(3,10,20,.08),rgba(3,10,20,.05) 45%,rgba(3,10,20,.85)); z-index: -1; }
.home-sponsor-card::after { display: none; }
.home-sponsor-copy { min-width: 0; position: relative; }
.home-sponsor-copy > span { display: block; color: #39dbff; font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.home-sponsor-copy > strong { display: block; margin: 10px 0 0; font-size: clamp(16px,1.2vw,23px); line-height: 1.15; }
.home-sponsor-copy > small { display: block; position: static; margin-top: 12px; color: #d6e5fc; font-size: 12px; line-height: 1.5; }
.home-sponsor-arrow { position: absolute; right: 14px; bottom: 14px; width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #8b44c3; border-radius: 50%; background: #170d2f; font-size: 20px; }
.home-sponsor-card:hover { border-color: #7059ed; }
.home-sponsor-card:focus-visible { outline: 2px solid #54d9ff; outline-offset: -3px; }
.home-empty-state { display: flex; flex: 1; flex-direction: column; justify-content: center; align-items: center; min-width: 0; min-height: 0; padding: 16px 14px; text-align: center; color: #a8bad6; gap: 10px; }
.home-empty-icon { color: #6b84a8; display: grid; place-items: center; }
.home-empty-icon svg { width: 38px; height: 38px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.home-empty-state strong { font-size: 13px; font-weight: 600; line-height: 1.45; }
.home-empty-state strong:empty { display: none; }
.home-empty-state p { max-width: 240px; margin: 0; font-size: 12px; line-height: 1.55; color: #a8bad6; }
.home-empty-action { margin-top: 4px; padding: 9px 17px; border: 1px solid #31516c; border-radius: 8px; background: linear-gradient(135deg,#122336,#0b1725); color: #eef4ff; cursor: pointer; font-size: 12px; }
.home-empty-action:hover { border-color: #6b8fff; background: #152942; }
.approved-live-card { color: #f5f7fc; text-align: left; font: inherit; padding: 0; }
.approved-live-cover > img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.approved-live-cover > span { display: flex; align-items: center; gap: 5px; }
.approved-live-cover > span svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; }
#nowView svg { fill: none; stroke: currentColor; stroke-width: 1.8; }
.approved-news-row > span:nth-child(2) { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
.approved-news-row > span:nth-child(2) strong { font-size: 12px; line-height: 1.35; }
.approved-news-row > span:nth-child(2) small { font-size: 11px; line-height: 1.45; }
.approved-news-row .home-news-arrow { flex: none; font-size: 20px; color: #9bb7db; }
.approved-bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; grid-column: 1/-1; min-width: 0; }
.approved-bottom-grid .home-wide-sponsor { grid-column: 1/-1; min-height: 175px; }
.home-friend-search { display: flex; align-items: center; flex: none; gap: 10px; height: 38px; margin: 10px 15px 0; padding: 0 11px; border: 1px solid #25445c; border-radius: 8px; background: #071320; color: #92b4dd; }
.home-friend-search svg { width: 17px; height: 17px; }
.home-friend-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: #dfeeff; font-size: 12px; }
.home-friend-search:focus-within { border-color: #6196df; }
.home-friend-search input::placeholder { color: #97b1d3; }

@media (min-width: 768px) {
  body.home-view-active { --home-aside-width: clamp(260px,20.4vw,324px); --home-live-height: calc((100vw - var(--shell-rail) - var(--home-aside-width) - 84px) * .140625 + 130px); }
  html, body { height: 100%; overflow: hidden; }
  .app-shell { height: 100dvh; min-height: 0; grid-template-rows: var(--shell-top) minmax(0,1fr); }
  .titlebar { height: var(--shell-top); min-height: 0; padding: 0 20px; gap: 20px; }
  .brand-lockup { width: calc(var(--shell-rail) - 32px); min-width: 0; }
  .brand-logo { width: 204px; max-width: 100%; height: 58px; max-height: 58px; object-fit: contain; }
  .global-search { width: min(570px,39vw); height: 42px; margin: 0 auto; }
  .window-actions { gap: 10px; }
  .window-actions .top-user-chip { display: none; }
  .window-actions .account-logout-button { display: inline-grid; }
  .titlebar .window-button { width: 38px; height: 38px; }
  .workspace.focus-view,.workspace.hub-focus-view,.workspace.ai-focus-view { grid-template-columns: var(--shell-rail) minmax(0,1fr) !important; width: 100% !important; max-width: 100% !important; }
  .workspace { gap: var(--shell-gap); padding: 12px; }
  .app-sidebar.rail { position: relative; width: 100%; min-height: 0; height: 100%; margin: 0; padding: 10px 6px; gap: 8px; border-radius: 16px; border-color: #16334a; display: flex; flex-direction: column; overflow: hidden; background: linear-gradient(150deg,#07131f,#040d16); }
  .rail-primary,.rail-secondary { display: flex; flex-direction: column; flex: 0 0 auto; gap: 2px; padding-bottom: 8px; border-color: #182a3e; }
  .app-sidebar .rail-item { flex: none; min-height: clamp(32px,4.8dvh,49px); height: clamp(32px,4.8dvh,49px); grid-template-columns: 25px minmax(0,1fr); gap: 12px; padding: 0 12px; border-radius: 10px; }
  .app-sidebar .rail-item b { display: block; font-size: 14px; font-weight: 600; }
  .app-sidebar .rail-item [data-icon] { width: 22px; height: 22px; }
  .app-sidebar .rail-item.active { background: linear-gradient(100deg,#352264,#0b4360); box-shadow: inset 3px 0 #28d5fa; }
  .app-sidebar .rail-item.active::before { display: none; }
  .app-sidebar .home-sidebar-sponsor { flex: 1 1 auto; display: flex !important; min-height: 64px; max-height: 240px; width: 100%; margin: auto 0 0; padding: 12px 10px; align-items: flex-start; justify-content: flex-start; border-radius: 9px; }
  .home-sidebar-sponsor .home-sponsor-copy { width: 100%; text-align: center; }
  .home-sidebar-sponsor .home-sponsor-copy strong { font-size: clamp(13px,1.16vw,18px); max-width: 180px; margin: 7px auto 0; }
  .home-sidebar-sponsor .home-sponsor-copy small { margin-top: 8px; font-size: 10px; }
  .home-sidebar-sponsor .home-sponsor-arrow { width: 24px; height: 24px; bottom: 8px; right: 8px; font-size: 15px; }
  .app-sidebar .home-version-note { display: block !important; flex: none; padding: 2px 4px; min-height: 18px; }
  .home-version-note small { display: none; }
  .home-version-note span { font-size: 10px; }
  .app-sidebar .rail-collapse-button { position: absolute; right: 8px; bottom: 122px; width: 24px; height: 22px; min-height: 0; padding: 0; margin: 0; border: 0; background: transparent; z-index: 3; }
  .rail-collapse-button b { display: none !important; }
  .app-sidebar .profile-chip { display: grid; grid-template-columns: 36px minmax(0,1fr); grid-template-rows: 36px 38px; flex: none; min-height: 96px; gap: 8px; margin: 0; padding: 8px; border: 1px solid #1c3c55; border-radius: 10px; background: #081522; }
  .profile-chip > .avatar { width: 36px; height: 36px; }
  .profile-chip > div:nth-child(2) { display: block; min-width: 0; }
  .profile-chip strong { font-size: 12px; }
  .profile-chip #profileStatus { color: #00dc96; font-size: 10px; }
  .profile-chip .profile-quick-controls { display: grid; grid-column: 1/-1; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; width: 100%; }
  .app-sidebar .profile-quick-controls > button { display: grid !important; place-items: center; width: 100%; height: 36px; min-width: 0; border-radius: 8px; border: 1px solid #203c52; background: linear-gradient(145deg,#102339,#091522); color: #bdd8f7; padding: 8px; }
  .profile-quick-controls > button.active { color: #ff6686; border-color: #a03f5e; background: #351628; }
  .profile-quick-controls svg { width: 18px; height: 18px; }
  body.home-view-active .main-panel.alt-view { height: 100%; min-height: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; overflow: hidden; }
  body.home-view-active #nowView { display: grid; height: 100%; min-height: 0; max-height: 100%; padding: 0 !important; margin: 0; overflow: hidden; grid-template-columns: minmax(0,1fr) var(--home-aside-width); grid-template-rows: minmax(166px,1.05fr) clamp(60px,8.3dvh,84px) var(--home-live-height) minmax(160px,.95fr); gap: var(--shell-gap); }
  #nowView .now-dashboard,#nowView .approved-home-layout,#nowView .approved-home-main { display: contents !important; }
  #nowView .approved-home-hero { grid-column: 1; grid-row: 1; min-height: 0; height: 100%; border-radius: 12px; box-shadow: none; background-position: center; }
  #nowView .approved-home-copy { display: flex; flex-direction: column; justify-content: center; height: 100%; width: 66%; padding: clamp(16px,2vw,32px); }
  #nowView .approved-home-copy > span { font-size: 10px; letter-spacing: .33em; }
  #nowView .approved-home-copy h1 { font-size: clamp(26px,2.75vw,45px); letter-spacing: -.02em; line-height: 1.08; margin: 12px 0 10px; }
  #nowView .approved-home-copy p { font-size: clamp(12px,1vw,16px); max-width: 440px; line-height: 1.4; }
  #nowView .approved-home-copy .now-actions { margin-top: clamp(12px,2dvh,22px); display: flex; gap: 12px; }
  #nowView .now-actions > button { flex: 1; min-width: 0; max-width: 235px; min-height: 0; height: clamp(38px,5.3dvh,54px); padding: 0 16px; font-size: clamp(11px,.9vw,14px); white-space: nowrap; gap: 10px; }
  #nowView .now-actions svg { width: 20px; height: 20px; flex: none; }
  #nowView .approved-metrics { grid-row: 2; grid-column: 1; margin: 0; gap: 12px; }
  #nowView .approved-metrics > div { min-height: 0; height: 100%; padding: 9px 14px; grid-template-columns: 46px minmax(0,1fr); column-gap: 12px; }
  #nowView .approved-metrics strong { font-size: 23px; line-height: 1.15; }
  #nowView .approved-metrics > div > span:first-child { width: 46px; height: 46px; padding: 11px; }
  #nowView .approved-metrics > div > span:last-child { font-size: 11px; white-space: nowrap; }
  #nowView .approved-panel.approved-friends-panel,#nowView .approved-panel.approved-match-panel { display: none; }
  #nowView .approved-panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; margin: 0; border: 1px solid #23415a; border-radius: 11px; background: linear-gradient(135deg,#0a1928,#050f19); }
  #nowView .approved-panel > header { min-height: 42px; height: 42px; flex: none; padding: 0 15px; gap: 8px; }
  #nowView .approved-panel h2 { font-size: 14px; font-weight: 700; min-width: 0; }
  #nowView .approved-panel header button { font-size: 11px; padding: 4px 0; flex: none; }
  #nowView .approved-panel h2 svg { width: 17px; height: 17px; }
  #nowView .approved-live-panel { grid-column: 1; grid-row: 3; }
  #nowView .approved-live-strip { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); grid-auto-flow: column; grid-auto-columns: 24%; flex: 1; min-height: 0; overflow-x: auto; overflow-y: hidden; padding: 8px; gap: 8px; }
  #nowView .approved-live-strip > .home-empty-state { grid-column: 1/-1; }
  #nowView .approved-live-card { min-width: 0; min-height: 0; height: 100%; display: grid; grid-template-rows: auto minmax(0,1fr); border: 1px solid #213a50; border-radius: 8px; overflow: hidden; transition: border-color .16s; }
  #nowView .approved-live-card:hover { border-color: #5579d1; }
  #nowView .approved-live-cover { aspect-ratio: 16/9; min-height: 0; background: #08121e; }
  #nowView .approved-live-cover > img { object-position: center; }
  #nowView .approved-live-cover b { padding: 3px 6px; font-size: 9px; }
  #nowView .approved-live-cover > span { padding: 3px 6px; font-size: 10px; border-radius: 14px; }
  #nowView .approved-live-card > div:last-child { padding: 7px; min-width: 0; }
  #nowView .approved-live-card strong { font-size: 12px; line-height: 1.3; }
  #nowView .approved-live-card small { font-size: 11px; }
  #nowView .approved-live-tags { margin-top: 6px; gap: 5px; }
  #nowView .approved-live-tags i { max-width: 72%; padding: 3px 5px; font-size: 9px; }
  #nowView .approved-bottom-grid { grid-row: 4; grid-column: 1; display: grid; grid-template-columns: 1.05fr .92fr 1.05fr; gap: 12px; min-height: 0; }
  #nowView .approved-bottom-grid > * { grid-column: auto; height: 100%; min-height: 0; }
  #nowView .approved-server-grid { display: flex; flex-direction: column; flex: 1; overflow-y: auto; min-height: 0; padding: 8px 10px; gap: 6px; }
  #nowView .approved-server-card { flex: none; min-height: 44px; width: 100%; padding: 7px; border-radius: 8px; }
  #nowView .approved-server-card strong { font-size: 12px; }
  #nowView .approved-server-emblem { width: 31px; height: 31px; font-size: 14px; }
  #nowView .approved-panel-body { min-height: 0; padding: 10px 14px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; }
  #nowView .approved-home-aside { display: grid; grid-row: 1/-1; grid-column: 2; grid-template-rows: 1fr 1.03fr 1.03fr; gap: 12px; min-height: 0; }
  #nowView .approved-home-aside > .approved-panel:first-child { display: flex; }
  #nowView .approved-events-panel,#nowView .approved-news-panel { min-height: 0; }
  #nowView .approved-news-panel .approved-panel-body { padding: 5px 13px; }
  #nowView .approved-news-row { flex: 1 0 auto; min-height: 66px; padding: 10px 0; gap: 10px; }
  #nowView .approved-news-row > span:first-child { width: 40px; height: 40px; flex: none; color: #b05aff; }
  #nowView .approved-news-row:nth-child(2) > span:first-child { color: #66a6ff; }
  #nowView .approved-news-row:nth-child(3) > span:first-child { color: #ff5b9b; }
  #nowView .approved-news-row svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; }
  #nowView .approved-news-row > span:nth-child(2) strong { font-size: 13px; }
  #nowView .approved-news-row > span:nth-child(2) small { font-size: 12px; }
  #nowView .home-wide-sponsor { display: flex; align-items: flex-start; justify-content: center; padding: 20px; border: 1px solid #44367a; border-radius: 11px; min-width: 0; }
  #nowView .home-wide-sponsor::before { position: absolute; inset: 0; content: ""; background: linear-gradient(90deg,rgba(4,9,22,.65),rgba(8,8,26,.1)); }
  #nowView .home-wide-sponsor img { object-position: 65% center; }
  #nowView .home-wide-sponsor strong { font-size: clamp(16px,1.3vw,24px); }
  #nowView .home-wide-sponsor small { font-size: 11px; max-width: 210px; }
  #nowView .approved-friend-row { flex: none; }
  #nowView :is(.approved-panel-body,.approved-server-grid,.approved-live-strip) { scrollbar-width: thin; scrollbar-color: #284560 transparent; overscroll-behavior: contain; }
  .sidebar-collapsed { --shell-rail: 88px; }
  .sidebar-collapsed .app-sidebar .rail-item { grid-template-columns: 1fr; place-items: center; padding: 0; }
  .sidebar-collapsed .app-sidebar .rail-item b,.sidebar-collapsed .home-sidebar-sponsor,.sidebar-collapsed .home-version-note,.sidebar-collapsed .profile-chip > div:nth-child(2) { display: none !important; }
  .sidebar-collapsed .app-sidebar .profile-chip { grid-template-columns: 1fr; grid-template-rows: 36px auto; margin-top: auto; height: 174px; justify-items: center; }
  .sidebar-collapsed .profile-quick-controls { grid-template-columns: 1fr; }
  .sidebar-collapsed .app-sidebar .rail-collapse-button { bottom: 192px; right: 22px; }
}

@media (min-width: 768px) and (max-width: 1279px) {
  :root { --shell-rail: 184px; --shell-gap: 10px; --shell-top: 62px; }
  .titlebar { padding: 0 14px; gap: 14px; }
  .brand-lockup { width: 164px; }
  .window-actions { gap: 5px; }
  body.home-view-active #nowView { grid-template-columns: minmax(0,1fr) 248px; }
  body.home-view-active { --home-aside-width: 248px; --home-live-height: calc((100vw - var(--shell-rail) - var(--home-aside-width) - 72px) * .1875 + 130px); }
  #nowView .approved-home-copy { width: 85%; padding: 18px; }
  #nowView .approved-home-copy h1 { font-size: 28px; }
  #nowView .approved-home-copy p { font-size: 12px; max-width: 300px; }
  #nowView .approved-metrics { gap: 7px; }
  #nowView .approved-metrics > div { grid-template-columns: 32px minmax(0,1fr); column-gap: 8px; padding: 8px; }
  #nowView .approved-metrics > div > span:first-child { width: 32px; height: 32px; padding: 7px; }
  #nowView .approved-metrics > div > span:first-child svg { width: 18px; height: 18px; }
  #nowView .approved-metrics strong { font-size: 20px; }
  #nowView .approved-metrics > div > span:last-child { font-size: 9px; }
  #nowView .approved-bottom-grid { grid-template-columns: 1fr 1fr; }
  #nowView .approved-activity-panel { display: none; }
  #nowView .approved-live-strip { grid-template-columns: repeat(3,minmax(0,1fr)); grid-auto-columns: calc((100% - 16px)/3); }
}

@media (min-width: 768px) and (max-width: 1023px) {
  :root { --shell-rail: 80px; }
  .brand-lockup { width: 160px; }
  .global-search { width: min(430px,45vw); }
  .app-sidebar .rail-item { grid-template-columns: 1fr; place-items: center; padding: 0; }
  .app-sidebar .rail-item b,.app-sidebar .home-sidebar-sponsor,.app-sidebar .home-version-note,.profile-chip > div:nth-child(2) { display: none !important; }
  .app-sidebar .profile-chip { grid-template-columns: 1fr; grid-template-rows: 36px auto; margin-top: auto; min-height: 174px; justify-items: center; }
  .profile-chip .profile-quick-controls { grid-template-columns: 1fr; }
  .app-sidebar .rail-collapse-button { display: none; }
  body.home-view-active #nowView { grid-template-columns: minmax(0,1fr) 225px; }
  body.home-view-active { --home-aside-width: 225px; }
  #nowView .approved-home-copy h1 { font-size: 25px; }
  #nowView .now-actions > button { padding: 0 10px; gap: 6px; font-size: 10px; }
  #nowView .now-actions svg { display: none; }
}

@media (min-width:768px) and (max-height:800px) {
  :root { --shell-top: 60px; --shell-gap: 9px; }
  .workspace { padding: 9px; }
  body.home-view-active { --home-live-height: calc((100vw - var(--shell-rail) - var(--home-aside-width) - 84px) * .140625 + 105px); }
  body.home-view-active #nowView { grid-template-rows: minmax(166px,1.05fr) 60px var(--home-live-height) minmax(160px,.95fr); }
  .app-sidebar .rail-item { min-height: 31px; height: 31px; }
  .app-sidebar .rail-item b { font-size: 12px; }
  .app-sidebar .home-sidebar-sponsor { max-height: 145px; padding: 8px; }
  .home-sidebar-sponsor .home-sponsor-copy small { display: none; }
  #nowView .approved-home-copy h1 { font-size: clamp(25px,2.5vw,37px); margin: 8px 0; }
  #nowView .approved-home-copy > span { font-size: 9px; }
  #nowView .approved-home-copy .now-actions { margin-top: 12px; }
  #nowView .approved-panel > header { height: 35px; min-height: 35px; padding: 0 11px; }
  #nowView .approved-panel h2 { font-size: 12px; }
  #nowView .approved-panel header button { font-size: 10px; }
  #nowView .approved-news-row { min-height: 53px; padding: 6px 0; }
  #nowView .approved-news-row > span:first-child { width: 31px; height: 31px; }
  #nowView .approved-news-row > span:nth-child(2) strong { font-size: 11px; }
  #nowView .approved-news-row > span:nth-child(2) small { font-size: 10px; }
  #nowView .home-empty-state { padding: 10px; gap: 7px; }
  #nowView .home-empty-icon svg { width: 29px; height: 29px; }
  #nowView .home-empty-state p { font-size: 11px; }
  #nowView .home-empty-action { padding: 7px 14px; }
  #nowView .approved-live-card > div:last-child { padding: 6px; }
  #nowView .approved-live-tags { display: none; }
}

@media(max-width:767px) {
  .app-shell { height: 100dvh; min-height: 0; }
  .workspace { height: 100%; overflow: hidden; padding-bottom: calc(68px + env(safe-area-inset-bottom)) !important; }
  .main-panel { height: 100%; min-height: 0; }
  #nowView { height: 100%; overflow-y: auto; padding-bottom: 14px !important; }
  .approved-home-hero { min-height: 300px; }
  .approved-home-copy { width: 88%; }
  .approved-home-copy h1 { font-size: 30px; }
  #nowView .approved-home-copy .now-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 8px; }
  #nowView .approved-home-copy .now-actions > button { display: flex; width: 100%; max-width: none; flex: none !important; height: 48px !important; padding: 0 10px; font-size: 11px; min-width: 0; white-space: nowrap; }
  .approved-home-copy .now-actions svg { display: none; }
  .approved-bottom-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
  .approved-bottom-grid .approved-servers-panel { display: flex; flex-direction: column; }
  .approved-bottom-grid .approved-server-grid { grid-template-columns: 1fr 1fr; }
  .approved-bottom-grid .home-wide-sponsor { min-height: 170px; grid-column: auto; padding: 24px; margin-bottom: 12px; border-radius: 10px; }
  .approved-home-aside { display: contents; }
  #nowView .approved-home-aside .approved-online-panel { display: flex; flex-direction: column; }
  .approved-news-row { padding: 12px 0; }
  .mobile-bottom-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
}

@media(min-width:768px) and (max-width:1279px) and (max-height:800px) {
  body.home-view-active { --home-live-height: calc((100vw - var(--shell-rail) - var(--home-aside-width) - 72px) * .1875 + 105px); }
}
