/* Хуяул screens. Tokens and shared components (buttons, chips, cards, tabs, toasts…) live in
   webapp/style/tokens.css; this file is the layout of the map, plot, sheets and overlays. */
html, body { height: 100%; overflow: hidden; }

#globe { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; background: var(--night-0); z-index: 1; }
#globeLabels { position: fixed; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
/* moved every frame by the globe: never eased (the reduced-motion rule would make each move a 1-ms transition from the last spot) */
#globeLabels * { transition: none !important; }
.ml { position: absolute; left: 0; top: 0; transform-origin: 0 0; white-space: nowrap; font-family: var(--font-display); font-weight: 400;
  color: var(--bone-2); line-height: 1; will-change: transform;
  /* a hard 1-px ink outline and a 2-px drop: pixel lettering, no blur */
  text-shadow: -1px -1px 0 var(--ink-0), 1px -1px 0 var(--ink-0), -1px 1px 0 var(--ink-0), 1px 1px 0 var(--ink-0), 0 2px 0 var(--ink-0), 2px 0 0 var(--ink-0), -2px 0 0 var(--ink-0); }
.ml.r1 { font-size: 19px; } .ml.r2 { font-size: 16px; } .ml.r3 { font-size: 14px; }
.ml.r4 { font-size: 13px; } .ml.r5 { font-size: 12px; } .ml.r6 { font-size: 12px; }
.ml.k-sea, .ml.k-lake { color: var(--water-5); letter-spacing: .04em; }
.ml.k-sea.r1 { color: var(--gold-3); letter-spacing: .06em; }
.ml.k-mountains { color: var(--wood-4); text-transform: uppercase; letter-spacing: .14em; }
.ml.k-peak { color: var(--bone-2); }
.ml.k-desert, .ml.k-plain, .ml.k-plateau, .ml.k-basin, .ml.k-lowland, .ml.k-region, .ml.k-valley, .ml.k-delta, .ml.k-peninsula {
  color: var(--bone-1); text-transform: uppercase; letter-spacing: .22em; }
.ml.k-island { color: var(--bone-2); }
.ml.k-wasteland { color: var(--rad-3); text-transform: uppercase; letter-spacing: .16em; }
.mlrivers { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.mlrivers text { font-family: var(--font-display); font-weight: 400; fill: var(--water-4); stroke: var(--ink-0); stroke-width: 3px;
  paint-order: stroke; stroke-linejoin: miter; letter-spacing: .08em; }
.mlrivers text.r1, .mlrivers text.r2 { font-size: 14px; } .mlrivers text.r3 { font-size: 12.5px; }
.mlrivers text.r4, .mlrivers text.r5, .mlrivers text.r6 { font-size: 12px; }
.glabel { position: absolute; left: 0; top: 0; white-space: nowrap; font: 700 12px/1 var(--font-ui); color: var(--bone-2);
  text-shadow: -1px -1px 0 var(--ink-0), 1px -1px 0 var(--ink-0), -1px 1px 0 var(--ink-0), 1px 1px 0 var(--ink-0), 0 2px 0 var(--ink-0); will-change: transform; }
.glabel.sea { font-weight: 600; color: var(--water-5); font-size: 12px; }
.glabel.sea.big { font-weight: 800; color: var(--gold-3); font-size: 14px; letter-spacing: .03em; }
.glabel.claim.own { color: var(--gold-3); font-size: 13px; }
.glabel.claim.asleep { color: var(--mist-2); }
.glabel.claim.ruins { color: var(--stone-4); font-style: italic; }
.glabel.sky { color: var(--gold-3); font-size: 14px; font-family: var(--font-display); font-weight: 400; }
/* v12: an NPC caravan on the globe: a 44-px tap target, the sprite standing on the point */
.cvmark { position: absolute; left: 0; top: 0; width: 44px; height: 44px; margin: -40px 0 0 -22px; padding: 0; border: 0; background: transparent no-repeat 50% 100%;
  background-size: var(--w) var(--h); image-rendering: pixelated; pointer-events: auto; cursor: pointer; }
.cvmark.robbed { opacity: .6; }
.cvmark.pip { background-image: none !important; margin: -22px 0 0 -22px; }
.cvmark.pip::after { content: ''; position: absolute; left: 19px; top: 19px; width: 6px; height: 6px; background: var(--sand-2); box-shadow: 0 0 0 2px var(--ink-0); }
/* v6: a free city on the globe: the sprite stands on the point (size and margins set by globe.js) */
.cymark { position: absolute; left: 0; top: 0; padding: 0; border: 0; background: transparent no-repeat 50% 100%; image-rendering: pixelated;
  pointer-events: auto; cursor: pointer; }
.cymark .cyev { position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 16px; height: 16px; background: var(--ink-1);
  box-shadow: 0 0 0 2px var(--ink-0), inset 0 -2px 0 var(--ink-0); }
.cymark .cyev.m-fire, .cymark .cyev.m-siege { background: var(--ochre-1); }
.cymark .cyev.m-fair, .cymark .cyev.m-festival { background: var(--gold-0); }
.cymark .cyev.m-plague, .cymark .cyev.m-radstorm { background: var(--rad-1); }
.cymark .cyev.m-flood { background: var(--water-1); }
.cymark .cyev.m-strike { background: var(--berry-1); }
.glabel.cyname { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; color: var(--bone-2); }
.glabel.cyname b { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; }
.glabel.cyname .st { display: none; font-size: 12px; font-weight: 600; color: var(--bone-1); }
.glabel.cyname.near .st { display: block; }
.glabel.nation { display: inline-flex; align-items: center; gap: 4px; font: 400 14px/1 var(--font-display); letter-spacing: .06em; color: var(--bone-1); }
.glabel.nation.ev { color: var(--gold-3); }
.glabel.qmark { display: inline-flex; align-items: center; gap: 4px; color: var(--gold-3); font-size: 12px; padding: 2px 4px; background: var(--ink-0); box-shadow: 0 0 0 1px var(--gold-2); }
.glabel.trip { color: var(--gold-3); font-size: 12px; display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.glabel.dep { color: var(--bone-2); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
#worldbar { position: fixed; left: 12px; bottom: calc(16px + var(--safe-bottom)); z-index: 4; display: flex; gap: 8px; }
#toCamp { background: var(--ochre-1); box-shadow: var(--frame), var(--drop), inset 0 -4px 0 var(--ochre-0); min-height: 44px; }
#citiesBtn { min-height: 44px; position: relative; }
#citiesBtn.alert::after { content: ''; position: absolute; right: -4px; top: -4px; width: 12px; height: 12px; background: var(--gold-2); box-shadow: 0 0 0 2px var(--ink-0); }
body[data-view="plot"] #worldbar { display: none; }
#roadBtn { min-height: 44px; }
#roadBtn.on { background: var(--steppe-1); color: var(--ink-0); box-shadow: var(--frame), var(--drop), inset 0 -4px 0 var(--steppe-0); }
body:has(#roadbar:not([hidden])) #roadBtn, body:has(#ghostbar:not([hidden])) #roadBtn { display: none; }
#roadbar { position: fixed; left: 8px; right: 8px; bottom: calc(10px + var(--safe-bottom)); z-index: 12; display: flex; gap: 12px;
  align-items: center; padding: 12px 12px; background: var(--bg); color: var(--text); box-shadow: var(--frame), var(--drop); max-width: 640px; margin: 0 auto; }
#roadbar .name { font-weight: 800; }
/* two or more settlements: the switcher needs the room, the stock button keeps only its basket */
@media (max-width: 460px) {
  body.multi #stockBtn .lbl { display: none; }
  body.multi #stockBtn { padding: 0 8px; }
  body.multi .chief { display: none; }
}
#roadbar .small { font-size: 12.5px; }
body:has(#roadbar:not([hidden])) #hud { bottom: calc(96px + var(--safe-bottom)); }
.chip.settle { max-width: 34vw; padding: 0 8px; gap: 4px; background: var(--green-1); box-shadow: var(--frame), var(--drop), inset 0 -4px 0 var(--green-0); font-size: 13px; }
.chip.settle .sname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.settle .caret { opacity: .7; }
.card.settle { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.card.settle.on { box-shadow: var(--frame), inset 0 0 0 2px var(--link); }
#map { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; background: var(--night-2); }

/* ---------------------------------------------------------------- top bar */
#bar { position: fixed; top: 0; left: 0; right: 0; z-index: 5; display: flex; gap: 8px; align-items: center;
  padding: calc(8px + var(--safe-top)) 12px 8px; background: var(--bar);
  color: var(--bone-2); pointer-events: none; }
/* the bar fades into the map through a 2-px checker dither, not a soft gradient */
#bar::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 8px; --dc: rgba(20, 12, 28, 0.86); background: var(--dither-50); pointer-events: none; }
#bar > * { pointer-events: auto; }
/* every control in the bar is 44 high; the switch's buttons fill it (no inner padding) */
#bar .chip, #bar .seg { height: var(--btn-h); min-height: var(--btn-h); margin: 0; }
#bar .seg button { min-height: 0; height: 100%; }
.chief { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12px; white-space: nowrap; overflow: hidden; }
.chief .meals { display: inline-flex; gap: 4px; align-items: center; }
.chief .hungry { color: var(--ochre-4); font-weight: 700; }
.chief .cs { color: var(--mist-1); overflow: hidden; text-overflow: ellipsis; display: inline-flex; }

/* ---------------------------------------------------------------- hud */
/* the zoom stack and the plot's tool row stand on one bottom line, 12 px from the edges, all 44×44 */
#hud { position: fixed; right: 12px; bottom: calc(16px + var(--safe-bottom)); z-index: 4; display: flex; flex-direction: column; gap: 8px; }
#hud .round { margin: 0; }

/* ---------------------------------------------------------------- toasts */
#toasts { position: fixed; top: calc(62px + var(--safe-top)); left: 0; right: 0; z-index: 30; display: flex; flex-direction: column;
  align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast .arr { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* over a sheet or the build bar: docked right above it, one line each, never over its header or buttons */
#toasts.docked { overflow: hidden; justify-content: flex-end; padding: 4px 12px; } /* room for the frames */
#toasts.docked .toast { max-width: calc(100vw - 24px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#toasts.docked .toast .arr { flex-wrap: nowrap; }
/* not even one line of room (a tall sheet on a short phone): out of the way until the sheet goes */
#toasts.docked.cramped { visibility: hidden; }

/* ---------------------------------------------------------------- ghost bar */
#ghostbar { position: fixed; left: 8px; right: 8px; bottom: calc(10px + var(--safe-bottom)); z-index: 12; display: flex; gap: 12px;
  align-items: center; padding: 12px; background: var(--bg); color: var(--text); box-shadow: var(--frame), var(--drop); max-width: 640px; margin: 0 auto; }
#ghostbar { flex-wrap: wrap; }
#ghostbar .grow { min-width: calc(100% - 60px); }
#ghostbar .btn { flex: 1; }
#ghostbar .name { font-weight: 700; }
#ghostbar .small { font-size: 12.5px; }
body:has(#ghostbar:not([hidden])) #hud { bottom: calc(150px + var(--safe-bottom)); }

/* ---------------------------------------------------------------- sheet */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; max-height: 66vh; max-height: 66dvh; display: flex; flex-direction: column;
  transform: translateY(105%); transition: transform .22s steps(6);
  max-width: 680px; margin: 0 auto; padding-bottom: var(--safe-bottom); }
.sheet.up { transform: translateY(0); }
.sheet.drag { transition: none; }
.grab { display: flex; justify-content: center; padding: 8px 0 4px; touch-action: none; }
.sheet-head { display: flex; align-items: flex-start; gap: 8px; padding: 4px var(--sheet-pad) 8px; touch-action: none; }
.sheet-titles { flex: 1; min-width: 0; }
.sheet-title { margin: 0; display: flex; align-items: center; gap: 8px; }
.sheet-sub { color: var(--hint); font-size: 13px; margin-top: 0; }
.sheet-close { width: 44px; height: 44px; margin: -8px -8px 0 0; border: 0; background: none; display: grid; place-items: center; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--sheet-pad) 20px; -webkit-overflow-scrolling: touch; }

/* ---------------------------------------------------------------- content */
.note.fog { background: var(--night-4); color: var(--mist-2); box-shadow: var(--frame), inset 4px 0 0 0 var(--mist-0); }
.card.trip .name { font-size: 15px; }
.does { margin: 0 0 8px; font-size: 14px; }

.sheet-body > .btn { width: calc(100% - 4px); margin-top: 8px; }
body.busy .btn.primary { opacity: .6; pointer-events: none; }

.card.build { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }

.card.build .thumb { width: 64px; height: 64px; flex: none; display: flex; align-items: center; justify-content: center;
  background: var(--ink-1); box-shadow: var(--frame); }
.grow { flex: 1; min-width: 0; }
.line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 4px 0; }
.line.flow { gap: 8px; }
.arrow { display: inline-flex; }
.why { font-size: 12.5px; margin-top: 4px; }
.why.ok { color: var(--good); }
.why.r1, .why.r2 { color: var(--bad); }
.why.r3 { color: var(--hint); }
.toast .mat { background: rgba(20, 12, 28, 0.3); }
.toast .mat.out b { color: var(--green-6); }
.row-end { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 8px; }
.row-end > span:first-child { flex: 1; } /* the reason or the hint takes the room; buttons pack to the right */
.row-end .why { flex: 1; margin: 0; }
.card.job { display: flex; gap: 12px; align-items: center; }
.card.worker { display: flex; gap: 12px; align-items: center; }
.card.worker.dim { opacity: .65; }
.card.res.done { box-shadow: var(--frame), inset 0 0 0 2px color-mix(in srgb, var(--good) 60%, transparent); }
.card.res.done .name { color: var(--good); }
.card.res.running { box-shadow: var(--frame), inset 0 0 0 2px var(--berry-3); }
.card.res.locked { opacity: .5; }
.card.res.open { box-shadow: var(--frame), inset 0 0 0 2px color-mix(in srgb, var(--link) 60%, transparent); }

.wchips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 4px 8px; scrollbar-width: none; touch-action: pan-x;
  overscroll-behavior-x: contain; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scroll-padding: 0 2px; }
.wchips::-webkit-scrollbar { display: none; }
.wchip { scroll-snap-align: start; }
.sec.row-sec { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sec.row-sec .btn.all { margin: 0 0; min-height: var(--tap); font-size: 13px; text-transform: none; letter-spacing: .02em; }
/* every worker on one screen */
.seg.wide { width: calc(100% - 4px); }
.seg.wide button { flex: 1; min-width: 0; padding: 0 4px; font-size: 14px; }
.breeds { display: flex; gap: 4px; overflow-x: auto; padding: 8px 4px; scrollbar-width: none; touch-action: pan-x; }
.bchip { flex: none; width: 44px; height: 44px; border: 0; background: var(--card); box-shadow: var(--frame); margin: 0; display: grid; place-items: center; }
.bchip.on { box-shadow: var(--frame), inset 0 0 0 2px var(--link); }
.wgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.wcell { min-height: 56px; display: grid; grid-template-columns: 28px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center;
  text-align: left; padding: 8px; border: 0; background: var(--card); box-shadow: var(--frame); margin: 0; }
.wcell img { grid-row: span 2; }
.wcell .wn { font: 400 14px/1.1 var(--font-display); }
.wcell .ws { font-size: 12px; color: var(--hint); line-height: 1.2; }
.wcell.on { box-shadow: var(--frame), inset 0 0 0 2px var(--link); }
.wcell.dim { opacity: .55; }
/* provisions on a trip card */
.prov { margin: 8px 0 0; padding: 8px 8px; background: rgba(20, 12, 28, .3); box-shadow: 0 0 0 1px var(--line); display: grid; gap: 4px; }
.prov .line { margin: 0; }
.pipbar { display: inline-flex; gap: 4px; margin: 0 4px; }
.pipbar i { width: 6px; height: 10px; background: var(--ink-1); box-shadow: 0 0 0 1px var(--ink); }
.pipbar i.on { background: var(--gold-2); }
.pipbar i.on.extra { background: var(--green-4); }
.pipbar i.need { background: var(--ochre-1); }
/* the strip scrolls (so it clips): room for the ±buttons' bigger hit areas, given back by the margin */
.foods { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; touch-action: pan-x; padding: 8px 8px; margin: -4px -4px; }
.food { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 4px; background: var(--card); box-shadow: var(--frame); }
.food.on { box-shadow: var(--frame), inset 0 0 0 2px var(--gold-1); }
.food b { min-width: 16px; text-align: center; font-size: 13px; }
/* ± a thumb can hit: 44×44 to the finger, a 32×32 square to the eye (and to the layout) */
.fb { position: relative; isolation: isolate; width: 44px; height: 44px; margin: -8px; border: 0; background: none; display: grid; place-items: center; }
.fb::before { content: ""; position: absolute; inset: 6px; z-index: -1; background: var(--ink-1); box-shadow: var(--bevel); }
.wchip { flex: none; min-height: 52px; width: 132px; display: grid; grid-template-columns: 32px 1fr; grid-template-rows: auto auto;
  column-gap: 4px; align-items: center; text-align: left; padding: 4px 8px; border: 0; background: var(--card); box-shadow: var(--frame); margin: 0; }
.wchip img { grid-row: span 2; }
.wchip .wn { font: 400 14px/1.1 var(--font-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wchip .ws { font-size: 12px; color: var(--hint); line-height: 1.15; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.wchip.on { box-shadow: var(--frame), inset 0 0 0 2px var(--link); }
.wchip.dim { opacity: .5; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.cell { position: relative; min-height: 84px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 8px 4px; border: 0; background: var(--card); box-shadow: var(--frame); margin: 0; }
.cell.zero { opacity: .38; }
.cell.on { box-shadow: var(--frame), inset 0 0 0 2px var(--link); }
.cell .q { font-weight: 800; font-size: 14px; }
.cell .q small { color: var(--hint); font-weight: 500; font-size: 12px; }
.cell .q.full { color: var(--warn); }
.cell .n { font-size: 12px; color: var(--hint); text-align: center; line-height: 1.1; }
.card.info .name { gap: 8px; }

/* ---------------------------------------------------------------- views */
body[data-view="world"] #chief { visibility: visible; }

/* ---------------------------------------------------------------- splash */
#splash { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: var(--night-2); color: var(--bone-2); transition: opacity .45s steps(4); }
#splash.gone { opacity: 0; pointer-events: none; }
#splash .title { font: 400 40px/1 var(--font-display); letter-spacing: .04em; color: var(--gold-2); text-shadow: 4px 4px 0 var(--ochre-1); }
#splash .say { color: var(--mist-1); }
#splash.fail .say { color: var(--ochre-4); max-width: 80%; text-align: center; }
#splash .huyak { width: 56px; height: 48px; image-rendering: pixelated; animation: hop .5s steps(2) infinite;
  background:
    linear-gradient(#140c1c,#140c1c) 16px 8px / 8px 8px no-repeat,
    linear-gradient(#f0aa9c,#f0aa9c) 8px 0 / 24px 8px no-repeat,
    linear-gradient(#f0aa9c,#f0aa9c) 0 8px / 48px 24px no-repeat,
    linear-gradient(#d27b78,#d27b78) 8px 32px / 8px 8px no-repeat,
    linear-gradient(#d27b78,#d27b78) 24px 32px / 8px 8px no-repeat,
    linear-gradient(#d27b78,#d27b78) 40px 32px / 8px 8px no-repeat; }
@keyframes hop { 50% { transform: translateY(-6px); } }
/* the boot's steps on a pixel bar (js/loader.js): 24 whole cells, a saying under it, a slow-network word */
#splash .bar, .curtain .bar { width: min(240px, 64vw); height: 12px; background: var(--ink-1); box-shadow: var(--frame); position: relative; }
#splash .bar i, .curtain .bar i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--gold-2);
  box-shadow: inset 0 -4px 0 0 var(--gold-1), inset 0 2px 0 0 var(--gold-3); transition: width .2s steps(3); }
#splash .tip { max-width: min(320px, 84vw); text-align: center; color: var(--mist-0); font-size: var(--fs-s); min-height: 2.6em; }
#splash .slow { color: var(--warn); font-size: var(--fs-s); }
#splash.fail .bar, #splash.fail .huyak { filter: grayscale(1); animation: none; }
#splash .retry { margin-top: 8px; min-width: 160px; }
/* a sheet waiting on the server */
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 24px 8px; color: var(--hint); font-size: var(--fs-s); }
.loading .dots { display: inline-flex; gap: 4px; }
.loading .dots i { width: 6px; height: 6px; background: var(--gold-2); animation: dot 0.9s steps(2) infinite; }
.loading .dots i:nth-child(2) { animation-delay: .15s; }
.loading .dots i:nth-child(3) { animation-delay: .3s; }
.loading.failed { flex-direction: column; color: var(--bad); text-align: center; }
@keyframes dot { 50% { transform: translateY(-4px); background: var(--gold-3); } }
/* long work in the page over everything (a grown hex, a big bake) */
.curtain { position: fixed; inset: 0; z-index: 45; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: color-mix(in srgb, var(--night-2) 88%, transparent); color: var(--mist-1); opacity: 0; transition: opacity .25s steps(3); }
.curtain.up { opacity: 1; }
.curtain .huyak { width: 56px; height: 48px; image-rendering: pixelated; animation: hop .5s steps(2) infinite;
  background:
    linear-gradient(#140c1c,#140c1c) 16px 8px / 8px 8px no-repeat,
    linear-gradient(#f0aa9c,#f0aa9c) 8px 0 / 24px 8px no-repeat,
    linear-gradient(#f0aa9c,#f0aa9c) 0 8px / 48px 24px no-repeat,
    linear-gradient(#d27b78,#d27b78) 8px 32px / 8px 8px no-repeat,
    linear-gradient(#d27b78,#d27b78) 24px 32px / 8px 8px no-repeat,
    linear-gradient(#d27b78,#d27b78) 40px 32px / 8px 8px no-repeat; }
@media (prefers-reduced-motion: reduce) { #splash .huyak, .curtain .huyak, .loading .dots i { animation: none; } }

/* ---------------------------------------------------------------- ?sheet=1 review */
body.sheetpage { overflow: auto; background: var(--night-4); }
body.sheetpage #bar, body.sheetpage #hud, body.sheetpage #map { display: none; }
.review { padding: 16px; }
.rgrid { display: flex; flex-wrap: wrap; gap: 12px; }
.rgrid figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--bone-1); }
.tiles4 { display: grid; grid-template-columns: repeat(2, 48px); }

@media (min-width: 700px) {
  .sheet { bottom: 12px; box-shadow: var(--frame), var(--drop); }
}
/* The bar must fit a 360px phone with every button: the camp name gives way first. */
.chip.settle { flex: 0 1 auto; min-width: 0; }
/* Terra Gentium: no Хуяка, no хуяк on the splash (index.html sets .tone-clean). */
.tone-clean #huyaBtn, .tone-clean #splash .huyak { display: none !important; }
#huyaBtn { flex: 0 0 auto; padding: 0 12px; min-width: 44px; justify-content: center; text-decoration: none; }
@media (max-width: 400px) { #bar { gap: 8px; } .chip.settle { max-width: 26vw; } }

/* top bar: «Озарения» */
.chip.insight { background: var(--berry-1); padding: 0 8px; }

/* ---------------------------------------------------------------- tree of discoveries */
#tree { position: fixed; inset: 0; z-index: 40; background: var(--night-1); display: flex; flex-direction: column; }
#tree .tree-head { display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-top)) 12px 8px; background: var(--bar); }
#tree .tree-head h2 { flex: 1; margin: 0; font: 400 22px/1 var(--font-display); color: var(--gold-2); letter-spacing: .03em; }
#tree .tree-close, #tree .tree-center { width: var(--tap); height: var(--tap); border: 0; background: var(--card); box-shadow: var(--frame), var(--bevel); display: grid; place-items: center; margin: 0; }
#tree .tree-find { display: flex; gap: 8px; align-items: center; padding: 4px 12px 8px; background: var(--bar); }
#tree .tree-search { flex: 1; min-height: var(--tap); border: 0; background: var(--night-2); color: var(--text); padding: 0 12px; font: 15px var(--font-ui); box-shadow: var(--frame); margin: 0; }
#tree .tree-found { min-width: 28px; color: var(--water-4); font-weight: 700; }
#tree canvas { flex: 1; width: 100%; min-height: 0; touch-action: none; display: block; }
#tree .tree-card { position: absolute; left: 8px; right: 8px; bottom: calc(10px + var(--safe-bottom)); max-width: 560px; margin: 0 auto;
  max-height: 46vh; overflow-y: auto; background: var(--bg); padding: 4px 8px; box-shadow: var(--frame), var(--drop); }
.wearleft { color: var(--hint); font-size: 12px; }
/* a peak's name gets a pixel triangle (7×5), not a ▲ glyph */
.ml.k-peak::before { content: ''; display: inline-block; width: 7px; height: 5px; margin: 0 4px 0 0; vertical-align: middle;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='5' shape-rendering='crispEdges'%3E%3Cpath d='M3 0h1v1h1v1h1v1h1v2H0V3h1V2h1V1h1z' fill='%23f3e9d2'/%3E%3C/svg%3E") no-repeat; }
/* the chief's meals in the top bar: gold pips, not icons shrunk to a fraction */
.chief .meal { display: inline-block; width: 6px; height: 8px; background: var(--gold-2); box-shadow: 0 0 0 1px var(--ink); margin: 0 0; }
body.tree-open #bar, body.tree-open #hud { visibility: hidden; }
/* a narrow phone: the settlement switcher keeps its camp icon, the name moves to the sheet */
@media (max-width: 460px) { .chip.settle .sname { display: none; } .chip.settle { max-width: none; } }
.chip.season { position: relative; padding: 0 12px; background: var(--water-1); }
.chip.season .sprog { position: absolute; left: 6px; right: 6px; bottom: 5px; height: 4px; background: var(--ink-0); }
.chip.season .sprog b { display: block; height: 100%; background: var(--snow-1); }
.bfilter { display: flex; gap: 8px; align-items: center; margin: 4px 0 8px; }
.bfilter .bsearch { flex: 1; min-width: 0; min-height: var(--tap); border: 0; background: var(--night-2); color: var(--text); padding: 0 12px; font: 15px var(--font-ui); box-shadow: var(--frame); margin: 0; }
/* a phone: the top bar takes two rows — the switches and buttons on top, the chief's state, the
   season and the insights under them — rather than squeezing anything below a thumb's width */
@media (max-width: 440px) {
  #bar { flex-wrap: wrap; row-gap: 4px; gap: 8px; }
  #bar .seg { order: 1; }
  #bar .seg button { min-width: 0; padding: 0 12px; font-size: 15px; }
  #settleBtn { order: 2; min-width: 44px; justify-content: center; }
  /* icon buttons of the bar: one 44×44 square each */
  #settleBtn, #stockBtn, #huyaBtn, #seasonBtn { width: var(--icon-btn); min-width: var(--icon-btn); padding: 0; flex: none; }
  #stockBtn { order: 3; }
  #stockBtn .lbl { display: none; }
  #bar #huyaBtn { order: 4; margin-left: auto; } /* row 1 ends on the same right edge as row 2 */
  #bar .chief { order: 5; flex: 1 0 40%; display: flex; }
  #seasonBtn { order: 6; }
  #insightBtn { order: 7; }
  .chip.settle .caret { display: none; }
  #toasts { top: calc(112px + var(--safe-top)); }
}

/* ---------------------------------------------------------------- construction (v7) */
/* the plot's own row of tools: build, path, layer, rooms, work queues */
#plotbar { position: fixed; left: 12px; bottom: calc(16px + var(--safe-bottom)); z-index: 4; display: grid; grid-auto-flow: column; grid-auto-columns: var(--icon-btn); gap: 8px; }
#plotbar .chip { position: relative; width: var(--icon-btn); height: var(--icon-btn); min-height: 0; min-width: 0; padding: 0; margin: 0; justify-content: center; }
#plotbar .chip > span { display: none; }
#plotbar .chip.build { background: var(--ochre-1); box-shadow: var(--frame), var(--drop), inset 0 -4px 0 var(--ochre-0); }
#plotbar .chip.on { background: var(--steppe-1); color: var(--ink-0); box-shadow: var(--frame), var(--drop), inset 0 -4px 0 var(--steppe-0); }
/* the layer button: top right under the top bar (ui.js placeToasts sets its top), hidden when there is no room */
#layerBtn { position: fixed; right: 12px; top: calc(120px + var(--safe-top)); z-index: 4; margin: 0; }
#layerBtn.on { background: var(--steppe-1); }
#layerBtn.cramped, body.sheet-open #layerBtn { display: none; }
#toasts.beside-layer { right: 64px; }
/* a first-run hint (hints.js): under the top bar, left of the layer button; out of the way of sheets */
.hint { position: fixed; left: 12px; right: 64px; top: calc(120px + var(--safe-top)); z-index: 26; display: grid; grid-template-columns: 20px 1fr var(--icon-btn);
  gap: 8px; align-items: center; padding: 4px 4px 4px 12px; background: var(--card); color: var(--text); box-shadow: var(--frame), var(--drop), inset 4px 0 0 var(--gold-2);
  font: 400 14px/1.3 var(--font-ui); }
.hint .ibtn { margin: 0; }
.hint.cramped, body.sheet-open .hint { display: none; }
/* no camp yet: what to do, at the bottom of the map beside the zoom buttons */
.firstbar { position: fixed; left: 12px; right: 64px; bottom: calc(16px + var(--safe-bottom)); z-index: 4; display: grid; gap: 8px; padding: 12px;
  background: var(--card); color: var(--text); box-shadow: var(--frame), var(--drop), inset 4px 0 0 var(--gold-2); }
.firstbar .ftext { display: grid; gap: 4px; font: 400 14px/1.3 var(--font-ui); }
.firstbar .ftext b { font: 700 15px/1.2 var(--font-ui); color: var(--bone-2); }
.firstbar .btn { margin: 0; height: var(--btn-primary-h); }
body.sheet-open .firstbar { display: none; }
/* the kit from the old camp: a gift card */
.card.gift { display: grid; gap: 12px; box-shadow: var(--frame), inset 0 0 0 2px var(--gold-2); }
.card.gift .gifthead { display: flex; gap: 12px; align-items: center; }
#toasts.beside-layer.docked .toast { max-width: calc(100vw - 88px); }
#layerBtn > span { display: none; }
#layerBtn .badge { position: absolute; right: 2px; bottom: 2px; min-width: 16px; height: 16px; padding: 0 2px; display: grid; place-items: center;
  background: var(--ink-0); color: var(--bone-2); font: 700 12px/1 var(--font-ui); }
/* the layer picker: the plot's layers, the highest on top, over the button that opened it */
.layerpop { position: fixed; z-index: 25; display: grid; gap: 8px; min-width: 152px; padding: 8px; background: var(--bg); box-shadow: var(--frame), var(--drop); }
.layerpop .lbtn { display: grid; grid-template-columns: 20px 1fr; gap: 8px; align-items: center; height: var(--btn-h); padding: 0 12px; margin: 0; border: 0;
  text-align: left; background: var(--card); color: var(--text); box-shadow: var(--bevel); font: 700 14px/1 var(--font-ui); }
.layerpop .lbtn.on { background: var(--steppe-1); color: var(--ink-0); }
#plotbar .chip.queue.alert::after { content: ''; position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; background: var(--bad); box-shadow: 0 0 0 2px var(--ink-0); }
}
body:has(#roadbar:not([hidden])) #plotbar, body:has(#ghostbar:not([hidden])) #plotbar, body.building #plotbar { display: none; }
body.under #map { background: var(--night-1); }

/* the build bar: tools, what to lay, the preview's verdict and the buttons */
#buildbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 12; max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px;
  padding: 6px 8px calc(8px + var(--safe-bottom)); background: var(--bg); color: var(--text); box-shadow: var(--frame), var(--drop); }
#buildbar .btools, #buildbar .bkinds { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; touch-action: pan-x; padding: 4px; }
#buildbar .btools::-webkit-scrollbar, #buildbar .bkinds::-webkit-scrollbar { display: none; }
/* map first: tools are icons (the picked one with its name), one row of kinds that opens to a grid */
#buildbar .btool { flex: none; min-width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; gap: 4px;
  padding: 0 8px; margin: 0; border: 0; background: var(--card); color: var(--bone-1); box-shadow: var(--bevel); font: 400 12px/1.1 var(--font-ui); }
#buildbar .btool.on { background: var(--ink-2); color: var(--gold-3); font-weight: 700; box-shadow: var(--bevel), inset 0 0 0 2px var(--gold-2); }
#buildbar .bpick { display: flex; gap: 4px; align-items: flex-start; }
#buildbar .bpick .bkinds { flex: 1; min-width: 0; }
#buildbar .bpick.open .bkinds { flex-wrap: wrap; max-height: max(112px, min(44vh, calc(100vh - 340px - var(--safe-top) - var(--safe-bottom)))); overflow-y: auto; touch-action: pan-y; align-content: flex-start; }
#buildbar .bpick .bmore { flex: none; margin-top: 4px; }
#buildbar.drawing .bpick, #buildbar.drawing .btools { display: none; }
#buildbar .bkind { flex: none; display: grid; grid-template-columns: 32px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center;
  width: 152px; height: 52px; padding: 4px 8px 4px 4px; margin: 0; border: 0; text-align: left; background: var(--card); color: var(--text); box-shadow: var(--frame); overflow: hidden; }
#buildbar .bkind .kthumb { grid-row: span 2; display: flex; align-items: center; justify-content: center; }
#buildbar .bkind .kname { font-size: 12px; font-weight: 700; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#buildbar .bkind .kcost { display: flex; flex-wrap: nowrap; gap: 4px; overflow: hidden; }
#buildbar .bkind .kcost .mat { padding: 0 4px 0 0; background: none; box-shadow: none; font-size: 12px; }
#buildbar .bkind.on { box-shadow: var(--frame), inset 0 0 0 2px var(--gold-2); }
#buildbar .bkind.locked { opacity: .5; }
#buildbar .bfoot { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
#buildbar .bfoot .go { margin: 0; padding: 0 12px; min-width: 120px; height: 44px; }
#buildbar .bstatus { min-height: 44px; font-size: 13px; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
#buildbar .bstatus .line { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
#buildbar .bstatus > * { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#buildbar .small { font-size: 12px; }
#buildbar .bwork { display: flex; gap: 8px; align-items: center; font-size: 13px; }
/* the rail under the top bar: exit, undo, redo, the hand, the tool's toggles, rooms, the minimap, builders */
/* build mode's own header: the top bar steps aside; icons with their word under them */
#buildrail { position: fixed; top: calc(8px + var(--safe-top)); left: 8px; right: 8px; z-index: 11; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  touch-action: pan-x; padding: 2px; }
#buildrail::-webkit-scrollbar { display: none; }
#buildrail .rb { flex: none; min-width: 52px; height: 52px; padding: 4px 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 0; background: var(--card); color: var(--bone-2); box-shadow: var(--frame), var(--drop); font: 600 12px/1 var(--font-ui); white-space: nowrap; }
#buildrail .rb.on { background: var(--steppe-1); color: var(--ink-0); }
#buildrail .rb.off { opacity: .45; }
#buildrail .rb.rbuild { background: var(--water-1); }
body.building #bar, body.building #layerBtn { display: none; }
body.sheet-open #buildrail { display: none; }
#buildbar .bact .btn { margin: 0; padding: 0 8px; height: var(--btn-h); }
.seg.mini button { min-width: 0; padding: 0 12px; font-size: 14px; }
body.building #hud { bottom: calc(var(--bbar, 250px) + 10px); }
body.sheet-open #plotbar { display: none; }
.small.warn { color: var(--warn); }
.small.good { color: var(--good); }

/* sheets: rooms, blueprints, zones, queues, the premium */
.qbar { height: 10px; margin: 0 0 8px; background: rgba(0, 0, 0, .3); box-shadow: 0 0 0 var(--b) var(--ink); }
.qbar i { display: block; height: 100%; }
.check { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; font-size: 14px; color: var(--text); }
.check:not(.ok) { color: var(--bone-1); }
.check.ok { color: var(--hint); }
.rdot { flex: none; width: 12px; height: 12px; margin-top: 4px; box-shadow: 0 0 0 2px var(--ink-0); }
.roomline { display: flex; gap: 8px; align-items: center; width: calc(100% - 4px); min-height: 44px; margin: 8px 0; padding: 8px 12px; border: 0; text-align: left;
  background: var(--card); color: var(--text); box-shadow: var(--frame); font-size: 14px; }
.objs { display: flex; flex-wrap: wrap; gap: 8px; }
.ochip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 12px 4px 4px; border: 0; background: var(--card); color: var(--text); box-shadow: var(--frame); font-size: 13px; }
.card.blueprint { box-shadow: var(--frame), inset 4px 0 0 0 var(--water-4); }
.pbar.bp i { background: var(--water-4); }
.card.zone { box-shadow: var(--frame), inset 4px 0 0 0 var(--green-5); }
.card.zone .row-end, .card.blueprint .row-end { flex-wrap: wrap; }
.card.buildmode { display: flex; gap: 12px; align-items: center; width: calc(100% - 4px); border: 0; text-align: left; color: var(--text); cursor: pointer;
  box-shadow: var(--frame), inset 0 0 0 2px var(--ochre-3); }
.card.buildmode .thumb { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; }
.card.queue .qhead { display: flex; gap: 12px; align-items: center; }
.card.queue .qcount { font-family: var(--font-ui); font-variant-numeric: tabular-nums; color: var(--hint); }
.qlist { margin: 8px 0 4px; padding: 0 0 0 24px; }
.qlist li { display: flex; gap: 8px; align-items: center; padding: 4px 0; font-size: 14px; border-bottom: var(--b) dotted var(--line); }
.qlist li.blocked { color: var(--bone-1); }
.ibtn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; padding: 0; background: var(--card); box-shadow: var(--bevel); }
.ibtn.off { opacity: .35; cursor: default; }
.qbtns { display: grid; grid-template-columns: repeat(3, var(--act-slot)); gap: 4px; flex: none; }
.qadd { margin-top: 8px; }
.qadd .btn { margin: 0; }
.card.premium { display: flex; gap: 12px; align-items: center; width: calc(100% - 4px); border: 0; text-align: left; color: var(--text);
  box-shadow: var(--frame), inset 0 0 0 2px var(--gold-2); }
.card.prod { box-shadow: var(--frame), inset 4px 0 0 0 var(--gold-2); }
.card.prod.have { box-shadow: var(--frame), inset 4px 0 0 0 var(--good); }
.btn.stars { width: 128px; justify-content: center; background: var(--gold-1); color: var(--ink-0); box-shadow: var(--frame), inset 0 -4px 0 var(--gold-0); }
#buildbar .btn.rooms.on { background: var(--steppe-1); color: var(--ink-0); }
body.building #toasts.docked { right: calc(var(--icon-btn) + 24px); align-items: flex-start; }
body.building #toasts.docked .toast { max-width: 100%; }
#buildbar .bkind.kit { grid-template-columns: 44px 1fr; }
#buildbar .bkind .ksub { font-size: 12px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
#buildbar .bkind.kit.act .kthumb { display: grid; place-items: center; }
#buildbar .kitname { width: 100%; margin-top: 4px; }
.kitcard .qhead { margin-bottom: 8px; }
/* a sheet over the build bar: the bar steps aside (one thing to tap at a time) */
body.sheet-open #buildbar { display: none; }
body.building.nohud #hud { display: none; }

/* v12 caravans: bands as pips, cargo with names, the ambush cell list, the chance, a market stepper */
.pips { display: inline-flex; gap: 2px; margin-right: 8px; vertical-align: middle; }
.pips i { width: 8px; height: 8px; background: var(--ink-2); box-shadow: 0 0 0 1px var(--ink-0); }
.pips.rich i.on { background: var(--gold-2); }
.pips.esc i.on { background: var(--ochre-2); }
.band { display: inline-flex; align-items: center; }
.mats .mat .mn { font-size: 12px; margin-left: 4px; }
.lrow.pick { width: 100%; min-height: 44px; border: 0; background: var(--card); color: var(--text); text-align: left; margin: 0 0 4px; padding: 4px 12px; box-shadow: var(--frame); }
.lrow.pick.on { box-shadow: var(--frame), inset 0 0 0 2px var(--gold-2); }
.lrow.pick.dim { opacity: .55; }
.raidplan .chance { font: 400 22px/1 var(--font-display); color: var(--bone-2); }
.raidplan .chance.good { color: var(--good); }
.raidplan .chance.bad { color: var(--bad); }
.card.owner { box-shadow: var(--frame), inset 4px 0 0 var(--ochre-2); }
.stepper { display: inline-grid; grid-template-columns: var(--icon-btn) 32px var(--icon-btn); gap: 4px; align-items: center; justify-items: center; }
.stepper .n { font-variant-numeric: tabular-nums; }
.lrow.trade .tname { display: inline-flex; align-items: center; gap: 8px; }
/* v6: free cities. A city's head, its stages, events by mark colour, reputation, quests, the deal */
.cyhead { display: flex; gap: 12px; align-items: center; margin: 4px 0 8px; }
.cyhead .cypic { flex: none; display: grid; place-items: end center; width: 84px; min-height: 60px; padding: 4px; background: var(--ink-1); box-shadow: var(--frame); }
.cyhead .name { font: 400 16px/1.2 var(--font-display); }
.stages { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.stages .stg { padding: 4px 8px; font-size: 12px; line-height: 1.2; background: var(--ink-1); color: var(--hint); box-shadow: 0 0 0 1px var(--ink-0); }
.stages .stg.on { background: var(--wood-1); color: var(--bone-2); }
.evhead { display: flex; gap: 8px; align-items: center; }
.evhead .evi { flex: none; display: grid; place-items: center; width: 40px; height: 40px; background: var(--ink-1); box-shadow: 0 0 0 2px var(--ink-0); }
.evcard { box-shadow: var(--frame), inset 4px 0 0 var(--stone-2); }
.evcard.past { opacity: .6; }
.evcard.tap { cursor: pointer; }
.evcard.m-fire, .evcard.m-burnt { box-shadow: var(--frame), inset 4px 0 0 var(--ochre-3); }
.evcard.m-fire .evi, .evcard.m-siege .evi { background: var(--ochre-1); }
.evcard.m-siege { box-shadow: var(--frame), inset 4px 0 0 var(--ochre-2); }
.evcard.m-fair, .evcard.m-festival { box-shadow: var(--frame), inset 4px 0 0 var(--gold-2); }
.evcard.m-fair .evi, .evcard.m-festival .evi { background: var(--gold-0); }
.evcard.m-plague, .evcard.m-radstorm { box-shadow: var(--frame), inset 4px 0 0 var(--rad-2); }
.evcard.m-plague .evi, .evcard.m-radstorm .evi { background: var(--rad-1); }
.evcard.m-flood { box-shadow: var(--frame), inset 4px 0 0 var(--water-3); }
.evcard.m-flood .evi { background: var(--water-1); }
.evcard.m-strike { box-shadow: var(--frame), inset 4px 0 0 var(--berry-3); }
.evcard.m-strike .evi { background: var(--berry-1); }
.evcard.m-pollution, .evcard.m-desert, .evcard.m-crater { box-shadow: var(--frame), inset 4px 0 0 var(--stone-3); }
.fx { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 0; }
.fx .tag { margin: 0; background: var(--ink-1); color: var(--bone-1); }
.card.rep .repbar { position: relative; height: 12px; margin: 8px 0; background: var(--ink-1); box-shadow: 0 0 0 2px var(--ink-0); }
.card.rep .repbar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--good); }
.card.rep .repbar.neg i { background: var(--bad); }
.card.rep .repbar b { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--bone-2); }
.tiers { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tiers .tier { padding: 4px 8px; font-size: 12px; line-height: 1.2; background: var(--ink-1); color: var(--hint); }
.tiers .tier.neg { color: var(--flesh-2); }
.tiers .tier.on { background: var(--steppe-1); color: var(--ink-0); }
.card.ruler { box-shadow: var(--frame), inset 4px 0 0 var(--berry-3); }
.card.ruler .meme { margin-top: 8px; }
.qcard.urgent { box-shadow: var(--frame), inset 4px 0 0 var(--ochre-3); }
.qcard .eq2, .qcard > .btn { margin-top: 8px; }
.card.deal { margin-top: 12px; }
.lrow.trade .tn { display: grid; gap: 4px; }
.lrow.trade.locked .tname { opacity: .6; }
.lrow.trade .lockline { display: inline-flex; align-items: center; gap: 4px; max-width: 152px; text-align: right; }

/* tap-to-inspect: a small card over the plot (js/inspect.js) */
#inspect { position: fixed; left: 12px; right: 72px; bottom: calc(76px + var(--safe-bottom)); z-index: 13; max-width: 420px; padding: 12px 56px 12px 12px;
  background: var(--card); color: var(--text); box-shadow: var(--frame), var(--drop); }
/* building: the card comes under the header, the slim toast line keeps the bar's edge */
body.building #inspect { bottom: auto; top: calc(68px + var(--safe-top)); }
#inspect .ihead { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
#inspect .ihead .ipic { flex: none; display: grid; place-items: center; width: 44px; height: 44px; background: var(--ink-1); box-shadow: 0 0 0 2px var(--ink-0); }
#inspect .ihead .name { font: 400 16px/1.2 var(--font-display); }
#inspect p { margin: 4px 0; }
#inspect .igo { margin: 8px 0 0; width: 100%; }
#inspect .eq2 .igo { width: auto; }
#inspect .iclose { position: absolute; right: 8px; top: 8px; }
body.sheet-open #inspect { display: none; }
/* the plot's minimap (js/minimap.js) */
#minimap { position: fixed; left: 12px; z-index: 10; image-rendering: pixelated; box-shadow: var(--frame), var(--drop); touch-action: none; cursor: pointer; }
body[data-view="world"] #miniBtn { display: none; }
#miniBtn.on { background: var(--steppe-1); }
/* building: toasts are one slim line on the build bar's top edge */
body.building #toasts.docked .toast { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 4px 12px; font-size: 13px; min-height: 0; }
#buildbar .owed { gap: 4px; }
#buildbar .linkbtn { min-height: 44px; padding: 0 8px; border: 0; background: none; color: var(--link); font: 700 12px/1 var(--font-ui); text-decoration: underline; }
/* the picker: what is still shut is one line at the end of the row; demolishing is red */
#buildbar .bshut { flex: none; align-self: center; padding: 0 8px; white-space: nowrap; }
#buildbar .btool.danger.on { color: var(--ochre-5); }
#buildbar .bfoot .go.danger { background: var(--ochre-1); color: var(--bone-2); }
/* the start hub (js/hub.js): big pixel tiles over everything, the page's own night behind */
#hub { position: fixed; inset: 0; z-index: 40; overflow-y: auto; padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  background: var(--bg); display: flex; flex-direction: column; gap: 12px; }
#hub[hidden] { display: none; }
#hub .hubhead { display: flex; flex-direction: column; gap: 4px; padding: 8px 4px 4px; }
#hub .hubtitle { font: 400 32px/1 var(--font-display); color: var(--gold-3); letter-spacing: .04em; text-shadow: 0 4px 0 var(--ink-0); }
#hub .hubcont { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; margin: 0; padding: 8px 12px; border: 0; text-align: left;
  background: var(--ochre-1); color: var(--bone-2); box-shadow: var(--frame), var(--drop), inset 0 -4px 0 var(--ochre-0); }
#hub .hubcont .grow { display: flex; flex-direction: column; gap: 4px; }
#hub .hubcont b { font: 400 18px/1 var(--font-display); }
#hub .hubcont .hubpic { width: 48px; height: 48px; }
#hub .hubgrid { display: grid; grid-template-columns: 1fr 1fr; grid-template-columns: round(down, calc((100% - 12px) / 2), 4px) 1fr; gap: 12px; }
#hub .hubtile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-height: 152px; margin: 0; padding: 12px;
  border: 0; text-align: left; background: var(--card); color: var(--text); box-shadow: var(--frame), var(--drop), inset 0 -4px 0 var(--ink-1); }
#hub .hubtile b { font: 400 17px/1.1 var(--font-display); color: var(--bone-2); }
#hub .hubtile .small { color: var(--bone-1); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
#hub .hubtile.warn { box-shadow: var(--frame), var(--drop), inset 0 -4px 0 var(--ink-1), inset 4px 0 0 var(--gold-2); }
#hub .hubpic { position: relative; display: grid; place-items: center; width: 64px; height: 64px; background: var(--ink-1); box-shadow: 0 0 0 2px var(--ink-0); }
/* the camp tile is wide (its picture left, what it needs right); the rest in a 2×2 grid */
#hub .hubtile.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: 96px; gap: 12px; }
#hub .hubtxt { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
#hub .hubtile:not(.wide) { min-height: 0; }
#hub .hubtile:not(.wide) .hubpic { width: 52px; height: 52px; }
#hub .hubdot { position: absolute; right: -4px; top: -4px; width: 12px; height: 12px; background: var(--gold-2); box-shadow: 0 0 0 2px var(--ink-0); }
#hub .hubnote { text-align: center; margin: 4px 0 0; }
#hubBtn { min-width: var(--btn-h); padding: 0; justify-content: center; }
body.hub-open #toasts { display: none; }

/* ---------------------------------------------------------------- the living aul (colony.js) */
/* «Род» on the plot bar: a mark when someone is weak with hunger or waits to be buried */
#plotbar .chip.rod.alert::after { content: ''; position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; background: var(--bad); box-shadow: 0 0 0 2px var(--ink-0); }
/* the unattended window: one slim chip over the plot bar */
.colonychip { position: fixed; left: 12px; bottom: calc(16px + var(--icon-btn) + 8px + var(--safe-bottom)); z-index: 4; display: inline-flex; align-items: center; gap: 6px;
  height: var(--icon-btn); padding: 0 12px 0 8px; margin: 0; border: 0; background: var(--card); color: var(--bone-2); font: 400 13px/1 var(--font-ui);
  box-shadow: var(--frame), var(--drop), inset 4px 0 0 var(--good); }
.colonychip.resting { color: var(--bone-1); box-shadow: var(--frame), var(--drop), inset 4px 0 0 var(--warn); }
body.building .colonychip, body.sheet-open .colonychip, body:not([data-view="plot"]) .colonychip { display: none; }
/* needs: four short bars with their icons */
.needs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 0; }
.need { display: flex; align-items: center; gap: 4px; min-width: 0; }
/* the server keeps hunger only for now: one wider bar with how long since the meal */
.needs.n1 { grid-template-columns: 1fr; }
.needs.n1 .nbar { flex: 0 1 50%; }
.needs.n2 { grid-template-columns: 1fr 1fr; }
.nbar { flex: 1; min-width: 0; height: 6px; background: rgba(0, 0, 0, .3); box-shadow: 0 0 0 2px var(--ink); }
.nbar i { display: block; height: 100%; background: var(--good); }
.nbar.rest i { background: var(--water-4); }
.nbar.warmth i { background: var(--gold-2); }
.nbar.mood i { background: var(--berry-3); }
.nbar.low i { background: var(--bad); }
.card.settler .task { margin: 8px 0 0; }
.card.settler .task .pbar { display: block; margin-top: 4px; }
.card.settler.alarm { box-shadow: var(--frame), inset 4px 0 0 var(--bad); }
.card.settler.dead { box-shadow: var(--frame), inset 4px 0 0 var(--ink-2); }
.card.settler.dead .evi { filter: grayscale(1) brightness(.7); }
.wplace { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; min-height: 32px; }
.wplace .btn { margin: 0; }
/* intentions: the season's slots, then the cards */
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.slot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 64px; padding: 6px; text-align: center;
  background: rgba(0, 0, 0, .25); box-shadow: inset 0 0 0 2px var(--line); color: var(--bone-1); }
.slot.on { background: var(--card); box-shadow: var(--frame), inset 0 -4px 0 var(--steppe-0); color: var(--bone-2); }
.slot.locked { opacity: .6; }
button.card.intent { min-height: 80px; display: block; width: calc(100% - 4px); text-align: left; border: 0; color: inherit; font: inherit; cursor: pointer; position: relative; }
button.card.intent .tag { position: absolute; top: 8px; right: 8px; background: var(--steppe-1); color: var(--ink-0); }
button.card.intent.on { box-shadow: var(--frame), inset 4px 0 0 var(--steppe-1); }
/* norms and the Аксакал */
.lrow.norm .tn { display: flex; flex-direction: column; gap: 2px; }
.lrow.norm .tname { display: flex; align-items: center; gap: 8px; min-width: 0; }
.addnorm .mat { cursor: pointer; border: 0; color: inherit; }
.card.aksakal { box-shadow: var(--frame), inset 4px 0 0 var(--gold-2); }
.card.aksakal .btn { margin: 8px 0 0; }
.card.prod.soon { opacity: .8; }
.card.prod.soon .tag { background: var(--ink-2); color: var(--bone-1); }
/* workplaces with hands */
.hands .hrow { display: flex; align-items: center; gap: 8px; }
.hands .imp { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 8px 0 0; }
.impb { min-height: 44px; padding: 0 4px; border: 0; background: rgba(0, 0, 0, .3); color: var(--bone-1); font: 400 14px/1 var(--font-display); box-shadow: inset 0 0 0 2px var(--line); }
.impb.on.low { background: var(--ink-2); color: var(--bone-2); }
.impb.on.normal { background: var(--steppe-1); color: var(--ink-0); }
.impb.on.high { background: var(--ochre-2); color: var(--bone-2); }
.hands.compact { margin: 8px 0 0; }
.card.wplace-card .evhead { width: 100%; min-height: 44px; border: 0; padding: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.card.wplace-card .fill { font: 400 18px/1 var(--font-display); color: var(--bone-2); font-variant-numeric: tabular-nums; }
.card.wplace-card .fill.short { color: var(--warn); }
.card.wplace-card.idle { box-shadow: var(--frame), inset 4px 0 0 var(--warn); }
.tag.imp-high { background: var(--ochre-2); color: var(--bone-2); }
.tag.imp-normal { background: var(--steppe-1); color: var(--ink-0); }
.tag.imp-low { background: var(--ink-2); color: var(--bone-1); }
#inspect .needs { margin: 4px 0; }
.addnorm .mat { min-width: var(--tap, 44px); min-height: var(--tap, 44px); justify-content: center; }
/* a short phone: the hub's tiles get smaller so all of them fit above the home indicator */
@media (max-height: 640px) {
  #hub { gap: 8px; }
  #hub .hubhead { padding: 0 4px; }
  #hub .hubtitle { font-size: 24px; }
  #hub .hubcont { min-height: 52px; padding: 4px 12px; }
  #hub .hubcont .hubpic { width: 40px; height: 40px; }
  #hub .hubgrid { gap: 8px; }
  #hub .hubtile { padding: 8px; gap: 6px; }
  #hub .hubtile.wide { min-height: 72px; }
  #hub .hubtile .small { -webkit-line-clamp: 2; }
  /* only the camp and a tile with news keep their line */
  #hub .hubtile:not(.wide):not(.warn) .small { display: none; }
  #hub .hubnote { display: none; }
}
/* settling a huyak in or out: the button, then a line on what changes and the confirm */
.settlebox { margin: 8px 0 0; }
.settlebox p { margin: 0 0 8px; }
.settlebox .btn { margin: 0; }
.card.caged .settlebox { display: flex; flex-direction: column; align-items: flex-end; }
.card.caged .settlebox p { align-self: stretch; }
#inspect .igo2 { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin: 8px 0; }
#inspect .igo2 .settlebox { margin: 0; flex: 1 1 auto; }
#inspect .igo2 .btn { margin: 0; }
button.card.calling .tag { background: var(--steppe-1); color: var(--ink-0); }
/* herds and the hard winter (colony.js, API v14) */
.card.jut { box-shadow: var(--frame), inset 4px 0 0 var(--water-4); }
.card.jut.now { box-shadow: var(--frame), inset 4px 0 0 var(--water-4), inset 0 0 0 2px var(--water-3); }
.card.jut .evi { background: var(--water-1); }
button.card.herd { display: block; width: calc(100% - 4px); text-align: left; border: 0; color: inherit; font: inherit; cursor: pointer; min-height: 44px; }
button.card.herd .evhead > .px.ui { flex: none; }
button.card.herd .tag { background: var(--ink-2); color: var(--bone-2); }
button.card.herd.st-weak, button.card.herd.st-dying { box-shadow: var(--frame), inset 4px 0 0 var(--bad); }
button.card.herd.st-thin { box-shadow: var(--frame), inset 4px 0 0 var(--warn); }
.nbar.herd { display: block; margin: 8px 0 0; }
.nbar.herd i { background: var(--good); }
.nbar.herd.low i { background: var(--bad); }
.card.pasture .name { margin-bottom: 4px; }
.hrow.slaughter { display: flex; align-items: center; gap: 8px; }
.colonychip.jut { box-shadow: var(--frame), var(--drop), inset 4px 0 0 var(--water-4); }
