/* Телефон в портрете: та же игра, переложенная в узкий кадр (класс #stage.mobile ставит game-map.js).
   Сверху шапка в две строки, посередине карта (двигается пальцем), снизу — действия лентой, строка чата и «Готов».
   Гонка, событие дня, чат и цели выезжают шторкой. Компьютерную раскладку эти правила не трогают. */

/* Слой мира всегда размером с карту, а не с кадр: иначе на телефоне дождь и сияние обрезались бы по ширине кадра. */
#world { inset: auto; left: 0; top: 0; width: 1440px; height: 810px; transform-origin: 0 0; }
#stage.gliding #map, #stage.gliding #world { transition: transform .6s cubic-bezier(.3, .8, .3, 1); }
#m-strip, #m-event, #side .m-close { display: none; }

#stage.mobile { touch-action: none; }
#stage.mobile #cards { touch-action: pan-x; }
#stage.mobile #side, #stage.mobile .modal { touch-action: pan-y; }

/* Карта уменьшена, а подписи остаются читаемыми: их увеличиваем обратно отдельным свойством scale. */
#stage.mobile #world .chip { scale: var(--unzoom); }
#stage.mobile #world .pin { scale: var(--unzoom); transform-origin: 50% 100%; }
#stage.mobile #world .tag, #stage.mobile #world .route-tag { scale: var(--unzoom); transform-origin: 0 100%; }
#stage.mobile #world .floater, #stage.mobile #world .act-scene { scale: var(--unzoom); }
#stage.mobile #world .chip.here { z-index: 3; }

/* ------------------------------------------------------------ шапка */
#stage.mobile #hud { left: 0; top: 0; right: 0; padding: 6px 8px 8px; gap: 6px; flex-wrap: wrap; background: var(--cream); border-bottom: 2.5px solid var(--ink); z-index: 12; }
#stage.mobile #hud .logo { order: 1; font-size: 13px; padding: 4px 9px; border-width: 2.5px; border-radius: 9px; box-shadow: 0 3px 0 var(--ink); }
#stage.mobile #hud .pill { height: 36px; padding: 0 9px; gap: 5px; font-size: 12.5px; }
#stage.mobile #hud .pill.day { order: 2; margin-left: auto; }
#stage.mobile #hud .pill.money { order: 3; }
#stage.mobile #hud .pill.yellow { order: 4; }
#stage.mobile #hud .pill.yellow .unit { display: none; }
#stage.mobile #hud .spacer { order: 5; flex: 0 0 100%; height: 0; }
#stage.mobile #hud .meter.m-time { order: 6; flex: 1 1 120px; width: auto; height: 40px; padding: 0 9px; }
#stage.mobile #hud .meter.m-time .lbl .ico { width: 20px; height: 20px; }
#stage.mobile #hud .meter.m-time .tval b { font-size: 14px; }
#stage.mobile #hud .meter.m-time .bar { height: 9px; }
#stage.mobile #hud .meter.iconic { order: 7; width: 74px; height: 40px; padding: 3px 7px 4px; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 4px; row-gap: 2px; }
#stage.mobile #hud .meter.iconic .big-ico { width: 20px; height: 20px; grid-row: 1; grid-column: 1; }
#stage.mobile #hud .meter.iconic .big-ico .ico { width: 20px; height: 20px; }
#stage.mobile #hud .meter.iconic > b { grid-row: 1; grid-column: 2; font-size: 14px; }
#stage.mobile #hud .meter.iconic .bar { grid-row: 2; grid-column: 1 / -1; height: 7px; }
#stage.mobile #hud .pill.red, #stage.mobile #hud .pill.green { order: 8; height: 40px; font-size: 0; gap: 0; padding: 0 9px; }
#stage.mobile #hud .pill.sound { order: 9; width: 38px; height: 40px; font-size: 16px; padding: 0; }
#stage.mobile #hud .delta { z-index: 14; }

/* Событие дня — плашка на карте под шапкой */
#stage.mobile #m-event:not([hidden]) { display: block; position: absolute; left: 8px; top: 108px; max-width: 250px; padding: 4px 10px; background: #2E2350; color: #fff;
  font: 700 11px/1.25 var(--display); z-index: 6; transform: rotate(-1.5deg); }

/* ------------------------------------------------------------ низ: действия, чат, «Готов» */
#stage.mobile #dock { left: 0; right: 0; bottom: 118px; align-items: stretch; z-index: 8; }
#stage.mobile #dock .title { align-self: flex-start; margin-left: 8px; }
#stage.mobile #cards { display: flex; gap: 8px; padding: 0 8px 7px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  background: linear-gradient(180deg, rgba(43, 35, 32, 0) 0, rgba(43, 35, 32, .28) 100%); }
#stage.mobile #cards::-webkit-scrollbar { display: none; }
#stage.mobile #cards .card { flex: 0 0 auto; width: 178px; height: 140px; scroll-snap-align: start; }
#stage.mobile #cards .card.wait { width: 100%; height: auto; }

#stage.mobile #m-strip { display: flex; align-items: center; gap: 7px; position: absolute; left: 8px; right: 8px; bottom: 76px; height: 34px; padding: 0 8px 0 4px;
  background: var(--cream); border: 2.5px solid var(--ink); border-radius: 11px; box-shadow: 0 3px 0 var(--ink); z-index: 9; text-align: left; }
#m-strip b { flex: none; background: var(--ink); color: #fff; border-radius: 7px; padding: 3px 7px; font: 600 9.5px var(--display); }
#m-strip .m-last { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 12.5px; }
#m-strip .m-last.bad { color: #A31621; font-weight: 700; }
#m-strip .m-last.good { color: #0F5A2E; font-weight: 700; }
#m-strip i { flex: none; font-style: normal; font-size: 10px; color: var(--muted); }

#stage.mobile #ready { left: 8px; right: 8px; bottom: 10px; width: auto; height: 56px; flex-direction: row; gap: 10px; border-radius: 14px; box-shadow: 0 5px 0 var(--ink); z-index: 9; }
#stage.mobile #ready b { font-size: 20px; }
#stage.mobile #ready span { font-size: 12px; }
#stage.mobile .ready-info { display: none; }
#stage.mobile #hint { left: 8px; right: 8px; width: auto; bottom: auto; top: 108px; padding: 5px 10px; font-size: 12px; z-index: 7; }
#stage.mobile #m-event:not([hidden]) ~ #hint { top: 140px; }
#stage.mobile #hint .soft { display: none; }
#stage.mobile #game-connection { left: 8px; right: 8px; top: 108px; width: auto; z-index: 16; }

/* ------------------------------------------------------------ шторка: гонка, событие, чат, цели */
#stage.mobile #side { left: 0; right: 0; top: 60px; bottom: 0; width: auto; padding: 10px 10px 12px; gap: 8px; background: var(--cream); border-top: 3px solid var(--ink); border-radius: 18px 18px 0 0;
  z-index: 18; overflow-y: auto; transform: translateY(104%); transition: transform .28s ease-out; }
#stage.mobile.side-open #side { transform: none; box-shadow: 0 -70px 0 0 rgba(22, 16, 12, .5); }
#stage.mobile #side .m-close { display: block; align-self: flex-end; height: 38px; font-size: 12px; flex: none; }
#stage.mobile #side .event { transform: none; flex: none; }
#stage.mobile #side .panel { flex: none; }
#stage.mobile #chat { flex: 1 0 220px; }
#stage.mobile #side .goals-sum { display: none; }
#stage.mobile #side .goals-full { position: static; width: auto; opacity: 1; transform: none; pointer-events: auto; box-shadow: none; border: 0; padding: 0; background: transparent; }

/* ------------------------------------------------------------ окна, новости, обучение */
#stage.mobile .modal, #stage.mobile .modal.wide, #stage.mobile .modal.final, #stage.mobile .modal.paper { width: calc(100% - 16px); max-height: calc(100% - 20px); padding: 14px 14px 16px; gap: 9px; }
#stage.mobile .modal h1 { font-size: 20px; }
#stage.mobile .modal.paper { padding: 22px 14px 24px; transform: none; }
#stage.mobile .modal.paper .mh-title { font-size: 21px; }
#stage.mobile .modal.paper .mh-line span:nth-child(2) { display: none; }
#stage.mobile .modal.paper h1 { font-size: 19px; }
#stage.mobile .modal.paper .paper-head { flex-wrap: wrap; gap: 6px 12px; }
#stage.mobile .modal.paper .paper-stamp { font-size: 15px; }
#stage.mobile .modal.paper .paper-cols { grid-template-columns: 1fr; }
#stage.mobile .modal.paper .list.gossip { border-left: 0; padding-left: 0; border-top: 1.5px solid var(--ink); }
#stage.mobile .tl-cells { gap: 2px; }
#stage.mobile .rowbtn { flex-wrap: wrap; }
#stage.mobile .rowbtn > * { flex: 1 1 140px; }
#stage.mobile .big, #stage.mobile .ghost { height: 50px; }
#stage.mobile .podium { gap: 6px; height: 240px; }
#stage.mobile .p-col { width: 112px; }
#stage.mobile .sb-legend { flex-wrap: wrap; }

#stage.mobile .daybanner { left: 50px; right: 50px; top: 230px; padding: 10px 14px 12px; border-width: 3px; box-shadow: 0 6px 0 var(--ink); }
#stage.mobile .daybanner b { font-size: 34px; }
#stage.mobile .news-card { width: 340px; margin-left: -170px; top: 120px; }
#stage.mobile .news-card .news-who { font-size: 30px; }
#stage.mobile .news-card.mini { left: auto; right: 8px; top: 108px; width: 230px; margin-left: 0; }
#stage.mobile .news-card.mini .news-who { font-size: 19px; }
#stage.mobile .tour-bubble { width: 330px; padding: 11px 13px 10px; }
#stage.mobile .tour-bubble .tour-title { font-size: 15px; }
#stage.mobile .tour-bubble p { font-size: 13px; }
#stage.mobile .clouds { display: none; }

/* Первая строка шапки должна помещаться и с пятизначными суммами */
#stage.mobile #hud .logo { font-size: 11px; padding: 4px 7px; }
#stage.mobile #hud .pill.day { padding: 0 8px; }
#stage.mobile #hud .pill.day .muted { display: none; }
#stage.mobile #hud .pill.money { padding: 0 7px; gap: 4px; font-size: 12px; }
#stage.mobile #hud .pill.money .cash-part, #stage.mobile #hud .pill.money .card-part { gap: 3px; }
#stage.mobile #hud .pill.money .ico { width: 16px; height: 16px; }
#stage.mobile #hud .pill.yellow { padding: 0 8px; }
#stage.mobile .modal.paper .paper-stamp { margin-bottom: 8px; }
#stage.mobile .tl-head { font-size: 10px; align-items: center; gap: 8px; }
#stage.mobile .tl-total { font-size: 15px; white-space: nowrap; }

/* Партия на одном устройстве: имя ходящего встаёт на место логотипа */
#stage.mobile #hud:has(.who-pill) .logo { display: none; }
#stage.mobile #hud .pill.who-pill { order: 1; max-width: 104px; padding: 0 8px 0 5px; }
#stage.mobile #hud .pill.who-pill b { font-size: 11.5px; }
#stage.mobile .handoff-card h1 { font-size: 28px; }
