/* ==================================================================================================
   Fincan — phone layout & PWA chrome (CHAIN_SPEC §6, §8.4 Mobile)
   Loaded after ui.css and chain.css. Phone rules key off classes set by ui/dom.js:
     body.ui-mobile     phone layout (< 768 px wide, or a landscape phone ≤ 520 px tall)
     body.ui-portrait   phone upright → compact two-row HUD card on top, tab bar at the bottom
     body.ui-landscape  phone sideways → left rail, single-row HUD, sheets beside the rail
     body.ui-touch      coarse pointer (also tablets) · body.ui-kb on-screen keyboard is up
   Sheets (PanelHost) move with --sheet-y; --sheet-pad keeps a half sheet's last rows reachable.
   Same paper / lacquer / cobalt world as the desktop UI; only geometry and type size change.
   ================================================================================================== */

:root {
  /* p8:shell — inside the Capacitor app the SystemBars plugin (insetsHandling 'css') sets --safe-area-inset-*
     on <html> (older Android WebViews report env() as 0); everywhere else env() is used as before. */
  --safe-t: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --safe-r: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
  --safe-b: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --safe-l: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
  --tabbar-h: 0px;     /* phone tab bar incl. home-indicator inset (0 elsewhere) */
  --rail-w: 0px;       /* landscape rail incl. notch inset */
  --hud-h: 76px;       /* bottom edge of the top HUD (desktop: --top) */
  --bb-h: 0px;         /* phone build bar height incl. inset */
  --m-gap: 8px;
  --sheet-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ------------------------------------------------------------------------------------------------
   Every layout: respect notches / home indicators (iPad, desktop-sized phones in landscape)
   ------------------------------------------------------------------------------------------------ */
body:not(.ui-mobile) .topbar { top: calc(var(--gutter) + var(--safe-t)); left: calc(var(--gutter) + var(--safe-l)); right: calc(var(--gutter) + var(--safe-r)); }
body:not(.ui-mobile) .chat { left: calc(var(--gutter) + var(--safe-l)); bottom: calc(var(--gutter) + var(--safe-b)); }
body:not(.ui-mobile) .inspector { right: calc(var(--gutter) + var(--safe-r)); bottom: calc(var(--gutter) + var(--safe-b)); }
body:not(.ui-mobile) .buildbar { bottom: calc(16px + var(--safe-b)); }
body:not(.ui-mobile) .toasts { right: calc(var(--gutter) + var(--safe-r)); }

/* Hover lifts stick after a tap on touch screens. */
@media (hover: none) {
  .item-card:hover, button.street-row:hover, .plot-slot.is-free:hover, .swatch:hover { transform: none; }
  .tb-stat:hover, .tb-brand:hover { background: transparent; }
}

/* ================================================================================================
   PHONE — shared
   ================================================================================================ */
body.ui-mobile #ui-root.fincan-ui { font-size: 15px; }
body.ui-mobile .ui-tooltip { max-width: min(300px, calc(100vw - 24px)); font-size: 14px; padding: 10px 12px; }
body.ui-mobile .ui-tooltip .tip-title { font-size: 15px; }
body.ui-mobile .dock { display: none; }
body.ui-mobile .text-in, body.ui-mobile .chat-input { font-size: 16px; }   /* < 16 px makes iOS zoom on focus */

/* ---------------------------------------------------------------------------------- tab bar */
body.ui-mobile .tabbar {
  position: fixed; z-index: calc(var(--z-panel) + 1); display: grid;
  background: linear-gradient(180deg, var(--lacquer-2), var(--lacquer));
  box-shadow: 0 -10px 30px -16px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(201, 162, 39, 0.28);
  transition: transform 380ms var(--sheet-ease), opacity 240ms ease;
}
.tab-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-width: 0; min-height: 48px; padding: 4px 2px; border: 0; background: transparent; cursor: pointer;
  color: #cdbca2; font: 600 12px/1 var(--f-ui); letter-spacing: 0.01em;
  transition: color var(--t-fast) ease;
}
.tab-btn::before {
  /* brass indicator for the active tab */
  content: ""; position: absolute; top: 0; left: 50%; width: 26px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--brass-hi); transform: translateX(-50%) scaleX(0); transition: transform 260ms var(--ease-out);
}
.tab-btn[aria-pressed="true"] { color: var(--brass-hi); }
.tab-btn[aria-pressed="true"]::before { transform: translateX(-50%) scaleX(1); }
.tab-btn:active .tab-ico { transform: scale(0.92); }
.tab-btn:focus-visible { outline: 2px solid var(--brass-hi); outline-offset: -4px; border-radius: 12px; }
.tab-ico { position: relative; display: inline-flex; transition: transform 90ms ease; }
.tab-label { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab-btn .dock-badge { top: -5px; right: -9px; box-shadow: 0 0 0 2px var(--lacquer); }
.tab-btn .dock-badge.is-dot { top: -2px; right: -4px; }
body.ui-spectator .tab-btn.needs-cafe { color: rgba(205, 188, 162, 0.45); }
body.ui-spectator .tab-btn.needs-cafe .dock-badge { display: none; }
/* `.fincan-ui button { font: inherit; color: inherit }` (ui.css) outranks the single-class rules above:
   restate ink + type with a higher specificity so the tab bar is legible on its lacquer background. */
body.ui-mobile .tabbar { color: #cdbca2; }
.fincan-ui .tab-btn { color: #cdbca2; font: 600 12px/1 var(--f-ui); letter-spacing: 0.01em; }
.fincan-ui .tab-btn[aria-pressed="true"] { color: var(--brass-hi); }
body.ui-spectator .fincan-ui .tab-btn.needs-cafe { color: rgba(205, 188, 162, 0.45); }

/* ---------------------------------------------------------------------------------- sheets */
body.ui-mobile .panel {
  position: fixed; width: auto; max-height: none; filter: none; opacity: 1;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -14px 44px -16px rgba(20, 12, 8, 0.55), var(--hair);
  transform: translate3d(0, calc(100% + 48px), 0);
  transition: transform 420ms var(--sheet-ease), box-shadow 200ms ease;
  will-change: transform;
}
body.ui-mobile .panel.is-open { transform: translate3d(0, var(--sheet-y, 0px), 0); }
body.ui-mobile .panel.is-closing { opacity: 1; transform: translate3d(0, calc(100% + 48px), 0); transition-duration: 320ms; }
body.ui-mobile .panel.is-dragging { transition: none; }
body.ui-mobile .panel.is-wide { width: auto; }
body.ui-mobile .panel::after { inset: 5px 5px 0; border-radius: 18px 18px 0 0; }
body.ui-mobile .panel[data-snap="peek"] { pointer-events: none; box-shadow: none; }

body.ui-mobile .sheet-grip {
  display: flex; justify-content: center; align-items: center; flex: none; height: 22px; margin-bottom: -6px;
  touch-action: none; cursor: grab; position: relative; z-index: 1;
}
.sheet-grip-bar { width: 42px; height: 5px; border-radius: 3px; background: rgba(42, 31, 26, 0.22); transition: background var(--t-fast) ease, width 200ms var(--ease-out); }
body.ui-mobile .panel.is-dragging .sheet-grip-bar { background: rgba(138, 79, 31, 0.55); width: 52px; }
body.ui-mobile .panel-head { touch-action: none; padding: 8px 8px 6px 16px; gap: 12px; }
body.ui-mobile .panel-emblem { width: 36px; height: 36px; }
body.ui-mobile .panel-title { font-size: 21px; }
body.ui-mobile .panel-sub { font-size: 14px; }
body.ui-mobile .panel-close { width: 44px; height: 44px; border-radius: 12px; }
body.ui-mobile .panel-orn { margin: 0 0 4px; }
body.ui-mobile .panel-tools { padding: 2px 14px 8px; }
body.ui-mobile .panel-body { padding: 10px 14px 16px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
body.ui-mobile .panel-body::after { content: ""; display: block; height: var(--sheet-pad, 0px); flex: none; }

/* Panel content is authored at desktop density; on phones it is zoomed so body text lands ≥ 14 px and
   controls ≥ 44 px without rewriting every panel (also covers chain-ui panels). Values below are in
   pre-zoom units: 39 px × 1.15 ≈ 45 px. */
body.ui-mobile .panel-body, body.ui-mobile .panel-tools { zoom: 1.15; }
body.ui-mobile .panel-body .btn, body.ui-mobile .panel-tools .btn,
body.ui-mobile .panel-body .btn-sm, body.ui-mobile .panel-tools .btn-sm { min-height: 39px; }
body.ui-mobile .panel-body .icon-btn, body.ui-mobile .panel-tools .icon-btn { min-width: 39px; min-height: 39px; }
body.ui-mobile .panel-body .stepper { height: 39px; }
body.ui-mobile .panel-body .stepper-btn { width: 36px; }
body.ui-mobile .panel-body .seg-btn, body.ui-mobile .panel-tools .seg-btn { min-height: 38px; }
body.ui-mobile .panel-body .text-in { height: 39px; font-size: 14px; }   /* 14 × 1.15 ≈ 16 px: no iOS focus zoom */
body.ui-mobile .panel-body .link-btn { min-height: 38px; }
body.ui-mobile .panel-tools .tab { height: 40px; }
body.ui-mobile .panel-body .switch { min-height: 39px; }

body.ui-mobile .sheet-backdrop {
  position: fixed; inset: 0 0 var(--tabbar-h) var(--rail-w); display: block; background: rgba(20, 14, 10, 0.4);
  transition: opacity 320ms ease, visibility 0s linear 320ms;
}
body.ui-mobile .sheet-backdrop.is-on { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity 320ms ease, visibility 0s; }

/* "Daha" overflow sheet */
.more-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.more-item {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 82px; padding: 10px 4px; border: 0; border-radius: 14px; cursor: pointer; color: var(--ink);
  background: rgba(255, 250, 241, 0.82); box-shadow: inset 0 0 0 1px var(--line-2), 0 1px 2px rgba(42, 31, 26, 0.06);
  transition: background var(--t-fast) ease, box-shadow var(--t-fast) ease, transform 90ms ease;
}
.more-item:active { transform: scale(0.97); background: #fff; }
.more-item.is-muted { opacity: 0.45; }
.more-ico {
  position: relative; width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: var(--copper-deep); background: radial-gradient(circle at 35% 30%, #fff8ea, #efe0c6); box-shadow: inset 0 0 0 1px rgba(184, 115, 51, 0.3);
}
.more-ico .dock-badge { top: -3px; right: -5px; box-shadow: 0 0 0 2px var(--paper); }
.more-label { font: 600 12.5px/1.2 var(--f-ui); text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.more-install {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 14px; padding: 12px 14px; border: 0; border-radius: 14px; cursor: pointer;
  text-align: left; color: var(--cobalt-deep); background: rgba(31, 78, 156, 0.08); box-shadow: inset 0 0 0 1px rgba(31, 78, 156, 0.24);
}
.more-install-text { display: flex; flex-direction: column; gap: 3px; }
.more-install-text strong { font: 650 14px/1.2 var(--f-display); color: var(--ink); }
.more-install-text span { font-size: 12.5px; color: var(--ink-3); }

/* ---------------------------------------------------------------------------------- top bar */
body.ui-mobile .tb-cta { min-height: 44px; }
body.ui-mobile .tb-open-switch { min-height: 44px; }
body.ui-mobile .tb-stat-label { font-size: 11px; }
body.ui-mobile .tb-event, body.ui-mobile .tb-stat.is-beauty, body.ui-mobile .tb-stat.is-visitors { display: none; }
body.ui-mobile .tb-level .tb-title { display: none; }
body.ui-mobile .tb-weekday { display: none; }

/* ---------------------------------------------------------------------------------- ticker */
/* only flash news on phones (day change, last orders, events), tap to skip */
body.ui-mobile .ticker { height: 36px; transform: none; }
body.ui-mobile .ticker:not(.is-flash) { opacity: 0; visibility: hidden; pointer-events: none; }
body.ui-mobile .ticker-line { font-size: 14px; }
body.ui-mobile .ticker-tag { font-size: 11px; }
body.ui-mobile.ui-has-panel .ticker, body.ui-mobile.ui-building .ticker, body.ui-mobile.ui-chat-open .ticker { opacity: 0; visibility: hidden; pointer-events: none; }

/* ---------------------------------------------------------------------------------- toasts */
.toast { touch-action: none; }   /* horizontal swipe-to-dismiss is handled in JS */
body.ui-mobile .toast { border-radius: 16px; padding: 12px 12px 14px 12px; }
body.ui-mobile .toast-title { font-size: 16px; }
body.ui-mobile .toast-text { font-size: 14px; }
body.ui-mobile .toast-detail { font-size: 13.5px; }
body.ui-mobile .toast { transform: translateY(-14px); }
body.ui-mobile .toast.is-in { transform: translateX(var(--toast-x, 0px)); }
body.ui-mobile .toast-action { min-height: 40px; font-size: 14px; padding: 0 14px; }

/* ---------------------------------------------------------------------------------- chat */
body.ui-mobile .chat-toggle {
  width: 52px; height: 52px; border-radius: 50%;
  transition: opacity 200ms ease, transform 260ms var(--ease-out), color var(--t-fast) ease;
}
body.ui-mobile .chat-badge { top: 2px; right: 2px; }
body.ui-mobile .chat-window {
  position: fixed; width: auto; transform-origin: center bottom;
  border-radius: 22px 22px 0 0; box-shadow: 0 -14px 44px -16px rgba(20, 12, 8, 0.55), var(--hair);
  opacity: 1; transform: translate3d(0, calc(100% + 40px), 0);
  transition: transform 380ms var(--sheet-ease), visibility 0s linear 380ms, bottom 200ms ease, height 200ms ease;
}
body.ui-mobile .chat.is-open .chat-window {
  transform: translate3d(0, var(--chat-y, 0px), 0); visibility: visible;
  transition: transform 380ms var(--sheet-ease), visibility 0s, bottom 200ms ease, height 200ms ease;
}
body.ui-mobile .chat-window.is-dragging { transition: none !important; }
body.ui-mobile .chat-grip { display: flex; justify-content: center; align-items: center; height: 18px; touch-action: none; cursor: grab; margin-bottom: -4px; }
body.ui-mobile .chat-head { touch-action: none; padding: 6px 6px 8px 16px; }
body.ui-mobile .chat-title { font-size: 16px; }
body.ui-mobile .chat-street { font-size: 13px; }
body.ui-mobile .chat-min { width: 44px; height: 44px; }
body.ui-mobile .chat-list { padding: 10px 16px; gap: 7px; }
body.ui-mobile .chat-line { font-size: 15px; line-height: 1.45; }
body.ui-mobile .chat-line.is-system { font-size: 14px; }
body.ui-mobile .chat-cafe { font-size: 13px; }
body.ui-mobile .chat-form { padding: 8px 10px calc(8px + var(--safe-b)); gap: 8px; }
body.ui-mobile.ui-kb .chat-form { padding-bottom: 8px; }
body.ui-mobile .chat-input { height: 44px; border-radius: 12px; }
body.ui-mobile .chat-send { width: 44px; height: 44px; border-radius: 12px; }
body.ui-mobile .chat-counter { right: 64px; font-size: 12px; }
body.ui-mobile.ui-chat-open .chat-toggle,
body.ui-mobile.ui-has-panel .chat-toggle,
body.ui-mobile.ui-building .chat-toggle,
body.ui-mobile:has(.inspector.is-open) .chat-toggle { opacity: 0; transform: scale(0.8); pointer-events: none; }
body.ui-mobile.ui-chat-tab .chat-toggle { display: none; }

/* ---------------------------------------------------------------------------------- inspector */
body.ui-mobile .inspector { width: auto; border-radius: 20px; }
body.ui-mobile .insp-body { zoom: 1.12; padding: 12px 12px 14px; }
body.ui-mobile .insp-close { width: 40px; height: 40px; top: 6px; right: 6px; }
body.ui-mobile .insp-actions .btn { min-height: 40px; }
body.ui-mobile.ui-chat-open .inspector { opacity: 0; visibility: hidden; pointer-events: none; }
/* p10:ui — fold grip (inspector.js setFolded): phones only; folded = title row + action row */
.insp-fold { display: none; }
body.ui-mobile .insp-fold {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: 2;
  width: 76px; height: 26px; padding: 0; border: 0; background: transparent; color: var(--ink-3);
  cursor: pointer; -webkit-tap-highlight-color: transparent; border-radius: 0 0 12px 12px;
}
body.ui-mobile .insp-fold:focus-visible { outline: 2px solid var(--cobalt); outline-offset: -2px; }
.insp-fold-bar { width: 40px; height: 4px; border-radius: 3px; background: rgba(42, 31, 26, 0.22); }
.insp-fold-ico { transition: transform 200ms var(--ease-out); opacity: 0.7; }
.inspector.is-folded .insp-fold-ico { transform: rotate(180deg); }
body.ui-mobile .inspector .insp-body { padding-top: 26px; }
body.ui-mobile .inspector.is-folded .insp-body > :not(.insp-head):not(.insp-actions) { display: none; }
body.ui-mobile .inspector.is-folded .insp-body > .insp-actions ~ .insp-actions { display: none; }
body.ui-mobile .inspector.is-folded .insp-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------------------------- build bar */
body.ui-mobile .buildbar {
  left: 0; right: 0; bottom: 0; max-width: none; transform: translate3d(0, calc(100% + 24px), 0);
  flex-direction: column; align-items: stretch; gap: 8px;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -14px 44px -16px rgba(20, 12, 8, 0.55), var(--hair);
}
body.ui-mobile .buildbar.is-open { transform: none; }
body.ui-mobile .buildbar.is-bad { box-shadow: 0 -14px 44px -16px rgba(20, 12, 8, 0.55), inset 0 0 0 1px rgba(192, 57, 43, 0.55); }
.bb-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bb-info .bb-item { flex: 1; max-width: none; }
.buildbar.is-mobile .bb-thumb, .buildbar.is-mobile .bb-mode-ico { width: 46px; height: 46px; }
.buildbar.is-mobile .bb-title { font-size: 17px; }
.buildbar.is-mobile .bb-sub { font-size: 14px; white-space: normal; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bb-cost { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: none; padding-left: 10px; border-left: 1px solid var(--line); }
.bb-cost > .bb-stat-val { font-size: 17px; }
.bb-cost .bb-stat-label { font-size: 11px; }
.bb-cost .bb-stat-line { align-items: baseline; gap: 5px; }
.bb-cost .bb-stat-line .bb-stat-val { font-size: 14px; }
.bb-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1fr); }
.bb-main .btn { width: 100%; min-height: 54px; height: auto; padding: 0 8px; font-size: 15px; border-radius: 14px; gap: 7px; }
.bb-main .bb-commit:disabled { opacity: 0.5; }
.bb-main .btn-quiet.bb-commit { color: var(--ink-3); background: rgba(42, 31, 26, 0.05); border-color: var(--line-2); }
.bb-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; padding: 3px; border-radius: 13px; background: rgba(42, 31, 26, 0.07); box-shadow: inset 0 1px 2px rgba(42, 31, 26, 0.1); }
.bb-mode {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; border: 0; border-radius: 10px;
  background: transparent; color: var(--ink-2); cursor: pointer; font: 600 14px/1 var(--f-ui);
  transition: background var(--t-fast) ease, color var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.bb-mode.is-active { background: var(--card); color: var(--cobalt); box-shadow: 0 1px 2px rgba(42, 31, 26, 0.16), inset 0 0 0 1px rgba(31, 78, 156, 0.3); }
.bb-mode:active { background: rgba(255, 250, 241, 0.7); }
body.ui-mobile.ui-building .tabbar { transform: translate3d(0, 110%, 0); opacity: 0; pointer-events: none; }
body.ui-mobile.ui-building .panel { bottom: var(--bb-h); }
body.ui-mobile.ui-building .sheet-backdrop { bottom: var(--bb-h); }
.fincan-build-hint { font-size: 14px !important; }

/* ---------------------------------------------------------------------------------- tutorial */
body.ui-mobile .tutorial { transform: translateY(-8px); width: auto; }
body.ui-mobile .tutorial.is-open { transform: none; }
body.ui-mobile.ui-has-panel .tutorial { transform: translateY(-8px); }
body.ui-mobile.ui-has-panel .tutorial.is-open { transform: none; }
body.ui-mobile.ui-sheet-full .tutorial, body.ui-mobile.ui-chat-open .tutorial { opacity: 0; visibility: hidden; pointer-events: none; }
body.ui-mobile .tut-card { padding: 14px 44px 14px 14px; border-radius: 16px; }
body.ui-mobile .tut-title { font-size: 17px; }
body.ui-mobile .tut-text { font-size: 14px; }
body.ui-mobile .tut-step { font-size: 12px; }
body.ui-mobile .tut-close { width: 40px; height: 40px; top: 4px; right: 4px; }
body.ui-mobile .tut-actions .btn { min-height: 44px; }
body.ui-mobile .tut-actions .link-btn { min-height: 44px; font-size: 14px; }

/* ---------------------------------------------------------------------------------- modals */
body.ui-mobile .modal-layer { place-items: end center; padding: calc(var(--safe-t) + 12px) calc(8px + var(--safe-r)) calc(8px + var(--safe-b)) calc(8px + var(--safe-l)); }
body.ui-mobile .modal, body.ui-mobile .modal-card { max-height: calc(var(--vvh, 100dvh) - var(--safe-t) - var(--safe-b) - 24px); }
body.ui-mobile .modal-card { width: 100%; padding: 20px 18px 18px; border-radius: 22px; overscroll-behavior: contain; }
body.ui-mobile .modal-card .modal-card { width: 100%; }
body.ui-mobile .modal-title { font-size: 21px; }
body.ui-mobile .modal-text { font-size: 15px; max-width: none; }
body.ui-mobile .modal-actions { width: 100%; }
body.ui-mobile .modal-actions .btn { flex: 1; min-height: 48px; font-size: 15px; }
body.ui-mobile .modal-card.eod { width: 100%; padding: 0 16px 16px; }
body.ui-mobile .eod-band { margin: 0 -16px 12px; }
body.ui-mobile .eod-title { font-size: 24px; }
body.ui-mobile .eod-cafe { font-size: 14px; }
body.ui-mobile .eod-profit-val { font-size: 36px; }
body.ui-mobile .eod-profit-label { font-size: 13px; }
body.ui-mobile .eod-grid { gap: 5px; }
body.ui-mobile .eod-cell { padding: 8px 9px; }
body.ui-mobile .eod-k { font-size: 11px; }
body.ui-mobile .eod-v { font-size: 16px; }
body.ui-mobile .eod-cols { grid-template-columns: minmax(0, 1fr); gap: 12px; }
body.ui-mobile .eod-col, body.ui-mobile .eod-reviews { font-size: 14px; }
body.ui-mobile .eod-foot { flex-wrap: wrap; gap: 8px 12px; }
body.ui-mobile .eod-foot .btn { width: 100%; min-height: 48px; margin-left: 0; font-size: 15px; }
body.ui-mobile .eod-level, body.ui-mobile .eod-money { font-size: 13px; }
body.ui-mobile .modal-layer.is-open { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(20, 14, 10, 0.5); }

/* ---------------------------------------------------------------------------------- onboarding card */
body.ui-mobile .title-card {
  left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); width: auto; top: auto;
  bottom: calc(8px + var(--safe-b)); max-height: calc(var(--vvh, 100dvh) - var(--safe-t) - var(--safe-b) - 24px);
  padding: 18px 18px 14px; border-radius: 22px; transform: translate3d(0, 28px, 0); overscroll-behavior: contain;
}
body.ui-mobile .title-layer.is-open .title-card { transform: none; }
body.ui-mobile .title-layer::before { background: linear-gradient(0deg, rgba(20, 14, 10, 0.55), rgba(20, 14, 10, 0) 70%); }
body.ui-mobile .title-lead { font-size: 14.5px; }
body.ui-mobile .title-logo { font-size: 38px; }
body.ui-mobile .title-emblem, body.ui-mobile .title-emblem svg { width: 56px; height: 56px; }
body.ui-mobile .title-card .btn { min-height: 46px; }
body.ui-mobile .title-card .text-in { height: 46px; }
body.ui-mobile .field-label { font-size: 13.5px; }
body.ui-mobile .field-pair { grid-template-columns: minmax(0, 1fr); }
body.ui-mobile .title-credit { display: none; }
body.ui-mobile .plotmap { gap: 4px; }
body.ui-mobile .swatch { width: 34px; height: 34px; }
body.ui-title .tabbar { transform: translate3d(0, 110%, 0); opacity: 0; pointer-events: none; }

/* ---------------------------------------------------------------------------------- banner */
body.ui-mobile .conn-banner { height: 40px; font-size: 14px; max-width: calc(100vw - 24px); }

/* ================================================================================================
   PHONE PORTRAIT — two-row HUD card, bottom tab bar, bottom sheets
   ================================================================================================ */
body.ui-mobile.ui-portrait {
  --tabbar-h: calc(58px + var(--safe-b));
  --hud-h: calc(var(--safe-t) + 8px + 98px);
  --bb-h: calc(194px + var(--safe-b));
}
body.ui-portrait .tabbar {
  left: 0; right: 0; bottom: 0; height: var(--tabbar-h);
  grid-template-columns: repeat(var(--tabs, 5), minmax(0, 1fr));
  padding: 2px calc(4px + var(--safe-r)) var(--safe-b) calc(4px + var(--safe-l));
  border-radius: 0;
}

/* top bar: row 1 identity · treasury · map toggle, row 2 branch · rating · clock · weather · open */
body.ui-mobile.ui-portrait .topbar {
  top: calc(var(--safe-t) + 8px); left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r));
  height: auto; padding: 4px 6px; gap: 0 6px; border-radius: 18px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto auto; grid-template-rows: 48px 44px; align-items: center;
}
body.ui-mobile.ui-portrait .topbar::before {
  content: ""; position: absolute; left: 12px; right: 12px; top: 52px; height: 1px; background: var(--line-2); pointer-events: none;
}
body.ui-mobile.ui-portrait .topbar::after { left: 30px; right: 30px; }
body.ui-portrait .tb-stats, body.ui-portrait .tb-time { display: contents; }
body.ui-portrait .tb-brand { grid-column: 1 / 4; grid-row: 1; height: 46px; flex: none; padding: 0 6px 0 2px; gap: 9px; }
body.ui-portrait .tb-emblem, body.ui-portrait .tb-emblem svg { width: 34px; height: 34px; }
body.ui-portrait .tb-name { font-size: 17px; max-width: none; }
body.ui-portrait .tb-level { font-size: 11px; }
body.ui-portrait .xp { width: 48px; }
body.ui-portrait .tb-stat.is-money { grid-column: 4; grid-row: 1; height: 46px; padding: 0 6px; gap: 7px; }
body.ui-portrait .tb-stat.is-money .tb-stat-ico { width: 28px; height: 28px; }
body.ui-portrait .tb-stat.is-money .tb-val { font-size: 17px; min-width: 0; }
body.ui-portrait .tb-mode { grid-column: 5; grid-row: 1; justify-self: stretch; height: 44px; width: auto; min-width: 44px; margin: 0; padding: 0 10px; justify-content: center; border-radius: 13px; }
body.ui-portrait .tb-mode-label { display: inline; font-size: 14px; }
body.ui-portrait .tb-cta { grid-column: 4 / 6; grid-row: 1; justify-self: end; margin: 0; }
body.ui-portrait .tb-mode:not([hidden]) ~ .tb-cta { grid-column: 4; }

body.ui-portrait .tb-branch { grid-column: 1; grid-row: 2; max-width: none; height: 40px; padding: 0 8px; gap: 7px; justify-self: stretch; }
body.ui-portrait .tb-branch-name { font-size: 15px; }
body.ui-portrait .tb-branch-city { display: block; font-size: 11.5px; }
body.ui-portrait .tb-stat.is-rating { grid-column: 2; grid-row: 2; height: 40px; padding: 0 6px; gap: 5px; }
body.ui-portrait .tb-stat.is-rating::before, body.ui-portrait .tb-stat.is-money::before { display: none; }
body.ui-portrait .tb-rating-ico { display: inline-flex; width: auto; height: auto; background: none; box-shadow: none; color: var(--brass); }
body.ui-portrait .tb-stars, body.ui-portrait .tb-rating-count { display: none; }
body.ui-portrait .tb-stat.is-rating .tb-val { font-size: 16px; }
body.ui-portrait .tb-clock { grid-column: 3; grid-row: 2; padding: 0 4px; align-items: center; }
body.ui-portrait .tb-hm { font-size: 17px; min-width: 0; text-align: center; }
body.ui-portrait .tb-dayno { font-size: 11px; }
body.ui-portrait .tb-weather { grid-column: 4; grid-row: 2; height: 34px; padding: 0 6px; justify-self: center; }
body.ui-portrait .tb-open { grid-column: 5; grid-row: 2; height: 40px; margin: 0; padding: 0 8px; justify-self: end; }
body.ui-portrait .tb-open .switch-lg .switch-track { width: 40px; height: 24px; }
body.ui-portrait .tb-open .switch-lg .switch-thumb { width: 20px; height: 20px; }
body.ui-portrait .tb-open .switch-lg[aria-checked="true"] .switch-thumb { transform: translateX(16px); }
body.ui-portrait .tb-open .switch-text { min-width: 0; font-size: 12px; }
/* spectator / map without a branch on screen: clock & weather move right, rows stay tidy */
body.ui-portrait.ui-spectator .tb-clock { grid-column: 4; }
body.ui-portrait.ui-spectator .tb-weather { grid-column: 5; justify-self: end; }
body.ui-portrait.ui-spectator:not(.ui-has-chain) .tb-clock { grid-column: 1; justify-self: start; align-items: flex-start; flex-direction: row; gap: 8px; align-items: baseline; padding-left: 8px; }

/* sheets sit above the tab bar, full width */
body.ui-portrait .panel { top: calc(var(--safe-t) + 10px); bottom: var(--tabbar-h); left: 0; right: 0; }
body.ui-portrait .panel-head { padding-left: calc(16px + var(--safe-l)); padding-right: calc(8px + var(--safe-r)); }

body.ui-portrait .ticker { top: calc(var(--hud-h) + 6px); left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); width: auto; }
body.ui-portrait .toasts { top: calc(var(--hud-h) + 8px); left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); width: auto; }
body.ui-portrait:has(.ticker.is-flash) .toasts { top: calc(var(--hud-h) + 50px); }
body.ui-portrait.ui-has-panel .toasts { top: calc(var(--safe-t) + 8px); }
body.ui-title.ui-portrait .toasts { top: calc(var(--safe-t) + 8px); }
body.ui-portrait .tutorial { top: calc(var(--hud-h) + 8px); left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); }
body.ui-portrait.ui-has-panel .tutorial { left: calc(8px + var(--safe-l)); width: auto; }
body.ui-portrait .conn-banner { top: calc(var(--hud-h) + 6px); }

body.ui-portrait .chat { left: auto; right: calc(10px + var(--safe-r)); bottom: calc(var(--tabbar-h) + 12px); }
body.ui-portrait .chat-window {
  left: 0; right: 0; bottom: max(var(--tabbar-h), var(--kb, 0px));
  height: min(60vh, 480px, calc(var(--vvh, 100vh) - var(--safe-t) - 24px));
}
body.ui-portrait.ui-kb .chat-window { bottom: var(--kb); height: min(60vh, 440px, calc(var(--vvh, 100vh) - var(--safe-t) - 12px)); }

body.ui-portrait .inspector {
  left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); bottom: calc(var(--tabbar-h) + 8px);
  max-height: min(54vh, calc(var(--vvh, 100vh) - var(--hud-h) - var(--tabbar-h) - 20px));
}
body.ui-portrait .buildbar { padding: 10px calc(10px + var(--safe-r)) calc(10px + var(--safe-b)) calc(10px + var(--safe-l)); }

/* ================================================================================================
   PHONE LANDSCAPE — left rail, single-row HUD, sheets beside the rail
   ================================================================================================ */
body.ui-mobile.ui-landscape {
  --rail-w: calc(70px + var(--safe-l));
  --hud-h: calc(var(--safe-t) + 6px + 52px);
  --bb-h: 0px;
}
body.ui-landscape .tabbar {
  top: 0; bottom: 0; left: 0; width: var(--rail-w);
  grid-auto-rows: minmax(0, 64px); align-content: center; gap: 2px;
  padding: calc(6px + var(--safe-t)) 4px calc(6px + var(--safe-b)) calc(4px + var(--safe-l));
  box-shadow: 10px 0 30px -18px rgba(0, 0, 0, 0.7), inset -1px 0 0 rgba(201, 162, 39, 0.28);
}
body.ui-landscape .tab-btn::before { top: 50%; left: 0; width: 3px; height: 26px; border-radius: 0 3px 3px 0; transform: translateY(-50%) scaleY(0); }
body.ui-landscape .tab-btn[aria-pressed="true"]::before { transform: translateY(-50%) scaleY(1); }
body.ui-landscape.ui-building .tabbar { transform: translate3d(-110%, 0, 0); }

body.ui-mobile.ui-landscape .topbar {
  top: calc(var(--safe-t) + 6px); left: calc(var(--rail-w) + 8px); right: calc(8px + var(--safe-r));
  height: 52px; padding: 0 6px 0 4px; gap: 4px; border-radius: 16px;
}
body.ui-landscape .tb-brand { flex: 0 1 220px; height: 44px; gap: 8px; }
body.ui-landscape .tb-emblem, body.ui-landscape .tb-emblem svg { width: 32px; height: 32px; }
body.ui-landscape .tb-name { font-size: 16px; max-width: 150px; }
body.ui-landscape .tb-branch { height: 42px; max-width: 150px; }
body.ui-landscape .tb-branch-city { display: block; }
body.ui-landscape .tb-stats { margin: 0 auto; padding: 0; }
body.ui-landscape .tb-stat { height: 44px; padding: 0 7px; gap: 6px; }
body.ui-landscape .tb-stat-ico { width: 26px; height: 26px; }
body.ui-landscape .tb-stars, body.ui-landscape .tb-rating-count { display: none; }
body.ui-landscape .tb-rating-ico { display: inline-flex; background: none; box-shadow: none; color: var(--brass); width: auto; }
body.ui-landscape .tb-dayno { display: none; }
body.ui-landscape .tb-hm { font-size: 17px; min-width: 0; }
body.ui-landscape .tb-weather { height: 34px; padding: 0 5px; }
body.ui-landscape .tb-open { height: 44px; padding: 0 8px; margin-left: 0; }
body.ui-landscape .tb-open .switch-text { min-width: 0; }
body.ui-landscape .tb-mode { height: 44px; width: 44px; padding: 0; justify-content: center; margin-left: 0; }
body.ui-landscape .tb-mode-label { display: none; }

body.ui-landscape .panel {
  top: calc(var(--safe-t) + 8px); bottom: 0; left: calc(var(--rail-w) + 8px); right: auto;
  width: min(480px, calc(100vw - var(--rail-w) - 24px - var(--safe-r)));
}
body.ui-landscape .panel-body { padding-bottom: calc(16px + var(--safe-b)); }
body.ui-landscape .ticker { top: calc(var(--hud-h) + 6px); left: calc(var(--rail-w) + 50% - var(--rail-w) / 2); transform: translateX(-50%); width: min(520px, calc(100vw - var(--rail-w) - 380px)); }
body.ui-landscape .toasts { top: calc(var(--hud-h) + 8px); right: calc(8px + var(--safe-r)); width: min(340px, 44vw); }
body.ui-landscape.ui-has-panel .toasts { top: calc(var(--safe-t) + 8px); }
body.ui-landscape .tutorial { top: calc(var(--hud-h) + 8px); left: calc(var(--rail-w) + 8px); width: min(380px, calc(100vw - var(--rail-w) - 380px)); }
body.ui-landscape .conn-banner { top: calc(var(--hud-h) + 6px); left: calc(50% + var(--rail-w) / 2); }

body.ui-landscape .chat { left: auto; right: calc(10px + var(--safe-r)); bottom: calc(10px + var(--safe-b)); }
body.ui-landscape .chat-window {
  left: calc(var(--rail-w) + 8px); right: auto; width: min(440px, calc(100vw - var(--rail-w) - 24px));
  bottom: var(--kb, 0px); height: min(360px, calc(var(--vvh, 100vh) - var(--safe-t) - 16px));
}

body.ui-landscape .inspector {
  right: calc(8px + var(--safe-r)); left: auto; bottom: calc(8px + var(--safe-b)); width: min(340px, 46vw);
  max-height: calc(var(--vvh, 100vh) - var(--hud-h) - 20px);
}

body.ui-landscape .buildbar {
  left: calc(var(--rail-w) + 8px); right: calc(8px + var(--safe-r)); width: auto;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); grid-template-areas: "info main" "modes main";
  gap: 6px 10px; padding: 8px 10px calc(8px + var(--safe-b));
}
body.ui-landscape .bb-info { grid-area: info; }
body.ui-landscape .bb-main { grid-area: main; align-self: center; }
body.ui-landscape .bb-modes { grid-area: modes; }
body.ui-landscape .buildbar.is-mobile .bb-sub { -webkit-line-clamp: 1; }
body.ui-landscape .bb-main .btn { min-height: 56px; }
body.ui-landscape .buildbar.is-mobile .bb-thumb, body.ui-landscape .buildbar.is-mobile .bb-mode-ico { width: 40px; height: 40px; }

body.ui-landscape .title-card { left: calc(8px + var(--safe-l)); right: auto; width: min(460px, calc(100vw - 32px)); top: calc(8px + var(--safe-t)); bottom: calc(8px + var(--safe-b)); max-height: none; }
body.ui-landscape .modal-layer { place-items: center; }
body.ui-landscape .modal-card { width: min(560px, 100%); }

/* ================================================================================================
   PWA chrome (pwa.js): "Ana ekrana ekle" chip, iOS hint, update notice
   ================================================================================================ */
.pwa-chip {
  position: fixed; z-index: 43; left: 50%; bottom: calc(20px + var(--safe-b));
  display: flex; align-items: center; gap: 10px; max-width: min(460px, calc(100vw - 16px)); padding: 8px 6px 8px 10px;
  border-radius: 18px; color: #2a1f1a; font: 500 14px/1.35 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--paper-bg); background-color: var(--paper);
  box-shadow: 0 2px 4px rgba(42, 31, 26, 0.08), 0 18px 40px -16px rgba(20, 12, 8, 0.6), inset 0 0 0 1px rgba(184, 115, 51, 0.3);
  transform: translate3d(-50%, 18px, 0); opacity: 0; pointer-events: none;
  transition: transform 460ms cubic-bezier(0.16, 1, 0.3, 1), opacity 260ms ease;
  -webkit-font-smoothing: antialiased; touch-action: manipulation;
}
.pwa-chip.is-in { transform: translate3d(-50%, 0, 0); opacity: 1; pointer-events: auto; }
.pwa-chip-icon { width: 40px; height: 40px; flex: none; border-radius: 10px; box-shadow: 0 3px 8px -3px rgba(22, 58, 118, 0.6); }
.pwa-chip-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pwa-chip-text strong { font: 650 15px/1.2 "Fraunces", Georgia, serif; color: #2a1f1a; }
.pwa-chip-text span { font-size: 13px; color: #6f5a4b; }
.pwa-chip-text .ico { vertical-align: -4px; color: var(--cobalt); }
.pwa-chip-go {
  flex: none; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--cobalt-deep); cursor: pointer;
  font: 650 14px/1 "Inter", system-ui, sans-serif; color: #fdf8ee; background: linear-gradient(180deg, var(--cobalt-hi), var(--cobalt));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 6px 14px -8px rgba(22, 58, 118, 0.7);
}
.pwa-chip-go:active { transform: translateY(1px); }
.pwa-chip-x {
  flex: none; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 12px;
  background: transparent; color: #6f5a4b; cursor: pointer;
}
.pwa-chip-x:hover { background: rgba(184, 115, 51, 0.12); color: #2a1f1a; }
.pwa-chip :focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; }
.pwa-chip.is-update { top: calc(14px + var(--safe-t)); bottom: auto; transform: translate3d(-50%, -18px, 0); z-index: 45; }
.pwa-chip.is-update.is-in { transform: translate3d(-50%, 0, 0); }
.pwa-chip.is-update .pwa-chip-icon { border-radius: 50%; }
body.ui-title .pwa-chip:not(.is-update), body.ui-building .pwa-chip:not(.is-update),
body.ui-has-panel .pwa-chip:not(.is-update), body.ui-modal-open .pwa-chip:not(.is-update) { opacity: 0; pointer-events: none; transform: translate3d(-50%, 18px, 0); }
body.ui-portrait .pwa-chip:not(.is-update) { bottom: calc(var(--tabbar-h) + 12px); left: calc(8px + var(--safe-l)); right: calc(72px + var(--safe-r)); max-width: none; transform: translate3d(0, 18px, 0); }
body.ui-portrait .pwa-chip:not(.is-update).is-in { transform: translate3d(0, 0, 0); }
body.ui-portrait.ui-chat-tab .pwa-chip:not(.is-update) { right: calc(8px + var(--safe-r)); }
body.ui-portrait .pwa-chip.is-update { left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); max-width: none; transform: translate3d(0, -18px, 0); }
body.ui-portrait .pwa-chip.is-update.is-in { transform: none; }
body.ui-landscape .pwa-chip:not(.is-update) { left: calc(50% + var(--rail-w) / 2); }

@media (prefers-reduced-motion: reduce) {
  body.ui-mobile .panel, body.ui-mobile .chat-window, body.ui-mobile .buildbar, body.ui-mobile .tabbar, .pwa-chip { transition-duration: 1ms !important; }
}

/* === p3:qa === open-branch dialog: keep "Vazgeç / Şube aç" in thumb reach on phones (the card scrolls) */
body.ui-mobile .ob-card .modal-actions {
  position: sticky; bottom: 0; z-index: 2; margin: 0 -18px -18px; padding: 10px 18px calc(14px + var(--safe-b));
  background: rgb(246, 239, 226); box-shadow: 0 -10px 18px -14px rgba(40, 24, 12, 0.45);
}
/* five-tab strips (İnşa: Masalar/Oturma/Ekipman/Dekor/Zemin) clipped to "Masa…" at 375px: icon over label */
body.ui-portrait .panel-tools .tabs:has(> .tab:nth-child(5)) .tab { flex-direction: column; height: 50px; gap: 2px; font-size: 11.5px; line-height: 1.1; padding: 4px 1px; }
/* p7:integ — Rewards tabs: "Achievements" (EN) was cut to "Achievem…" at 375px */
body.ui-portrait .panel-tools .ct-tabs .tab-label { font-size: 13px; }
/* p7:integ — new-chain wizard stepper: "Sen — Marka — Konsept — Merkez" ran 37px past a 375px card; phones
   show the numbers and only the current step's name */
@media (max-width: 420px) {
  .ob-step-dot:not(.is-current) .ob-step-l { display: none; }
}
/* "R ile döndür" is a keyboard hint: phones rotate with the build bar's Döndür button */
body.ui-touch .panel-build .tool-hint { display: none; }

/* === p6:qa === */
/* open-branch footer: `.modal-actions { width:100% }` cancelled the −18px side margins, so the sticky bar was
   narrower than the card and the long "Open branch · ₺10,500" button ran past it (375×812 / 375×667) */
body.ui-mobile .ob-card .modal-actions { width: auto; align-self: stretch; }
body.ui-mobile .ob-card .modal-actions > .btn { flex: 0 0 auto; }
body.ui-mobile .ob-card .modal-actions .ob-confirm { flex: 1 1 0; min-width: 0; white-space: normal; line-height: 1.15; }
/* street plot card: the "Open a branch here" button stays visible while the details scroll (375×667) */
body.ui-mobile .insp-actions.qa-sticky {
  position: sticky; bottom: -14px; z-index: 2; margin: 0 -12px -14px; padding: 8px 12px 14px;
  background: rgb(246, 239, 226); box-shadow: 0 -10px 18px -14px rgba(40, 24, 12, 0.45);
}
/* rankings at 375px: the chain name got ~15px ("L.", "K.") next to the NPC chip and two wide number columns;
   narrow the branch-count column and drop the NPC chip (the owner line already says it is a league chain) */
body.ui-mobile.ui-portrait .rank-list.is-league .rank-row { grid-template-columns: 22px minmax(0, 1fr) 46px 78px; gap: 6px; }
body.ui-mobile.ui-portrait .rank-list.is-league .rank-row > :nth-child(3) { text-align: center; }
body.ui-mobile.ui-portrait .rank-list.is-league .rank-name .chip-neutral { display: none; }
body.ui-mobile.ui-portrait .rank-list.is-league .rank-name .chip { flex-shrink: 0; }
/* === /p6:qa === */
/* === end p3:qa === */

/* === p4:ui-polish === phones: the goals/hint card steps aside while the city sheet is up, so the
   focused city stays visible in the strip between the top bar and the sheet */
body.ui-mobile[data-panel="city"] .tutorial { opacity: 0; visibility: hidden; pointer-events: none; }
/* === /p4:ui-polish === */

/* === p4:safety === phones: message actions / report sheet full width, thumb-sized rows */
body.ui-mobile .modal-card.sf-sheet { width: 100%; padding-bottom: calc(16px + var(--safe-b, 0px)); }
body.ui-mobile .sf-list .btn.sf-item { min-height: 52px; font-size: 15px; }
body.ui-mobile .sf-brow .btn, body.ui-mobile .pf-safety .btn { min-height: 44px; }
body.ui-mobile .sf-pref { min-height: 52px; }
/* === /p4:safety === */

/* === p4:qa === half city sheet: the sticky "Şube aç" bar sat below the screen edge (the half snap
   pushes the panel's bottom off-screen by --sheet-pad), so tapping a plot looked like it did nothing */
body.ui-mobile .panel .city-action { bottom: calc(-18px + var(--sheet-pad, 0px)); }
/* === end p4:qa === */

/* === p5:client === portrait top bar: the treasury sat alone in column 4 and made the weather cell as
   wide as itself, squeezing the branch chip (row 2, column 1) down to its pin. The treasury now spans the
   clock + weather columns, drops its wallet icon and the season glyph, so the district name fits. */
body.ui-mobile.ui-portrait .tb-brand { grid-column: 1 / 3; }
body.ui-mobile.ui-portrait .tb-stat.is-money { grid-column: 3 / 5; justify-self: end; }
body.ui-mobile.ui-portrait .tb-stat.is-money .tb-stat-ico { display: none; }
body.ui-mobile.ui-portrait .tb-season { display: none; }
body.ui-mobile.ui-portrait .tb-branch { padding: 0 3px 0 5px; gap: 4px; }
body.ui-mobile.ui-portrait .tb-branch-name { font-size: 14px; }
body.ui-mobile.ui-portrait .tb-branch-caret { display: none; }
/* landscape phones: the chip keeps ~7 letters; on phones up to 860 px wide the chain name gives way
   (emblem stays), and the caret / season glyph / wallet icon drop out (measured: 667×375, 740×360) */
body.ui-mobile.ui-landscape .tb-branch { min-width: 100px; padding: 0 6px 0 8px; gap: 5px; }
body.ui-mobile.ui-landscape .tb-branch-text { flex: 1 1 auto; }
@media (max-width: 860px) {
  body.ui-mobile.ui-landscape .tb-id { display: none; }
  body.ui-mobile.ui-landscape .tb-brand { flex: none; padding-right: 2px; }
  body.ui-mobile.ui-landscape .tb-branch-caret, body.ui-mobile.ui-landscape .tb-season,
  body.ui-mobile.ui-landscape .tb-stat.is-money .tb-stat-ico { display: none; }
  body.ui-mobile.ui-landscape .tb-branch-name { font-size: 15px; }
}
/* === /p5:client === */

/* === p7:qa === portrait top bar: once the Gold Beans chip shows a 4-digit balance, the chain name shrank
   to one letter ("B…") and the branch chip to "Ko…". The Open/Closed caption now sits under the switch
   (like "Treasury" under the money and "Day 5" under the clock), which frees ~44 px for column 1. */
body.ui-mobile.ui-portrait .tb-open { padding: 0 4px; }
body.ui-mobile.ui-portrait .tb-open .switch-lg { flex-direction: column; gap: 3px; }
body.ui-mobile.ui-portrait .tb-open .switch-text { font-size: 10px; line-height: 1; }
/* stock rows: "₺150 / pack · 50 units · ₺3 per unit" was cut to "₺3 per u…" at 375 px */
body.ui-mobile .stock-unit { white-space: normal; }
/* menu rows: "Missing equipment: Maraş Ice Cream Counter" ran 44 px past the card (and the screen) */
.menu-status .chip { height: auto; min-height: 20px; padding: 3px 7px; white-space: normal; line-height: 1.2; flex: 0 1 auto; max-width: 100%; }
/* rankings on a phone: "Cup League · Chain Lv. 9" was cut to "Cup League · Chain …" in both languages;
   the owner line may wrap, and chain names take a second line instead of "Kervan Kah…" */
body.ui-mobile.ui-portrait .rank-owner { white-space: normal; line-height: 1.25; }
/* first screen: "4 steps: your name, your brand, y…" / "4 adım: adın, markan, konseptin, …" — the big
   main-menu buttons may use two lines for their subtitle */
body.ui-mobile .mm-cta-sub { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
body.ui-mobile.ui-portrait .panel-sub { font-size: 13.5px; } /* "Türkiye’nin en değerli kahve zincirleri" was 2 px too wide */
body.ui-mobile.ui-portrait .rank-name-t { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
/* === /p7:qa === */

/* === p8:shell === Capacitor app only (html.is-native, set by client/js/platform/native.js): no long-press
   text selection / callout and no page pinch-zoom on game screens; text fields stay selectable. */
html.is-native, html.is-native body {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  touch-action: pan-x pan-y;
}
html.is-native input, html.is-native textarea, html.is-native select, html.is-native [contenteditable="true"] {
  -webkit-user-select: text; user-select: text; -webkit-touch-callout: default;
}
html.is-native img, html.is-native svg, html.is-native a { -webkit-user-drag: none; }
/* the app never offers "Add to home screen" (pwa.js also keeps the chips away) */
html.is-native .pwa-chip, html.is-native .more-install { display: none !important; }
/* dev "Server address" dialog (client/js/ui/serverAddress.js) */
.srv-card { width: min(440px, calc(100vw - 32px)); }
.srv-card .srv-badge { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px; font: 700 11px/1.4 Inter, system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; color: #8a5a2b; background: rgba(184, 115, 51, .14); vertical-align: middle; }
.srv-card .srv-now { margin: 0 0 10px; font-size: 13px; color: #5a4134; overflow-wrap: anywhere; }
.srv-card .srv-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.srv-card .srv-preset { border: 1px solid rgba(42, 31, 26, .18); background: #fffdf8; color: #2a1f1a; border-radius: 999px; padding: 6px 10px; font: 600 12.5px/1.2 Inter, system-ui, sans-serif; cursor: pointer; max-width: 100%; overflow-wrap: anywhere; text-align: left; }
.srv-card .srv-preset:active { transform: translateY(1px); }
.srv-card .srv-result { min-height: 1.4em; margin: 8px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.srv-card .srv-result.is-good { color: #2f6b3a; }
.srv-card .srv-result.is-bad { color: #b3261e; }
.srv-card .modal-actions { flex-wrap: wrap; }
.banner-retry.banner-server { margin-left: 6px; }
/* === /p8:shell === */

/* === p11:hud === portrait top bar: the brand never paints outside its grid cell. Its level line (tag +
   XP bar) did not shrink, so on a narrow cell it ran under the next cells (the bean chip, the treasury).
   Now the chain name ellipsizes, the XP bar gives way first, then the level tag ellipsizes.
   The Gold Beans chip and the treasury share the wallet cell (store.css p11:hud). */
body.ui-mobile.ui-portrait .tb-brand { min-width: 0; overflow: hidden; padding-right: 3px; gap: 8px; }
body.ui-mobile.ui-portrait .tb-id { flex: 1 1 auto; overflow: hidden; }
body.ui-mobile.ui-portrait .tb-level { min-width: 0; overflow: hidden; }
body.ui-mobile.ui-portrait .tb-lvl { flex: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
body.ui-mobile.ui-portrait .tb-level .xp { flex: 0 1 48px; min-width: 0; }
body.ui-mobile.ui-portrait .tb-stat.is-money { min-width: 0; }
/* a 10-digit till (₺1.234.567.890, topbar.js .is-long) a size smaller, so its cell (over the clock and
   weather columns) does not squeeze the branch chip in row 2 */
body.ui-mobile.ui-portrait .tb-stat.is-money.is-long .tb-val { font-size: 15px; }
/* 320–345 px phones: tighter gaps, rating padding and till size, so the branch chip keeps ~6 letters
   ("Karşıy…" instead of "Ka…") and the chain name ~8 */
@media (max-width: 345px) {
  body.ui-mobile.ui-portrait .topbar { column-gap: 4px; }
  body.ui-mobile.ui-portrait .tb-stat.is-money .tb-val { font-size: 15.5px; }
  body.ui-mobile.ui-portrait .tb-stat.is-money.is-long .tb-val { font-size: 14px; }
  body.ui-mobile.ui-portrait .tb-stat.is-rating { padding: 0 3px; }
}
/* === /p11:hud === */

/* === p13:hud === landscape phones up to 860 px: with the Gold Beans chip the map toggle ran 2–10 px past
   the bar's right edge (740×360). The stats, weather and open switch give up a little padding instead. */
@media (max-width: 860px) {
  body.ui-mobile.ui-landscape .tb-stat { padding: 0 5px; }
  body.ui-mobile.ui-landscape .tb-weather { padding: 0 3px; }
  body.ui-mobile.ui-landscape .tb-open { padding: 0 6px; }
  body.ui-mobile.ui-landscape .topbar .tb-beans { padding: 0 6px 0 5px; }
}
/* 667×375 (small phones sideways) ran 60 px over: the weather chip goes (the clock stays) and the
   Open/Closed caption sits under the switch, as on portrait phones */
@media (max-width: 700px) {
  body.ui-mobile.ui-landscape .tb-weather { display: none; }
  body.ui-mobile.ui-landscape .tb-open { padding: 0 4px; }
  body.ui-mobile.ui-landscape .tb-open .switch-lg { flex-direction: column; gap: 3px; }
  body.ui-mobile.ui-landscape .tb-open .switch-text { font-size: 10px; line-height: 1; }
  body.ui-mobile.ui-landscape .tb-stat { padding: 0 4px; }
}
/* === /p13:hud === */
