/* Build menu (bottom centre): black-lacquer tab strip, dó-paper body; sections of square tiles and production-chain
   diagrams (tiles joined by connectors carrying good tokens to the final good's medallion). Geometry: --tile etc. */

.build-menu {
  position: absolute;
  bottom: var(--gap);
  left: var(--menu-x, 50%);
  z-index: 3;
  transform: translateX(-50%);
}
.build-menu__inner {
  zoom: var(--menu-zoom, 1);
  --tile: 48px;
  --lane-gap: 10px;
  --page-h: calc(3 * var(--tile) + 2 * var(--lane-gap));
  border-color: var(--then-700);
  overflow: visible;
}
.build-menu__tabs {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding: 6px 10px 0;
  background: var(--lacquer-black);
  border-bottom: 2px solid var(--son-500);
  box-shadow: 0 1px 0 var(--vang-400);
  border-radius: 4px 4px 0 0;
}
.build-tab {
  position: relative;
  top: 2px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  min-width: 44px;
  padding: 0 10px 0 6px;
  border: 1px solid var(--then-600);
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  background: linear-gradient(180deg, #2b2620, #191612);
  color: var(--paper-200);
  font-size: 12.5px;
  font-weight: 600;
}
.build-tab.is-on {
  height: 42px;
  border-color: var(--vang-500);
  background: var(--lacquer-red);
  color: var(--paper-50);
  box-shadow: inset 0 1px 0 rgba(239, 200, 112, 0.4);
}
.build-tab .portrait {
  width: 26px;
  height: 26px;
  box-shadow: 0 0 0 1.5px var(--tone, var(--vang-400));
}
.build-tab__name {
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 700;
  color: var(--vang-200);
  white-space: nowrap;
}
.build-tab__count {
  font-size: 12px;
  color: var(--paper-200);
}
.build-tab.is-locked {
  color: var(--muc-400);
}
.build-tab.is-locked .portrait {
  filter: grayscale(1) brightness(0.8);
}
.build-tab__dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--nghe-500);
  box-shadow: 0 0 0 1.5px var(--then-900);
}
.build-menu__spacer {
  flex: 1;
}
.build-menu__help {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  margin-bottom: 4px;
  padding: 0 6px;
  border: 1px solid var(--then-600);
  border-radius: 6px;
  background: transparent;
  color: var(--paper-200);
}
.build-menu__body {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 8px 12px 10px;
  border-radius: 0 0 4px 4px;
  overflow: hidden;
}
.build-section {
  display: flex;
  flex-direction: column;
  padding: 0 12px;
}
.build-section + .build-section {
  border-left: 1px solid var(--paper-400);
}
.build-section:first-child {
  padding-left: 2px;
}
.build-section:last-child {
  padding-right: 2px;
}
.build-section__head {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 20px;
  margin-bottom: 6px;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}
.build-tiles {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(var(--rows, 3), var(--tile));
  gap: var(--lane-gap) 10px;
  align-content: center;
  height: var(--page-h);
}
.tile {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--tile);
  height: var(--tile);
  padding: 0;
  border: 1px solid var(--paper-400);
  border-radius: 7px;
  background: radial-gradient(circle at 50% 40%, var(--paper-50), var(--paper-200));
  box-shadow: 0 1px 2px rgba(36, 27, 18, 0.25);
}
.tile__img {
  width: 92%;
  height: 92%;
  object-fit: contain;
}
.tile__img--good {
  width: 70%;
  height: 70%;
}
.tile--tool {
  color: var(--text-2);
}
.tile.is-temp::before {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px dashed rgba(117, 94, 54, 0.45);
  border-radius: 5px;
  pointer-events: none;
}
.tile__key {
  position: absolute;
  left: -4px;
  bottom: -4px;
  display: grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border: 1px solid var(--muc-500);
  border-radius: 4px;
  background: var(--paper-50);
  color: var(--text-2);
  font: 700 10px/1 var(--font-ui);
}
:root[data-input='touch'] .tile__key {
  display: none;
}
.tile__badge {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--paper-50);
  background: var(--nghe-500);
  color: var(--then-900);
  font: 800 11px/1 var(--font-ui);
}
.tile__badge--short {
  background: var(--paper-50);
  border-color: var(--bad);
}
.tile__badge--short img {
  width: 13px;
  height: 13px;
}
.tile.is-on {
  border-color: var(--son-300);
  box-shadow: 0 0 0 2px var(--son-300), 0 0 0 4px rgba(239, 200, 112, 0.7), 0 4px 10px rgba(36, 27, 18, 0.35);
}
.tile.is-hover {
  border-color: var(--muc-500);
  transform: translateY(-2px);
  box-shadow: 0 0 0 2px var(--vang-400), 0 6px 12px rgba(36, 27, 18, 0.3);
}
.tile.is-suggested {
  box-shadow: 0 0 0 2px var(--ngoc-500), 0 0 0 5px rgba(47, 96, 96, 0.3);
}
.tile.is-locked .tile__img {
  filter: grayscale(1) opacity(0.5);
}
.tile.is-locked::after {
  content: '';
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--then-700) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f6e8c5' stroke-width='2.4'%3E%3Crect x='5' y='10.5' width='14' height='10' rx='2'/%3E%3Cpath d='M8 10.5V8a4 4 0 0 1 8 0v2.5'/%3E%3C/svg%3E") center/10px no-repeat;
}
.build-upgrade {
  display: grid;
  gap: 6px;
  align-content: center;
  height: var(--page-h);
  width: 132px;
}
.build-upgrade__wire {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.build-upgrade__wire .portrait {
  width: 34px;
  height: 34px;
}
.build-upgrade__wire .glyph {
  color: var(--muc-500);
}
.build-upgrade__note {
  color: var(--text-2);
  font-size: 11.5px;
  text-align: center;
  line-height: 1.25;
}
.build-upgrade .btn {
  min-height: 30px;
  font-size: 12px;
}

/* chains */
.chains {
  display: flex;
  flex-direction: column;
}
.chains__head {
  justify-content: space-between;
}
.chains__dots {
  display: inline-flex;
  gap: 5px;
}
.chains__dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 1px solid var(--muc-500);
  border-radius: 50%;
  background: transparent;
}
.chains__dot.is-on {
  background: var(--son-400);
  border-color: var(--son-400);
}
.chain-page {
  display: flex;
  gap: 22px;
  height: var(--page-h);
}
.chain-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--lane-gap);
}
.chain {
  position: relative;
  flex: none;
}
.chain__wires {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}
.chain__wires path {
  fill: none;
  stroke: var(--muc-500);
  stroke-width: 1.6;
}
.chain__wires path.is-feed {
  stroke-dasharray: 3 3;
}
.chain.is-hot .chain__wires path {
  stroke: var(--son-300);
  stroke-width: 2.2;
}
.chain > .tile,
.chain__token,
.chain__end,
.chain__feed {
  position: absolute;
}
.chain__token {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--paper-50);
  box-shadow: 0 0 0 1px var(--muc-500);
}
.chain__token img {
  width: 16px;
  height: 16px;
}
.chain__end {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--paper-50), var(--paper-200));
  box-shadow: 0 0 0 2px var(--vang-500), 0 0 0 3px var(--then-700);
}
.chain__end img {
  width: 24px;
  height: 24px;
}
.chain.is-short .chain__end {
  box-shadow: 0 0 0 2px var(--nghe-500), 0 0 0 3px var(--then-700);
}
.chain__feed {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1.5px dashed var(--muc-500);
  border-radius: 50%;
  background: var(--paper-50);
}
.chain__feed img {
  width: 22px;
  height: 22px;
}
.build-locked {
  display: grid;
  place-items: center;
  gap: 6px;
  height: var(--page-h);
  width: 360px;
  color: var(--text-muted);
  text-align: center;
}

/* hover card (BuildCard) */
.build-card {
  position: absolute;
  z-index: 8;
  width: 296px;
  bottom: var(--card-bottom, 280px);
  left: var(--card-x, 50%);
}
.build-card .panel__head {
  padding: 12px 12px 4px 14px;
}
.build-card__img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex: none;
}
.build-card__body {
  display: grid;
  gap: 8px;
  padding: 4px 14px 12px;
}
.cost-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.cost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 8px 0 4px;
  border: 1px solid var(--paper-400);
  border-radius: 999px;
  background: var(--paper-50);
  font-size: 13px;
}
.cost img,
.cost .coin {
  width: 20px;
  height: 20px;
}
.cost.is-short {
  border-color: var(--bad);
  color: var(--bad);
}
.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 10px;
  margin: 0;
}
.fact {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 12.5px;
}
.fact .glyph {
  color: var(--text-2);
}
.fact dt {
  color: var(--text-muted);
  font-weight: 500;
}
.recipe {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(213, 183, 143, 0.35);
  font-size: 12.5px;
}
.recipe img {
  width: 26px;
  height: 26px;
}
.recipe__op {
  color: var(--text-muted);
  font-weight: 700;
}
.recipe__time {
  margin-left: auto;
  color: var(--text-2);
}
.build-card__desc {
  margin: 0;
  color: var(--text-2);
  font-size: 12.5px;
}
.build-card__foot {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-title);
  font-size: 12px;
  font-weight: 600;
}
.build-card::after {
  content: '';
  position: absolute;
  left: var(--card-arrow, 50%);
  bottom: -11px;
  width: 14px;
  height: 14px;
  background: var(--paper-100);
  border-right: 4px solid var(--frame);
  border-bottom: 4px solid var(--frame);
  transform: translateX(-50%) rotate(45deg);
}
.chains__scroll {
  padding-right: 4px;
}
.build-menu.is-collapsed .build-menu__body {
  display: none;
}
.build-menu.is-collapsed .build-menu__tabs {
  border-bottom: 0;
  border-radius: 4px;
  padding-bottom: 4px;
}
.build-menu.is-collapsed .build-tab {
  top: 0;
  border-bottom: 1px solid var(--then-600);
  border-radius: 7px;
}
.build-menu__open {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: max(30px, var(--tap));
  margin-bottom: 4px;
  padding: 0 10px;
  border: 1px solid var(--vang-600);
  border-radius: 6px;
  background: var(--lacquer-red);
  color: var(--vang-200);
  font-weight: 600;
  font-size: 12.5px;
}
.build-card.is-detached::after {
  display: none;
}
