/* ==== panels (tabs 1-5): bottom sheet on phones, a wide window over the play area on desktop ==== */
#sheet {
  position: absolute;
  inset: 0;
  z-index: var(--z-sheet);
  pointer-events: none;
  background: transparent;
  transition: background 0.25s;
  display: flex;
  align-items: flex-end;
}
#sheet.open {
  pointer-events: auto;
  background: var(--c-scrim);
}
:where([data-layout='desk']) #sheet {
  position: fixed;
  left: calc(96px * var(--z));
  top: var(--hudH, 72px);
  right: 0;
  bottom: 0;
  align-items: stretch;
}
@media (min-aspect-ratio: 21/9) {
  :where([data-layout='desk']) #sheet {
    left: calc(110px * var(--z));
  }
}
:where([data-layout='land']) #sheet {
  position: fixed;
  left: calc(78px * var(--z));
  top: 0;
  right: 0;
  bottom: 0;
  align-items: stretch;
}
:where([data-layout='land'][data-size~='ln']) #sheet {
  top: var(--hudH, 60px);
} /* the HUD bar stays above the panel: no wallet squeezing the title */ /* full screen beside the tab column (money and gems ride in the panel header) */
/* phones and tablets: full screen above the tab bar (the tab bar stays: the open tab is lit and tapping it closes the panel) */
:where([data-layout='phone'], [data-layout='tab']) #sheet {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: var(--navH, 0px);
  align-items: stretch;
}
.sheet {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  max-height: 92%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  background: linear-gradient(var(--c-surface-3), var(--c-surface-1));
  border: var(--stroke-3) solid var(--c-line-strong);
  border-bottom: 0;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  transform: translateY(105%);
  transition:
    transform 0.34s cubic-bezier(0.25, 1.3, 0.5, 1),
    opacity 0.2s;
}
#sheet.open .sheet {
  transform: translateY(0);
}
#sheet:not(.open) .sheet {
  visibility: hidden;
  transition:
    transform 0.25s,
    opacity 0.25s,
    visibility 0s 0.25s;
} /* closed sheet: no focusable buttons off screen */
:where([data-layout='desk']) .sheet {
  max-width: 1400px;
  height: 100%;
  max-height: none;
  margin: 0 auto;
  border-radius: 0;
  border: 0;
  border-inline: var(--stroke-3) solid var(--c-line-strong);
  transform: translateX(6%);
  opacity: 0;
} /* 1400 UI px at most (21:9, 32:9), centred over the room */
:where([data-layout='desk']) #sheet.open .sheet {
  transform: none;
  opacity: 1;
}
:where([data-layout='land'], [data-layout='phone'], [data-layout='tab']) .sheet {
  max-width: none;
  height: 100%;
  max-height: none;
  border-radius: 0;
  border: 0;
  padding-top: env(safe-area-inset-top);
}
.sheet.dragging {
  transition: none;
}
/* window / panel header: fixed height, icon + title + close always in the same place */
.window-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: var(--ctl-lg);
  flex: none;
  margin: 0 calc(-1 * var(--space-5)) var(--space-4);
  padding: 0 var(--space-3) 0 var(--space-5);
  border-bottom: var(--stroke-1) solid var(--c-line);
}
.window-head h2 {
  flex: 1;
  min-width: 0;
  font-size: var(--font-xl);
  line-height: var(--lh-tight);
  color: var(--c-text);
  -webkit-text-stroke: var(--outline-text) var(--ink);
  paint-order: stroke fill;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheet > .window-head {
  margin: 0;
  z-index: 2;
  background: var(--c-surface-3);
  touch-action: none;
} /* fixed: only the body scrolls; dragging it down closes the panel (phones) */
:where([data-layout='desk']) .sheet > .window-head {
  height: 64px;
  padding: 0 var(--space-4) 0 var(--space-6);
}
:where([data-layout='desk']) .sheet > .window-head h2 {
  font-size: var(--font-2xl);
}
:where([data-layout='land']) .sheet > .window-head {
  height: 48px;
}
:where([data-layout='land']) .sheet > .window-head h2 {
  font-size: var(--font-lg);
}
.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4) max(var(--space-5), env(safe-area-inset-right))
    max(var(--space-5), env(safe-area-inset-bottom)) max(var(--space-5), env(safe-area-inset-left));
}
:where([data-layout='desk']) .sheet-body {
  padding: var(--space-4) var(--space-6) var(--space-6);
}
:where([data-layout='tab']) .sheet-body > * {
  width: 100%;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
} /* tablet: the panel is the whole height, the content a centred column */
.sheet-body > .seg:first-child {
  position: sticky;
  top: calc(-1 * var(--space-4));
  z-index: 2;
  border-image: linear-gradient(var(--c-surface-3), var(--c-surface-3)) 1 / var(--space-4) 100vw var(--space-3)
    var(--space-6) / var(--space-4) 100vw var(--space-3) var(--space-6);
} /* an opaque band around the sticky tabs: no scrolled card leaks around them */ /* the sub-tabs stay put; only the content scrolls */
/* money and gems ride in the panel header where the HUD is covered (phone, sideways, tablet) */
.sh-wallet {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: none;
  font-size: var(--font-sm);
  color: var(--c-text);
}
.sh-wallet > span {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  white-space: nowrap;
}
.sh-wallet b {
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
}
:where([data-layout='desk'], [data-layout='land'][data-size~='ln']) .sh-wallet {
  display: none;
} /* desk: the HUD stays visible; ln: the panel opens under the HUD bar */
:where([data-layout='phone'][data-size~='n']) .sheet > .window-head .sh-ico {
  display: none;
}
/* column flex children never shrink below their content */
.sheet-body > *,
.map-wrap > *,
.tgt-card > *,
.cards > *,
.rows > *,
.rcards > *,
.mis-list > *,
.ach-list > *,
.shop-grid > * {
  flex-shrink: 0;
}
.cards,
.rows,
.rcards,
.mis-list,
.ach-list,
.shop-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
:where([data-layout='desk']) .sheet-body {
  max-width: 1500px;
  margin: 0 auto;
  width: 100%;
}
@media (min-aspect-ratio: 21/9) {
  :where([data-layout='desk']) .sheet-body {
    max-width: 2600px;
  }
}
/* card grids: rows wrap and the cards of the last row grow to fill it, so no count of cards leaves an orphan hole */
:where([data-layout='desk'], [data-layout='tab'])
  :is(.sheet-body .rows, .shop-grid, .mis-list, .ach-list, .sheet-body .cards, .sheet-body .rcards) {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: stretch;
}
:where([data-layout='desk'], [data-layout='tab'])
  :is(.sheet-body .rows, .shop-grid, .mis-list, .ach-list, .sheet-body .rcards)
  > * {
  flex: 1 1 380px;
  min-width: 0;
}
:where([data-layout='desk'], [data-layout='tab']) .sheet-body .cards > * {
  flex: 1 1 420px;
  min-width: 0;
}
:where([data-layout='desk'], [data-layout='tab']) .sheet-body .rows > .detail {
  flex-basis: 100%;
  max-width: 720px;
}
:where([data-layout='desk'], [data-layout='tab']) .bal > :not(.detail) {
  flex: 1 1 calc((100% - (var(--cols) - 1) * var(--space-3)) / var(--cols) - 1px);
} /* balanced rows (ui.js balanceGrids) */
:where([data-layout='desk'], [data-layout='tab']) .sheet-body .seg {
  width: min(620px, 100%);
} /* the inner tabs line up with the content (left), never centred */
.sheet-body h4 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: var(--space-2);
  font-size: var(--font-md);
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
}
.sheet-body h4 small {
  font-size: var(--font-xs);
  color: var(--c-text-3);
  -webkit-text-stroke: 0;
}
.sub-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  justify-content: space-between;
}
.sub-row .btn {
  flex: none;
}
:where([data-size~='xs']) .sub-row {
  flex-wrap: wrap;
}
:where([data-size~='xs']) .sub-row .sub {
  flex: 1 1 100%;
}
.legend {
  font-size: var(--font-xs);
  color: var(--c-text-3);
}
.empty {
  text-align: center;
}

/* Crew: recruit cards, crew rows, detail */
.rc {
  gap: var(--space-3);
  padding: var(--space-3);
}
.rc.soon {
  border-style: dashed;
}
.rc-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  line-height: var(--lh-tight);
}
.rc-info b {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-md);
  white-space: nowrap;
}
.rc-info b .cm-role {
  flex: none;
  font-size: var(--font-xs);
}
.rc-stats {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  font-size: var(--font-xs);
  color: var(--c-text-3);
}
.rc-stats .pips i {
  width: 8px;
  height: 8px;
}
.row-m {
  gap: var(--space-3);
  padding: var(--space-3);
  cursor: pointer;
}
.rm-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  font-size: var(--font-md);
  line-height: var(--lh-tight);
}
.rm-rate {
  font-size: var(--font-sm);
  color: var(--c-primary);
}
.rm-top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}
.rm-top b {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
:where([data-layout='phone'][data-size~='n']) .rm-top {
  flex-wrap: wrap;
}
:where([data-layout='phone'][data-size~='n']) .rm-top b {
  white-space: normal;
  overflow: visible;
}
.detail {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin-top: calc(-1 * var(--space-1));
}
.d-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-3) var(--space-4);
  align-items: center;
  font-size: var(--font-sm);
}
:where([data-layout='desk']) .d-grid {
  grid-template-columns: 120px 1fr;
}
.d-grid em {
  font-style: normal;
  color: var(--c-text-2);
  font-weight: 700;
}
.d-move > span {
  display: block;
  margin-bottom: var(--space-3);
  font-size: var(--font-sm);
}
.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  max-width: 300px;
}
.mini {
  flex-direction: column;
  gap: 0;
  padding: 0 var(--space-2);
  font-size: var(--font-md);
}
.mini i {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: normal;
  font-size: var(--font-xs);
  color: var(--c-text-3);
}
.mini.is-sel i {
  color: var(--c-text-2);
}

/* Expansion: plan of the base + selected room + moving card */
.plan {
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr;
  grid-template-rows: auto auto;
  gap: var(--space-3);
}
:where([data-layout='desk']) .plan {
  max-width: 760px;
}
.plan .main {
  grid-column: 2;
  grid-row: 1 / span 2;
}
.room {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-1);
  min-height: 128px;
  padding: var(--space-2);
  border-radius: var(--radius-lg);
  background: var(--c-bg);
  border: var(--stroke-2) solid var(--c-line);
  overflow: hidden;
}
:where([data-layout='desk']) .room {
  min-height: 170px;
}
.room {
  justify-content: flex-start;
}
.room-art {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  opacity: 0.35;
  filter: grayscale(0.7);
} /* the art on top, the name and level below it: labels never cover the picture */
:where([data-layout='phone'], [data-layout='land']) .room-art {
  zoom: 0.72;
}
.main-crew {
  position: relative;
  z-index: 1;
  flex: 1;
  align-self: stretch;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-content: center;
  justify-items: center;
  gap: var(--space-1);
} /* the main room shows its crew */
.main-crew i {
  display: grid;
  place-items: end center;
  height: 44px;
}
:where([data-layout='phone'], [data-layout='land']) .main-crew i {
  zoom: 0.72;
}
.room.built .room-art {
  opacity: 1;
  filter: none;
}
.room.sel {
  border-color: var(--c-accent);
  box-shadow: var(--glow-accent);
}
.room.locked {
  opacity: 0.55;
}
.room-lv {
  position: relative;
  z-index: 1;
  color: var(--c-primary-pale);
  background: var(--c-scrim-strong);
}
.main-art {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 40%;
  opacity: 0.9;
}
.plaque {
  position: relative;
  z-index: 1;
  font-size: var(--font-sm);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--c-text);
  text-shadow: 0 1px 0 var(--c-bg-deep);
  border: var(--stroke-2) solid var(--c-bg);
  box-shadow: var(--shadow-shine), var(--shadow-drop-1);
  background-image:
    radial-gradient(circle at 6px 50%, var(--c-surface-2) 1.5px, transparent 2px),
    radial-gradient(circle at calc(100% - 6px) 50%, var(--c-surface-2) 1.5px, transparent 2px),
    linear-gradient(var(--c-text-muted), var(--c-line-strong));
}
:where([data-size~='xs']) .plan .plaque {
  font-size: var(--font-xs);
  padding: var(--space-1) var(--space-2);
  line-height: var(--lh-tight);
}
.room-plus {
  position: absolute;
  z-index: 1;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 2px 0 var(--c-shade));
}
:where([data-layout='desk']) .sheet[data-tab='3'] .sheet-body {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr);
  gap: var(--space-4) var(--space-6);
  align-items: start;
}
:where([data-layout='desk']) .sheet[data-tab='3'] .sheet-body > .sub {
  grid-column: 1 / -1;
}
:where([data-layout='desk']) .sheet[data-tab='3'] .plan {
  grid-column: 1;
  grid-row: 3 / span 3;
  max-width: none;
}
:where([data-layout='desk']) .sheet[data-tab='3'] .room-card {
  grid-column: 2;
  grid-row: 4 / span 2;
} /* the room detail sits beside the plan, under the move card (it was cut under the plan on wide screens) */
:where([data-layout='desk']) .sheet[data-tab='3'] .move-card {
  grid-column: 2;
  grid-row: 2 / span 2;
}
.move-card {
  grid-template-columns: auto 1fr;
  border-style: dashed;
  border-color: var(--c-line-hi);
}
.move-card.is-ready {
  border-style: solid;
  background: linear-gradient(var(--c-gold-deep), var(--c-gold-night));
}
.move-card > div {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.move-card b {
  font-size: var(--font-lg);
}
.move-card small {
  font-size: var(--font-xs);
  color: var(--c-text-2);
  font-weight: 700;
}
.move-card .keep {
  color: var(--c-text-3);
}
.move-card .need {
  max-width: none;
  text-align: left;
}
.move-gain {
  font-size: var(--font-sm);
  color: var(--c-gold-hi);
}
.move-btn {
  grid-column: 1 / -1;
}

/* Targets: map, target card, missions, achievements */
.map-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
:where([data-layout='desk']) .map-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(340px, 1fr);
  gap: var(--space-5);
  align-items: start;
}
:where([data-layout='land']) .map-wrap {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--space-4);
  align-items: start;
}
.map-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}
.map {
  position: relative;
  aspect-ratio: 1.25;
  border-radius: var(--radius-lg);
  border: var(--stroke-2) solid var(--c-line);
  background: var(--c-map);
  isolation: isolate;
  overflow: hidden;
  box-shadow: var(--shadow-vignette);
}
.map::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--c-surface-1) url(../assets/img/mapbg.jpg) center / cover no-repeat;
  filter: brightness(1.45) contrast(1.18) saturate(1.1);
}
:where([data-layout='phone']) .map {
  aspect-ratio: 1.02;
}
:where([data-layout='land']) .map {
  aspect-ratio: auto;
  height: calc(100dvh / var(--z) - 168px);
  grid-column: 1;
  grid-row: 1 / span 2;
} /* sideways: the whole map on screen under the sub-tabs */
:where([data-layout='land']) .map-col {
  display: contents;
}
:where([data-layout='land']) .map-wrap {
  grid-template-rows: auto 1fr;
}
:where([data-layout='land']) .map-wrap .dom-card {
  grid-column: 2;
  grid-row: 1;
}
:where([data-layout='land']) .map-wrap .tgt-card {
  grid-column: 2;
  grid-row: 2;
}
:where([data-layout='land'][data-size~='ln']) .map-wrap {
  display: flex;
}
:where([data-layout='land'][data-size~='ln']) .map {
  aspect-ratio: 1.25;
  height: auto;
}
:where([data-layout='land'][data-size~='ln']) .map-col {
  display: flex;
} /* too narrow for map + cards side by side: one column that scrolls */
:where([data-layout='desk']) .sheet .map {
  aspect-ratio: auto;
  height: calc((100dvh - var(--tickB, 160px) - 230px * var(--z)) / var(--z));
  min-height: 300px;
} /* zoomed panels: vh is multiplied by zoom, so divide it back */
.map-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.map-lines polyline {
  fill: none;
  stroke: var(--c-haze);
  stroke-width: 1.5;
  stroke-dasharray: 3 4;
  vector-effect: non-scaling-stroke;
}
.map-lines polyline.lit {
  stroke: var(--c-accent);
  stroke-width: 2.5;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 2px var(--c-accent-glow));
}
/* map node = building + corner lock + one label block placed by layoutMap() */
.node {
  position: absolute;
  width: 0;
  height: 0;
  padding: 0;
  display: block;
  --ns: 0.85;
}
:where([data-layout='phone'], [data-layout='land'][data-size~='n']) .node {
  --ns: 0.72;
}
:where([data-layout='desk']) .node {
  --ns: 1;
}
:root body .node:focus-visible {
  box-shadow: none;
}
.node:focus-visible .node-art {
  box-shadow: var(--ring-focus);
}
.node-art {
  position: relative;
  display: inline-block;
  transform: translate(-50%, -50%) scale(var(--ns));
  transform-origin: 50% 50%;
  filter: drop-shadow(0 3px 2px var(--c-shade-lg));
}
.node.sel .node-art {
  filter: drop-shadow(0 0 6px var(--c-accent));
}
.node.now .node-art {
  filter: drop-shadow(0 0 10px var(--c-accent-2-glow)) drop-shadow(0 3px 2px var(--c-shade-lg));
}
.node.lock .node-art {
  filter: grayscale(1) brightness(0.62) contrast(0.95);
  opacity: 0.95;
}
.node.now .node-art::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 120%;
  height: 30%;
  transform: translateX(-50%);
  border: var(--stroke-2) solid var(--c-accent-2);
  border-radius: 50%;
  background: radial-gradient(var(--c-accent-2-soft), transparent 70%);
  box-shadow: var(--glow-now-soft);
  animation: nowRing 1.8s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}
@keyframes nowRing {
  50% {
    transform: translateX(-50%) scale(1.1);
    opacity: 0.6;
  }
}
.node-lock {
  position: absolute;
  right: -6px;
  bottom: -4px;
  filter: drop-shadow(0 2px 0 var(--c-shade-lg));
}
.node.lock .node-lock {
  transform: scale(0.75);
  opacity: 0.8;
}
.map-leads {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
} /* label -> building leader lines */
.map-leads line {
  stroke: var(--c-text-2);
  stroke-width: var(--stroke-2);
  stroke-linecap: round;
  stroke-dasharray: 2 5;
}
.node-lab {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}
.node-lab[hidden] {
  display: none;
}
.node-name {
  font-size: var(--font-md);
  width: max-content;
  max-width: 8.5em;
  text-align: center;
  line-height: 1.05;
  padding: var(--space-1) var(--space-2);
  background: var(--c-scrim);
  border: var(--stroke-1) solid var(--c-haze);
  border-radius: var(--radius-sm);
  color: var(--c-text-2);
}
:where([data-layout='phone'], [data-layout='land']) .node-name {
  font-size: var(--font-xs);
} /* the short sideways map gets the phone's label size */
.node-lab.tight .node-name {
  max-width: 7em;
  padding: 0 var(--space-2);
}
.node.now .node-name {
  background: var(--c-scrim-strong);
  border: var(--stroke-2) solid var(--c-accent-2);
  color: var(--c-text);
}
.node.sel:not(.now) .node-name {
  border-color: var(--c-accent);
}
.node.lock .node-name {
  background: var(--c-scrim);
  border-color: transparent;
  color: var(--c-text-2);
} /* locked targets stay readable on the map */
.node-stars {
  display: flex;
  gap: var(--space-1);
}
.node-stars .ico {
  width: 12px;
  height: 12px;
}
.dom-card {
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
}
.dom-card > div {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.dom-card small {
  font-size: var(--font-xs);
  color: var(--c-accent-hi);
}
.dom-card b {
  font-size: var(--font-md);
}
.tgt-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-3);
}
.tgt-card header {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  cursor: pointer;
}
.tgt-card header > div {
  flex: 1;
  min-width: 0;
}
.tgt-fold {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--ctl-md);
  height: var(--ctl-md);
  color: var(--c-text-3);
  transition: transform var(--dur-state);
}
.tgt-card.fold .tgt-fold {
  transform: rotate(-90deg);
}
.tgt-card.fold > :not(header) {
  display: none;
}
.tgt-card header b {
  font-size: var(--font-lg);
  line-height: var(--lh-tight);
}
.tgt-card header small {
  display: block;
  color: var(--c-text-3);
  font-size: var(--font-xs);
}
.tgt-card p {
  font-size: var(--font-sm);
  color: var(--c-text-2);
  font-weight: 700;
}
:where([data-layout='desk']) .tgt-card p {
  font-size: var(--font-md);
}
.rw-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}
.rw {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background: var(--c-surface-2);
  font-size: var(--font-md);
}
.rw b {
  font-size: var(--font-sm);
  color: var(--c-gold);
  white-space: nowrap;
}
.prog-h {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-sm);
}
.segbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}
.segbar .bar {
  height: 8px;
}
.steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.steps li {
  grid-template-columns: 22px 1fr auto;
  grid-template-areas: 'box txt num' 'box bar bar';
  gap: var(--space-1) var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--font-sm);
  box-shadow: none;
}
.steps li.ok {
  grid-template-areas: 'box txt num';
  border-color: var(--c-success);
}
.steps li[role='button'],
.steps li.ok {
  min-height: var(--ctl-md);
} /* steps that react to a tap: 44 px tall */
.steps .box {
  grid-area: box;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  border: var(--stroke-3) solid var(--c-text-muted);
  background: var(--c-ink);
}
.steps li.ok .box {
  display: none;
}
.steps li > span {
  grid-area: txt;
}
.steps li > em {
  grid-area: num;
  font-style: normal;
  font-size: var(--font-xs);
  color: var(--c-text-3);
}
.steps li > .bar {
  grid-area: bar;
  height: 8px;
}
.steps li.ok > em {
  grid-area: box;
}
.mis,
.ach {
  gap: var(--space-3);
  padding: var(--space-3);
}
.mis-i,
.ach > div {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  font-size: var(--font-sm);
}
.mis-i small,
.ach small {
  color: var(--c-text-3);
  font-size: var(--font-xs);
}
.mis-rw {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
  font-size: var(--font-md);
  color: var(--c-gold);
  white-space: nowrap;
}
.ach > span {
  display: flex;
  align-items: center;
  font-size: var(--font-md);
  color: var(--c-gold);
  white-space: nowrap;
}
.kv {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  white-space: nowrap;
}
.ach-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.ach-head .bar {
  flex: 1;
}
.ach-head b {
  font-size: var(--font-lg);
}

/* Tech tree */
.tp-have,
.gem-have {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--font-lg);
}
.tp-have span {
  font-size: var(--font-sm);
  color: var(--c-text-3);
}
.ttree {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}
:where([data-layout='desk']) .ttree {
  grid-template-columns: repeat(3, 1fr);
  align-items: start;
}
.tchain {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.tchain.branch {
  position: relative;
  margin-left: var(--space-6);
  padding-left: var(--space-4);
  border-left: var(--stroke-3) solid var(--c-accent-glow);
}
.tchain.branch::before {
  content: '';
  position: absolute;
  left: -3px;
  top: 22px;
  width: 14px;
  height: 3px;
  background: var(--c-accent-glow);
}
.tbranch {
  font-size: var(--font-xs);
  color: var(--c-text-3);
  margin: 0 0 var(--space-2) var(--space-3);
}
.tnode {
  gap: var(--space-3);
  padding: var(--space-3);
}
.tnode.owned {
  opacity: 0.8;
}
.tnode.ready {
  box-shadow: var(--glow-now);
}
.tn-i {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.tn-i b {
  font-size: var(--font-md);
}
.tn-i small {
  font-size: var(--font-xs);
  color: var(--c-text-2);
  font-weight: 700;
}
.tn-i .tn-req {
  color: var(--c-gold-hi);
}
.tlink {
  align-self: flex-start;
  width: 6px;
  height: 18px;
  margin-left: calc(var(--space-3) + 26px - 3px);
  border-radius: var(--radius-xs);
  background: var(--c-line);
} /* under the centre of the node's icon */
.tlink.on {
  background: var(--c-success);
}
.tfork {
  position: relative;
  margin-left: calc(var(--space-3) + 26px - 3px);
  padding: 18px 0 0 var(--space-4);
  border-left: 6px solid var(--c-line);
} /* parent -> branch: the chain's line keeps going down, a tick enters the branch */
.tfork::before {
  content: '';
  position: absolute;
  left: 0;
  top: calc(18px + var(--space-3) + 23px);
  width: var(--space-4);
  height: 6px;
  background: var(--c-line);
}
.tfork.on {
  border-left-color: var(--c-success);
}
.tfork.on::before {
  background: var(--c-success);
}

/* Shop */
.shop-card {
  grid-template-columns: 56px 1fr auto;
  gap: var(--space-3);
  padding: var(--space-3);
}
.shop-card b {
  font-size: var(--font-md);
}
.shop-card small {
  display: block;
  font-size: var(--font-xs);
  color: var(--c-text-2);
  font-weight: 700;
}
.boost-left {
  display: inline-block;
  margin-top: var(--space-1);
  font-style: normal;
  font-size: var(--font-xs);
  color: var(--c-primary-pale);
}
.shop-card.bought {
  animation: bought 0.9s ease-out;
  position: relative;
}
.shop-card.has-seal {
  position: relative;
}
.shop-card .bought-tag {
  position: absolute;
  right: var(--space-3);
  top: -12px;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--c-surface-2);
  border: var(--stroke-2) solid var(--c-primary);
  animation: boughtTag 1.4s ease-out forwards;
}
@keyframes bought {
  0% {
    box-shadow: var(--pulse-buy-0);
    transform: scale(1.03);
  }
  100% {
    box-shadow: var(--pulse-buy-1);
    transform: none;
  }
}
@keyframes boughtTag {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  20% {
    transform: scale(var(--juice-pop, 1.1));
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-8px);
  }
}
@keyframes boughtCalm {
  0%,
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
.fly-coin {
  position: fixed;
  left: 0;
  top: 0;
  z-index: calc(var(--z-hud) - 1);
  pointer-events: none;
  will-change: transform;
} /* earnings flying to the HUD coin (positioned by ui.js in screen px) */
.fly-gem {
  position: fixed;
  z-index: var(--z-overlay);
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition:
    transform 0.55s cubic-bezier(0.5, -0.3, 0.6, 1),
    opacity 0.55s ease-in;
}

/* ==== windows (#modal): settings, sound, member card, how-to, confirm, offline, finale ==== */
#modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  background: var(--c-scrim);
}
#modal.open {
  display: flex;
}
:where([data-h~='s']) #modal {
  padding: var(--space-3);
}
.window {
  width: min(calc(100vw / var(--z) - 32px), 420px);
  max-height: calc(100dvh / var(--z) - 32px);
  overflow-y: auto;
  padding: 0 var(--space-5) var(--space-5);
  background: var(--g-window);
  border: var(--stroke-3) solid var(--c-line-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-drop-2);
  animation: modalIn 0.38s cubic-bezier(0.25, 1.45, 0.5, 1);
}
.window.wide {
  width: min(calc(100vw / var(--z) - 32px), 560px);
}
.window:not(:has(> .window-head)) {
  padding-top: var(--space-5);
}
@keyframes modalIn {
  from {
    transform: scale(0.7) translateY(30px);
    opacity: 0;
  }
}
.opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-1);
  border-bottom: var(--stroke-1) solid var(--c-line);
  font-size: var(--font-md);
}
.opt.col {
  flex-direction: column;
  align-items: stretch;
}
.opt:last-child {
  border-bottom: 0;
} /* no empty divider under the last row */
.opt .lang-pick {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.opt:has(.lang-pick) {
  align-items: flex-start;
}
.opt:has(.lang-pick) > span {
  line-height: var(--ctl-md);
}
.opt.vol {
  display: grid;
  grid-template-columns: 8em minmax(0, 1fr) 3ch;
  align-items: center;
  gap: var(--space-3);
} /* both tracks start and end at the same x */
.opt.vol > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.opt.vol .vol-n {
  width: 3ch;
  text-align: right;
  color: var(--c-text-2);
  font-size: var(--font-md);
}
.opt-foot {
  display: flex;
  justify-content: center;
  padding-top: var(--space-2);
}
.member .mc-role {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--c-text-2);
  font-size: var(--font-md);
}
.member .mc-trait {
  color: var(--c-accent-2-pale);
  font-size: var(--font-md);
  margin: var(--space-3) 0 var(--space-2);
}
.member .mc-bio {
  color: var(--c-text-3);
  font-size: var(--font-sm);
  margin-bottom: var(--space-4);
}
.dismiss {
  display: block;
  margin: var(--space-3) auto 0;
}
.confirm p {
  font-size: var(--font-md);
  text-align: center;
  margin-bottom: var(--space-4);
  color: var(--c-text);
}
.how p {
  font-size: var(--font-md);
  color: var(--c-text-2);
  margin-bottom: var(--space-4);
}
.how .btn:not(.x),
.finale-card .fin-go {
  width: 100%;
} /* the close X of the how-to card keeps its size (it was stretched over the title) */
.finale-card {
  text-align: center;
}
.cred-logo {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-4);
}
.cred-img {
  display: block;
  width: min(100%, 420px);
  height: auto;
  margin: 0 auto;
}
.fin-art img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(40vh / var(--z));
  aspect-ratio: 3 / 2;
  margin: 0 auto var(--space-3);
  border-radius: var(--radius-md);
} /* short screens: smaller, still the whole 3:2 frame */
.fin-art + .cred-logo .cred-img {
  width: min(60%, 240px);
}
:where([data-h~='s']) .fin-art + .cred-logo {
  display: none;
} /* short screens: the art and the text fit, the logo goes */
.away {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}
.away h2 {
  font-size: var(--font-xl);
  -webkit-text-stroke: var(--outline-text) var(--ink);
  paint-order: stroke fill;
}
.away-cat {
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 6px 0 var(--c-shade-sm));
}
@keyframes float {
  50% {
    transform: translateY(-8px);
  }
}
.away p {
  color: var(--c-text-2);
  font-size: var(--font-md);
  font-weight: 700;
}
.away .cap {
  color: var(--c-gold-hi);
  font-size: var(--font-sm);
}
.away-amt {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--font-3xl);
  -webkit-text-stroke: var(--outline-text) var(--ink);
  paint-order: stroke fill;
  color: var(--c-primary);
}
.collect {
  animation: ready 2.6s ease-in-out infinite;
}

/* ==== overlays: tutorial, moving ceremony, title menu, intro comic, loading ==== */
.tut {
  position: fixed;
  inset: 0;
  z-index: var(--z-tutorial);
  pointer-events: none;
  display: none;
}
.tut.on {
  display: block;
}
/* the pointing hand (js/ui-meta.js createHand): the outer box sits on the fingertip in screen px, the zoom lives on .hand-z */
.hand {
  position: fixed;
  left: 0;
  top: 0;
  z-index: var(--z-tutorial);
  pointer-events: none;
  display: none;
  transition: transform 0.35s cubic-bezier(0.3, 1.3, 0.5, 1);
}
.hand.on {
  display: block;
}
.tut .hand {
  position: absolute;
}
.hand-z {
  width: 0;
  height: 0;
  transform-origin: 0 0;
}
.hand.flip-x .hand-z {
  transform: scaleX(-1);
}
.hand.flip-y .hand-z {
  transform: scaleY(-1);
}
.hand.flip-x.flip-y .hand-z {
  transform: scale(-1, -1);
}
.hand-m {
  animation: handMove 1.2s infinite;
}
.hand-i {
  display: block;
  background: url(../assets/img/hand.png) no-repeat 0 0;
  filter: drop-shadow(0 3px 0 var(--c-shade));
  animation: handPose 1.2s infinite step-end;
}
/* pose 1 floats just off the point, springs down, pose 2 presses, pose 3 (the tap dashes) for ~120 ms, back up */
@keyframes handMove {
  0%,
  36% {
    transform: translate(9px, 11px);
  }
  18% {
    transform: translate(9px, 8px);
  }
  36% {
    animation-timing-function: cubic-bezier(0.3, 1.6, 0.6, 1);
  }
  46%,
  72% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(9px, 11px);
  }
}
@keyframes handPose {
  0% {
    background-position-x: 0;
  }
  46% {
    background-position-x: var(--p2);
  }
  62% {
    background-position-x: var(--p3);
  }
  72%,
  100% {
    background-position-x: 0;
  }
}
/* swipe hint: the same hand pressing and dragging sideways */
.hand.swipe .hand-m {
  animation: handSwipe 1.6s infinite;
}
.hand.swipe .hand-i {
  animation: handSwipePose 1.6s infinite step-end;
}
@keyframes handSwipe {
  0% {
    transform: translate(0, 0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  22% {
    transform: translate(0, 0);
    animation-timing-function: cubic-bezier(0.5, 0, 0.3, 1);
  }
  70% {
    transform: translate(var(--sw), 0);
  }
  82% {
    transform: translate(var(--sw), 0);
    opacity: 1;
  }
  94%,
  100% {
    transform: translate(var(--sw), 0);
    opacity: 0;
  }
}
@keyframes handSwipePose {
  0% {
    background-position-x: 0;
  }
  16% {
    background-position-x: var(--p2);
  }
  76%,
  100% {
    background-position-x: 0;
  }
}
/* less motion: no travel, pose 1 and 3 take turns */
@keyframes handCalm {
  0% {
    background-position-x: 0;
  }
  50% {
    background-position-x: var(--p3);
  }
}
[data-motion='reduced'] .hand-m,
[data-motion='reduced'] .hand.swipe .hand-m {
  animation: none;
  transform: none;
  opacity: 1;
}
[data-motion='reduced'] .hand-i,
[data-motion='reduced'] .hand.swipe .hand-i {
  animation: handCalm 1.2s infinite step-end;
}
.tut-bubble {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  transition: transform 0.35s;
} /* the card never takes a touch: only Skip does */
.tut-skip {
  pointer-events: auto;
}
.tut-prog {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: none;
  font-size: var(--font-sm);
  color: var(--c-gold-hi);
  white-space: nowrap;
}
.tut-prog[hidden] {
  display: none;
}
.tut-on .sheet-body {
  padding-bottom: var(--tutH, 0px);
} /* the card never hides the last row of a panel */
.tut-in {
  width: min(320px, calc(100vw / var(--z) - 16px));
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--g-window);
  color: var(--c-text);
  border: var(--stroke-3) solid var(--c-line-strong);
  box-shadow: var(--shadow-drop-2);
  font-size: var(--font-md);
  line-height: var(--lh-body);
}
.tut-txt {
  flex: 1;
}
.tut-step {
  background: var(--c-primary);
  color: var(--c-on-primary);
}
.tut-skip {
  flex: none;
  padding: 0 var(--space-3);
  font-size: var(--font-sm);
}
/* moving ceremony: beacon, convoy, new hideout card */
.cere {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: grid;
  place-items: center;
  transition: opacity 0.4s;
  background: var(--c-scrim);
  backdrop-filter: blur(10px) brightness(0.6);
  -webkit-backdrop-filter: blur(10px) brightness(0.6);
}
.cere.out {
  opacity: 0;
}
.cere-stage {
  position: relative;
  width: calc(100vw / var(--z));
  height: 360px;
  overflow-x: clip;
  overflow-y: visible;
} /* the convoy is clipped sideways, the siren beams are not */
.beat {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  text-align: center;
}
.cere[data-beat='1'] .b1,
.cere[data-beat='2'] .b2,
.cere[data-beat='3'] .b3 {
  display: flex;
}
.beat h2 {
  position: relative;
  z-index: 2;
  padding: 0 var(--space-5);
  max-width: 100%;
  text-align: center;
  font-size: clamp(22px, calc(7vw / var(--z)), 30px);
  -webkit-text-stroke: 6px var(--ink);
  paint-order: stroke fill;
  color: var(--c-gold-hi);
}
.b3 .rep {
  font-size: var(--font-2xl);
  color: var(--c-gold);
  -webkit-text-stroke: var(--outline-text) var(--ink);
  paint-order: stroke fill;
}
.beacon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
}
.beacon::before {
  content: '';
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: var(--radius-pill);
  background: radial-gradient(circle, var(--c-gold-glow), transparent 70%);
  animation: sirenGlow 0.5s ease-in-out infinite alternate;
}
@keyframes sirenGlow {
  to {
    transform: scale(1.15);
    opacity: 0.7;
  }
}
.beams {
  position: absolute;
  z-index: 0;
  width: 520px;
  height: 520px;
  border-radius: var(--radius-pill);
  filter: blur(6px);
  animation: spin 1s linear infinite;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    var(--c-gold-glow) 18deg,
    transparent 42deg,
    transparent 180deg,
    var(--c-gold-glow) 198deg,
    transparent 222deg,
    transparent 360deg
  );
  -webkit-mask-image: radial-gradient(circle, var(--c-bg-deep) 12%, var(--c-shade-lg) 40%, transparent 70%);
  mask-image: radial-gradient(circle, var(--c-bg-deep) 12%, var(--c-shade-lg) 40%, transparent 70%);
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.b2-art {
  opacity: 0.5;
  filter: grayscale(0.4);
}
.convoy {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  animation: convoy 1.6s linear forwards;
}
@keyframes convoy {
  from {
    transform: translateX(60vw);
  }
  to {
    transform: translateX(-90vw);
  }
}
.truck {
  margin-right: var(--space-3);
  animation: hop 0.18s ease-in-out infinite alternate;
}
.runner {
  animation: hop 0.25s ease-in-out infinite alternate;
}
.runner:nth-child(odd) {
  animation-delay: 0.12s;
}
@keyframes hop {
  to {
    transform: translateY(-10px);
  }
}
.new-card {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-6) var(--space-4);
  border-radius: var(--radius-xl);
  background: linear-gradient(var(--c-line-strong), var(--c-on-paper));
  border: 4px solid var(--c-gold);
  box-shadow: var(--shadow-drop-3);
  animation: cardIn 0.6s cubic-bezier(0.25, 1.6, 0.5, 1);
}
@keyframes cardIn {
  from {
    transform: scale(0.4) rotate(-6deg);
    opacity: 0;
  }
  70% {
    transform: scale(1.06) rotate(1deg);
  }
}
.new-card small {
  font-size: var(--font-sm);
  color: var(--c-text-2);
}
.confetti {
  position: absolute;
  inset: -40px 0 0;
  pointer-events: none;
  overflow: hidden;
}
.cf {
  position: absolute;
  left: var(--x);
  top: -20px;
  width: 10px;
  height: 14px;
  background: var(--c);
  border-radius: var(--radius-xs);
  animation: fall 1.8s cubic-bezier(0.2, 0.6, 0.4, 1) var(--d) forwards;
}
@keyframes fall {
  to {
    transform: translateY(380px) rotate(540deg);
    opacity: 0.2;
  }
}
.cere.calm .beams,
.cere.calm .convoy,
.cere.calm .truck,
.cere.calm .new-card {
  animation: none;
}
.cere-skip {
  position: absolute;
  right: var(--space-5);
  bottom: max(var(--space-5), env(safe-area-inset-bottom));
}
/* title menu: gear + sound in the corner, one column in the middle */
.menu {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: none;
  overflow: hidden;
  background: var(--c-ink);
}
.menu.on {
  display: block;
}
.menu.out {
  animation: menuOut 0.5s ease-in forwards;
}
@keyframes menuOut {
  to {
    opacity: 0;
    transform: scale(1.08);
  }
}
.menu-bg {
  position: absolute;
  inset: -4%;
  background: var(--c-surface-1) url(../assets/img/titlebg.jpg) center / cover;
  filter: saturate(1.1) blur(1.5px);
  animation: menuPan 26s ease-in-out infinite alternate;
}
@keyframes menuPan {
  from {
    transform: scale(1.06) translateX(-1.5%);
  }
  to {
    transform: scale(1.12) translateX(1.5%);
  }
}
.menu-shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 35%, var(--c-scrim-faint), var(--c-scrim-strong) 70%),
    linear-gradient(transparent 55%, var(--c-scrim-strong));
}
.menu-main {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, calc(3.5vh / var(--z)), 36px);
  padding: var(--space-5);
}
:where([data-layout='land']) .menu-main {
  flex-direction: row;
  gap: calc(5vw / var(--z));
}
.menu-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  animation: logoIn 0.8s cubic-bezier(0.25, 1.6, 0.5, 1) both;
}
@keyframes logoIn {
  0% {
    transform: scale(0.4) translateY(30px);
    opacity: 0;
  }
  60% {
    transform: scale(1.08);
    opacity: 1;
  }
  100% {
    transform: none;
  }
}
.menu-logo small {
  font-size: clamp(13px, calc(2vh / var(--z)), 20px);
  color: var(--c-primary-pale);
  letter-spacing: 2px;
  text-transform: uppercase;
}
.logo-glitch {
  position: relative;
  display: block;
  width: min(calc(86vw / var(--z)), 720px);
}
:where([data-layout='land']) .logo-glitch {
  width: min(calc(44vw / var(--z)), 420px);
}
.menu-logo-img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 8px 0 var(--c-shade-lg));
}
.menu.on .logo-glitch {
  animation: logoIn 0.8s cubic-bezier(0.25, 1.6, 0.5, 1) both;
}
.logo-glitch::before,
.logo-glitch::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url(../assets/img/logo-800.webp) center / 100% 100% no-repeat;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}
.logo-glitch::before {
  filter: drop-shadow(0 0 0 var(--cyan)) hue-rotate(160deg) saturate(2);
}
.logo-glitch::after {
  filter: hue-rotate(-40deg) saturate(2);
}
.menu.on .logo-glitch::before {
  animation: sliceA 0.42s steps(1) 0.85s 1;
}
.menu.on .logo-glitch::after {
  animation: sliceB 0.42s steps(1) 0.85s 1;
}
@keyframes sliceA {
  0% {
    opacity: 0.55;
    clip-path: inset(18% 0 62% 0);
    transform: translateX(-10px);
  }
  25% {
    clip-path: inset(55% 0 28% 0);
    transform: translateX(8px);
  }
  50% {
    clip-path: inset(32% 0 50% 0);
    transform: translateX(-6px);
  }
  75% {
    clip-path: inset(70% 0 12% 0);
    transform: translateX(5px);
  }
  100% {
    opacity: 0;
  }
}
@keyframes sliceB {
  0% {
    opacity: 0.5;
    clip-path: inset(62% 0 20% 0);
    transform: translateX(9px);
  }
  25% {
    clip-path: inset(8% 0 76% 0);
    transform: translateX(-7px);
  }
  50% {
    clip-path: inset(44% 0 38% 0);
    transform: translateX(6px);
  }
  75% {
    clip-path: inset(24% 0 60% 0);
    transform: translateX(-4px);
  }
  100% {
    opacity: 0;
  }
}
.menu-hud {
  position: absolute;
  z-index: 3;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  gap: var(--space-3);
}
.menu-col {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-4);
  width: min(360px, calc(100vw / var(--z) - 32px));
}
:where([data-layout='land']) .menu-col {
  width: min(320px, calc(44vw / var(--z)));
  gap: var(--space-3);
}
.menu-col > * {
  animation: btnIn 0.5s cubic-bezier(0.25, 1.5, 0.5, 1) both;
}
.menu-col > :nth-child(1) {
  animation-delay: 0.35s;
}
.menu-col > :nth-child(2) {
  animation-delay: 0.45s;
}
.menu-col > :nth-child(3) {
  animation-delay: 0.55s;
}
@keyframes btnIn {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}
.menu-col > .btn {
  width: 100%;
  flex-direction: column;
  gap: var(--space-1);
  white-space: normal;
  text-align: center;
}
.menu-col > .btn small {
  color: var(--c-on-primary);
  opacity: 0.85;
}
.menu-col > .btn.ghost small {
  color: var(--c-text-2);
}
.menu-sub {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-2);
}
.menu-sub .select,
.menu-sub .menu-intro {
  width: 100%;
  min-width: 0;
  padding: 0 var(--space-3);
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu-sub .lang-pick {
  position: relative;
}
.menu-sub .select-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + var(--space-3));
  z-index: 2;
  margin: 0;
}
.menu-cat {
  position: absolute;
  z-index: 1;
  right: max(16px, 4vw);
  bottom: max(14px, 3vh);
  animation: float 2.6s ease-in-out infinite;
  filter: drop-shadow(0 6px 0 var(--c-shade));
}
:where([data-h~='s'], [data-layout='phone'][data-h~='m'], [data-layout='tab'][data-h~='m']) .menu-cat {
  display: none;
}
/* intro comic */
.story {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--c-bg-deep) url(../assets/img/titlebg.jpg) center / cover;
}
.story::before {
  content: '';
  position: absolute;
  inset: 0;
  backdrop-filter: blur(14px) brightness(0.45);
  -webkit-backdrop-filter: blur(14px) brightness(0.45);
}
.story > * {
  position: relative;
}
.story.out {
  animation: menuOut 0.38s ease-in forwards;
}
.story-panel {
  width: min(94vw, calc((100vh - 170px) * 1.5), 1100px);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.story-art {
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: var(--radius-lg);
  border: 5px solid var(--c-text);
  box-shadow: var(--ring-ink), var(--shadow-drop-3);
  background: var(--c-surface-1) center / cover;
}
.story-panel.in .story-art {
  animation: panelIn 0.55s cubic-bezier(0.25, 1.45, 0.5, 1);
}
@keyframes panelIn {
  from {
    transform: scale(0.85) rotate(-2deg) translateY(20px);
    opacity: 0;
  }
}
.story-cap {
  align-self: center;
  max-width: 60ch;
  padding: 10px var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--c-text);
  color: var(--c-surface-1);
  border: 3px solid var(--c-ink);
  font-size: clamp(15px, calc(2.2vh / var(--z)), 20px);
  line-height: 1.3;
  text-align: center;
  box-shadow: var(--shadow-drop-2);
}
.story-panel.in .story-cap {
  animation: btnIn 0.45s 0.18s cubic-bezier(0.25, 1.5, 0.5, 1) both;
}
.story-foot {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.story-dots {
  display: flex;
  gap: var(--space-3);
}
.story-dots i {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--c-line);
}
.story-dots i.on {
  background: var(--pink);
}
.story-hint {
  font-size: var(--font-sm);
  color: var(--c-text-3);
}
.story-start {
  order: 9;
  min-width: 8em;
  font-size: var(--font-md);
} /* Start (last panel): the main button, after the ghost Skip */

/* phones and tablets held upright: the art takes ~half the screen, controls pinned to the bottom */
:where([data-layout='phone'], [data-layout='tab']) .story {
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: calc(var(--ctl-md) + var(--space-7));
}
:where([data-layout='phone'], [data-layout='tab']) .story-panel {
  width: min(98vw, 600px);
}
:where([data-layout='phone'], [data-layout='tab']) .story-art {
  max-height: 58vh;
} /* the whole 3:2 frame (never cropped square) */
:where([data-layout='phone'], [data-layout='tab']) .story-cap {
  min-height: 5.4em;
  display: flex;
  align-items: center;
  justify-content: center;
}
:where([data-layout='phone'], [data-layout='tab']) .story > .story-foot {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(16px, env(safe-area-inset-bottom));
  justify-content: center;
}
:where([data-layout='phone']) .story > .story-foot {
  padding: 0 var(--space-4);
  gap: var(--space-3);
} /* dots, hint and button inside the margins */
:where([data-layout='phone']) .story-hint {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  line-height: var(--lh-tight);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
:where([data-layout='phone']) .story-dots {
  flex: none;
  gap: var(--space-2);
}
.story-hint[hidden] {
  display: none;
}
:where([data-layout='land']) .story {
  flex-direction: row;
}
:where([data-layout='land']) .story-panel {
  flex-direction: row;
  align-items: center;
  width: min(96vw, 1100px);
}
:where([data-layout='land']) .story-art {
  width: auto;
  height: calc(100vh - 90px);
}
:where([data-layout='land']) .story-cap {
  max-width: 30ch;
}
:where([data-layout='land']) .story > .story-foot {
  position: absolute;
  bottom: 8px;
  right: 12px;
}
@media (min-aspect-ratio: 21/9) {
  :where([data-layout='desk']) .story-panel {
    width: min(calc((100vh - 200px) * 1.5), 1500px);
  }
}
/* loading screen */
#boot {
  position: fixed;
  inset: 0;
  z-index: var(--z-boot);
  display: grid;
  place-items: center;
  background: var(--c-ink);
  transition: opacity 0.45s ease;
}
#boot img {
  width: min(80vw, 900px);
  height: auto;
  animation: bootPulse 1.4s ease-in-out infinite;
}
@keyframes bootPulse {
  50% {
    transform: scale(1.03);
  }
}
#boot.out {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0s 0.3s;
}
#boot .boot-bar {
  position: absolute;
  left: 50%;
  bottom: 18%;
  width: min(60vw, 420px);
  height: 10px;
  translate: -50% 0;
  border-radius: var(--radius-pill);
  background: var(--c-surface-2);
  overflow: hidden;
}
#boot .boot-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--g-primary);
  border-radius: inherit;
  transition: width 0.2s;
}

/* ==== less motion: the state stays, the decoration goes ==== */
[data-motion='reduced'] *:not(.bought-tag, .reset.holding, .hand-i, .short-tip),
[data-motion='reduced'] *::before,
[data-motion='reduced'] *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}
[data-motion='reduced'] #ticker {
  transition: opacity 0.2s !important;
  transform: none !important;
}
[data-motion='reduced'] #ticker,
[data-motion='reduced'] #ticker .tk-ico,
[data-motion='reduced'] .logo-glitch,
[data-motion='reduced'] .logo-glitch::before,
[data-motion='reduced'] .logo-glitch::after {
  animation: none !important;
}
[data-motion='reduced'] .nav-ind,
[data-motion='reduced'] .woe,
[data-motion='reduced'] .plate.bump,
[data-motion='reduced'] .lvl-btn.bump,
[data-motion='reduced'] .shop-card.bought,
[data-motion='reduced'] .hint-glow,
[data-motion='reduced'] .tut-glow,
[data-motion='reduced'] .node.now .node-art::before {
  animation: none;
}

[data-motion='reduced'] .shop-card .bought-tag {
  animation-name: boughtCalm;
} /* R1: the purchase seal stays 1.4 s (state), without the jump; R2: the Restart fill keeps its real 2 s */
@media (prefers-reduced-motion: reduce) {
  .node.now .node-art::before {
    animation: none;
  }
}

/* ---------- what the new rules show (previews, room bonus, veterans, gold star, hideout rule, mission swap) ---------- */
.tag.pv {
  height: auto;
  min-height: 20px;
  font-weight: 800;
}
.tag.pv.up {
  background: var(--c-primary-mid);
  color: var(--c-text);
}
.tag.pv.down {
  background: var(--c-surface-2);
  color: var(--c-danger-soft);
}
.vet-stars {
  display: inline-flex;
  gap: 0;
  flex: none;
}
.cm-duo,
.duo-line {
  display: block;
  font-size: var(--font-xs);
  color: var(--c-accent-hi);
  font-weight: 700;
}
.duo-line {
  color: var(--c-text-3);
  font-weight: 600;
}
.d-grid .duo-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: var(--space-2);
  align-items: center;
}
.duo-row .duo-line {
  grid-column: 2;
} /* icon + name on one line, the line under the name */
.bonus-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
}
.bonus-card > b {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: help;
}
/* one bonus per row: icon | name (who, small) | [Go] | value on the right */
.bn-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.bn-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--c-line);
}
.bn-row:first-child {
  border-top: 0;
}
.bn-name {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-size: var(--font-sm);
  font-weight: 700;
  line-height: var(--lh-tight);
}
.bn-name small {
  font-size: var(--font-xs);
  color: var(--c-text-2);
  font-weight: 600;
}
.bn-val {
  flex: none;
  font-size: var(--font-sm);
  color: var(--c-accent-hi);
  white-space: nowrap;
}
.bn-row.can .bn-val {
  color: var(--c-text-3);
}
.bn-row .btn.mini {
  flex: none;
  min-width: calc(var(--ctl-md) * 1.6);
  padding-inline: var(--space-4);
  white-space: nowrap;
} /* "Go" is a button, not a thin vertical pill */
.bn-h {
  font-size: var(--font-xs);
  color: var(--c-gold-hi);
  font-weight: 700;
}
.buyall-row {
  margin: var(--space-2) 0;
}
.buyall-row .sub {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
}
.buyall-row .sub.bi-list {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--space-3);
  row-gap: var(--space-1);
}
.buyall-row .sub .bi {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  white-space: nowrap;
}
.rule-seal {
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-2) 0;
  cursor: help;
  border-color: var(--c-gold-dark);
}
.rule-seal > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: var(--lh-tight);
}
.rule-seal small {
  font-size: var(--font-xs);
  color: var(--c-text-3);
}
.rule-seal b {
  color: var(--c-gold-hi);
  font-size: var(--font-md);
}
.rule-seal .rule-line {
  font-size: var(--font-xs);
  color: var(--c-text-2);
  font-weight: 700;
}
.side .rule-seal {
  margin: 0;
}
.ui-ico.gold-star {
  filter: drop-shadow(0 0 2px var(--c-gold-glow)) saturate(1.4);
}
.ico .gold-star,
.node-stars .gold-star:not(:first-child) {
  margin-left: var(--space-1);
}
.steps li.gold {
  border-style: dashed;
  border-color: var(--c-gold-dark);
}
.steps li.gold.ok {
  border-style: solid;
  border-color: var(--c-gold);
}
.gold-tag {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-xs);
  color: var(--c-gold-hi);
  font-weight: 800;
}
.mis-swap {
  align-self: flex-start;
  min-height: var(--ctl-sm);
  font-size: var(--font-xs);
}
.mis-free {
  color: var(--c-text-3);
  font-size: var(--font-xs);
}
.mv-line {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
  font-size: var(--font-xs);
  color: var(--c-success);
  font-weight: 700;
}
.mv-line.stay {
  color: var(--c-text-3);
}
.mc-lines {
  margin: var(--space-2) 0;
  align-items: baseline;
} /* label and text start on the same line (a 2-line text no longer drags its label/icon down) */
.mc-lines > span .ui-ico {
  vertical-align: -3px;
}
.mc-loss {
  font-size: var(--font-sm);
  color: var(--c-danger-soft);
  font-weight: 700;
  margin: 0 0 var(--space-2);
}
.mc-last {
  max-width: none;
  margin-top: var(--space-2);
}
.tnode .need small {
  display: block;
  font-size: var(--font-xs);
}
.mv-pv {
  display: block;
  font-size: var(--font-xs);
  font-style: normal;
}
.mv-pv.up {
  color: var(--c-success);
}
.mv-pv.down {
  color: var(--c-danger-soft);
}

/* recruitment line on the Recruit card, room quip on the Expansion card, closing card text, glossary legend */
.rc-quote {
  font-size: var(--font-xs);
  color: var(--c-text-2);
  font-style: italic;
}
.cm-quip {
  display: block;
  font-size: var(--font-xs);
  color: var(--c-text-3);
  font-style: italic;
  margin-top: var(--space-1);
}
.fin-text {
  font-size: var(--font-sm);
  color: var(--c-text-2);
  margin: 0 0 var(--space-2);
}
.fin-sign {
  font-size: var(--font-xs);
  color: var(--c-text-3);
  font-style: italic;
  margin: 0 0 var(--space-4);
}
.legend [data-term] {
  cursor: help;
}
.node-lab.nostars .node-stars {
  display: none;
} /* crowded small map: the name stays, the stars go (the side card shows them) */
/* narrow phones (320-380): an upgrade card puts its buy button on its own row, so the name and line get the width (no "Energétic/o") */
:where([data-layout='phone'][data-size~='n']) .card.up {
  grid-template-columns: auto minmax(0, 1fr);
}
:where([data-layout='phone'][data-size~='n']) .card.up .cm-buy {
  grid-column: 1 / -1;
}
:where([data-layout='phone'][data-size~='n']) .card.up .cm-buy .btn {
  width: 100%;
  flex-direction: row;
  justify-content: center;
  gap: var(--space-2);
}
:where([data-layout='phone'][data-size~='n']) .buyall-row {
  flex-direction: column;
  flex-wrap: nowrap;
  flex-shrink: 0;
  align-items: stretch;
} /* nowrap + no shrink: the scrolling panel squeezed the row and the column wrapped beside itself (button cut at 320) */ /* the summary keeps one line above the button (no "·" hanging at line ends) */
:where([data-layout='phone'][data-size~='n']) .shop-card {
  grid-template-columns: 56px minmax(0, 1fr);
} /* narrow phones: names keep their width ("Engradado de Energético" no longer 3 lines) */
:where([data-layout='phone'][data-size~='n']) .shop-card > :is(.btn, .maxed) {
  grid-column: 1 / -1;
  justify-self: stretch;
}
:where([data-layout='phone'][data-size~='n']) .shop-card > .btn.price {
  flex-direction: row;
  justify-content: center;
  gap: var(--space-2);
}
/* 21:9 / 32:9 panels: the card lists take the panel's height (rows grow, capped), recruits in 2 columns, instead of a short strip over an empty band */
@media (min-aspect-ratio: 21/9) {
  :where([data-layout='desk']) .sheet-body > :is(.rows, .rcards, .mis-list, .cards) {
    flex-grow: 1;
    align-content: stretch;
  }
  :where([data-layout='desk']) .sheet-body > :is(.rows, .rcards, .mis-list, .cards) > * {
    max-height: 320px;
  }
  :where([data-layout='desk']) .sheet-body > .rcards > * {
    flex-basis: calc(50% - var(--space-3));
  }
  :where([data-layout='desk']) .sheet-body > .rcards .rc > .card-art {
    transform: scale(1.4);
    margin: 0 var(--space-5);
  } /* the bigger card carries a bigger portrait (1.4, it stays inside its card) */
  :where([data-layout='desk']) .sheet-body > .rcards .rc-info {
    font-size: var(--font-md);
    gap: var(--space-2);
  }
}
/* sideways phone: recruits two per row, so more than one shows under the filters */
:where([data-layout='land']:not([data-size~='ln'])) .sheet-body .rcards {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: stretch;
}
:where([data-layout='land']:not([data-size~='ln'])) .sheet-body .rcards > * {
  flex: 1 1 300px;
  min-width: 0;
}
.more-below {
  -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 44px), transparent);
  mask-image: linear-gradient(to bottom, black calc(100% - 44px), transparent);
} /* more content below (set by ui.js moreBelow) */
.tut-sub {
  display: block;
  font-size: var(--font-xs);
  color: var(--c-text-2);
} /* "collect N" under the lesson it is for */
:where([data-layout='desk'], [data-layout='tab']) .bal-fix > :not(.detail) {
  flex-grow: 0;
} /* a short grid keeps the panel's column width instead of stretching its cards */
:where([data-layout='desk'], [data-layout='tab']) .bal-tail {
  justify-content: center;
}
:where([data-layout='desk'], [data-layout='tab']) .bal-tail > :not(.detail) {
  flex-grow: 0;
}
/* story chapter title, Syndicate Files gallery, event prize in the toast */
.story-title {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--space-4);
  z-index: 1;
  text-align: center;
  font-size: var(--font-lg);
  color: var(--c-text);
  -webkit-text-stroke: 4px var(--ink);
  paint-order: stroke fill;
  pointer-events: none;
}
.gal-open {
  align-self: stretch;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.window.gallery {
  width: min(760px, 100%);
}
.gal-sub {
  color: var(--c-text-3);
  font-size: var(--font-sm);
  margin: 0 0 var(--space-3);
}
.gal-body {
  overflow-y: auto;
  max-height: calc(100dvh / var(--z) - 160px);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.gal-h {
  font-size: var(--font-md);
  color: var(--c-gold);
  margin: var(--space-3) 0 var(--space-1);
}
.gal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--space-3);
}
.gal-ch {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2);
  text-align: left;
  cursor: pointer;
}
.gal-files {
  margin-top: var(--space-4);
}
.gal-ch small {
  font-size: var(--font-xs);
  color: var(--c-text-2);
  line-height: var(--lh-tight);
}
.gal-thumbs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-1);
}
.gal-thumbs img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--c-well);
}
.gal-ch.is-locked {
  cursor: default;
}
.gal-ch.is-locked img {
  filter: grayscale(1) brightness(0.22) contrast(1.6) blur(1px);
} /* a silhouette of the panel, not the panel */
.gal-q-lock {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: var(--c-well);
  display: grid;
  place-items: center;
  opacity: 0.8;
} /* a file panel not earned yet: sealed like a locked chapter, never a black square */
.gal-lock {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.ev-prize {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--c-gold);
  white-space: nowrap;
}
/* End of css/screens.css */
