/* Le jeu est uniquement en paysage.
   Sur un écran tactile (ou très étroit) tenu en portrait, toute l'application est tournée de 90° :
   le joueur tourne son appareil et retrouve la même interface. src/ui/menus.js tente aussi
   le verrouillage natif (plein écran) et corrige les gestes de caméra pendant la rotation. */
@media (orientation: portrait) and (pointer: coarse), (orientation: portrait) and (max-width: 640px) {
  #root {
    inset: auto; top: 0; left: 100vw; left: 100dvw;
    width: 100vh; width: 100dvh; height: 100vw; height: 100dvw;
    transform-origin: 0 0; transform: rotate(90deg);
  }
}

/* Petits écrans paysage (téléphones) : la classe html.compact est posée par src/ui/menus.js
   d'après la hauteur effective en paysage, y compris quand la page est tournée. */
html.compact { --top-h: 44px; --side-w: clamp(250px, 34cqw, 320px); --safe-b: max(8px, env(safe-area-inset-bottom)); }
html.compact body { font-size: 13px; }
html.compact .brand { display: none; }
html.compact .side-nav button { font-size: 1.02rem; padding: 0 11px; }
html.compact .route-chip { min-width: 0; padding: 4px 10px 4px 9px; }
html.compact .route-chip small { display: none; }
html.compact .route-chip b { font-size: .95rem; max-width: 150px; }
html.compact #sidebarToggle { padding: 6px 12px; font-size: .95rem; }
html.compact #screenshotBtn { display: none; }
html.compact .side-main { padding: 10px 10px 16px var(--safe-l); }
html.compact .category-selector { grid-template-columns: repeat(4, 1fr); }
html.compact .catbtn { font-size: .82rem; padding: 6px 2px 5px; }
html.compact .caritem { padding: 4px 8px 4px 4px; grid-template-columns: 28px 1fr auto; }
html.compact .car-color { width: 28px; height: 20px; }
html.compact .car-name { font-size: 1rem; }
html.compact .pagetitle { font-size: 1.5rem; }
html.compact .desc { display: none; }

html.compact .garage-scene-ui { padding: 10px var(--safe-r) var(--safe-b) 14px; }
html.compact .garage-identity { left: 14px; top: 10px; max-width: 58%; }
html.compact .plate h1 { font-size: 1.5rem; padding: 6px 12px 6px 10px; }
html.compact .plate-number { min-width: 38px; font-size: 1.15rem; }
html.compact #garageCarMeta { margin-top: 6px; font-size: .72rem; }
html.compact .car-stats { display: none; }
html.compact .garage-camera-tools { top: 10px; }
html.compact .garage-view-caption { display: none; }
html.compact .view-buttons { grid-template-columns: repeat(2, auto); }
html.compact .view-buttons button { padding: 5px 8px; font-size: .72rem; }
html.compact .vehicle-inspection { display: none; }
html.compact .garage-orbit-hint { display: none; }
html.compact .garage-drive { min-width: 200px; font-size: 1.45rem; padding: 9px 40px 10px 16px; }
html.compact .garage-category-rail { left: 14px; right: 240px; }

html.compact .nav-sign { width: min(250px, 32cqw); padding: 8px 11px 9px; }
html.compact .worldtitle { font-size: 1.15rem; }
html.compact .worldsub { display: none; }
html.compact .location-card { margin-top: 5px; padding-top: 5px; }
html.compact .progressline strong { font-size: .98rem; }
html.compact .minimap-wrap { width: 96px; }
html.compact .stage-tools #cameraLabel { display: none; }
html.compact .stage-tools button { padding: 7px 8px; }
html.compact .drift-meter strong { font-size: 1.5rem; }
html.compact .speedo { width: 184px; padding: 9px 12px; }
html.compact #speed { font-size: 3rem; }
html.compact .gear-box b { width: 36px; height: 36px; font-size: 1.6rem; }
html.compact .speedo-foot { margin-top: 5px; }
html.compact .bottom-keys { display: none; }
html.compact .aid-lights, html.compact .boost-row { margin-top: 5px; }
html.compact .side-readout { bottom: var(--safe-b); }

html.compact .menu-title { font-size: 3rem; }
html.compact .menu-sub { margin-bottom: 12px; }
html.compact .menu-item { font-size: 1.25rem; min-width: 240px; padding: 8px 44px 9px 16px; }
html.compact .menu-item.primary { font-size: 1.55rem; min-width: 280px; }
html.compact .menu-list { gap: 5px; }
html.compact .title-screen { gap: 16px; padding-top: 16px; }
html.compact .logo-main { font-size: 4.6rem; }
html.compact .logo-sub { font-size: 1.1rem; }
html.compact .title-car { margin-top: 8px; }
html.compact .map-picker { padding-top: 14px; gap: 12px; }
html.compact .picker-head .menu-title { font-size: 2.2rem; }
html.compact .map-signs { grid-template-columns: repeat(3, 1fr); gap: 9px; }
html.compact .map-sign { min-height: 0; padding: 11px 13px; }
html.compact .map-sign strong { font-size: 1.4rem; }
html.compact .map-sign p { font-size: .72rem; }
html.compact .pause .menu-column { padding-right: 0; }
html.compact .region-travel { margin-top: 10px; }


@media (hover: none) and (pointer: coarse) {
  html.compact .touchkey { width: 66px; height: 66px; }
  html.compact .touchkey.gas { width: 74px; height: 96px; }
  html.compact .touchkey.brake { width: 68px; height: 80px; }
  html.compact .touchkey.hand { width: 56px; height: 56px; font-size: .7rem; }
  html.compact .speedo { bottom: calc(var(--safe-b) + 104px); width: 170px; }
  html.compact #speed { font-size: 2.8rem; }
  html.compact .side-readout { display: none; }
}

/* Écrans larges mais peu hauts (tablette paysage) */
@media (min-height: 541px) and (max-width: 1100px) {
  .car-stats { grid-template-columns: auto minmax(90px, 150px) auto; }
  .garage-category-rail { right: 290px; }
}

/* Finishing layouts share the same landscape container on phones and desktops. */
html.compact .side-main { padding-top: 11px; }
html.compact .side-main > .panelpage > .section-kicker { margin-bottom: 7px; font-size: .57rem; }
html.compact .collection-tools { gap: 4px; }
html.compact .collection-tools select, html.compact #carFavorites { font-size: .72rem; padding: 5px 7px; }
html.compact .caritem { min-height: 44px; padding-block: 6px; }
html.compact .car-row { grid-template-columns: minmax(0,1fr) 24px; }
html.compact .car-id { display: none; }
html.compact .caritem { grid-template-columns: 24px minmax(0,1fr); gap: 7px; }
html.compact .car-color { width: 24px; }
html.compact .field { padding-block: 9px; }
html.compact .setup-status { font-size: .6rem; }
html.compact .garage-identity > .section-kicker { display: none; }
html.compact .plate h1 { padding: 0; font-size: 1.65rem; }
html.compact .plate-number { margin: 0 9px 0 0; padding: 0 9px 0 0; min-width: 0; font-size: 1.25rem; }
html.compact #garageOptionsBtn { padding: 6px 8px; }
html.compact .title-kicker,html.compact .title-intro,html.compact .title-edition { display: none; }
html.compact .title-screen { gap: 13px; }
html.compact .title-menu .menu-item:not(.primary) { font-size: 1.1rem; padding: 6px 12px; min-width: 240px; }
html.compact .title-car { max-width: 42ch; font-size: .66rem; }
html.compact .title-foot { font-size: .6rem; }
html.compact .title-foot span { margin-left: 5px; }
html.compact .pause { padding-top: 14px; padding-bottom: 10px; }
html.compact .pause .section-kicker { margin-bottom: 7px; font-size: .58rem; }
html.compact .pause .menu-column { width: min(700px,82cqw); }
html.compact .pause-actions .menu-item { min-width: 0; font-size: 1rem; padding: 8px 11px; line-height: 1.05; }
html.compact .pause-actions .menu-item.primary { font-size: 1.4rem; }
html.compact .picker-head .section-kicker { margin-bottom: 6px; font-size: .6rem; }
html.compact .map-signs { grid-template-columns: repeat(3,minmax(0,1fr)); }
html.compact .map-sign { min-height: 135px; padding: 12px; gap: 4px; }
html.compact .map-sign .kind { min-height: 0; font-size: .55rem; padding-right: 20px; }
html.compact .route-preview { height: 34px; margin: 0 0 5px; }
html.compact .map-sign p { display: none; }
html.compact .route-features { font-size: .56rem; padding-top: 2px; padding-bottom: 15px; }
html.compact .map-sign .route-number { top: 8px; right: 10px; font-size: 1.2rem; }
html.compact .map-sign .current { bottom: 8px; right: 9px; font-size: .52rem; }
html.compact .options-menu { padding: 8px; }
html.compact .options-shell { width: 96cqw; height: 94cqh; border-radius: 8px; }
html.compact .options-head { padding: 12px 18px 9px; }
html.compact .options-head .section-kicker { display: none; }
html.compact .options-head .menu-title { font-size: 2rem; }
html.compact .options-head .menu-close { padding: 6px 10px; font-size: .82rem; }
html.compact .options-nav { padding-inline: 12px; }
html.compact .options-nav button { padding: 9px 12px; font-size: .76rem; }
html.compact .options-content { padding: 10px 18px; }
html.compact .options-content .input-setting { font-size: .8rem; margin-block: 12px; }
html.compact .options-content .desc { display: block; }
html.compact .options-foot { padding: 6px 18px; font-size: .6rem; }
html.compact .map-sign { min-height: 108px; height: 108px; padding: 10px 12px 22px; gap: 3px; }
html.compact .map-sign .kind { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 11px; }
html.compact .map-sign strong { font-size: 1.3rem; line-height: 1; margin-bottom: 0; }
html.compact .route-preview { height: 22px; margin: 0 0 2px; }
html.compact .route-features { display: none; }
html.compact .map-sign .current { bottom: 5px; }
