/* Root runnable prototype overrides.
   The extracted design handoff is left untouched; these rules make the root copy usable on small screens. */

body.globe-unfolded .paul-peek {
  opacity: 0 !important;
  transform: translateY(24px) scale(0.96);
  transition: opacity 180ms var(--ease), transform 220ms var(--ease);
}

.mobile-game-nav,
.mobile-match-dock,
.mobile-price-pill {
  display: none;
}

@media (max-width: 760px) {
  body {
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
  }

  .topbar {
    height: 72px !important;
    min-height: 72px !important;
    padding: 10px 14px !important;
    gap: 10px !important;
    overflow: hidden !important;
  }

  .topbar-brand {
    flex: 0 0 auto !important;
    gap: 10px !important;
  }

  .topbar-brand > div:first-child {
    width: 38px !important;
    height: 38px !important;
    border-radius: 11px !important;
  }

  .topbar-brand .display {
    font-size: 18px !important;
    letter-spacing: 0 !important;
  }

  .desktop-tabs,
  .topbar-stats {
    display: none !important;
  }

  .mobile-price-pill {
    display: flex !important;
    flex: 0 0 auto !important;
  }

  .mobile-game-nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 90;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    padding: 7px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(12,8,28,0.92), rgba(5,6,16,0.94));
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 18px 48px -18px rgba(0,0,0,0.95), 0 0 34px -24px var(--gold), inset 0 1px 0 rgba(255,255,255,0.08);
    backdrop-filter: blur(18px);
  }

  .mobile-game-nav-item {
    min-width: 0;
    min-height: 50px;
    border: 1px solid transparent;
    border-radius: 13px;
    background: transparent;
    color: var(--t2);
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
  }

  .mobile-game-nav-item.is-active {
    color: var(--gold);
    background: linear-gradient(180deg, rgba(245,208,32,0.20), rgba(245,208,32,0.07));
    border-color: rgba(245,208,32,0.38);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 0 22px -12px var(--gold);
  }

  .mobile-game-nav-icon {
    font-size: 13px;
    line-height: 1;
  }

  [data-screen-label="01 Globe"] {
    flex-direction: column !important;
    min-height: auto !important;
    overflow: visible !important;
  }

  .globe-stage {
    order: 1 !important;
    flex: 0 0 max(660px, calc(100svh - 174px)) !important;
    min-height: max(660px, calc(100svh - 174px)) !important;
    overflow: hidden !important;
  }

  .leaderboard-rail {
    order: 2 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: 0 0 auto !important;
    padding: 16px 16px 108px !important;
    border-right: 0 !important;
    border-top: 1px solid var(--hair) !important;
  }

  .leaderboard-rail .main-scroll {
    max-height: none !important;
    overflow: visible !important;
    margin-right: 0 !important;
    padding-right: 0 !important;
  }

  .matchday-panel {
    display: none !important;
  }

  .mobile-match-dock {
    display: grid !important;
  }

  body.globe-unfolded .mobile-match-dock {
    display: none !important;
  }

  .mobile-match-team {
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--t1);
    display: grid;
    grid-template-columns: auto auto 1fr;
    align-items: center;
    gap: 6px;
    text-align: left;
    cursor: pointer;
  }

  .mobile-match-team.is-right {
    grid-template-columns: 1fr auto auto;
    justify-items: end;
    text-align: right;
  }

  .mobile-match-team .display {
    font-size: 18px;
    line-height: 1;
    letter-spacing: 0;
  }

  .mobile-match-team .mono {
    font-size: 9px;
    font-weight: 800;
    color: var(--t2);
  }

  .mobile-vs-chip {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: var(--gold);
    background: rgba(245,208,32,0.12);
    border: 1px solid rgba(245,208,32,0.34);
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 12px;
    font-weight: 900;
  }

  .mobile-match-bar {
    height: 7px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255,255,255,0.06);
    display: flex;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.55);
  }

  .country-command-panel {
    left: 14px !important;
    right: 14px !important;
    top: auto !important;
    bottom: 96px !important;
    width: auto !important;
    max-width: none !important;
    padding: 12px !important;
    border-radius: 15px !important;
  }

  .country-command-panel .display {
    font-size: 20px !important;
    letter-spacing: 0 !important;
  }

  .country-command-panel button {
    padding: 10px 12px !important;
  }

  .globe-unfold-button {
    bottom: 26px !important;
    max-width: 236px !important;
    padding: 10px 16px !important;
    white-space: normal !important;
    justify-content: center !important;
    z-index: 8 !important;
  }

  .globe-status-overlay {
    display: none !important;
  }

  .flat-map-control {
    top: 18px !important;
    left: 14px !important;
    right: 14px !important;
    transform: none !important;
    width: auto !important;
    max-width: none !important;
    grid-template-columns: 1fr !important;
    padding: 11px !important;
  }

  .flat-map-control .globe-mode-switch button {
    min-width: 0 !important;
    flex: 1 1 0 !important;
  }
}

@media (max-width: 760px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  #root {
    height: auto;
    min-height: 100vh;
  }

  #root > div {
    height: auto !important;
    min-height: 100vh !important;
    overflow: visible !important;
  }

  #root > div > div[style*="z-index: 1"] {
    min-height: 100vh !important;
    overflow: visible !important;
  }

  /* Top bar */
  #root > div > div[style*="z-index: 1"] > div:nth-child(2) {
    height: auto !important;
    min-height: 72px !important;
    padding: 10px 14px !important;
    gap: 14px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none;
  }

  #root > div > div[style*="z-index: 1"] > div:nth-child(2)::-webkit-scrollbar {
    display: none;
  }

  #root > div > div[style*="z-index: 1"] > div:nth-child(2) > div:first-child {
    flex: 0 0 auto !important;
  }

  /* Globe tab: stack the rail and the visual canvas instead of clipping at 1440px. */
  [data-screen-label="01 Globe"] {
    flex-direction: column !important;
    min-height: auto !important;
    overflow: visible !important;
  }

  [data-screen-label="01 Globe"] > div:first-child {
    width: auto !important;
    max-height: none !important;
    flex: 0 0 auto !important;
    overflow: visible !important;
  }

  [data-screen-label="01 Globe"] > div:nth-child(2) {
    min-height: 620px !important;
    flex: 0 0 620px !important;
    overflow: hidden !important;
  }

  [data-screen-label="01 Globe"] canvas {
    max-width: 100% !important;
  }

  [data-screen-label="01 Globe"] > div:nth-child(2) > div[style*="top: 24px"][style*="left: 24px"] {
    left: 16px !important;
    right: 16px !important;
    max-width: 300px !important;
  }

  .matchday-panel {
    top: 14px !important;
    left: 14px !important;
    right: 14px !important;
    width: auto !important;
    max-width: none !important;
    padding: 13px !important;
  }

  .matchday-panel .globe-mode-switch {
    width: 100% !important;
  }

  .matchday-panel .globe-mode-switch button {
    min-width: 0 !important;
    flex: 1 1 0 !important;
  }

  .flat-map-control {
    top: 52px !important;
    left: 14px !important;
    right: 14px !important;
    transform: none !important;
    width: auto !important;
    max-width: none !important;
    grid-template-columns: 1fr !important;
  }

  .flat-map-control .globe-mode-switch button {
    min-width: 0 !important;
    flex: 1 1 0 !important;
  }

  [data-screen-label="01 Globe"] > div:nth-child(2) > div[style*="top: 24px"][style*="right: 24px"] {
    display: none !important;
  }

  [data-screen-label="01 Globe"] > div:nth-child(2) > div[style*="bottom: 84px"][style*="left: 28px"] {
    left: 14px !important;
    right: 14px !important;
    bottom: 96px !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    max-width: 220px !important;
  }

  [data-screen-label="01 Globe"] > div:nth-child(2) > div[style*="bottom: 28px"][style*="right: 28px"] {
    display: none !important;
  }

  [data-screen-label="01 Globe"] button[style*="bottom: 28px"][style*="left: 50%"] {
    bottom: 20px !important;
    max-width: 220px !important;
    white-space: normal !important;
    justify-content: center !important;
  }

  .main-scroll {
    overflow-x: hidden !important;
  }

  .team-monitor-hero {
    grid-template-columns: 1fr !important;
  }

  .team-monitor-summary,
  .monitored-team-grid,
  .team-picker-grid {
    grid-template-columns: 1fr !important;
  }

  .team-picker-grid {
    max-height: none !important;
    overflow: visible !important;
    padding-right: 0 !important;
  }

  .paul-peek {
    display: none !important;
  }

  .buy-drawer {
    width: min(440px, 100vw) !important;
    padding: 22px !important;
  }

  .season-hub-grid {
    grid-template-columns: 1fr !important;
  }

  .share-paul {
    display: none !important;
  }

  .share-card {
    width: calc(100vw - 32px) !important;
    max-width: calc(100vw - 32px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
}
