/* An equal-radius ring, with image-only targets and desktop hover labels. */
.buildMenu {
  position: fixed;
  inset: 0;
  z-index: 16;
  background: rgba(22, 32, 16, 0.72);
  pointer-events: auto;
  touch-action: none;
  zoom: 1;
}
body.bchoose .cmdbar {
  z-index: 18;
}
.buildMenu[hidden],
body.bchoose .dock {
  display: none;
}
.buildCircle {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(239, 225, 186, 0.13) 35%, rgba(239, 225, 186, 0.04) 60%, transparent 69%);
}
.buildCategory {
  position: absolute;
  transform: translate(-50%, -50%);
  width: var(--category-size);
  height: var(--category-size);
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  box-shadow: none;
  color: #fff4dc;
  font: 500 13px/1.08 Rubik, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.buildCategory img {
  width: var(--category-art);
  height: var(--category-art);
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 2px #18200d);
}
.buildCategory span {
  position: absolute;
  top: calc(100% - 16px);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  flex: none;
  width: max-content;
  max-width: 104px;
  padding: 1px 3px;
  border-radius: 5px;
  background: #25311c;
  text-align: center;
}
.buildCategory[data-category='food'] span,
.buildCategory[data-category='wonder'] span {
  max-width: var(--category-size);
}
.buildCategory:focus-visible {
  background: rgba(255, 241, 187, 0.16);
  outline: 2px solid #ffda72;
  outline-offset: 2px;
}
@media (hover: hover) and (pointer: fine) {
  .buildCategory:hover {
    background: rgba(255, 241, 187, 0.16);
    outline: 2px solid #ffda72;
    outline-offset: 2px;
    z-index: 1;
  }
  .buildCategory:hover span {
    visibility: visible;
    opacity: 1;
  }
}
.buildCategory:active {
  filter: brightness(1.15);
}
.buildCentre {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: var(--return-size, 64px);
  color: #fff4dc;
  text-align: center;
}
.buildCentre h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  margin: 0;
}
.buildDrawerHead button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid #9e8158;
  border-radius: 12px;
  background: #f5e7cb;
  color: #392716;
  font: 500 14px Rubik, sans-serif;
  cursor: pointer;
}
.buildDrawerHead {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 0 6px;
}
.buildDrawerHead button {
  padding: 4px 12px;
}
/* Only construction/placement controls use the supplied check and cross. */
button.buildAction,
.placeBar button.buildAction,
.trackBar button.buildAction,
.toolChip button.buildAction {
  border: 0;
  border-image: none;
  border-radius: 50%;
  padding: 0;
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 3px 1px rgba(24, 16, 8, 0.4));
}
button.buildAction img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
button.buildAction:disabled {
  filter: grayscale(1);
  opacity: 0.55;
  cursor: not-allowed;
}
button.buildAction:focus-visible {
  outline: 3px solid #ffe497;
  outline-offset: 2px;
}
body.bchoose .hint,
body.bchoose .toolChip,
body.bchoose .qbub {
  visibility: hidden;
}
/* A phone rotated past the drawer's width breakpoint still needs its placement controls. */
@media (pointer: coarse) and (max-height: 699px) and (min-width: 701px) {
  body.placing:not(.popen):not(.qopen):is(:not(.bopen), .bmini) .placeBar:not([hidden]) {
    display: flex !important;
  }
  body.tracking:not(.popen):not(.qopen):is(:not(.bopen), .bmini) .trackBar:not([hidden]) {
    display: block !important;
  }
}
/* In short touch landscapes, stacked HUD/name/editor rows otherwise consume the entire map height. */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  :is(body.placing, body.tracking, body.incamp) .hudL > :not(.rpill) {
    display: none !important;
  }
  :is(body.placing, body.tracking, body.incamp) .cmdbar {
    padding: 4px 6px;
    bottom: max(6px, env(safe-area-inset-bottom, 0px));
  }
  :is(body.placing, body.tracking, body.incamp) .cmdbar .cb {
    height: 52px;
    min-height: 44px;
    padding: 2px 4px;
  }
  :is(body.placing, body.tracking, body.incamp) .cmdbar .cb.big {
    height: 60px;
    width: 64px;
    margin-top: -8px;
  }
  body.placing .placeBar {
    left: 12px;
    right: 12px;
    bottom: calc(var(--cmdH, 76px) + 8px);
    transform: none;
    align-items: center;
    gap: 8px;
  }
  body.placing .placeBar .pbName {
    position: static;
    flex: 1;
    min-width: 0;
    max-height: 74px;
    overflow-y: auto;
    box-sizing: border-box;
    transform: none;
    white-space: normal;
    touch-action: pan-y;
  }
  body.placing .placeBar > button {
    flex: none;
    width: 56px;
    height: 56px;
  }
  body.tracking:not(.popen):not(.qopen):is(:not(.bopen), .bmini) .trackBar:not([hidden]) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    align-items: center;
    gap: 8px;
  }
  body.tracking .trackBar .tbTop {
    min-width: 0;
    margin: 0;
  }
  body.tracking .trackBar .tbText small {
    font-size: 13px;
  }
  body.tracking .trackBar .tbBtns .btn {
    min-height: 44px;
    white-space: normal;
  }
}
/* A category is a modal item picker; category navigation belongs only to the radial chooser. */
body.bopen:not(.bmini):not(.bchoose) .dock {
  display: flex;
}
.dock {
  position: fixed;
  inset: 0;
  z-index: 17;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(22, 32, 16, 0.72);
  pointer-events: auto;
  zoom: 1;
}
.dock .tray {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  grid-template-rows: auto minmax(0, 1fr);
  width: calc(100% - 24px);
  height: calc(100dvh - 24px);
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border-width: 16px;
  overflow: hidden;
}
.buildDrawerHead {
  grid-column: 1 / -1;
  grid-row: 1;
  align-items: center;
  padding: 0 4px 8px;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
}
.buildDrawerHead h2 {
  grid-column: 2;
  min-width: 0;
  margin: 0;
  font: 500 28px/1.15 Rubik, sans-serif;
  text-align: center;
  overflow-wrap: anywhere;
}
#buildDrawerClose,
.buildMenuClose {
  flex: none;
  border: 0;
  border-image: none;
  padding: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}
#buildDrawerClose {
  grid-column: 3;
  width: 56px;
  height: 56px;
  padding: 7px;
  background: var(--stone-round);
}
.buildMenuClose {
  width: var(--return-size, 64px);
  height: max(44px, calc(var(--return-size, 64px) * 0.82));
}
#buildDrawerClose img,
.buildMenuClose img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
#buildDrawerClose:focus-visible,
.buildMenuClose:focus-visible {
  outline: 3px solid #ffda72;
  outline-offset: 2px;
}
.dock #items {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  align-content: start;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 12px;
  touch-action: pan-y;
  overscroll-behavior: contain;
}
.dock .item {
  width: auto;
  min-width: 0;
  min-height: 156px;
  box-sizing: border-box;
}
/* Cards below the fold are laid out and painted only when they scroll near (a long tab froze a phone on its first draw) */
.dock #items > .item {
  content-visibility: auto;
  contain-intrinsic-size: auto 156px;
}
/* Path cards: the picture keeps its own box and the name sits at the bottom of the card, never over the picture. */
.dock #items > .item .tool-ico {
  flex: 1 0 auto;
  height: 96px;
  overflow: hidden;
}
.dock #items > .item .tool-ico img.path-thumb {
  height: 100%;
  object-fit: contain;
}
.dock #items > .item .tool-ico + b {
  margin-top: auto;
}
.buildTools {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 640px;
  justify-self: center;
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(90, 58, 30, 0.22);
}
.dock .buildTools .item {
  min-height: 0;
  padding: 6px;
  gap: 5px;
  border: 0;
  border-image: none;
  border-radius: 14px;
  background: transparent;
  box-shadow: none;
  filter: none;
  text-shadow: none;
  justify-content: flex-start;
}
.buildTools .tool-ico {
  width: min(100%, 96px);
  height: auto;
  aspect-ratio: 1;
  background: transparent;
}
.buildTools .tool-ico img {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 3px 1px rgba(58, 36, 20, 0.35));
}
.buildTools .item b {
  min-height: 0;
  max-width: 100%;
  font-size: clamp(13px, 3.8vw, 16px);
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.buildTools .item span {
  font-size: 13px;
  line-height: 1.2;
  color: var(--rim);
}
.dock .buildTools .item[aria-pressed='true'] {
  background: rgba(99, 130, 48, 0.12);
  outline: 2px solid rgba(87, 118, 42, 0.55);
  outline-offset: -2px;
}
.buildTools .item:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 0;
}
.buildTools .item:active .tool-ico {
  transform: translateY(2px);
}
.dock .scrollHint {
  grid-column: 1 / -1;
}
.dock .binfo {
  grid-column: 2;
  grid-row: 2;
  min-height: 0;
  overflow-y: auto;
}
.dock .tray::after {
  display: none;
}
@media (max-width: 850px) {
  .dock .tray {
    grid-template-columns: minmax(0, 1fr);
    width: calc(100% - 16px);
    height: calc(100dvh - 16px);
    border-width: 12px;
  }
  .dock .binfo {
    display: none;
  }
  .buildDrawerHead h2 {
    font-size: 24px;
  }
}
/* Desktop: the item picker is a panel at the bottom, above the command bar, and the park stays visible above it. Phones
   and touch screens keep the full-screen picker. */
@media (min-width: 701px) and (pointer: fine) {
  body.bopen:not(.bmini):not(.bchoose) .dock {
    inset: auto 0 var(--cmdH, 110px) 0;
    padding: 0 12px;
    background: transparent;
    align-items: flex-end;
    pointer-events: none;
  }
  .dock .tray {
    pointer-events: auto;
    width: min(1100px, 100%);
    height: min(340px, 46vh);
    border-width: 14px;
  }
  .buildDrawerHead {
    padding-bottom: 4px;
  }
  .buildDrawerHead h2 {
    font-size: 22px;
  }
  .dock #items {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    grid-auto-rows: max-content;
    gap: 8px;
    padding: 8px;
  }
  .dock #items > .item {
    min-height: 0;
  }
  .dock #items > .item .tool-ico,
  .dock #items > .item > img {
    height: 56px;
  }
}
