/* ==== base: reset, page, icons, text utilities ==== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  scrollbar-width: thin;
  scrollbar-color: var(--c-violet-mid) var(--c-scrim);
}
html,
body {
  height: 100%;
  line-height: var(--lh-body);
  background: var(--bg);
  color: var(--txt);
  font-family: var(--f);
  font-weight: 800;
  overflow: clip;
  user-select: none;
  -webkit-user-select: none;
}
button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}
.ui-scale {
  zoom: var(--z);
} /* every interface root (never nested): one scale for the whole UI */
.ico {
  display: inline-block;
  vertical-align: middle;
  background-repeat: no-repeat;
  flex: none;
}
.ico-missing {
  background: var(--c-violet-mid);
  border-radius: 30%;
}
/* interface icon (uiIco in js/dom.js): square box, figure centred on its optical centre whatever the box display is */
.ui-ico {
  display: inline-grid;
  place-items: center;
  position: relative;
}
.ui-ico > i {
  position: absolute;
  inset: 0;
  margin: auto;
  background-repeat: no-repeat;
}
.ico.dim {
  filter: grayscale(0.8) brightness(0.6);
  opacity: 0.8;
}
.ico.gold {
  filter: sepia(1) saturate(4) brightness(1.1);
}
.stroke,
.val,
.tab-label,
#baseLv,
.lv,
.slot .price,
.hire-label {
  -webkit-text-stroke: 0.16em var(--ink);
  paint-order: stroke fill;
}
/* short labels never wrap in any language: plates, buttons, chips, tabs, HUD labels (they shrink to fit instead) */
.plate,
.plate-row,
.plate-row *,
.hire-btn,
.buy-card,
.buy-card *,
#targetLabel,
#targetName,
#baseLabel,
.tab-label,
.pill .val,
#rateMini,
.tag,
.seg > button,
.chip,
#modeChip,
.cm-role {
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
}
.num,
.cost,
.price {
  white-space: nowrap;
}
[data-how] {
  cursor: pointer;
}
[data-term] {
  cursor: help;
}
/* scrollbars: thin, dark rounded track, purple thumb that glows (pink while dragging); touch screens get no bar, the edges fade instead */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--c-scrim);
  border-radius: var(--radius-pill);
  margin: var(--space-2);
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--c-violet), var(--c-violet-mid));
  border-radius: var(--radius-pill);
  border: 2px solid var(--c-scrim);
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(var(--cyan), var(--c-violet));
  background-clip: padding-box;
  box-shadow: var(--glow-accent-soft);
}
::-webkit-scrollbar-thumb:active {
  background: linear-gradient(var(--pink), var(--c-violet));
  background-clip: padding-box;
}
::-webkit-scrollbar-corner {
  background: transparent;
}
.side,
.sheet-card,
.card-modal,
#hud {
  scrollbar-gutter: stable;
}
@media (hover: none) and (pointer: coarse) {
  * {
    scrollbar-width: none;
  }
  ::-webkit-scrollbar {
    display: none;
  }
  .side,
  .sheet-card,
  .card-modal,
  #hud {
    scrollbar-gutter: auto;
  }
  .more-below {
    -webkit-mask-image: linear-gradient(var(--c-bg-deep) calc(100% - 28px), transparent);
    mask-image: linear-gradient(var(--c-bg-deep) calc(100% - 28px), transparent);
  } /* set by main.js while there is more to scroll */
}

/* ==== layout: html[data-layout] = phone | tab | land | desk (main.js layoutOf), [data-size~=xs|n], [data-h~=m|s|xs|xxs] ==== */
#app {
  height: 100dvh;
  display: grid;
  overflow: clip;
  opacity: 0;
  transition: opacity 0.25s;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: 'hud' 'room' 'nav';
  background: radial-gradient(120% 80% at 50% 0%, var(--c-on-paper) 0%, var(--c-bg) 60%);
}
#app.ready {
  opacity: 1;
}
#hud {
  grid-area: hud;
}
#room {
  grid-area: room;
}
#nav {
  grid-area: nav;
}
:where([data-layout='tab']) #app {
  grid-template-columns: minmax(0, 1fr) calc(280px * var(--z));
  grid-template-areas: 'hud hud' 'room right' 'nav nav';
}
:where([data-layout='land']) #app {
  grid-template-columns: calc(78px * var(--z)) calc(190px * var(--z)) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: 'nav hud room';
}
:where([data-layout='land'][data-size~='ln']) #app {
  grid-template-columns: calc(78px * var(--z)) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: 'nav hud' 'nav room';
} /* short and narrow: the HUD is one bar over the room */
/* desktop: the room column is exactly as wide as the room; the side panel takes the rest */
:where([data-layout='desk']) #app {
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: 'hud hud hud hud' 'nav room room right';
  grid-template-columns: calc(96px * var(--z)) minmax(calc(250px * var(--z)), 1fr) minmax(
      0,
      calc((100vh - var(--hudH, 72px) - 70px * var(--z)) * 0.75)
    ) minmax(calc(270px * var(--z) + var(--slack, 0px)), 1fr);
} /* --slack: see main.js layout */
/* ultrawide (21:9, 32:9): the room keeps a comfortable size, the side panel stays on the right */
@media (min-aspect-ratio: 21/9) {
  :where([data-layout='desk']) #app {
    grid-template-areas: 'hud hud hud hud hud hud' 'nav room room room room right';
    grid-template-columns: calc(110px * var(--z)) calc(300px * var(--z)) minmax(0, 1fr) min(
        calc((100vh - var(--hudH, 72px) - 70px * var(--z)) * 0.92),
        1700px
      ) minmax(0, 1fr) calc(330px * var(--z) + var(--slack, 0px));
  } /* --slack: room width no whole room can use goes to the side column (main.js) */
}

/* ==== HUD: every control in the bar is 44 px tall (pill or icon button) ==== */
#hud {
  display: grid;
  gap: var(--space-3) var(--space-2);
  padding: max(var(--space-3), env(safe-area-inset-top)) var(--space-3) var(--space-3);
  position: relative;
  z-index: var(--z-nav);
  align-items: center;
  grid-template-columns: auto minmax(0, 1.2fr) minmax(0, 1fr) auto;
  grid-template-areas: 'logo money gems gear' 'base base target target';
  background: var(--c-bg);
  border-bottom: var(--stroke-3) solid var(--c-bg-deep);
}
:where([data-layout='tab']) #hud {
  grid-template-columns: auto fit-content(300px) fit-content(220px) minmax(0, 1fr) auto;
  grid-template-areas: 'logo money gems . gear' 'base base base base base';
} /* money and gems as wide as their numbers (capped), side by side next to the logo */
:where(.side-auto[data-layout='tab']) #hud {
  grid-template-areas: 'logo money gems . gear' 'base base target target target';
} /* tall tablet, right column away: the next target rides in the HUD like on phones */
:where([data-layout='desk']) #hud {
  grid-template-columns: auto minmax(200px, 260px) 1fr minmax(150px, 200px) minmax(120px, 160px) auto;
  grid-template-areas: 'logo base rate money gems gear';
  padding: var(--space-3) var(--space-5);
  gap: var(--space-4);
}
:where([data-layout='land']) #hud {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: 'logo gear' 'money money' 'gems gems' 'base base' 'target target';
  align-content: start;
  gap: var(--space-3);
  padding: var(--space-3);
  border-bottom: 0;
  border-right: var(--stroke-3) solid var(--c-bg-deep);
  overflow-y: auto;
}
:where([data-layout='land'][data-size~='ln']) #hud {
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas: 'money gems gear';
  padding: var(--space-2) var(--space-3);
  border-right: 0;
  border-bottom: var(--stroke-3) solid var(--c-bg-deep);
  overflow: visible;
}
:where([data-layout='land'][data-size~='ln']) :is(#hud .logo, #base, #gemPlus, #moneyPlus) {
  display: none;
}
:where([data-layout='land'][data-size~='ln'][data-size~='xs']) #hud #rateMini {
  display: none;
}
:where([data-layout='land'][data-size~='ln']) #hud .pill {
  padding-right: var(--space-2);
}
:where([data-layout='land'][data-size~='ln'][data-size~='xs']) #hud .pill .val {
  font-size: var(--font-md);
} /* 320 px: every digit of the money fits */ /* 320 px wide: the money keeps its digits, the rate is in the Crew tab */ /* the shop stays one tab away */
.logo {
  grid-area: logo;
  display: flex;
  align-items: center;
  min-width: 0;
}
.logo img {
  display: block;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 3px 0 var(--c-shade-lg));
}
.logo .logo-full {
  width: 150px;
}
.logo .logo-mascot {
  width: var(--ctl-md);
  display: none;
}
:where([data-layout='desk']) .logo .logo-full {
  width: 200px;
}
:where(
    [data-layout='phone'],
    [data-layout='land'],
    [data-layout='desk'][data-size~='n'],
    [data-layout='tab'][data-size~='n']
  )
  .logo
  .logo-full {
  display: none;
}
:where(
    [data-layout='phone'],
    [data-layout='land'],
    [data-layout='desk'][data-size~='n'],
    [data-layout='tab'][data-size~='n']
  )
  .logo
  .logo-mascot {
  display: block;
}
/* money and gems: the money is the biggest number of the bar */
#money {
  grid-area: money;
  transform-origin: 12% 50%;
}
#gems {
  grid-area: gems;
}
#money .ico {
  transition: transform 0.08s;
}
.pill.gems .val {
  font-size: var(--font-md);
}
:where([data-layout='desk'], [data-layout='tab']) #moneyVal {
  font-size: var(--font-xl);
} /* money is the biggest number on the bar */
.valwrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
#rateMini {
  display: block;
  max-width: 100%;
  font-size: var(--font-xs);
  line-height: var(--lh-tight);
  color: var(--c-primary-hi);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#moneyPlus,
:where([data-layout='phone']) #hud .plus {
  display: none;
} /* one shop shortcut (on the gems), none on phones */
:where([data-layout='desk']:not([data-size~='n'])) #rateMini {
  display: none;
} /* the income shows once: the centre pill */
#repChip[hidden],
#botdock[hidden] {
  display: none;
} /* phones: the shop shortcut gives its room to the numbers (the Shop tab is one tap away) */
/* income + reputation (desktop: fills the middle of the bar) */
#rate {
  display: none;
  grid-area: rate;
  justify-content: center;
  justify-self: center;
  gap: var(--space-5);
  padding: 0 var(--space-5);
  font-size: var(--font-md);
}
:where([data-layout='desk']) #rate {
  display: flex;
}
:where([data-layout='desk'][data-size~='n']) #rate {
  display: none;
} /* narrow desktop: the income already sits under the money */
.rate > span {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.rate b {
  color: var(--c-text);
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
}
.rate .rep b {
  color: var(--c-gold);
}
.rate .rep small {
  font-size: var(--font-md);
  color: var(--c-text-2);
}
/* sound + settings */
.hud-btns {
  grid-area: gear;
  display: flex;
  gap: var(--space-2);
  align-items: center;
  justify-content: flex-end;
}
:where([data-size~='xs'], [data-layout='land'][data-size~='ln']) #spk {
  display: none;
} /* 320 px: the sound button stays in Settings, the money keeps its digits */
#spk.off,
.menu-spk.off {
  border-color: var(--c-text-muted);
} /* muted is a state, not an error (neutral rim + the crossed speaker; red read as a fault) */
#spk:not(.off) .spk-off,
#spk.off .spk-on,
.menu-spk:not(.off) .spk-off,
.menu-spk.off .spk-on {
  display: none;
} /* sound on / muted: two sprites */
.spk-pair {
  display: grid;
  place-items: center;
}
/* base level (and the next target on phones) */
#base {
  grid-area: base;
  padding-right: var(--space-4);
}
.crown {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: none;
}
#baseLv {
  font-size: var(--font-lg);
  color: var(--c-text);
  line-height: 1;
}
.base-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--font-xs);
  line-height: var(--lh-tight);
  color: var(--c-text-2);
}
.base-info .bar,
.t-row .bar {
  height: 8px;
}
:where([data-layout='desk'], [data-layout='tab']) .base-info {
  font-size: var(--font-sm);
}
#baseLabel {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
:where([data-h~='xs']) #baseLabel {
  display: none;
}
#target {
  grid-area: target;
  position: relative;
  overflow: hidden;
  text-align: left;
  padding: 0 var(--space-2) 0 var(--space-1);
}
:where([data-layout='desk'], [data-layout='tab'], [data-layout='land']) #target {
  display: none;
}
:where(.side-auto[data-layout='tab']) #target {
  display: flex;
}
/* sideways phones keep the target in the HUD column, compact: ring + percent (the name lives in the Targets panel) */
:where([data-layout='land']:not([data-size~='ln']):not([data-h~='xs'])) #target {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  position: fixed;
  left: 86px;
  bottom: calc(56px + var(--ctl-md) + var(--space-3));
  z-index: calc(var(--z-nav) + 1);
  width: 104px;
  height: var(--ctl-md);
  padding: 0 var(--space-2) 0 var(--space-1);
}
:where([data-layout='land']:not([data-size~='ln']):not([data-h~='xs']))
  #target
  :is(#targetLabel, #targetName, .t-chev, .t-row .bar) {
  display: none;
}
:where([data-layout='land']:not([data-size~='ln']):not([data-h~='xs'])) #target .t-ring {
  width: 36px;
  height: 36px;
}
/* phones: the second row (base + target) carries two lines, so both cards are 52 tall */
:where([data-layout='phone']) :is(#base, #target) {
  height: 52px;
  border-radius: var(--radius-lg);
}
.t-ring {
  width: var(--ctl-md);
  height: var(--ctl-md);
  border-radius: var(--radius-pill);
  background: var(--c-primary-night);
  border: var(--stroke-2) solid var(--c-primary-deep);
  display: grid;
  place-items: center;
  flex: none;
}
:where([data-size~='xs']) .t-ring {
  width: 36px;
  height: 36px;
}
:where([data-size~='xs']) .t-ring .ico {
  transform: scale(0.75);
}
.t-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: var(--font-xs);
  line-height: var(--lh-tight);
  color: var(--c-text-2);
}
#targetName {
  display: block;
  font-size: var(--font-sm);
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
}
#targetLabel {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
}
:where([data-layout='phone'][data-size~='xs']) #targetLabel {
  display: none;
} /* 320 px: the name and % say enough */
.t-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.t-row .bar {
  flex: 1;
}
.t-row em {
  font-style: normal;
  font-size: var(--font-md);
  color: var(--c-text);
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
}
.t-city {
  display: none;
}
.t-chev {
  display: grid;
  place-items: center;
  flex: none;
  color: var(--c-text-3);
}
.t-chev .ico {
  transform: rotate(-90deg);
}
:where([data-size~='xs']) .t-chev {
  display: none;
}

/* ==== tab bar ==== */
#nav {
  position: relative;
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-3) max(var(--space-3), env(safe-area-inset-bottom));
  background: linear-gradient(var(--c-surface-1), var(--c-well));
  border-top: var(--stroke-3) solid var(--c-bg-deep);
  z-index: var(--z-nav);
}
:where([data-layout='desk']) #nav {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: 72px;
  align-content: start;
  gap: var(--space-3);
  padding: var(--space-3);
  border-top: 0;
  border-right: var(--stroke-3) solid var(--c-bg-deep);
}
:where([data-layout='desk'][data-h~='m']) #nav {
  grid-auto-rows: minmax(0, 1fr);
  align-content: stretch;
  gap: var(--space-2);
}
:where([data-layout='land']) #nav {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: minmax(0, 64px);
  align-content: start; /* one tab alone no longer stretches the whole column */
  gap: var(--space-2);
  padding: var(--space-2);
  border-top: 0;
  border-right: var(--stroke-3) solid var(--c-bg-deep);
}
.tab {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  height: 64px;
  min-width: 0;
  padding: 0 var(--space-2);
  border-radius: var(--radius-lg);
  background: linear-gradient(var(--c-surface-3), var(--c-surface-2));
  border: var(--stroke-2) solid var(--c-ink);
  box-shadow: var(--shadow-key);
}
:where([data-layout='desk'], [data-layout='land']) .tab {
  height: auto;
}
:where([data-layout='phone'], [data-layout='tab']) .tab {
  flex: 1 1 0;
  max-width: 128px;
  transition:
    max-width var(--dur-enter) var(--ease-out),
    opacity var(--dur-enter) var(--ease-out);
}
:where([data-layout='phone'], [data-layout='tab']) .tab.tab-enter {
  max-width: 0;
  opacity: 0;
  transition: none;
} /* a new tab grows in, the others narrow with it */ /* horizontal bar: the tabs that exist share it, centred, no empty slots */
.tab[hidden] {
  display: none;
}
.tab:not(.on) {
  opacity: 0.78;
}
.tab:not(.on):hover,
.tab:not(.on):active {
  opacity: 1;
}
.tab .ico {
  filter: drop-shadow(0 2px 0 var(--c-shade-lg));
}
:where([data-layout='land']) .tab .ico {
  transform: scale(0.75);
  margin: calc(-1 * var(--space-2)) 0;
}
.tab-label {
  font-size: var(--font-xs);
  letter-spacing: -0.2px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
}
:where([data-layout='desk'], [data-layout='tab']) .tab-label {
  font-size: var(--font-sm);
}
:where([data-layout='land'], [data-layout='phone'][data-size~='n']) .tab-label {
  font-size: var(--font-2xs);
}
:where([data-layout='phone']) .tab {
  padding: 0 var(--space-1);
}
:where([data-layout='phone'][data-size~='n']) .tab {
  padding: 0;
}
:where([data-layout='phone'][data-size~='n']) #nav {
  padding-left: var(--space-2);
  padding-right: var(--space-2);
}
:where([data-size~='xs']) .tab-label {
  letter-spacing: -0.5px;
}
:where([data-size~='xs']) #nav {
  padding-left: var(--space-1);
  padding-right: var(--space-1);
}
:where([data-layout='phone'][data-size~='n']) #hud .pill {
  padding-right: var(--space-2);
}
/* active tab: dark game surface, full-colour icon, light text; the neon frame slides between tabs (.nav-ind) */
.tab.on {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.tab.on .ico {
  filter: drop-shadow(0 0 6px var(--c-accent-glow));
}
.tab.on .tab-label {
  color: var(--c-text);
}
.nav-ind {
  position: absolute;
  z-index: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(var(--c-accent-faint), var(--c-accent-2-faint)), var(--c-surface-1);
  box-shadow: var(--glow-accent);
  animation: navGlow 3.2s ease-in-out infinite;
  pointer-events: none;
  transition:
    left 0.32s cubic-bezier(0.3, 1.35, 0.5, 1),
    top 0.32s cubic-bezier(0.3, 1.35, 0.5, 1),
    width 0.32s,
    height 0.32s;
}
.nav-ind::after {
  content: '';
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 4px;
  height: 4px;
  border-radius: var(--radius-xs);
  background: var(--c-accent);
  box-shadow: var(--glow-accent-soft);
}
@keyframes navGlow {
  50% {
    box-shadow: var(--glow-accent-hi);
  }
}
/* pending = red dot, new = cyan dot */
.tab.alert .badge,
.tab.fresh .badge {
  display: block;
}
.tab.alert .badge {
  animation: badge 2.4s ease-in-out infinite;
}
.tab.fresh:not(.alert) .badge {
  background: var(--c-accent);
  box-shadow: 0 0 6px var(--c-accent);
}
@keyframes badge {
  0%,
  80%,
  100% {
    transform: scale(1);
  }
  88% {
    transform: scale(var(--juice-pop, 1.1));
  }
}

/* ==== side column (tablet and desktop) ==== */
.side {
  display: none;
}
:where([data-layout='tab'], [data-layout='desk']) .side {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-4) var(--space-4) var(--space-7);
  background: linear-gradient(var(--c-surface-1), var(--c-well));
  -webkit-mask-image: linear-gradient(var(--c-bg-deep) calc(100% - 26px), transparent);
  mask-image: linear-gradient(var(--c-bg-deep) calc(100% - 26px), transparent);
}
:where([data-layout='tab']) .side {
  border-left: var(--stroke-3) solid var(--c-bg-deep);
  border-top: var(--stroke-3) solid var(--c-bg-deep);
  overscroll-behavior: contain;
}
:where([data-layout='desk']) .side {
  border-left: var(--stroke-3) solid var(--c-bg-deep);
}
@media (min-aspect-ratio: 21/9) {
  :where([data-layout='desk']) .side {
    padding: var(--space-5) var(--space-6) var(--space-7);
  }
}
#sideR {
  grid-area: right;
}
#app:has(#sheet.open) :is(#hype, #modeChip, #botdock, .cam-nav, .side-toggle) {
  visibility: hidden;
} /* room chips never show around or through an open panel */
#sideR.more-down {
  -webkit-mask-image: linear-gradient(var(--c-ink) calc(100% - 72px), transparent);
  mask-image: linear-gradient(var(--c-ink) calc(100% - 72px), transparent);
} /* more below: the column fades out at the bottom */
/* the right column folds away: the room spans its column */
#room > .side-toggle {
  display: none;
  position: absolute;
  right: var(--space-2);
  top: calc(50% - var(--ctl-md) / 2);
  z-index: var(--z-hud);
}
.side-off .side-toggle .ico {
  transform: scaleX(-1);
} /* panel hidden: the arrow points back in */
:where([data-layout='tab'], [data-layout='desk']) #room > .side-toggle {
  display: grid;
}
:where([data-layout='tab']) #room > .side-toggle {
  top: var(--space-3);
} /* tablet: up in the pills row on the wall, never over a desk */
:where(.side-off[data-layout='tab'], .side-off[data-layout='desk'], .side-auto[data-layout='tab']) #sideR {
  display: none;
}
:where(.side-auto[data-layout='tab']) #room > .side-toggle {
  display: none;
}
:where(.side-off[data-layout='desk']) #app {
  grid-template-areas: 'hud hud hud hud' 'nav room room room';
}
:where(.side-off[data-layout='tab'], .side-auto[data-layout='tab']) #app {
  grid-template-areas: 'hud hud' 'room room' 'nav nav';
}
@media (min-aspect-ratio: 21/9) {
  :where(.side-off[data-layout='desk']) #app {
    grid-template-areas: 'hud hud hud hud hud hud' 'nav room room room room room';
  }
}
.side h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-2);
  font-size: var(--font-md);
  color: var(--c-accent-hi);
  -webkit-text-stroke: 4px var(--ink);
  paint-order: stroke fill;
}
.side-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.side .side-row {
  display: flex;
  padding: var(--space-3);
}
.side-row .sr-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  flex: 1;
  line-height: var(--lh-tight);
}
.side-row .sr-info b {
  font-size: var(--font-sm);
  overflow-wrap: anywhere;
}
.side-row .bar {
  height: 8px;
}
.side-row .sr-hg {
  font-size: var(--font-xs);
  color: var(--c-text-2);
  font-variant-numeric: tabular-nums;
}
.mrw {
  display: flex;
  align-items: center;
  font-size: var(--font-xs);
  white-space: nowrap;
}
.side .side-card {
  display: flex;
  width: 100%;
}
.side-card > div {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  flex: 1;
}
.side-card small {
  color: var(--c-text-3);
  font-size: var(--font-xs);
  font-weight: 700;
}
.side-card b {
  font-size: var(--font-md);
  line-height: var(--lh-tight);
}
.target-card .t-row em {
  -webkit-text-stroke: 0;
}
.bots .btn {
  align-self: flex-start;
}
.srw {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.side-line {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--c-text-3);
  font-size: var(--font-sm);
  padding: var(--space-1) var(--space-2);
}
.side .mini-map {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  background: linear-gradient(var(--c-map-hi), var(--c-map));
  border-color: var(--c-accent-lo);
  cursor: pointer;
}
:where([data-layout='desk']) .side .mini-map {
  display: grid;
}
.mini-map > b {
  grid-column: 1 / -1;
  font-size: var(--font-md);
}
.mini-map .mm {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: var(--font-xs);
  color: var(--c-accent-hi);
  text-align: center;
}
.mini-map .mm.lock .ico {
  filter: grayscale(0.9) brightness(0.55);
}
.mini-map .mm i {
  font-style: normal;
}

/* ==== room: canvas, world overlay (desk plates), chips over the room ==== */
#room {
  position: relative;
  overflow: clip;
  touch-action: none;
  min-height: 0;
  background: var(--c-bg);
}
#cv {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
}
#fx {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  pointer-events: none;
  z-index: 1;
}
#world {
  position: absolute;
  left: 0;
  top: 0;
  width: 1086px;
  height: 1448px;
  transform-origin: 0 0;
  pointer-events: none;
}
/* chips over the room: hype meter, buy amount, robot dock (pills), camera arrows and dots */
#hype {
  position: absolute;
  left: 50%;
  top: var(--space-3);
  transform: translateX(-50%);
  z-index: var(--z-hud);
  gap: var(--space-3);
  padding: 0 var(--space-1) 0 var(--space-4);
  background: var(--c-scrim-strong);
  border-color: var(--c-line-hi);
  font-size: var(--font-sm);
  pointer-events: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
#hype.hot {
  border-color: var(--c-accent-2-hi);
  box-shadow: var(--halo-now);
}
#hype.frenzy {
  border-color: var(--c-gold);
  color: var(--c-gold-hi);
  box-shadow: var(--halo-gold);
  animation: frenzy 1s ease-in-out infinite alternate;
}
@keyframes frenzy {
  to {
    filter: brightness(1.3);
  }
} /* C2: the frenzy meter pulses in light, never in size */
#hype.tap {
  animation: hypeTap 0.28s ease-out;
} /* every tap: a short jump of light */
@keyframes hypeTap {
  0% {
    filter: brightness(1.7);
  }
  100% {
    filter: none;
  }
}
#hypeMult.pop {
  animation: hmPop 0.26s cubic-bezier(0.3, 1.6, 0.5, 1);
}
@keyframes hmPop {
  0% {
    transform: scale(0.9);
  }
  60% {
    transform: scale(1.1);
  }
  100% {
    transform: none;
  }
}
.hbar {
  width: 96px;
  height: 12px;
  border-radius: var(--radius-sm);
  background: var(--c-surface-1);
  overflow: hidden;
  border: var(--stroke-2) solid var(--c-bg-deep);
}
.hbar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--c-accent-2-hi), var(--c-gold));
  transition: width 0.12s linear;
}
#hype.frenzy .hbar i {
  background: linear-gradient(90deg, var(--c-gold), var(--c-gold-pale));
}
#hype b {
  min-width: 46px;
  text-align: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--c-surface-3);
  color: var(--c-text);
  font-size: var(--font-md);
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
}
#hype.frenzy b {
  background: var(--c-gold-dark);
}
/* phones: the three room pills share one row (#chips): buy amount | hype (takes the rest) | bots, always 8 px apart */
#chips {
  display: contents;
}
:where([data-layout='phone'], [data-layout='land'][data-size~='ln']) #chips {
  position: absolute;
  left: var(--space-3);
  right: var(--space-3);
  top: var(--space-3);
  z-index: var(--z-hud);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  pointer-events: none;
}
:where([data-layout='phone'], [data-layout='land'][data-size~='ln']) #chips > :is(#hype, #modeChip, #botdock) {
  position: static;
  flex: none;
  pointer-events: auto;
}
:where([data-layout='phone'], [data-layout='land'][data-size~='ln']) #chips > #hype#hype {
  flex: 1 1 auto;
  min-width: 0;
  transform: none;
  gap: var(--space-2);
  padding-left: var(--space-3);
  font-size: var(--font-xs);
  pointer-events: none;
}
:where([data-layout='phone'], [data-layout='land'][data-size~='ln']) .hbar {
  flex: 1 1 auto;
  width: auto;
  min-width: 16px;
  max-width: 96px;
  height: 10px;
}
:where([data-layout='phone'], [data-layout='land'][data-size~='ln']) #hype b {
  min-width: 38px;
  font-size: var(--font-sm);
  padding: var(--space-1) var(--space-2);
}
:where([data-layout='land']) #hype {
  position: fixed;
  left: 84px;
  top: auto;
  bottom: var(--space-3);
  transform: none;
  z-index: calc(var(--z-nav) + 1);
  max-width: 178px;
  gap: var(--space-2);
  padding-left: var(--space-3);
  font-size: var(--font-xs);
}
:where([data-layout='land']) #hype .hbar {
  width: 54px;
}
:where([data-layout='land']) #hype b {
  min-width: 38px;
  font-size: var(--font-sm);
}
#modeChip {
  position: absolute;
  left: var(--space-3);
  bottom: var(--space-3);
  z-index: var(--z-hud);
  padding: 0 var(--space-4) 0 var(--space-3);
  font-size: var(--font-md);
  color: var(--c-text);
}
.mode-lbl {
  font-size: var(--font-sm);
  color: var(--c-text-2);
  white-space: nowrap;
}
:where([data-layout='phone'], [data-layout='land'], [data-layout='tab'], [data-layout='desk'][data-size~='n'])
  .mode-lbl {
  display: none;
} /* no room beside the camera dots: arrow + amount (label in the tooltip) */
#modeChip b {
  font-size: var(--font-md);
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
}
:where([data-layout='phone'], [data-layout='land'], [data-layout='tab']) #modeChip {
  top: var(--space-3);
  bottom: auto;
  padding: 0 var(--space-3) 0 var(--space-2);
}
#botdock {
  position: absolute;
  right: var(--space-3);
  bottom: var(--space-3);
  z-index: var(--z-hud);
  padding: 0 var(--space-1) 0 var(--space-2);
  background: var(--c-scrim-strong);
}
:where([data-layout='desk'], [data-layout='tab']) #botdock {
  display: none;
}
:where(.side-off[data-layout='tab'], .side-off[data-layout='desk'], .side-auto[data-layout='tab']) #botdock {
  display: flex;
} /* the right column is away: robots are bought from the pill over the room */
.bot-info {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  cursor: help;
}
:where([data-size~='xs']) #hypeLabel {
  display: none;
} /* 320 px: the bar and its number say it; the bots keep icon, count and price */
:where([data-layout='land']) #botdock {
  position: fixed;
  left: 86px;
  right: auto;
  bottom: 56px;
  z-index: calc(var(--z-nav) + 1);
  width: max-content;
  max-width: 176px;
}
:where([data-layout='land']:not([data-size~='ln'])) #modeChip {
  position: fixed;
  left: 86px;
  top: auto;
  bottom: calc(56px + var(--ctl-md) + var(--space-3));
  z-index: calc(var(--z-nav) + 1);
} /* sideways phone: x1 sits in the HUD column (between the base level and the robots), the room's top band is the toast's */
:where([data-layout='land']:not([data-size~='ln']):not([data-h~='xs'])) #modeChip {
  left: calc(86px + 104px + var(--space-2));
} /* beside the compact target chip */
.bot-count {
  font-size: var(--font-sm);
  color: var(--c-text-2);
  white-space: nowrap;
}
:where([data-layout='land']) .bot-count {
  font-size: var(--font-xs);
}
#botBuy {
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  color: var(--c-text);
}
#botBuy.poor {
  background: var(--c-surface-2);
  color: var(--c-text-3);
}
#botBuy.max {
  background: var(--c-surface-2);
  color: var(--c-text-3);
}
#botBuy.max .ico {
  display: none;
} /* MAX: grey, a tap shakes (never a dead spot) */
.cam-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--space-3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  pointer-events: none;
  z-index: var(--z-hud);
}
.cam-nav[hidden],
:where([data-h~='xxs']) .cam-nav {
  display: none;
} /* very short screens: swipe between rooms */
.cam-nav > * {
  pointer-events: auto;
}
.cam-dots {
  display: flex;
  gap: var(--space-5);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--c-scrim-strong);
  border: var(--stroke-2) solid var(--c-line);
}
.cam-dot {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-pill);
  background: var(--c-line);
  border: var(--stroke-2) solid var(--c-ink);
}
.cam-dot::after {
  content: '';
  position: absolute;
  inset: -17px -15px;
} /* 44 x 44 touch area (neighbours overlap a little; the nearer dot wins) */
.cam-dot.on {
  background: var(--c-accent);
  box-shadow: var(--glow-accent-soft);
  width: 26px;
}
.cam-dot.alert:not(.on) {
  background: var(--c-accent-2);
  animation: camAlert 1.6s ease-in-out infinite;
}
@keyframes camAlert {
  50% {
    box-shadow: var(--glow-now-soft);
  }
}
/* check-css: off — world: px of the 1086x1448 scene, scaled by #world and by --ps (plates never shrink below ~12 real px) */
.slot {
  position: absolute;
  width: 0;
  height: 0;
}
.slot > * {
  display: none;
  position: absolute;
  pointer-events: auto;
}
.slot[data-st='hired'] .plate-row,
.slot[data-st='empty'] .hire-btn,
.slot[data-st='buy'] .buy-card,
.slot[data-st='locked'] .lock-card {
  display: flex;
}
.slot .woe:not([hidden]) {
  display: block;
} /* the problem bubble (ZZZ, EMPTY!) was hidden by the rule above */
.slot .plate-row {
  left: -96px;
  top: 70px;
  gap: 5px;
  align-items: center;
  scale: var(--ps, 1);
  transform-origin: 116px 0;
}
#world.stack .slot .plate-row {
  flex-direction: column;
  align-items: center;
  gap: 4px;
  left: -66px;
  top: 46px;
  transform-origin: 66px 0;
}
.plate {
  height: 48px;
  min-width: 96px;
  padding: 0 10px;
  border-radius: 13px;
  background: var(--c-surface-2);
  border: 4px solid var(--c-ink);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-key);
  cursor: pointer;
}
#world.stack .slot .plate {
  min-width: 0;
}
#world.tight .slot .plate-row {
  gap: 3px;
}
#world.tight .slot .plate {
  min-width: 0;
  padding: 0 6px;
}
#world.tight .slot .lv {
  font-size: 28px;
}
.lv-pre {
  font-style: normal;
}
#world.short .lv-pre {
  display: none;
}
#world.tight .slot .lvl-btn {
  padding: 0 5px 0 3px;
  letter-spacing: -0.5px;
} /* tighter, still side by side */
.lv {
  font-size: 30px;
  color: var(--c-text);
}
.lvl-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 48px;
  min-width: 0;
  max-width: 132px;
  padding: 0 8px 0 6px;
  border-radius: 14px;
  background: linear-gradient(var(--c-locked-lo), var(--c-surface-2));
  border: 4px solid var(--c-ink);
  box-shadow: var(--shadow-key);
  color: var(--c-text);
  font-size: 28px;
  -webkit-text-stroke: 5px var(--ink);
  paint-order: stroke fill;
  touch-action: none;
  cursor: default;
  transition:
    transform 0.12s cubic-bezier(0.3, 1.6, 0.5, 1),
    filter 0.15s;
}
#world.stack .slot .lvl-btn {
  max-width: 150px;
}
.lvl-btn.long {
  letter-spacing: -0.5px;
}
.lvl-btn:active {
  transform: scale(0.93) translateY(2px);
}
.lvl-btn::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100%, var(--hit, 100px));
  height: max(100%, var(--hit, 100px));
  transform: translate(-50%, -50%);
} /* invisible touch area of at least 48 screen px */
.lvl-btn .arrow {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
}
.slot:not(.afford) .lvl-btn .arrow {
  filter: grayscale(1) brightness(0.8);
}
.lvl-btn > .ico {
  display: none;
}
.lvl-btn span {
  font-size: inherit;
}
.lvl-btn .lvl-n {
  font-size: 0.72em;
  line-height: 1;
  padding: 2px 4px;
  margin-right: 4px;
  border-radius: 6px;
  background: var(--c-scrim);
  color: var(--c-primary-paper);
}
.lvl-btn .lvl-n:empty {
  display: none;
}
.slot.afford .lvl-btn {
  background: var(--g-primary);
  color: var(--c-text);
  cursor: pointer;
  animation: ready 2.6s ease-in-out infinite;
}
.hire-btn,
.buy-card,
.lock-card {
  scale: min(var(--ps, 1), 1.4);
}
.hire-btn {
  left: -100px;
  top: -150px;
  width: 200px;
  height: 84px;
  border-radius: 22px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  background: linear-gradient(var(--c-locked-hi), var(--c-locked-lo));
  border: 5px solid var(--c-ink);
  box-shadow: var(--shadow-key), var(--shadow-drop-2);
}
.slot.afford .hire-btn {
  background: var(--g-primary);
  animation: ready 2.6s ease-in-out infinite;
}
.hire-label {
  font-size: 34px;
}
.hire-btn .price {
  font-size: 28px;
  padding-left: 30px;
}
.hire-btn > .ico {
  position: absolute;
  left: 30px;
  bottom: 9px;
}
.buy-card {
  left: -112px;
  top: -78px;
  width: 224px;
  height: 170px;
  border-radius: 26px;
  border: 6px dashed var(--c-text-muted);
  background: var(--c-veil);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.slot.afford .buy-card {
  border-color: var(--c-primary-hi);
  background: var(--c-primary-veil);
  animation: ready 2.6s ease-in-out infinite;
}
.buy-card .plus {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 0;
  background: none;
  box-shadow: none;
}
.slot:not(.afford) .buy-card .plus {
  filter: grayscale(1) brightness(0.75);
} /* the "+" sprite: green when the desk can be paid for */
.buy-card .price {
  font-size: 36px;
  display: inline-flex;
  padding-left: 34px;
}
.buy-card > .ico {
  position: absolute;
  left: 38px;
  bottom: 30px;
}
.lock-card {
  left: -118px;
  top: -78px;
  width: 236px;
  height: 170px;
  border-radius: 22px;
  background: var(--c-glass);
  border: 4px solid var(--c-bg);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--c-text-3);
  font-size: 27px;
}
.lock-card b {
  color: var(--c-paper-2);
}
.slot.far .lock-card {
  background: transparent;
  border: 5px dashed var(--c-haze);
}
.slot.far .lock-card > * {
  display: none;
}
/* the problem bubble of a desk: DOM, above plates, level buttons and income chips */
.woe {
  position: absolute;
  left: 66px;
  top: -132px;
  z-index: 5;
  padding: 6px 16px;
  border-radius: 22px;
  background: var(--c-text);
  color: var(--c-violet-mid);
  border: 5px solid var(--c-surface-1);
  font-size: 26px;
  white-space: nowrap;
  box-shadow: var(--shadow-drop-2);
  animation: woeBob 1.6s ease-in-out infinite;
  pointer-events: none;
}
.slot .woe {
  scale: var(--ps, 1);
  transform-origin: 0 100%;
}
.woe::after {
  content: '';
  position: absolute;
  left: 10px;
  bottom: -14px;
  border: 10px solid transparent;
  border-top-color: var(--c-surface-1);
}
.woe[data-k='panic'] {
  background: var(--c-paper);
  color: var(--c-danger);
}
.dom-pop {
  z-index: 7;
}
.plate.bump {
  animation: plateBump 0.42s cubic-bezier(0.25, 1.4, 0.5, 1);
}
.lvl-btn.bump {
  animation: btnBump 0.36s cubic-bezier(0.25, 1.8, 0.5, 1);
}
/* check-css: on */
@keyframes woeBob {
  50% {
    transform: translateY(-4px);
  }
}
@keyframes plateBump {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(var(--juice-pop, 1.1));
    background: var(--c-primary);
    color: var(--c-on-primary);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes btnBump {
  0% {
    transform: scale(0.88) translateY(3px);
  }
  60% {
    transform: scale(1.1);
  }
  100% {
    transform: none;
  }
}
@keyframes ready {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.1);
  }
}
.pop {
  animation: pop 0.36s cubic-bezier(0.3, 1.7, 0.5, 1);
}
.nope {
  animation: nope 0.32s ease-in-out;
}
@keyframes pop {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(var(--juice-pop, 1.1));
  }
  70% {
    transform: scale(0.97);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes nope {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}
/* the room scrolls when the hideout has more desk rows than fit: fade + arrow at the edge that has more */
#room::before,
#room::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 26px; /* thin, so the last row of plates stays readable under it */
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
  background-repeat: no-repeat;
  background-position: 50% 50%;
  background-size: 26px 16px;
}
#room::before {
  top: 0;
  background-image: linear-gradient(var(--c-scrim-strong), transparent);
}
#room::after {
  bottom: var(--camStrip, 0px);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 16'%3E%3Cpath d='M3 3l10 10L23 3' fill='none' stroke='%237cff4f' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
    linear-gradient(transparent, var(--c-scrim-strong));
  background-position:
    50% 70%,
    0 0;
  background-size:
    26px 16px,
    100% 100%;
}
#room.more-up::before,
#room.more-down::after {
  opacity: 1;
}
#room.more-down::after {
  animation: hintDown 1.4s ease-in-out infinite;
}
@keyframes hintDown {
  50% {
    background-position:
      50% 85%,
      0 0;
  }
}
/* the "more below" cue is a fade with a centred arrow on the room's own bottom edge (above the camera strip), gone at the end of the scroll */
#botdock.is-over .bot-count {
  color: var(--c-warn);
} /* more robots than the cap (after Reorganize) */
/* End of css/base.css */
