/* ==========================================================================
   LyricBingo V2 — Mobile cleanup (Jul 2026)
   Mobile-only polish via max-width queries. Desktop layout unchanged.
   Load last.
   ========================================================================== */

:root {
  --v2-m-gutter: max(16px, env(safe-area-inset-left, 0px));
  --v2-m-gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --v2-m-touch: 44px;
  --v2-m-touch-lg: 48px;
}

/* ── Global V2 foundation ── */
@media (max-width: 900px) {
  html.lb-v2-html,
  html.lb-v2-html body.lb-v2-active {
    overflow-x: clip;
    max-width: 100%;
    -webkit-text-size-adjust: 100%;
  }

  #lb-v2-root,
  .lb-v2,
  .wx-site,
  .bd-venues-page {
    max-width: 100%;
    overflow-x: clip;
  }

  .lb-v2 img,
  .wx-site img,
  .bd-venues-page img {
    max-width: 100%;
    height: auto;
  }

  .lb-v2 input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  .lb-v2 select,
  .lb-v2 textarea,
  .wx-site input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  .wx-site select,
  .wx-site textarea,
  .bd-v-modal input,
  .bd-v-modal select,
  .bd-v-modal textarea {
    font-size: 16px !important;
  }

  .lb-v2 .v2-btn,
  .lb-land .lb-btn,
  .wx-site .wx-btn,
  .bd-v-btn,
  .wx-auth-tabs a {
    min-height: var(--v2-m-touch);
    touch-action: manipulation;
  }

  .lb-v2 .v2-toast,
  .bd-venues-toast {
    left: var(--v2-m-gutter);
    right: var(--v2-m-gutter-r);
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    max-width: none;
  }
}

/* ── Landing / welcome ── */
@media (max-width: 960px) {
  .lb-land .lb-nav__brand img {
    height: 30px;
  }

  .lb-land .lb-section {
    padding-inline: var(--lb-inline);
  }

  .lb-land .lb-section__head {
    text-align: left;
  }

  .lb-land .lb-section__head h2 {
    font-size: clamp(1.75rem, 7vw, 2.5rem);
    line-height: 1.05;
  }

  .lb-land .lb-hero__proof {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.75rem;
  }

  .lb-land .lb-hero-card {
    min-height: 320px;
  }

  .lb-land .lb-feat-track {
    display: grid;
    grid-template-columns: 1fr;
    overflow: visible;
    gap: 1rem;
  }

  .lb-land .lb-feat-card {
    flex: none;
    min-width: 0;
    width: 100%;
  }

  .lb-land .lb-price__term {
    grid-template-columns: 1fr auto;
    row-gap: 0.35rem;
  }

  .lb-land .lb-price__term em {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .lb-land .lb-foot__nav {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
  }

  .lb-land .lb-foot__nav a {
    min-height: var(--v2-m-touch);
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
  }
}

@media (max-width: 560px) {
  .lb-land .lb-nav {
    padding-inline: max(1rem, env(safe-area-inset-left, 0px)) max(1rem, env(safe-area-inset-right, 0px));
  }

  .lb-land .lb-stats article {
    padding: 1rem 0.875rem;
  }

  .lb-land .lb-faq__item summary {
    min-height: var(--v2-m-touch);
    display: flex;
    align-items: center;
    padding-right: 2rem;
    font-size: 0.9375rem;
  }

  .lb-land .lb-finale {
    padding-inline: var(--v2-m-gutter);
  }

  .lb-land .lb-finale h2 {
    font-size: clamp(1.5rem, 7vw, 2rem);
  }
}

/* ── Login / register ── */
@media (max-width: 720px) {
  .wx-auth-page .wx-nav {
    min-height: 64px;
    padding-inline: var(--v2-m-gutter);
  }

  .wx-auth-page .wx-nav-brand img {
    height: 32px;
  }

  .wx-auth-page .wx-nav-actions {
    gap: 0.5rem;
  }

  .wx-auth-page .wx-nav-actions .wx-btn {
    min-height: var(--v2-m-touch);
    padding-inline: 1rem;
    font-size: 0.8125rem;
  }

  .wx-auth-main {
    padding: 1.25rem var(--v2-m-gutter) calc(2rem + env(safe-area-inset-bottom, 0px));
    place-items: start center;
  }

  .wx-auth-grid {
    width: 100%;
    max-width: 480px;
    gap: 1.5rem;
  }

  .wx-auth-grid:not(.wx-auth-grid--single) .wx-auth-story {
    display: none;
  }

  .wx-auth-card {
    width: 100%;
    padding: 1.5rem 1.25rem;
    border-radius: 20px;
  }

  .wx-auth-card h2 {
    font-size: 1.5rem;
  }

  .wx-input {
    min-height: var(--v2-m-touch-lg);
  }

  .wx-auth-card .wx-btn.wide,
  .wx-auth-card .wx-btn--primary {
    min-height: var(--v2-m-touch-lg);
    width: 100%;
  }

  .wx-auth-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    text-align: center;
  }

  .wx-auth-switch {
    text-align: center;
    line-height: 1.5;
  }

  .wx-auth-trust {
    font-size: 0.8125rem;
    line-height: 1.45;
  }
}

/* ── Logged-in app shell + dashboard ── */
@media (max-width: 900px) {
  .lb-v2.v2-shell-pro:not(.v2-admin-shell) .v2-main {
    padding-left: var(--v2-m-gutter) !important;
    padding-right: var(--v2-m-gutter-r) !important;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .lb-v2 .v2-top-pro {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding-top: 8px;
    padding-bottom: 16px;
    position: relative;
    top: auto;
  }

  .lb-v2 .v2-top-pro__search,
  .lb-v2 .v2-search-pro {
    width: 100%;
    min-width: 0;
  }

  .lb-v2 .v2-head {
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px;
    min-height: 0;
    margin-bottom: 16px !important;
  }

  .lb-v2 .v2-head > div:last-child,
  .lb-v2 .v2-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: stretch;
    gap: 8px;
  }

  .lb-v2 .v2-actions .v2-btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    justify-content: center;
    min-height: var(--v2-m-touch);
  }

  .lb-v2 .v2-actions .v2-btn:only-child {
    flex: 1 1 100%;
  }

  .lb-v2 .v2-spotlight__tools {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .lb-v2 .v2-spotlight__search {
    width: 100%;
    max-width: none;
  }

  .lb-v2 .v2-spotlight__count {
    margin-left: 0;
    text-align: center;
  }

  .lb-v2 .v2-tier-grid,
  .lb-v2 .v2-tier-grid--account {
    grid-template-columns: 1fr !important;
  }

  .lb-v2 .v2-analytics-hero-stats,
  .lb-v2 .v2-glow-stats,
  .lb-v2 .v2-report-lite__stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .lb-v2 .v2-col-section {
    padding: 16px 14px;
    border-radius: 18px;
  }

  .lb-v2 .v2-grid.c4,
  .lb-v2 .v2-featured-playlists.v2-grid.c4,
  #v2-grid.v2-grid.c4 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .lb-v2 .v2-card .v2-art,
  #v2-grid .v2-art {
    height: 130px;
  }
}

@media (max-width: 680px) {
  .v2-home-hub--refreshed {
    padding: 16px 12px calc(72px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .v2-home-hub--refreshed .v2-home-hub__actions {
    grid-template-columns: 1fr !important;
    width: 100%;
  }

  .v2-home-hub--refreshed .v2-home-hub__actions .v2-btn {
    width: 100%;
  }

  .v2-home-quickstart a {
    min-height: 72px;
    padding: 14px 16px;
  }

  .v2-account-hero {
    padding: 20px 18px;
    border-radius: 20px;
  }

  .v2-account-grid--pro {
    grid-template-columns: 1fr !important;
  }

  .lb-v2 .v2-grid.c4,
  .lb-v2 .v2-featured-playlists.v2-grid.c4,
  #v2-grid.v2-grid.c4 {
    grid-template-columns: 1fr !important;
  }

  .lb-v2 .v2-analytics-hero-stats,
  .lb-v2 .v2-glow-stats,
  .lb-v2 .v2-report-lite__stats {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .lb-v2 .v2-actions .v2-btn {
    flex: 1 1 100%;
  }

  .lb-v2 .v2-analytics-hero-stats,
  .lb-v2 .v2-glow-stats,
  .lb-v2 .v2-report-lite__stats {
    grid-template-columns: 1fr;
  }
}

/* ── Host console ── */
@media (max-width: 720px) {
  .lb-v2 .v2-main:has(.v2-host-pro) {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .v2-host-pro .v2-host-topbar {
    gap: 10px;
  }

  .v2-host-utilitybar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  .v2-host-utilitybar .v2-btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    min-height: var(--v2-m-touch);
    justify-content: center;
    padding-inline: 10px;
    font-size: 12px;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
  }

  .v2-host-utilitybar .v2-validate-btn,
  .v2-host-utilitybar .v2-venue-launch {
    flex: 1 1 100%;
  }

  .v2-host-pro .v2-host-grid {
    gap: 10px;
  }

  .v2-host-deck .v2-playback-console,
  .v2-host-pro .v2-current-panel,
  .v2-host-queue {
    border-radius: 14px;
  }

  .v2-host-pro .v2-command-queue {
    max-height: min(50vh, 420px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .v2-host-pro .v2-command-queue .v2-queue-tools .v2-btn {
    min-height: var(--v2-m-touch);
    min-width: var(--v2-m-touch);
  }

  .v2-host-deck .v2-deck-buttons .v2-btn,
  .v2-host-pro .v2-deck-buttons .v2-btn {
    min-height: var(--v2-m-touch-lg);
  }

  .v2-host-pro .v2-setting-grid label input,
  .v2-host-pro .v2-setting-grid label select {
    min-height: var(--v2-m-touch);
  }

  .v2-host-scan-qr img {
    width: 72px;
    height: 72px;
  }
}

@media (max-width: 480px) {
  .v2-host-utilitybar .v2-btn {
    flex: 1 1 100%;
  }

  .v2-host-deck .v2-deck-buttons,
  .v2-host-pro .v2-deck-buttons {
    grid-template-columns: 1fr !important;
  }

  .v2-host-pro .v2-setting-grid--audio {
    grid-template-columns: 1fr !important;
  }
}

/* ── Venues planner ── */
@media (max-width: 900px) {
  .bd-venues-route #bd-venues-mount {
    margin-left: 0 !important;
  }

  .bd-venues-page {
    padding: 20px var(--v2-m-gutter) calc(64px + env(safe-area-inset-bottom, 0px));
  }

  .bd-venues-grid {
    gap: 14px;
  }

  .bd-venues-sidebar {
    display: grid !important;
    overflow: visible !important;
    gap: 6px;
    padding: 10px;
  }

  .bd-venues-sidebar__head {
    display: flex !important;
    padding: 4px 6px 10px;
  }

  .bd-venue-row {
    min-width: 0 !important;
    min-height: var(--v2-m-touch);
  }

  .bd-venues-hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .bd-venues-hero > .bd-v-btn {
    width: 100%;
    min-height: var(--v2-m-touch-lg);
  }

  .bd-venue-head > div:last-child {
    flex-direction: column;
    width: 100%;
  }

  .bd-venue-head .bd-v-btn {
    width: 100%;
    min-height: var(--v2-m-touch);
  }

  .bd-night-card {
    padding: 14px;
    gap: 12px;
  }

  .bd-night-game > div:last-child {
    flex-direction: column;
    width: 100%;
  }

  .bd-night-game > div:last-child .bd-v-btn {
    width: 100%;
    min-height: var(--v2-m-touch);
  }
}

@media (max-width: 560px) {
  .bd-venues-content {
    padding: 16px 12px;
  }

  .bd-venue-head h2 {
    font-size: 1.5rem;
  }

  .bd-v-modal__card {
    width: calc(100vw - 12px) !important;
    max-height: min(92dvh, 92vh);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .bd-v-modal label input,
  .bd-v-modal label textarea,
  .bd-v-modal label select {
    min-height: var(--v2-m-touch);
  }

  .bd-v-modal footer .bd-v-btn {
    min-height: var(--v2-m-touch-lg);
  }
}

/* ── Modals + billing ── */
@media (max-width: 720px) {
  .lb-v2 .v2-modal {
    align-items: flex-end;
    padding: 0;
  }

  .lb-v2 .v2-modal-card {
    width: 100% !important;
    max-width: 100% !important;
    max-height: min(92dvh, 92vh) !important;
    margin: 0 !important;
    border-radius: 20px 20px 0 0 !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .lb-v2 .v2-modal-card > footer,
  .v2-sponsors-foot,
  .v2-custom-logo-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .lb-v2 .v2-modal-card > footer .v2-btn,
  .v2-sponsors-foot .v2-btn,
  .v2-custom-logo-actions .v2-btn {
    width: 100%;
    min-height: var(--v2-m-touch-lg);
    justify-content: center;
  }

  .bd-upgrade-modal,
  .bd-billing-modal,
  #lb-v2-root > .bd-upgrade-modal,
  #lb-v2-root > .bd-billing-modal {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  .bd-upgrade-modal-card,
  .bd-billing-card {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    max-height: min(92dvh, 92vh);
    overflow-y: auto;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .bd-billing-options--three {
    grid-template-columns: 1fr;
  }

  .bd-upgrade-actions {
    flex-direction: column;
    gap: 10px;
  }

  .bd-upgrade-actions .bd-acc-btn,
  .bd-upgrade-actions .v2-btn {
    width: 100%;
    min-height: var(--v2-m-touch-lg);
  }
}

/* ── Tables that must scroll horizontally ── */
@media (max-width: 720px) {
  .v2-table-wrap,
  .bd-admin-users-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-inline: -4px;
    padding-inline: 4px 8px;
  }
}
