/* Building inspector (#32, machine sheet #153) and the build-mode bits of the floor (ghost label, palette menu). Reuses the shared
   cards and chips, and Market's segmented control. The machine sheet follows iOS BuildingPanel: header, stat strip, verdict, then
   Operators and Upgrade as buy rows. */
.panel-body.bld { container-type: inline-size; --row: #13325A; --link: #9FE6DC; --row-hover: #173B66; --on-accent: #2A1A00; }
#sheet:not(.large) .panel-body.bld { padding-bottom: calc(100vh - 470px + 24px); }   /* the sheet shows 470 px, like the iOS detent */
/* A machine's sheet has no title bar on a phone: the header is in the content. */
.navbar.bld-off { display: none; }
.bld-main { position: relative; min-width: 0; }
.bld-view { position: relative; z-index: 1; display: grid; gap: 14px; align-content: start; min-width: 0; }
.bld-none { text-align: center; padding: 24px 0; }
.bld-card { min-width: 0; }
.bld-card p { margin: 0; }
.bld-notice { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: rgba(235,235,245,.6); }
.bld-notice.strong { font-weight: 600; }
.bld-notice.bad { color: #FF5C5C; } .bld-notice.warn { color: var(--orange); } .bld-notice.good { color: var(--good); }

/* The machine's worker stands behind the stat strip's top edge, left of the "..." button: the header is 64 px and the strip 10 px
   below it, and his bottom edge sits 10 px into the strip (iOS: offset y 10 - his height, 60 px from the right). */
.bld-wk { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.bld-wk .worker.machine { right: 60px; bottom: auto; top: calc(74px + 10px - var(--wk-machine-height)); }

/* Header: the tier thumb, the name and the tier pill, and the "..." menu. */
.bld-head { display: flex; align-items: center; gap: 12px; height: 64px; }
.bld-head.slim { height: 44px; justify-content: flex-end; margin-bottom: -8px; }
.bld-head .id { flex: 1; min-width: 0; display: grid; gap: 5px; justify-items: start; }
.bld-head h3 { margin: 0; font-size: 27px; line-height: 1; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bld-head .pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: rgba(243,235,216,.12); font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.bld-head .pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.bld-thumb { flex: none; display: grid; place-items: center; border-radius: 13px; background: rgba(15,42,73,.8); border: 1px solid rgba(243,235,216,.3); }
.bld-thumb.ring { border: 2px solid var(--accent); border-radius: 9px; }
.bld-more { position: relative; flex: none; }
.bld-ell { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(243,235,216,.1); color: var(--ink); }
.bld-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 4; min-width: 180px; padding: 6px; border-radius: 16px; display: grid; background: rgba(40,40,52,.96); border: 1px solid var(--glass-line); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.bld-menu button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 44px; border-radius: 10px; text-align: left; font-size: 15px; white-space: nowrap; }
.bld-menu button:hover { background: rgba(255,255,255,.1); }
.bld-menu button.danger { color: var(--stamp); }

/* The stat strip: one card, three columns with hairline dividers. */
.bld-statwrap { margin-top: -4px; }
.bld-stats { display: flex; background: var(--row); border: 1px solid rgba(243,235,216,.1); border-radius: 12px; }
.bld-stats .cell { flex: 1; min-width: 0; padding: 8px 12px; display: grid; gap: 2px; }
.bld-stats .cell + .cell { border-left: 1px solid rgba(243,235,216,.1); }
.bld-stats .lbl { display: flex; align-items: center; gap: 5px; color: rgba(243,235,216,.7); font: 700 13px/1.1 var(--din); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.bld-stats .val { font-size: 22px; line-height: 1.1; color: var(--ink); white-space: nowrap; }
.bld-stats .good .val { color: var(--good); } .bld-stats .warn .val { color: var(--orange); }

/* The verdict: one line with a 3 px rule at its left, an icon, and a link to the bottleneck or a lesson. */
.bld-verdict { position: relative; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 12px; margin-top: -6px; border-radius: 12px; background: var(--row); font-size: 13.5px; font-weight: 600; color: var(--ink); --rule: var(--teal); }
.bld-verdict::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 12px 0 0 12px; background: var(--rule); }
.bld-verdict.bad { --rule: var(--stamp); background: rgba(232,85,62,.16); }
.bld-verdict.done { --rule: var(--accent); }
.bld-verdict .ic { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: var(--rule); background: color-mix(in srgb, var(--rule) 20%, transparent); }
.bld-verdict .txt { flex: 1; min-width: 0; }
.bld-verdict .go { flex: none; display: inline-flex; align-items: center; gap: 3px; min-height: 44px; color: var(--accent); font-size: 13px; font-weight: 700; }
.bld-gen2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 0 12px; margin-top: -6px; }
.bld-gen2 .notes { display: grid; gap: 4px; }

/* Section labels and the lesson link. */
.bld-sec { display: flex; align-items: center; gap: 8px; min-height: 20px; margin-bottom: -8px; }
.bld-sec b { font-size: 15px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink); font-weight: 700; }
.bld-sec .cap { font-size: 12px; color: rgba(243,235,216,.72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bld-link { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 12px 0; margin: -12px 0 -12px auto; color: var(--link); font-size: 12px; font-weight: 600; }
.bld-link span { white-space: nowrap; }
.bld-sec + .bld-rows { margin-top: 0; }

/* Buy rows: a lead, the title with what it adds, and the price chip. */
.bld-rows { display: grid; gap: 6px; }
.bld-stack { display: grid; gap: 4px; }
.bld-brow { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 56px; padding: 8px 9px; border-radius: 12px; background: var(--row); border: 1px solid rgba(243,235,216,.1); text-align: left; color: var(--ink); }
.bld-brow.poor { opacity: .6; }
.bld-brow:not(.done):not(:disabled):hover { background: var(--row-hover); }
.bld-brow .txt { flex: 1; min-width: 0; display: grid; gap: 1px; }
.bld-brow .txt b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bld-brow .eff { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bld-brow .eff.good { color: var(--teal); } .bld-brow .eff.bad { color: var(--stamp); } .bld-brow .eff.none { color: rgba(243,235,216,.62); }
.bld-brow .price { flex: none; display: inline-flex; align-items: baseline; gap: 1px; padding: 5px 9px; border-radius: 999px; background: rgba(243,235,216,.16); color: var(--ink); font-size: 14px; }
.bld-brow .price .num { font-size: 14px; }
.bld-brow .price small { font-size: 11px; font-weight: 600; opacity: .75; }
.bld-brow .price.amber { background: var(--accent); color: var(--on-accent); }
.bld-dot { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: rgba(243,235,216,.6); background: rgba(243,235,216,.16); }
.bld-dot.on, .bld-dot.amber { color: var(--accent); background: rgba(242,165,65,.16); }
.bld-dot.on { background: rgba(242,165,65,.16); }
.bld-dot.amber { background: rgba(242,165,65,.18); }
.bld-dot.teal { color: var(--teal); background: rgba(63,167,160,.18); }
.bld-short { margin: 0 9px; font-size: 12px; font-weight: 600; color: var(--stamp); }
/* "Remove one": a small line with a 44 px target; the negative margin keeps the next section's usual gap (iOS padding.bottom -14). */
.bld-rm { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 6px 9px; margin-bottom: -14px; font-size: 12px; font-weight: 600; color: rgba(243,235,216,.72); text-align: left; }
.bld-rm .saves { color: var(--teal); }

.bld-part { display: flex; align-items: center; gap: 12px; }
.bld-part .frame { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 12px; background: rgba(15,42,73,.6); border: 1px solid rgba(243,235,216,.3); }
.bld-part .partname { display: flex; align-items: center; gap: 6px; font-size: 17px; }
.bld-part .price { display: block; font-size: 15px; font-weight: 600; }
.bld-text { margin: 0; font-size: 16px; color: rgba(235,235,245,.6); line-height: 1.35; }
.bld-row { display: flex; align-items: flex-start; gap: 10px; text-align: left; width: 100%; color: var(--ink); }
.bld-row:disabled { opacity: .5; }
.bld-row .radio { color: rgba(235,235,245,.6); margin-top: 1px; }
.bld-row.on .radio { color: #FFD60A; }
.bld-row .txt { flex: 1; min-width: 0; display: grid; gap: 2px; }
.bld-row .txt b { font-size: 15px; font-weight: 600; }
.bld-row .txt small { font-size: 12px; }
.bld-spark { flex: none; fill: none; stroke: var(--accent); stroke-width: 1.6; }
.bld-rejects { display: grid; gap: 6px; }
.bld-rejects b { font-size: 15px; font-weight: 600; }

/* The ghost's label over the floor (PreviewTag): the marginal effect on one line, cost and caveats on the next. */
#ghosttag { position: absolute; transform: translate(-50%, -50%); z-index: 3; pointer-events: none; display: grid; gap: 1px; justify-items: center; text-align: center;
  padding: 6px 12px; border-radius: 12px; background: rgba(15,42,73,.92); border: 2px solid var(--good); white-space: nowrap; max-width: calc(100% - 8px); }
#ghosttag.warn { border-color: var(--accent); }
#ghosttag b { font-size: 19px; color: var(--ink); } #ghosttag b.loss { color: #FF5C5C; }
#ghosttag span { font: 700 11px var(--din); color: rgba(243,235,216,.75); }
#ghosttag.warn span { color: var(--accent); }
#ghosttag[hidden] { display: none; }

/* The Machines menu has many rows once docks and stations are in: scroll it, with dividers and greyed rows. */
.menu { max-height: min(60vh, 420px); overflow-y: auto; }
.menu hr { border: 0; border-top: .5px solid rgba(255,255,255,.18); margin: 4px 8px; width: auto; }
.menu button:disabled { opacity: .4; }
.menu button img.art { flex: none; }

@media (prefers-reduced-motion: reduce) { .bld-view * { transition: none !important; } }
