/* v2 desktop / tablet HUD. Positions that depend on measured sizes come from js/layout.js as CSS variables. */
.app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}
.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  --tb-h: 52px;
  --rail-w: 64px;
  --card-w: 340px;
}
:root[data-input='touch'] .hud {
  --tb-h: 56px;
  --rail-w: 72px;
  --card-w: 352px;
}
.hud > * {
  pointer-events: auto;
}

/* ---------------------------------------------------------------- top bar */
.tb {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--tb-h);
  padding: 0 10px 0 0;
  background: var(--black);
  color: var(--paper-50);
  border-bottom: 2px solid var(--son-500);
  box-shadow: 0 1px 0 var(--vang-400), 0 2px 0 var(--then-900), 0 8px 20px rgba(9, 8, 6, 0.35);
}
.tb__crest {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  height: 100%;
  padding: 0 18px 0 10px;
  background: var(--red);
  color: var(--vang-300);
  box-shadow: inset -1px 0 0 var(--vang-500), inset -3px 0 0 var(--son-700);
  clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
}
.tb__emblem {
  width: 32px;
  height: 32px;
  color: var(--vang-400);
}
.tb__title {
  font: 700 18px var(--font-head);
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.tb__gold {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
}
.tb__gold-t {
  display: grid;
  line-height: 1.08;
}
.tb__amount {
  color: var(--vang-200);
  font-size: 18px;
  white-space: nowrap;
}
.tb__amount small {
  font: 600 11.5px var(--font-ui);
  color: var(--paper-200);
}
.tb__rate {
  color: var(--la-bright);
  font-size: 12px;
}
.tb__tiers {
  display: flex;
  flex: none;
  gap: 2px;
  padding-left: 10px;
  border-left: 1px solid rgba(200, 161, 84, 0.35);
}
.tier-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: max(40px, var(--tap));
  padding: 2px 8px 2px 3px;
  border-radius: 999px;
}
.tier-chip:hover,
.tier-chip[data-show] {
  background: rgba(246, 232, 197, 0.08);
}
.tier-chip__t {
  display: grid;
  line-height: 1.08;
}
.tier-chip__n {
  font-size: 15px;
}
.tier-chip__w {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--la-bright);
  font-size: 11px;
}
.tier-chip__w.is-short {
  color: var(--chusa-bright);
}
.tb__watch {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding-left: 10px;
  border-left: 1px solid rgba(200, 161, 84, 0.35);
}
.tb__chips {
  display: flex;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}
.wchip {
  position: relative;
  display: grid;
  justify-items: center;
  flex: none;
  width: 50px;
  min-height: max(44px, var(--tap));
  padding: 2px 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--paper-50);
}
.wchip[hidden] {
  display: none;
}
.wchip:hover {
  border-color: var(--then-600);
  background: rgba(246, 232, 197, 0.06);
}
.wchip__icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 28px;
}
.wchip__n {
  font-size: 12.5px;
  line-height: 1.1;
}
.wchip.is-low .wchip__n {
  color: var(--chusa-bright);
}
.wchip.is-low .wchip__icon::before {
  content: '';
  position: absolute;
  inset: -1px 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 110, 80, 0.55), transparent 70%);
  animation: low-pulse 1.6s ease-in-out infinite;
}
.wchip__alert {
  position: absolute;
  top: -3px;
  right: -4px;
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--chusa-bright);
  color: var(--then-900);
  font: 800 10px/1 var(--font-ui);
  font-style: normal;
}
@keyframes low-pulse {
  50% {
    opacity: 0.35;
  }
}
@media (prefers-reduced-motion: reduce) {
  .wchip.is-low .wchip__icon::before {
    animation: none;
  }
}
.wmore {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  min-width: max(40px, var(--tap));
  height: max(36px, var(--tap));
  padding: 0 6px;
  border: 1px solid var(--vang-600);
  border-radius: 999px;
  background: rgba(239, 200, 112, 0.1);
  color: var(--vang-200);
  font-size: 13px;
}
.wmore[hidden] {
  display: none;
}
.wmore.is-low::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--chusa-bright);
  box-shadow: 0 0 0 1.5px var(--then-900);
}
.wbtn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  min-height: max(34px, var(--tap));
  min-width: max(34px, var(--tap));
  justify-content: center;
  padding: 0 10px 0 8px;
  border: 1px dashed var(--vang-600);
  border-radius: 8px;
  color: var(--vang-200);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.tb__right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.tb__date {
  color: var(--paper-200);
  font-size: 13px;
  white-space: nowrap;
  margin-right: 2px;
}
.tb__speed {
  display: flex;
  gap: 3px;
}
.tb__speed .orb,
.tb__right > .orb {
  --orb: max(32px, var(--tap));
}
/* compaction levels (js/layout.js): no date → tier counts only → crest emblem only → two speed buttons → "+" only →
   smaller portraits, no rate */
.tb.lv1 .tb__date {
  display: none;
}
.tb.lv2 .tier-chip {
  gap: 4px;
  padding-right: 4px;
}
.tb.lv2 .tier-chip__w {
  display: none;
}
.tb.lv2 .tb__amount small {
  display: none;
}
.tb.lv3 .tb__title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.tb.lv3 .tb__crest {
  padding-right: 16px;
}
.tb.lv4 .tb__sp:nth-child(3),
.tb.lv4 .tb__sp:nth-child(4) {
  display: none;
}
.tb.lv5 .wbtn__t {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.tb.lv5 .wbtn {
  padding: 0;
}
.tb.lv6 .tier-chip .portrait {
  width: 28px;
  height: 28px;
}
.tb.lv6 .tb__rate {
  display: none;
}
/* lv7: the tiers fold into one population chip (tap → statistics); lv8: one pause/play button */
.tb__popsum {
  display: none;
}
.tb.lv7 .tb__tiers {
  display: none;
}
.tb.lv7 .tb__popsum {
  display: flex;
  flex: none;
}
.tb.lv8 .tb__sp:nth-child(2) {
  display: none;
}

/* ---------------------------------------------------------------- left column of round buttons */
.rail {
  position: absolute;
  top: calc(var(--tb-h) + 12px);
  left: 10px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: var(--rail-w);
  padding: 10px 0;
  border: 1px solid var(--then-900);
  border-radius: 34px;
  background: var(--black);
  box-shadow: inset 0 0 0 1px rgba(200, 161, 84, 0.55), var(--shadow);
}
.rail__btn {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 100%;
  padding: 2px 0;
}
.rail__btn .orb {
  --orb: max(40px, var(--tap));
}
.rail__label {
  color: var(--paper-200);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
}
.rail__btn[aria-current='true'] .rail__label {
  color: var(--vang-200);
}
.rail__help {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(200, 161, 84, 0.3);
}
.rail.is-compact .rail__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ---------------------------------------------------------------- objective / tutorial cards (top-left of the map) */
.goal,
.tut,
.fc {
  position: absolute;
  top: calc(var(--tb-h) + 12px);
  left: var(--stage-l, 86px);
  z-index: 4;
}
.goal {
  width: 300px;
  padding: 8px 10px 10px;
  border-width: 3px;
}
.goal__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.goal__icon,
.fc__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--red-btn);
  color: var(--vang-200);
  box-shadow: inset 0 0 0 1.5px var(--vang-500);
}
.goal__t {
  flex: 1;
  display: grid;
  min-width: 0;
  line-height: 1.15;
}
.goal__t small {
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.goal__t b {
  font-size: 14px;
}
.goal__n {
  color: var(--text-2);
  font-size: 13px;
}
.goal__toggle {
  --orb: max(28px, var(--tap));
}
.goal__steps {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
}
.goal__steps li {
  display: flex;
  gap: 7px;
}
.goal__steps li.is-done {
  color: var(--text-muted);
  text-decoration: line-through;
}
.goal__check {
  display: grid;
  place-items: center;
  flex: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--muc-500);
  border-radius: 50%;
}
.is-done .goal__check {
  border-color: var(--good-ui);
  background: var(--good-ui);
  color: var(--paper-50);
}
.goal__actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.tut {
  width: 340px;
  padding: 12px 14px 12px;
}
.tut__top {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.tut__portrait {
  flex: none;
  margin: -4px 0 0 -4px;
}
.tut__speech {
  position: relative;
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--paper-50);
  box-shadow: inset 0 0 0 1px var(--paper-400);
  font-size: 13px;
  font-style: italic;
}
.tut__speech p {
  margin: 0;
}
.tut__speech::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 22px;
  width: 10px;
  height: 10px;
  background: var(--paper-50);
  border-left: 1px solid var(--paper-400);
  border-bottom: 1px solid var(--paper-400);
  transform: rotate(45deg);
}
.tut__who {
  display: block;
  color: var(--title);
  font: 700 12px var(--font-title);
  font-style: normal;
}
.tut__chapter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 10px 0 6px;
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tut__dots {
  display: flex;
  gap: 4px;
}
.tut__dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--paper-300);
  box-shadow: inset 0 0 0 1px var(--muc-500);
}
.tut__dots i.done {
  background: var(--good-ui);
  box-shadow: none;
}
.tut__dots i.now {
  background: var(--son-400);
}
.tut__goal {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(213, 183, 143, 0.4);
}
.tut__goal img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex: none;
}
.tut__goal > div {
  flex: 1;
  display: grid;
  gap: 4px;
}
.tut__goal small {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}
.tut__goal b {
  font-size: 13.5px;
  line-height: 1.25;
}
.tut__new {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-2);
}
.new-chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--ngoc-500);
  color: var(--paper-50);
  font-size: 10.5px;
  font-weight: 700;
}
.tut__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.tut__actions .btn--red {
  flex: 1 0 100%;
}
.tut__actions .btn:not(.btn--red) {
  flex: 1 1 auto;
}

/* ---------------------------------------------------------------- notices ribbon, showcase */
.toasts {
  position: absolute;
  top: calc(var(--tb-h) + 12px);
  left: var(--toast-l, 40%);
  width: var(--toast-w, 20%);
  z-index: 3;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.toasts > * {
  pointer-events: auto;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 6px 14px 6px 6px;
  border: 1px solid var(--then-900);
  border-radius: 10px;
  background: var(--paper-100) var(--paper-tex);
  box-shadow: inset 4px 0 0 var(--son-400), inset 0 0 0 1px var(--vang-500), var(--shadow);
}
.toast__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--nghe-500);
  color: var(--then-900);
}
.toast__t {
  display: grid;
  min-width: 0;
  line-height: 1.2;
}
.toast__t b {
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast__t small {
  color: var(--text-muted);
  font-size: 11.5px;
}
.show {
  width: min(560px, 100%);
  padding: 8px 10px 10px 12px;
  border-width: 3px;
}
.show__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.show__name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--title);
  font: 700 16px var(--font-head);
}
.show__tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(70, 121, 138, 0.16);
  color: var(--info);
  font-size: 12px;
  font-weight: 700;
}
.show__sp {
  flex: 1;
}
.show__colonies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.colony {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: max(30px, var(--tap));
  padding: 0 12px 0 8px;
  border: 1px solid var(--paper-400);
  border-radius: 999px;
  background: var(--paper-50);
  font-size: 13px;
  font-weight: 600;
}
.colony i {
  width: 11px;
  height: 11px;
  border-radius: 3px;
}
.colony.is-on {
  border-color: var(--then-900);
  background: var(--red);
  color: var(--paper-50);
}

/* ---------------------------------------------------------------- minimap: a bronze drum, its buttons around the upper-left arc */
.mm {
  position: absolute;
  right: 10px;
  bottom: var(--mm-bottom, 10px);
  z-index: 3;
  width: var(--mm-box, 250px);
  height: var(--mm-box-h, 240px);
  pointer-events: none;
  --drum: 196px;
}
:root[data-input='touch'] .mm {
  --drum: 180px;
}
.mm__drum {
  position: absolute;
  right: 0;
  bottom: 0;
  width: var(--drum);
  height: var(--drum);
  border-radius: 50%;
  background: radial-gradient(circle, #9f7e41 0%, #8a6c36 60%, #6b522a 100%);
  box-shadow: 0 0 0 2px var(--then-900), 0 0 0 5px var(--son-500), 0 0 0 6px var(--vang-400), var(--shadow);
  pointer-events: auto;
}
.mm__drum > .drum {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.mm__drum > .minimap__map {
  position: absolute;
  inset: 13%;
  width: 74%;
  height: 74%;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--dong-700), 0 0 0 3px var(--vang-400), inset 0 0 18px rgba(9, 8, 6, 0.45);
}
.mm__north {
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--son-500);
  color: var(--vang-200);
  box-shadow: 0 0 0 1px var(--vang-400);
  font: 700 11px/1 var(--font-title);
}
.mm__orb {
  position: absolute;
  --orb: max(32px, var(--tap));
  pointer-events: auto;
}

/* ---------------------------------------------------------------- right cards (house, workshop, ship) */
.rcard {
  position: absolute;
  top: calc(var(--tb-h) + 12px);
  right: 12px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  width: var(--card-w);
  max-height: var(--card-max, 70%);
  overflow: hidden;
}
.ch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px 8px 12px;
}
.ch__medal {
  display: grid;
  place-items: center;
  flex: none;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, var(--paper-50), var(--paper-300));
  box-shadow: 0 0 0 2px var(--vang-500), 0 0 0 4px var(--son-frame), 0 2px 6px rgba(9, 8, 6, 0.3);
  overflow: hidden;
}
.ch__medal img {
  width: 54px;
  height: 54px;
  object-fit: contain;
}
.ch__t {
  flex: 1;
  min-width: 0;
}
.ch__t h2 {
  margin: 0;
  color: var(--title);
  font: 700 21px/1.12 var(--font-head);
}
.ch__sub {
  color: var(--text-muted);
  font-size: 12.5px;
}
.ch__sub .portrait {
  display: inline-block;
  vertical-align: -4px;
  box-shadow: 0 0 0 1.5px var(--tone);
}
.ch .orb,
.lg__head .orb.close,
.fc__head .orb.close {
  --orb: max(32px, var(--tap));
}
.card__body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 2px 16px 12px;
  scrollbar-width: thin;
}
.card__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--paper-300);
  background: rgba(213, 183, 143, 0.28);
}
.card__foot--end {
  justify-content: flex-end;
}
.card__foot .btn {
  flex: 1 1 auto;
}
.card__foot--end .btn {
  flex: none;
}
.crow {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  column-gap: 8px;
  min-height: 34px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(188, 148, 90, 0.35);
  font-size: 13.5px;
}
.crow > .glyph {
  color: var(--text-2);
}
.crow__l {
  font-weight: 600;
}
.crow__v {
  text-align: right;
  white-space: nowrap;
}
.crow__v b {
  font-size: 15px;
}
.crow__v small {
  color: var(--text-muted);
}
.crow__bar {
  grid-column: 2 / -1;
  margin-top: 4px;
}
.mood {
  color: var(--good);
  font-weight: 600;
}
.needs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 12px 4px;
}
.needs--sm {
  grid-template-columns: repeat(auto-fill, minmax(66px, 1fr));
}
.up {
  margin-top: 14px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(246, 232, 197, 0.75);
  box-shadow: inset 0 0 0 1px var(--paper-300);
}
.up__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
}
.up__head .muted {
  color: var(--text-muted);
  font-size: 12px;
}
.up__rules {
  display: grid;
  gap: 3px;
  margin: 8px 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
}
.up__rules li {
  display: flex;
  align-items: center;
  gap: 6px;
}
.up__rules .ok {
  color: var(--good);
}
.up__rules .no {
  color: var(--bad);
}
.up__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.costs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.cost {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 26px;
  padding: 0 8px 0 3px;
  border: 1px solid var(--paper-400);
  border-radius: 999px;
  background: var(--paper-50);
  font-size: 12.5px;
}
.status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin: 2px 0 10px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
}
.status span {
  color: var(--text-2);
  font-size: 12px;
}
.status--warn {
  background: rgba(226, 136, 7, 0.14);
  box-shadow: inset 3px 0 0 var(--nghe-500);
  color: var(--warn);
}
.flow {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.flow__col {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.flow__col > small {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.flow__col--ring {
  justify-items: center;
}
.pring {
  position: relative;
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
}
.pring svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}
.pring .trk {
  fill: var(--paper-50);
  stroke: rgba(36, 27, 18, 0.14);
}
.pring .fil {
  fill: none;
  stroke: var(--warn-ui);
  stroke-linecap: round;
}
.pring .num {
  position: relative;
  font-size: 19px;
}
.pring .num small {
  font-size: 11px;
}
.flow__arrow {
  display: grid;
  justify-items: center;
  gap: 3px;
  width: 50px;
  color: var(--muc-500);
}
.flow__arrow .bar {
  width: 100%;
}
.flow__arrow small {
  color: var(--text-muted);
  font-size: 10px;
  white-space: nowrap;
}
.buf {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 4px 26px 4px 4px;
  border-radius: 8px;
  background: rgba(246, 232, 197, 0.8);
  box-shadow: inset 0 0 0 1px var(--paper-300);
}
.buf > div {
  display: grid;
  min-width: 0;
  font-size: 12px;
  line-height: 1.2;
}
.buf b {
  white-space: nowrap;
}
.buf__pips {
  display: flex;
  align-items: center;
  gap: 2px;
}
.buf__pips i {
  width: 8px;
  height: 6px;
  border-radius: 1.5px;
  background: rgba(36, 27, 18, 0.16);
}
.buf__pips i.on {
  background: var(--good-ui);
}
.buf__pips .num {
  margin-left: 4px;
  font-size: 11px;
  color: var(--text-muted);
}
.buf.is-empty .buf__pips i {
  background: rgba(163, 31, 18, 0.25);
}
.buf .need__flag {
  top: -6px;
  left: 30px;
  right: auto;
}
.pin {
  display: grid;
  place-items: center;
  flex: none;
  width: max(26px, var(--tap));
  height: max(26px, var(--tap));
  padding: 0;
  border: 1px solid var(--paper-400);
  border-radius: 50%;
  background: var(--paper-50);
  color: var(--muc-500);
}
.pin.is-on {
  border-color: var(--then-900);
  background: var(--red-btn);
  color: var(--vang-200);
}
.buf .pin {
  position: absolute;
  right: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
}
.src {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  font-size: 13px;
}
.src__img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}
.src span:nth-child(2) {
  flex: 1;
}
.src__add {
  margin-top: 4px;
}
.voyage {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(70, 121, 138, 0.14);
  color: var(--info);
  font-size: 12.5px;
  font-weight: 600;
}
.voyage__line {
  position: relative;
  height: 2px;
  border-top: 2px dashed var(--song-500);
}
.voyage__line i {
  position: absolute;
  top: -13px;
  transform: translateX(-50%);
  color: var(--song-700);
}
.voyage > b {
  grid-column: 1 / -1;
  text-align: center;
}
.cargo {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.crate {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  min-height: 70px;
  padding: 6px 4px;
  border: 1px solid var(--paper-400);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--paper-50), var(--paper-200));
  font-size: 12px;
}
.crate .bar {
  width: 80%;
  height: 3px;
}
.crate.is-empty {
  border-style: dashed;
  background: transparent;
  color: var(--muc-400);
}
.route {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}
.route li {
  position: relative;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 8px;
  padding: 0 0 12px;
}
.route li + li::before {
  content: '';
  position: absolute;
  left: 14px;
  top: -12px;
  height: 14px;
  border-left: 2px dotted var(--song-500);
}
.route__dot {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--paper-50);
  box-shadow: inset 0 0 0 1.5px var(--song-500);
  color: var(--song-700);
  font: 700 13px/1 var(--font-num);
}
.route li.is-next .route__dot {
  background: var(--song-500);
  color: var(--paper-50);
  box-shadow: 0 0 0 3px rgba(70, 121, 138, 0.3);
}
.route b {
  font-size: 13px;
}
.route__now {
  margin-left: 6px;
  color: var(--info);
  font-weight: 700;
}
.route__acts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.act {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 26px;
  padding: 0 7px 0 4px;
  border-radius: 999px;
  background: var(--paper-50);
  box-shadow: inset 0 0 0 1px var(--paper-400);
  font-size: 12px;
}
.act--sell .glyph {
  color: var(--good-ui);
}
.ship__btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.hint {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 10px 0 0;
  color: var(--text-2);
  font-size: 12px;
}
.glyph--inline {
  display: inline-block;
  vertical-align: -2px;
}

/* ---------------------------------------------------------------- floating cards (chat, players) and popovers */
.fc {
  width: 330px;
  max-height: var(--fc-max, 60%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.fc__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 6px 12px;
}
.fc__head h3 {
  flex: 1;
  margin: 0;
  color: var(--title);
  font: 700 17px var(--font-head);
}
.fc__sub {
  color: var(--text-muted);
  font-size: 12px;
}
.chat__log {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 2px 14px 8px;
  overflow: auto;
  list-style: none;
  font-size: 13px;
}
.chat__log .is-sys {
  color: var(--info);
  font-style: italic;
}
.chat__input {
  display: flex;
  gap: 6px;
  padding: 6px 10px 10px;
}
.chat__input input {
  flex: 1;
  min-width: 0;
  min-height: max(34px, var(--tap));
  padding: 0 10px;
  border: 1px solid var(--paper-400);
  border-radius: 7px;
  background: var(--paper-50);
}
.chat__input .orb {
  --orb: max(34px, var(--tap));
}
.plist {
  display: grid;
  margin: 0;
  padding: 0 12px;
  list-style: none;
}
.plist li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: max(40px, var(--tap));
  border-bottom: 1px solid var(--paper-300);
  font-size: 13.5px;
}
.plist li small {
  color: var(--text-muted);
}
.plist li .num {
  margin-left: auto;
  color: var(--text-2);
  font-size: 12.5px;
}
.plist__sw {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  box-shadow: 0 0 0 1px var(--then-900);
  flex: none;
}
.plist__on {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--la-ui);
  flex: none;
}
.plist__on.is-off {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--muc-400);
}
.plist__foot {
  display: flex;
  gap: 6px;
  padding: 10px 12px 12px;
}
.pop {
  position: absolute;
  z-index: 30;
  top: calc(var(--tb-h) + 6px);
  border-width: 3px;
}
.pop--notices,
.pop--menu {
  right: 12px;
  width: 320px;
  padding: 6px;
}
.pop--more,
.pop--good {
  left: var(--pop-x, 40%);
  width: var(--pop-w, 300px);
  padding: 10px 12px 12px;
}
.pop__title {
  margin-bottom: 6px;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
}
.more__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
  padding: 4px;
  border-radius: 8px;
  background: var(--then-800);
}
.nrow,
.mrow {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--paper-300);
  font-size: 13px;
}
.nrow span:last-child {
  display: grid;
  line-height: 1.25;
}
.nrow small,
.mrow small {
  color: var(--text-muted);
  font-size: 11.5px;
}
.mrow span {
  flex: 1;
  font-weight: 600;
}
.mrow > .glyph {
  color: var(--title);
}
.nrow__i {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--paper-300);
}
.nrow--warn .nrow__i {
  background: var(--nghe-500);
  color: var(--then-900);
}
.nrow--info .nrow__i {
  background: var(--song-500);
  color: var(--paper-50);
}
.nrow--ok .nrow__i {
  background: var(--la-ui);
  color: var(--paper-50);
}
.pmenu__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  color: var(--title);
  font-family: var(--font-title);
  font-size: 16px;
}
.gpop__head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.gpop__head > div {
  display: grid;
}
.gpop__head b {
  color: var(--title);
  font: 700 18px var(--font-head);
}
.gpop__head small {
  color: var(--text-muted);
  font-size: 12px;
}
.gpop__stock {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 8px 0 4px;
}
.gpop__stock .num:first-child {
  font-size: 22px;
}
.gpop__stock .num:last-child {
  margin-left: auto;
}
.gpop__dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  margin: 10px 0;
  font-size: 12.5px;
}
.gpop__dl dt {
  color: var(--text-muted);
}
.gpop__dl dd {
  margin: 0;
}
.gpop__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---------------------------------------------------------------- modal */
.modal {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(9, 8, 6, 0.5);
}
.mbox {
  display: flex;
  flex-direction: column;
  width: min(640px, 100%);
  max-height: min(88vh, 780px);
  overflow: hidden;
}
.modal__body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 4px 16px 14px;
}
.spotlight {
  position: absolute;
  z-index: 40;
  border-radius: 12px;
  box-shadow: 0 0 0 200vmax rgba(9, 8, 6, 0.6), 0 0 0 3px var(--vang-200), 0 0 18px 6px rgba(239, 200, 112, 0.7);
  pointer-events: none;
}
.spotlight__label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 14px);
  transform: translateX(-50%);
  padding: 6px 12px;
  border: 1px solid var(--then-900);
  border-radius: 999px;
  background: var(--red);
  box-shadow: inset 0 0 0 1px var(--vang-500), var(--shadow);
  color: var(--paper-50);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

/* workshop: productivity + status on top, inputs → output below */
.prodtop {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.prodtop__t {
  flex: 1;
  display: grid;
  gap: 4px;
  min-width: 0;
}
.prodtop__t .status {
  margin: 0;
  justify-self: start;
  padding: 4px 10px;
}
.prodtop__t small {
  color: var(--text-2);
  font-size: 11.5px;
}
.cycle {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cycle .bar {
  flex: 1;
}
.cycle .num {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}
.flow2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.flow2__col {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.flow2__col > small {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.flow2__arrow {
  color: var(--muc-500);
}
.buf .gicon {
  width: 34px;
  height: 34px;
}
