/* Small windows. The game starts inside the portal's page, not fullscreen:
   often about 960x540, and a phone on its side is 844x390 or 740x360.
   These rules only tighten things for short or narrow windows, so that
   nothing is cut off and the main button is always on screen. Loaded last.
   (The boot loader and the race loader have theirs in home.css / ui.css.) */

/* ---------------------------------------------------------------- landing */
/* the title and buttons sit at the bottom-left, but never slide under the top bar */
.land-main { top: calc(var(--bar-h) + 12px); justify-content: safe flex-end; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.land-main::-webkit-scrollbar { display: none; }
@media (max-height: 620px) {
  .land-main { bottom: clamp(12px, 5vh, 40px); width: min(560px, calc(100vw - 32px)); gap: 10px; }
  .wordmark { flex-direction: row; align-items: baseline; gap: 0.16em; font-size: clamp(38px, 11vh, 76px); line-height: 0.9; white-space: nowrap; }
  .wordmark i { margin: 0; font-size: 0.4em; letter-spacing: 0.2em; }
  .land-cta { gap: 8px; margin-top: 2px; }
  .land-soon { grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 0; }
  .soon-cta { min-height: 46px; padding: 8px 12px; gap: 10px; flex-wrap: wrap; }
  .soon-cta .sc-ic, .soon-cta .sc-ic svg { width: 22px; height: 22px; }
  .soon-cta .sc-t b { font-size: 15px; }
  .soon-cta em { font-size: 11px; padding: 3px 7px; }
}
@media (max-height: 460px) {
  .land-main { gap: 6px; }
  .land-main > .kick { display: none; }
  .land-cta .meta { margin: -2px 0 0 2px; font-size: 12px; }
  .land-cta .ghost.wide { padding: 9px 14px; }
  .soon-cta { min-height: 40px; padding: 6px 10px; }
}

/* ---------------------------------------------------------------- top bar */
@media (max-height: 480px) {
  :root { --bar-h: 44px; }
  .tb-icon { width: 32px; height: 32px; }
  .cred-chip { height: 32px; }
  .cred-chip svg { width: 20px; height: 20px; }
}
@media (max-width: 800px) {
  .topbar { gap: var(--s3); padding-right: var(--s3); }
  .tb-tabs button { padding: 0 7px; letter-spacing: 0.08em; }
}

/* ---------------------------------------------------------------- menu pages
   (race hub, quick race, weekend, settings, results, career...) */
@media (max-height: 560px) {
  h1 { font-size: 28px; }
  .pg-head { padding-top: 10px; padding-bottom: 8px; gap: 8px; }
  .pg-head .lede { font-size: 13.5px; line-height: 1.35; }
  .subtabs button { padding: 6px; font-size: 12.5px; }
  .pg-body { gap: 10px; padding-bottom: 12px; }
  .pg-foot { padding: 8px var(--pad-x) 10px; }
  .primary.big, .btn.big { padding: 10px 18px; font-size: 15.5px; }
  .card { padding: 12px; }
}
/* very short: the whole panel scrolls, the main button stays pinned at the bottom */
@media (max-height: 480px) {
  h1 { font-size: 24px; }
  .page > .side { overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent; }
  .page > .side > .pg-body { flex: none; overflow: visible; min-height: auto; }
  .page > .side > .pg-foot { position: sticky; bottom: 0; margin-top: auto; z-index: 2; background: rgba(5, 7, 11, 0.95); }
  .field { gap: 5px; }
  input, select { padding: 8px 10px; }
  select { padding-right: 34px; }
}

/* the pause menu's small-screen sizes live in screens.css (three columns, no scroll) */

/* ---------------------------------------------------------------- in-race HUD */
@media (max-height: 620px) {
  :root { --map-w: 128px; }
  .minimap canvas { width: 120px; height: 120px; }
  .radar canvas { height: 110px; }
  /* the right column never runs into the map: it scrolls instead */
  .rcol { max-height: calc(100vh - 2 * var(--g)); overflow-y: auto; scrollbar-width: none; }
  .rcol::-webkit-scrollbar { display: none; }
  /* the garage panel shows the weather itself, and needs the whole column */
  .rcol:has(.garagepanel:not(.hidden)) > .hud-wx { display: none; }
  body:has(.rcol.pp) .minimap { display: none; }
  .hud .pitpanel { padding: 10px 12px; }
  .hud .garagepanel .gp-clock { margin-bottom: 6px; }
  .hud .garagepanel .gp-clock b { font-size: 18px; }
  .hud .garagepanel .eng { margin-bottom: 6px; font-size: 12px; }
  .hud .garagepanel .tyres button { padding: 4px 8px; }
  .hud .garagepanel .gp-go { margin-top: 8px; padding: 6px 8px; }
  .hud .garagepanel .gp-skip { margin-top: 6px; padding: 5px 8px; }
}
@media (max-height: 460px) {
  .aidchip { display: none; }
  /* a phone on its side: the pit banner keeps its sign and speed, the words would run under the lap boxes */
  .pitbar .pb-do { display: none; }
  .hud .garagepanel .gridwx small { display: none; }
}

/* round 7: the garage panel grew by one button (the out-lap for me); the map is of no use in the garage and the two
   met on screens under 800 px tall */
@media (max-height: 800px) {
  body:has(.garagepanel:not(.hidden)) .minimap { display: none; }
}

/* ---------------------------------------------------------------- grid stack (round 11)
   top to bottom, nothing on top of anything else: the start lights, the "P" pointer, Ray's card, the tyre pick */
.hud .pitpanel.grid { top: 270px; transform: translateX(-50%); }
@media (max-height: 800px) { .hud .pitpanel.grid .tyres button { padding: 4px 10px; } .hud .pitpanel.grid h4 { margin-bottom: 6px; } }
@media (max-height: 620px) {
  .hud .pitpanel.grid { top: 176px; padding: 10px 12px; }
  .hud .pitpanel.grid .eng, .hud .pitpanel.grid .gridwx small { display: none; }
  .hud:has(.pitpanel.grid:not(.hidden)) .mentor { display: none; }
}
/* round 12: big start messages (WAIT FOR THE LIGHTS) sit under the start lights, never on them; Ray's card moves under both */
.hud:has(.lights.on) .bigmsg { top: 140px; }
@media (min-width: 901px) { .hud:has(.lights.on):has(.bigmsg.on) .mentor { top: 218px; } }
