/* ===================================================================
   3babees desktop identity — 2027.
   Applies only from 820px. Phone shell lives in phone.css.
   =================================================================== */

@media (min-width: 820px) {
  .babees-app {
    max-width: 1240px;
    padding-top: 22px;
    padding-inline: 28px;
  }

  .babees-topbar {
    position: sticky;
    top: 12px;
    z-index: 40;
    display: grid;
    grid-template-columns: minmax(160px, 1.05fr) auto minmax(200px, 1.05fr);
    align-items: center;
    gap: 14px 18px;
    min-height: 72px;
    margin-bottom: 20px;
    padding: 10px 16px;
    border-radius: 24px;
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--bb-glass-2, #12182c) 88%, transparent), color-mix(in srgb, var(--bb-ink, #070b16) 72%, transparent));
    box-shadow:
      0 1px 0 rgba(255, 209, 102, 0.18) inset,
      0 16px 40px rgba(3, 6, 20, 0.28);
    overflow: hidden;
  }

  .babees-topbar .babees-brand { justify-self: start; min-width: 0; gap: 12px; }
  .babees-topbar .babees-brand-name {
    unicode-bidi: isolate;
    direction: ltr;
  }
  .babees-topbar .babees-topbar-actions {
    justify-self: end;
    gap: 10px;
    min-width: 0;
    flex-wrap: nowrap;
  }
  .babees-topbar .babees-topbar-tools { gap: 4px; padding: 4px; flex: none; }
  .babees-topbar .babees-session-btn { flex: none; }
  .babees-topbar .babees-wallet-chip { flex: none; }

  .babees-brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }

  .babees-brand-name {
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: -0.03em;
  }

  .babees-brand-sub {
    font-size: 0.72rem;
    letter-spacing: 0;
    text-transform: none;
    opacity: 0.72;
  }

  .babees-topbar .babees-tabs {
    justify-self: center;
    display: inline-grid;
    grid-template-columns: repeat(5, auto);
    width: max-content;
    max-width: 100%;
    margin: 0;
    padding: 4px;
    gap: 3px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  }

  .babees-topbar .babees-tab {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 0.88rem;
    border-radius: 13px;
    white-space: nowrap;
  }
  .babees-topbar .babees-tab span {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
  }
  .babees-topbar .babees-tab-tv span {
    unicode-bidi: isolate;
    direction: ltr;
    letter-spacing: 0.04em;
  }

  html[data-theme="light"] .babees-topbar .babees-tabs,
  html[data-skin="paper"] .babees-topbar .babees-tabs {
    background: #f3f0e8 !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  @media (max-width: 1180px) {
    .babees-brand-sub { display: none; }
    .babees-topbar { gap: 12px; padding: 10px 12px; }
    .babees-topbar .babees-tab { padding: 8px 10px; font-size: 0.8rem; }
  }

  @media (max-width: 1080px) {
    .babees-topbar .babees-tab { padding: 8px 9px; font-size: 0.78rem; }
    #babees-lobby { grid-template-columns: minmax(0, 1fr) minmax(240px, 0.9fr); }
  }

  .babees-hero {
    text-align: start;
    margin: 8px 0 22px;
    padding: 8px 4px 0;
  }

  #babees-lobby {
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  .babees-lobby-open {
    gap: 14px;
    margin: 0 0 6px;
  }
  .babees-lobby-hero {
    min-height: min(42vh, 420px);
    border-radius: 32px;
  }
  .babees-lobby-hero-copy {
    padding: 40px 44px;
    max-width: 44rem;
  }
  .babees-lobby-brand {
    font-size: clamp(2.8rem, 4.5vw, 4rem);
  }
  .babees-lobby-byline {
    font-size: 0.86rem;
    padding: 6px 14px;
  }
  .babees-lobby-title {
    font-size: clamp(1.55rem, 2.2vw, 2rem);
  }
  .babees-lobby-lead {
    font-size: 1.08rem;
    max-width: 32rem;
  }
  .babees-lobby-jump {
    min-height: 52px;
    padding: 0 22px;
    font-size: 1rem;
    border-radius: 18px;
  }
  .babees-host-strip {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 14px 18px;
    border-radius: 22px;
  }
  .babees-host-strip-photo {
    width: 64px;
    height: 64px;
  }
  .babees-host-strip-name {
    font-size: 1.15rem;
  }
  .babees-host-strip-cta {
    min-height: 46px;
    min-width: 168px;
  }

  .babees-team-row { gap: 14px; }

  .babees-field-a,
  .babees-field-b {
    padding: 14px 14px 12px;
    border-radius: 18px;
    border: 1px solid var(--bb-line);
    background: color-mix(in srgb, var(--bb-glass, rgba(16, 20, 40, 0.55)) 82%, transparent);
  }

  .babees-hero-kicker {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.8rem;
  }

  .babees-hero-brand-name,
  .babees-hero-title {
    font-size: clamp(2.1rem, 3vw, 2.8rem);
    letter-spacing: -0.035em;
    line-height: 1.12;
  }

  .babees-hero-lead {
    max-width: 38rem;
    font-size: 1.05rem;
    line-height: 1.55;
  }

  .babees-cat-grid {
    gap: 14px;
  }

  .babees-cat-card {
    border-radius: 22px;
    min-height: 168px;
    transition: transform 0.28s var(--bb-ease), box-shadow 0.28s, border-color 0.28s;
  }

  .babees-cat-card:hover {
    transform: none;
  }

  .babees-cat-name {
    font-size: 1.05rem;
    letter-spacing: -0.02em;
  }

  .babees-cat-section-title {
    font-size: 1.15rem;
    letter-spacing: -0.02em;
  }

  .babees-dock-inner {
    border-radius: 28px;
    padding: 16px 18px;
  }
  .babees-dock-hint {
    font-size: 0.98rem;
  }
  .babees-app .babees-cta {
    min-height: 64px;
    font-size: 1.12rem;
    border-radius: 20px;
  }
  .babees-cta-icon {
    width: 38px;
    height: 38px;
    border-radius: 13px;
  }

  .babees-app.is-compete .babees-board-grid {
    gap: 14px;
  }

  .babees-app.is-compete .babees-q-btn {
    border-radius: 18px;
  }

  .babees-panel {
    border-radius: 22px;
  }

  /* ---- Wallet: stacked sections, subscriptions side by side ---- */
  #babees-wallet {
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  #babees-wallet > .babees-hero { margin-bottom: 0; }
  #babees-wallet > .babees-wallet-account { order: 8; }

  #babees-wallet .babees-wallet-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
  }

  #babees-wallet .babees-wallet-banner { grid-column: 1 / -1; }

  #babees-wallet .babees-wallet-stat {
    border-radius: 18px;
    padding: 16px 18px;
  }

  #babees-wallet .babees-wallet-stat > strong { color: var(--bb-text); }

  #babees-wallet .babees-wallet-stat:has(#babees-wallet-balance) > strong {
    font-size: 1.65rem;
    letter-spacing: -0.03em;
  }

  #babees-wallet .babees-panel-note {
    margin: 0 0 12px;
    color: var(--bb-dim);
    font-size: 0.88rem;
    line-height: 1.5;
  }

  #babees-topup-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 10px;
  }

  #babees-wallet .babees-topup-opt {
    min-height: 72px;
    border-radius: 16px;
  }

  #babees-wallet .babees-topup-pay {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 12px;
    align-items: end;
    margin-top: 12px;
  }

  #babees-pay-open { min-height: 52px; }

  #babees-wallet .babees-sub-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 14px;
    margin: 0;
    overflow: visible;
    height: auto;
  }

  #babees-wallet .babees-sub-card {
    min-height: 0;
    height: auto;
    overflow: hidden;
  }

  #babees-wallet .babees-sub-badge {
    position: static;
    display: inline-flex;
    align-self: flex-start;
  }

  #babees-wallet .babees-sub-price { flex-wrap: nowrap; }
  #babees-wallet .babees-sub-price strong { font-size: 1.6rem; }

  #babees-pack-grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
  }

  #babees-wallet .babees-pack {
    text-align: start;
    display: flex;
    flex-direction: column;
    min-height: 220px;
  }

  #babees-wallet .babees-pack .babees-btn { margin-top: auto; }

  #babees-wallet .babees-wallet-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 0;
  }

  #babees-wallet .babees-wallet-account-more > summary { display: none; }
  #babees-wallet .babees-profile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .babees-pay-modal { place-items: center; padding: 28px; }
  .babees-pay-sheet {
    width: min(520px, 100%);
    border-radius: 24px;
    max-height: min(86dvh, 820px);
  }

  /* Host card: one surface, identity on top, action on its own row. */
  /* Match board: six rows share the space under the top bar. */
  .babees-app.is-compete {
    height: 100dvh;
    height: 100svh;
    overflow: hidden;
  }
  .babees-app.is-compete .babees-compete {
    position: fixed;
    inset: 0;
    height: 100dvh;
    height: 100svh;
    max-height: 100dvh;
    overflow: hidden;
  }
  .babees-app.is-compete .babees-arena {
    display: grid;
    grid-template-columns: minmax(200px, 240px) minmax(0, 1fr) minmax(190px, 260px);
    grid-template-rows: minmax(0, 1fr);
    height: 100%;
    max-height: 100%;
    min-height: 0 !important;
    overflow: hidden;
    padding: 8px 8px 14px;
    gap: 8px;
    box-sizing: border-box;
  }
  .babees-app.is-compete .babees-arena.is-cams-closed {
    grid-template-columns: auto minmax(0, 1fr) minmax(190px, 260px) !important;
  }
  .babees-app.is-compete .babees-arena.is-cams-closed .babees-rail-cams {
    width: 52px;
    min-width: 0;
    max-width: 52px;
    padding: 8px 4px;
    overflow: hidden;
  }
  .babees-app.is-compete .babees-arena.is-cams-closed .babees-rail-cams > :not(.babees-cams-collapse) {
    display: none !important;
  }
  html:has(.babees-app.is-compete),
  body:has(.babees-app.is-compete) {
    overflow: hidden !important;
    height: 100dvh;
    height: 100svh;
  }
  .babees-app.is-compete .babees-rail {
    min-width: 0;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
  }
  .babees-app.is-compete .babees-rail-cams .babees-cam-zone {
    flex: 1 1 0;
    min-height: 0;
    overflow: auto;
  }
  .babees-app.is-compete .babees-rail-roster {
    flex: none;
    max-height: 28%;
    overflow: auto;
  }
  .babees-rail-cams .babees-cam-tile,
  .babees-rail-cams .babees-cam-slot {
    aspect-ratio: 1 / 1 !important;
    height: auto !important;
    min-height: 0 !important;
  }
  .babees-app.is-compete .babees-rail-tools {
    overflow: hidden;
    min-height: 0;
    min-width: 0;
  }
  .babees-app.is-compete .babees-rail-tools > .babees-score-stack,
  .babees-app.is-compete .babees-rail-tools > .babees-tools-hint {
    flex: 0 0 auto;
  }
  .babees-app.is-compete .babees-rail-tools > .babees-rail-panel:not(.babees-rail-chat) {
    flex: 0 1 auto;
    min-height: 0;
    overflow: auto;
  }
  .babees-app.is-compete .babees-rail-chat {
    flex: 1 1 92px;
    min-height: 92px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .babees-app.is-compete .babees-rail-chat .babees-chat-log {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
    overflow: auto;
  }
  .babees-app.is-compete .babees-rail-chat .babees-chat-form {
    flex: 0 0 auto;
  }
  .babees-app.is-compete .babees-rail-chat .babees-chat-form .babees-input {
    min-height: 40px;
  }
  .babees-app.is-compete .babees-arena-main {
    min-height: 0;
    min-width: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .babees-app.is-compete .babees-compete-bar,
  .babees-app.is-compete .babees-director-bar,
  .babees-app.is-compete .babees-spectator-react {
    flex: 0 0 auto;
  }
  .babees-app.is-compete .babees-compete-bar {
    flex-wrap: nowrap;
    padding: 6px 10px;
    border-radius: 16px;
  }
  .babees-app.is-compete .babees-director-bar {
    margin: 0;
    padding: 4px 8px;
  }
  .babees-app.is-compete .babees-board-shell {
    flex: 1 1 0px;
    min-height: 0;
    height: auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 8px 8px 10px;
    border-radius: 18px;
  }
  .babees-app.is-compete .babees-board-grid {
    display: grid !important;
    flex: 1 1 0;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
    height: auto !important;
    min-height: 0 !important;
    max-height: 100%;
    gap: 6px;
    overflow: hidden;
    align-items: stretch;
  }
  .babees-app.is-compete .babees-board-shell > .babees-tip { display: none; }
  .babees-app.is-compete .babees-col {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: 100%;
    padding: 6px !important;
    overflow: hidden;
    align-self: stretch;
  }
  .babees-app.is-compete .babees-col h4 {
    height: 1.8em !important;
    min-height: 0 !important;
    max-height: 1.8em !important;
    margin: 0;
    padding: 0 2px;
    font-size: clamp(0.68rem, 0.75vw, 0.8rem);
    line-height: 1.8;
    overflow: hidden !important;
    display: block !important;
    -webkit-line-clamp: unset !important;
    white-space: nowrap;
    text-overflow: ellipsis;
    align-self: stretch;
  }
  .babees-arena:not(.is-cams-closed) .babees-rail-cams .babees-rail-head {
    padding-inline-start: 0;
  }
  .babees-arena:not(.is-cams-closed) .babees-rail-cams .babees-rail-head h5 {
    white-space: nowrap;
    margin: 0;
  }
  .babees-app.is-compete .babees-live-bar {
    white-space: nowrap;
    max-width: 100%;
  }
  .babees-app.is-compete .babees-col-style {
    margin: 0;
    padding: 1px 6px;
    font-size: 0.55rem;
  }
  .babees-app.is-compete .babees-col-style,
  .babees-app.is-compete .babees-col h4 {
    flex: 0 0 auto;
  }
  .babees-app.is-compete .babees-q-btn {
    flex: 1 1 0px !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    align-self: stretch;
    width: 100%;
    margin: 0 !important;
    padding: 0 4px;
    border-radius: 12px;
    overflow: hidden;
  }
  .babees-app.is-compete .babees-q-pts {
    font-size: clamp(0.85rem, 1.4vw, 1.35rem);
  }
  .babees-app.is-compete .babees-q-slot { font-size: 0.55rem; }

  .babees-app.is-compete .babees-cams-collapse {
    position: static !important;
    top: auto !important;
    align-self: stretch !important;
    flex: 0 0 auto !important;
    flex-direction: row !important;
    justify-content: center !important;
    width: auto !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    margin: 0 !important;
    padding: 0 12px !important;
    gap: 6px;
    border-radius: 12px;
  }
  .babees-app.is-compete .babees-cams-collapse-label {
    writing-mode: horizontal-tb !important;
    font-size: 0.82rem !important;
    letter-spacing: 0 !important;
    line-height: 1 !important;
  }
  .babees-app.is-compete .babees-arena.is-cams-closed .babees-rail-cams {
    width: auto;
    min-width: 0;
    max-width: none;
    height: auto;
    align-self: start;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: visible;
  }
  .babees-app.is-compete .babees-arena.is-cams-closed .babees-cams-collapse {
    width: auto !important;
    min-width: 44px;
    height: 40px !important;
    min-height: 40px !important;
  }

  .babees-app.is-compete.is-local-mode .babees-arena {
    grid-template-columns: minmax(0, 1fr) minmax(200px, 280px) !important;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .babees-app.is-compete.is-local-mode .babees-rail-cams {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    max-height: none !important;
    align-self: stretch;
    overflow: visible !important;
  }
  .babees-app.is-compete.is-local-mode .babees-arena-main {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    min-height: 0;
  }
  .babees-app.is-compete.is-local-mode .babees-rail-tools {
    grid-column: 2;
    grid-row: 2;
    min-height: 0;
  }
  .babees-app.is-compete.is-local-mode .babees-rail-cams > :not(.babees-rail-roster) {
    display: none !important;
  }
  .babees-app.is-compete.is-local-mode .babees-arena .babees-rail-cams > .babees-rail-roster {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-height: none;
    overflow: hidden;
  }
}
