/* Desktop and tablet layout of the LIVE app (app/live.html → /beiti/app/). The demo keeps its phone frame.
   561–899 px: full-window app with the bottom tab bar, content in a centred column.
   ≥ 900 px:   sidebar with the tabs on the start side, content in a centred column, sheets and dialogs centred,
               hover states for the mouse. Everything is scoped to body.live, so phones and the demo are unchanged. */

@media (min-width: 561px) {
  body.live:not(.shot) { background: var(--canvas); }
  body.live:not(.shot) .stage { padding: 0; display: block; min-height: 100vh; }
  body.live:not(.shot) .device { padding: 0; border-radius: 0; background: none; box-shadow: none; transform: none !important; margin: 0 !important; }
  body.live:not(.shot) .phone { width: 100%; height: 100vh; height: 100dvh; border-radius: 0; }
  body.live:not(.shot) .statusbar { display: none; }
  body.live:not(.shot) .screen { scrollbar-width: thin; }
  body.live:not(.shot) .screen::-webkit-scrollbar { display: block; width: 10px; }
  body.live:not(.shot) .screen::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; }

  /* content column */
  body.live:not(.shot) .screen > .page { width: min(760px, 100%); margin-inline: auto; padding: 20px 28px 48px; }
  body.live:not(.shot) .screen > .page > .topbar:first-child { margin: -20px -28px -4px; padding: 18px 28px 10px; }
  body.live:not(.shot) .screen > .chat-room { width: min(860px, 100%); margin-inline: auto; border-inline: 1px solid var(--line); }
  /* signed-out screens (welcome, sign-up, sign-in): a narrower column */
  body.live:not(.shot) .phone:has(.tabbar[hidden]) .screen > .page { width: min(520px, 100%); }
  /* welcome screen: a card on the brand background instead of a phone-wide strip */
  body.live:not(.shot) .screen:has(> .welcome) { background: linear-gradient(180deg, rgba(11,58,47,.35), rgba(11,58,47,.7)), url(../img/tlv-bg.jpg) 50% 40% / cover var(--brand-dark); }
  body.live:not(.shot) .screen > .welcome.welcome-min { background: rgba(11,58,47,.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
  body.live:not(.shot) .screen:has(> .welcome) { display: grid; align-content: center; }
  body.live:not(.shot) .screen > .welcome { width: min(520px, calc(100% - 48px)); margin: 32px auto; min-height: min(600px, calc(100% - 64px)); border: 1px solid rgba(255,255,255,.1); border-radius: 28px; overflow: hidden; box-shadow: 0 30px 60px -30px rgba(0,0,0,.6); }

  /* sheets: a bottom sheet no wider than the column */
  body.live:not(.shot) .sheet { left: max(0px, calc(50% - 300px)); right: max(0px, calc(50% - 300px)); }
  body.live:not(.shot) .modal { left: max(24px, calc(50% - 220px)); right: max(24px, calc(50% - 220px)); }
  body.live:not(.shot) .toast { left: max(14px, calc(50% - 240px)); right: max(14px, calc(50% - 240px)); }
  body.live:not(.shot) .live-offline { left: max(12px, calc(50% - 280px)); right: max(12px, calc(50% - 280px)); top: 12px; }
}

@media (min-width: 900px) {
  /* sidebar + content */
  body.live:not(.shot) .phone { display: grid; grid-template-columns: 248px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  body.live:not(.shot) .phone:has(.tabbar[hidden]) { grid-template-columns: minmax(0, 1fr); }
  body.live:not(.shot) .screen { grid-column: -2; grid-row: 1; }
  body.live:not(.shot) .tabbar { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; gap: 4px; padding: 20px 14px; border-top: 0; border-inline-end: 1px solid var(--line); overflow-y: auto; }
  body.live:not(.shot) .tabbar button { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border-radius: 14px; font-size: 15.5px; color: var(--ink-2); text-align: start; }
  body.live:not(.shot) .tabbar .tb-ico { width: 26px; height: 26px; border-radius: 0; background: none !important; }
  body.live:not(.shot) .tabbar button[aria-current="true"] { background: var(--brand-soft); color: var(--brand-text); }
  body.live:not(.shot) .tabbar .tb-badge { position: static; margin-inline-start: auto; }
  body.live:not(.shot) .tabbar .tb-brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 20px; font-size: 21px; font-weight: 700; color: var(--ink); }
  body.live:not(.shot) .tabbar .tb-brand .logo { width: 38px; height: 38px; border-radius: 12px; }
  body.live:not(.shot) .tabbar .tb-brand .logo svg { width: 22px; height: 22px; }

  /* overlays cover the whole window; sheets and dialogs become centred cards */
  body.live:not(.shot) .sheet { inset: 0; margin: auto; width: min(560px, calc(100% - 48px)); height: fit-content; max-height: calc(100% - 64px);
    border-radius: 24px; padding: 22px 24px 24px; box-shadow: var(--shadow-lg); }
  body.live:not(.shot) .sheet .grab { display: none; }
  body.live:not(.shot) .modal { inset: 0; margin: auto; width: min(440px, calc(100% - 48px)); height: fit-content; transform: none; }
  body.live:not(.shot) .toast { inset-inline-start: calc(248px + max(14px, (100% - 248px) / 2 - 240px)); inset-inline-end: max(14px, calc((100% - 248px) / 2 - 240px)); bottom: 28px; }
  body.live:not(.shot) .live-offline { inset-inline-start: calc(248px + 24px); inset-inline-end: 24px; }
  body.live:not(.shot) .phone:has(.tabbar[hidden]) .toast { inset-inline-start: max(14px, calc(50% - 240px)); inset-inline-end: max(14px, calc(50% - 240px)); }
}
@media (min-width: 900px) and (prefers-reduced-motion: no-preference) {
  body.live:not(.shot) .modal:not([hidden]) { animation: deskpop .2s ease-out; }
  @keyframes deskpop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* mouse: show what can be clicked */
@media (min-width: 561px) and (hover: hover) {
  body.live:not(.shot) button.item:hover, body.live:not(.shot) .chat-row:hover, body.live:not(.shot) .alert-card:hover,
  body.live:not(.shot) .choice:hover, body.live:not(.shot) .tabbar button:not([aria-current="true"]):hover { background: var(--field); }
  body.live:not(.shot) .btn:hover { filter: brightness(1.05); }
  body.live:not(.shot) .iconbtn:hover { background: var(--field); }
}
