/* ═══════════════════════════════════════════════════════════════════════════════
   BLOC — SCREEN SIZING PASS (v3.2.43)
   Fixes found by rendering every screen at phone, tablet and desktop sizes:
   touch targets under 30px, labels under ~10px, and headers whose title ran
   into the corner buttons. Loaded last so these win over the per-screen sheets.
   ═══════════════════════════════════════════════════════════════════════════════ */

/* The old desktop game header sits outside every screen and is always covered
   by one; it still laid out (overflowing on small phones) and its buttons could
   take keyboard focus. The match has its own HUD. */
body > #hdr { display: none !important; }

/* Back / close buttons: one size everywhere, big enough for a thumb. */
.btn.btn-back {
  font-size: .72rem; letter-spacing: 1.5px; padding: 6px 12px;
  min-height: 34px; min-width: 76px;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.btn.btn-close-x { min-width: 36px; min-height: 34px; padding: 4px 10px; font-size: .85rem; }
.missions-close {
  width: 36px; height: 36px; top: 6px; right: 6px;
  display: flex; align-items: center; justify-content: center;
}

/* Settings toggles and small action buttons. */
.settings-toggle { min-height: 34px; }
.dm-chart-btn { min-height: 30px; }
#dust-convert-btn, #coll-convert-btn { min-height: 32px; }

/* Labels that rendered at 8-9px. */
.prof-stat-label, .hist-stat-label { font-size: .64rem; }
.lb-record { font-size: .66rem; }
.lb-tier { font-size: .62rem; }
.wardrobe-item-rarity { font-size: .64rem; }

/* The Bank / Black Market: the title ran under the dust counter and the close
   button on phones. Keep it clear of the corners and scale it with the screen.
   Sized by height: the modals are narrow, so width-based sizing wrapped the
   title onto two lines on landscape phones. */
.store-header { padding: 0 48px; }
.store-title { font-size: clamp(1.8rem, 8vh, 2.8rem); white-space: nowrap; }
.bm-header { padding: 0 52px; }
.bm-title { font-size: clamp(1.6rem, 6vh, 2.4rem); letter-spacing: .14em; white-space: nowrap; }
.missions-header { padding: 0 40px; box-sizing: border-box; }
@media (max-height: 500px) {
  .store-header { margin-bottom: 14px; }
  .bm-header { margin-bottom: 16px; }
  .bm-dust-counter { top: 14px; left: 16px; font-size: 1rem; }
  .bm-close { top: 12px; right: 12px; }
}
@media (max-width: 520px) {
  /* Too narrow for the counter beside the title: it drops below the close button. */
  .bm-header { padding: 34px 8px 0; }
}

/* Big screens: back buttons scale with everything else. */
@media (min-width: 1500px) and (min-height: 800px) {
  .btn.btn-back { font-size: .85rem; min-height: 40px; min-width: 92px; }
}

/* ── Rotate prompt (upright touch screens on the web) ───────────────────────── */
#rotate-prompt { display: none; }
/* Phones: always. Tablets: the menus work upright, but a match needs landscape. */
@media (orientation: portrait) and (max-width: 600px) and (pointer: coarse) {
  body:not(.native-app) #rotate-prompt { display: flex; }
}
@media (orientation: portrait) and (pointer: coarse) {
  body.game-active:not(.native-app) #rotate-prompt { display: flex; }
  #rotate-prompt {
    position: fixed; inset: 0; z-index: 100001;
    flex-direction: column; align-items: center; justify-content: center; gap: 12px;
    padding: 24px; text-align: center;
    background: radial-gradient(ellipse at 50% 40%, #1a1a22 0%, #050508 100%);
  }
}
#rotate-prompt .rp-phone {
  width: 54px; height: 92px; border: 3px solid var(--gold); border-radius: 10px;
  position: relative; margin-bottom: 14px; animation: rp-turn 2.4s ease-in-out infinite;
}
#rotate-prompt .rp-phone::after {
  content: ""; position: absolute; left: 50%; bottom: 6px; width: 14px; height: 3px;
  margin-left: -7px; border-radius: 2px; background: var(--gold); opacity: .6;
}
@keyframes rp-turn { 0%, 25% { transform: rotate(0); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
#rotate-prompt .rp-title { font-family: 'Bebas Neue', sans-serif; font-size: 2rem; letter-spacing: 5px; color: var(--gold); }
#rotate-prompt .rp-sub { font-family: 'Barlow Condensed', sans-serif; font-size: 1rem; letter-spacing: 1px; color: var(--muted2); }
#rotate-prompt #rp-fullscreen { margin-top: 14px; min-height: 44px; padding: 10px 22px; font-size: .9rem; letter-spacing: 2px; }
#rotate-prompt #rp-fullscreen.hidden { display: none; }
@media (prefers-reduced-motion: reduce) { #rotate-prompt .rp-phone { animation: none; transform: rotate(-90deg); } }

/* ── Lobby top bar (v3.2.43) ──────────────────────────────────────────────────
   Transparent ghost buttons disappeared against the bright street. Dark glass
   behind them, readable text, thumb-sized, and larger on big screens. */
#lobby-quick-controls .btn {
  font-size: .72rem; letter-spacing: 1.5px; padding: 6px 12px; min-height: 34px;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  background: rgba(8, 8, 12, .72); border: 1px solid rgba(255, 255, 255, .18); color: var(--text);
  border-radius: 6px; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
#lobby-quick-controls .btn:hover { border-color: var(--gold); color: var(--gold); }
#lobby-hud-top > div:first-child {
  background: rgba(8, 8, 12, .6); border-radius: 6px; padding: 4px 10px;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
#lobby-hud-top > div:first-child > span:first-child { text-shadow: 0 1px 6px rgba(0, 0, 0, .8); }
@media (min-width: 1500px) and (min-height: 800px) {
  #lobby-quick-controls .btn { font-size: .85rem; min-height: 40px; padding: 8px 16px; }
  #lobby-hud-top > div:first-child > span:first-child { font-size: 1.7rem !important; }
  #lobby-presence { font-size: .8rem; }
}

/* ── Daily missions (v3.2.44) ────────────────────────────────────────────────
   With real missions the box was taller than a landscape phone and centred, so
   its title and ✕ sat above the top of the screen. Cap it to the screen and
   scroll the list only, so the header and ✕ always stay visible. */
.missions-container { max-height: calc(100dvh - 24px); display: flex; flex-direction: column; box-sizing: border-box; }
.missions-list { overflow-y: auto; min-height: 0; -webkit-overflow-scrolling: touch; padding-right: 2px; }
.mission-action .btn { min-height: 32px; min-width: 64px; }
@media (max-height: 500px) {
  .missions-container { padding: 12px 14px; }
  .missions-header { margin-bottom: 10px; }
  .missions-title { font-size: 1.5rem; }
  .mission-card { padding: 8px 10px; }
}

/* ── Finding Match box (v3.2.46) ──────────────────────────────────────────────
   Eight stacked blocks came to ~490px, taller than a landscape phone (~410px),
   so the icon and CANCEL SEARCH were cut off (tester report). The box is capped
   to the screen and scrolls if it must; on short screens the status and the
   player card sit side by side. .mm-col is layout-transparent on tall screens. */
.mm-col { display: contents; }
#matchmaking-box {
  max-height: calc(100dvh - var(--safe-top, 0px) - var(--safe-bottom, 0px) - 16px);
  overflow-y: auto; box-sizing: border-box;
}
#mm-cancel-btn { min-height: 40px; flex-shrink: 0; }
@media (max-height: 520px) {
  #matchmaking-box {
    flex-direction: row; align-items: stretch; gap: 18px;
    max-width: 600px; width: calc(100vw - var(--safe-left, 0px) - var(--safe-right, 0px) - 32px);
    padding: 16px 18px;
  }
  .mm-col { display: flex; flex-direction: column; gap: 8px; flex: 1 1 0; min-width: 0; }
  #mm-col-status { align-items: center; justify-content: center; }
  #mm-col-player { justify-content: center; }
  #mm-icon { font-size: 1.7rem; }
  #matchmaking-timer { font-size: 1.8rem; }
  #mm-cancel-btn { margin-top: auto; }
}
@media (max-height: 340px) {
  #mm-tip-box { display: none; }   /* the least important thing in the box */
}

/* ── Social drawer (v3.2.46) ──────────────────────────────────────────────────
   Pinned to the very right edge, so with 3-button navigation in landscape its
   close button and BLOCKED tab sat under the system buttons. Keep clear of the
   right-edge safe area like the rest of the app. */
#social-drawer {
  width: calc(320px + var(--safe-right, 0px));
  padding-right: var(--safe-right, 0px);
  padding-top: var(--safe-top, 0px);
  padding-bottom: var(--safe-bottom, 0px);
  box-sizing: border-box;
  height: 100dvh;
}

/* ── Side safe areas for every page (v3.2.46) ────────────────────────────────
   With 3-button navigation the system buttons sit in a strip on the right in
   landscape. MainActivity hides them, but they come back while a player swipes,
   and not every device honours the request. Pages, the wardrobe and the lobby's
   floating panels stay clear of that strip (the match and the menu already do). */
.screen:not(#game-screen):not(#menu-screen),
#wardrobe-overlay {
  padding-left: var(--safe-left, 0px);
  padding-right: var(--safe-right, 0px);
}
body.lobby-active .screen.active:not(#menu-screen):not(#game-screen):not(#deck-screen):not(#auth-screen):not(#username-screen) {
  left: max(6vw, calc(var(--safe-left, 0px) + 12px));
  right: max(6vw, calc(var(--safe-right, 0px) + 12px));
  padding-left: 0; padding-right: 0;
}
@media (max-height: 460px) {
  body.lobby-active .screen.active:not(#menu-screen):not(#game-screen):not(#deck-screen):not(#auth-screen):not(#username-screen) {
    left: max(4vw, calc(var(--safe-left, 0px) + 10px));
    right: max(4vw, calc(var(--safe-right, 0px) + 10px));
  }
}

/* ── Feedback form (v3.2.46) ─────────────────────────────────────────────────
   With large system text on a small phone the form was taller than the screen
   and SEND / CANCEL fell off the bottom. Cap it and let the text box give way. */
#bug-report-box {
  max-height: calc(100dvh - var(--safe-top, 0px) - var(--safe-bottom, 0px) - 16px);
  overflow-y: auto; box-sizing: border-box;
}
@media (max-height: 460px) {
  #bug-report-input { min-height: 64px; height: 22vh; }
}

/* ── Username screen: which account (v3.2.49) ───────────────────────────────── */
#username-account-note {
  width: 100%; box-sizing: border-box; margin: 2px 0 6px; padding: 9px 12px;
  border: 1px solid rgba(212,175,55,.28); background: rgba(212,175,55,.06); border-radius: 6px;
  font-family: 'Barlow Condensed', sans-serif; font-size: .82rem; letter-spacing: .4px;
  line-height: 1.45; color: var(--muted2, #b8b4a8); text-align: center;
}
#username-account-note.hidden { display: none; }
#username-account-note b { color: var(--text); font-weight: 600; letter-spacing: .6px; }
#username-signout-btn {
  background: none; border: none; padding: 4px 2px; min-height: 30px; cursor: pointer;
  font: inherit; font-weight: 600; letter-spacing: 1.5px; color: var(--gold);
  text-decoration: underline; text-underline-offset: 3px;
}
