/* Rust.camp Wiki – page layout for the guides (recycling, blueprints, underwater lab rooms). Chips, spacing, tables and
   cards come from wiki.css / world.css (design contract); only page-specific grid / layout rules live here. Owner: guides agent. */

/* ---------- recycling: complete list under the top 12 ---------- */
.w-rec__more { margin-top: var(--sp-3); }
.w-rec__all[hidden] + .w-more { border-top: 0; }
.w-rec__tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: var(--sp-3); border-bottom: 1px solid var(--rc-line); }
.w-rec__search { flex: 1 1 240px; max-width: 420px; }
.w-rec__item { display: inline-flex; align-items: center; gap: var(--sp-2); min-width: 0; min-height: 40px; color: inherit; }
.w-rec__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.w-rec__tbl td.w-rec__on { font-weight: 700; color: var(--rc-ink); }
.w-rec__stack { display: inline-flex; align-items: center; gap: var(--sp-1); }
.w-rec__tbl td.r { font-variant-numeric: tabular-nums; }
/* phones: stacked rows; world.css ".w-tbl:has(5 x th.r) .r { width: 1% }" must not shrink the stacked cells (request C2) */
@media (max-width: 639px) {
  :is(.w-rec__tbl, .w-farm__stages, .w-gd__tbl).w-tbl--list td.r { width: auto !important; }
  /* measured AI costs: wide "p50 / p95" values, one label-value line each so no label has to break */
  .w-gd__tbl.w-tbl--list tr { grid-template-columns: minmax(0, 1fr); }
  .w-gd__tbl.w-tbl--list td[data-label]::before { overflow-wrap: normal; }
}

/* ---------- blueprints: tiles never grow past their column (long bench chips ellipsize); two-column tiles: an odd count lets
   "Unlocks" span the row (no orphan); in an even row its plate steps aside on phones so "Workbench 1" stays on one line ---------- */
:is(#how, .w-bp, .w-gd__facts) .w-tile { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 759px) { .w-tiles > .w-bp__unl:first-child:nth-last-child(odd) { grid-column: 1 / -1; } }
.w-bp__unl { container-type: inline-size; }
.w-bp__unl .w-tile__value { white-space: nowrap; }
@container (max-width: 240px) { .w-bp__unl .w-tile__value { font-size: 22px; } }
@container (max-width: 190px) { .w-bp__unl .w-tile__row > .plate { display: none; } }

/* ---------- blueprints: per-run definition chip ---------- */
.w-bp__def { display: inline-block; max-width: 100%; }
.w-bp__def > summary { list-style: none; cursor: pointer; }
.w-bp__def > summary::-webkit-details-marker { display: none; }
.w-bp__def[open] > summary { color: var(--rc-ink); border-color: var(--rc-line-2); }
.w-bp__defbody { margin: var(--sp-2) 0 0; max-width: 62ch; font-size: 13px; line-height: 1.45; color: var(--rc-ink-2); }
.w-sect__head .w-bp__def, .w-bp__sub .w-bp__def { margin-left: auto; text-align: right; }
.w-sect__head .w-bp__defbody, .w-bp__sub .w-bp__defbody { text-align: left; }

/* ---------- blueprints: sources (chance per crate + where the crates stand) ---------- */
.w-bp__srcgrid { --min: 260px; }
.w-bp__src { display: grid; align-content: start; gap: var(--sp-2); padding: 14px; min-width: 0; }
.w-bp__srcname { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; color: inherit; }
.w-bp__wheres { padding-top: var(--sp-2); border-top: 1px solid var(--rc-line); }
.w-bp__where { gap: 6px; max-width: 100%; }
.w-bp__where b { font-weight: 700; color: var(--rc-ink); font-variant-numeric: tabular-nums; }
.w-bp__wname { overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* ---------- blueprints: event crates ---------- */
.w-bp__evgrid { --min: 260px; }
.w-bp__ev { display: flex; align-items: flex-start; gap: var(--sp-3); padding: 14px; min-width: 0; color: inherit; }
.w-bp__evtxt { display: grid; gap: 6px; min-width: 0; }
.w-bp__evname { font-weight: 700; }
.w-bp__evval { display: inline-flex; align-items: center; gap: 6px; }
.w-bp__evval b { font-family: var(--rc-font-display); font-weight: 800; font-size: 22px; line-height: 1; }

/* ---------- blueprints: best monuments (parts under the value); stretched tiles keep their content at the top ---------- */
.w-bp .w-mtile { align-content: start; }
/* phones and tablets: photo left, name / value / parts right (stacked two-column tiles cut every part chip on phones and
   stretch to tall photo cards on tablets); one tile per row on phones, two on tablets */
@media (min-width: 640px) and (max-width: 979px) { .w-bp .w-grid.w-bp__best { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 979px) {
  .w-bp .w-grid.w-bp__best { gap: var(--sp-2); }
  @media (max-width: 639px) { .w-bp .w-grid.w-bp__best { grid-template-columns: minmax(0, 1fr); } }
  .w-bp__best > .w-mtile { grid-template-columns: 104px minmax(0, 1fr); align-items: start; gap: var(--sp-3); padding: var(--sp-2); }
  .w-bp__best .w-mtile__media { aspect-ratio: 1 / 1; }
  .w-bp__best .w-ocard__frame { padding: var(--sp-2); font-size: 13px; line-height: 1.2; }   /* the name plate behind the photo fits the square */
  .w-bp__best .w-mtile__row { padding: 2px 0 0; gap: var(--sp-1); }
  .w-bp__best .w-mtile__name { font-size: 14px; }
}
.w-bp__parts { margin-top: 2px; }

/* ---------- blueprints: per monument, one line per currency ---------- */
.w-pm { display: flex; flex-direction: column; }
.w-pm__link { display: block; color: inherit; }
.w-pm__lines { display: grid; gap: var(--sp-2); }
.w-pm__line { display: grid; gap: 6px; padding: var(--sp-2) 10px; border-radius: var(--rc-radius-sm); background: var(--rc-glass-2); min-width: 0; }
.w-pm__line--zero { background: transparent; border: 1px dashed var(--rc-line); }
.w-pm__cur { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.w-pm__curname { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; color: var(--rc-ink-2); }
.w-pm__v { font-family: var(--rc-font-display); font-weight: 800; font-size: 18px; line-height: 1; white-space: nowrap; }
.w-pm__line--zero .w-pm__v { color: var(--rc-ink-3); font-weight: 600; }
.w-pm__line .w-chips .w-chip { max-width: 100%; }
@media (max-width: 639px) {
  .w-bp .w-pmgrid { grid-template-columns: minmax(0, 1fr); }
  .w-pm .w-ocard__media { aspect-ratio: 21 / 9; }   /* a shorter photo band: ~25 cards on one phone page */
}

/* ---------- underwater lab: room types ---------- */
.w-rt { display: flex; flex-direction: column; gap: var(--sp-3); }
.w-rt__row { display: grid; gap: 6px; min-width: 0; }
.w-rt__row > .w-tile__label { font-size: 11px; }
.w-rtgrid { align-items: stretch; }
.w-bp__pct { flex: none; font-weight: 700; color: var(--rc-ink); font-variant-numeric: tabular-nums; }
/* tablets: seven columns fit without an inner scroll */
@media (min-width: 640px) and (max-width: 1099px) {
  .w-rec__tbl th, .w-rec__tbl td { padding-left: 6px; padding-right: 6px; }
  .w-rec__tbl th { white-space: normal; letter-spacing: .04em; }
  .w-rec__tbl th button { white-space: normal; text-align: inherit; }
}

/* ---------- farming: stage chain, the arrow travels with its stage (never alone at a line start) ---------- */
.w-farm__step { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; }

/* ---------- farming: breeding (genes, seed odds, best planting) ---------- */
.w-br__gene { gap: 2px 6px; }
.w-br__gene.chip--wrap { flex-wrap: wrap; }   /* letter + name stay whole, the effects wrap below as a block */
.w-br__gene > b, .w-br__gene > .w-br__gname { flex: none; white-space: nowrap; }
.w-br__gene > b { font-weight: 800; }
.w-br__eff { color: var(--rc-ink-3); font-weight: 500; white-space: normal; min-width: 0; }
.w-br__try { justify-self: start; }
.w-br__odds { table-layout: fixed; width: 100%; }
.w-br__odds :is(th, td).main { width: 4.5em; }
.w-br__odds th .w-br__gene { vertical-align: middle; }
.w-br__odds td.main { font-weight: 700; font-variant-numeric: tabular-nums; }
.w-br__odds td.r { font-variant-numeric: tabular-nums; }
.w-br__clonein > .input { width: 100%; padding-left: var(--sp-4); }   /* no search icon in this field */
.w-br__set { padding: 3px; }
@media (max-width: 639px) {
  .w-br__odds th .w-br__gname { display: none; }   /* the letter chip carries the gene, its title the name */
  .w-br__odds th, .w-br__odds td { padding-left: 4px; padding-right: 4px; }
}

/* ---------- guide fact tiles: a convar as the sub line stays one line (full name in the title) ---------- */
.w-ai__cv { font-family: var(--rc-font-mono); font-size: 12px; }

/* ---------- NPC AI calculator: inputs without a search icon; phones: label left, number right (one compact row each) ---------- */
.w-ai__in { padding-left: var(--sp-4); }
.w-ai__field { row-gap: var(--sp-2); }
@media (max-width: 639px) {
  .w-ai__grid { grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); }
  .w-ai__field { grid-template-columns: minmax(0, 1fr) 7.5em; align-items: center; column-gap: var(--sp-3); }
  .w-ai__field > .w-tile__label { white-space: normal; }
  .w-ai__field > :is(.w-chip, .w-ai__pair, button) { grid-column: 1 / -1; }
  .w-ai__field > .w-ai__in { max-width: none; }
}

/* ---------- compact real tables on phones (electricity, presents): headers may wrap, so the name column keeps its room ---------- */
@media (max-width: 639px) {
  .w-gd__fit th { white-space: normal; letter-spacing: .04em; }
  .w-gd__fit th button { white-space: normal; text-align: inherit; }
  .w-gd__fit td.r { white-space: nowrap; }
  .w-gd__fit :is(th, td):not(:first-child) { padding-left: 6px; padding-right: 6px; }
}

/* ---------- cooking: ovens table ---------- */
.w-cook__pair { display: grid; gap: var(--sp-1); justify-items: start; min-width: 0; }
.w-cook__to { display: none; }
@media (max-width: 639px) { .w-cook__to { display: inline-flex; } }

/* ---------- presents: "10 combine into [icon]" (the plate comes last, same trim as a leading one) ---------- */
.w-gift__into > .plate:last-child { margin: -1px 0; }
/* breeding odds: fixed layout, the gene columns share the width equally (the shared "numbers hug their content" 1 % rule must not apply) */
.w-tbl.w-br__odds :is(th, td).r { width: auto !important; }
/* ovens table: the "→ cooked" chip only on phones (beats the canonical chip display); tablets show raw, cooked and the three
   fastest ovens (every oven's speed is in the chips above), so names never ellipsize and nothing scrolls inside the card */
.w-cook__pair > .w-cook__to { display: none; }
@media (max-width: 639px) { .w-cook__pair > .w-cook__to { display: inline-flex; } }
@media (min-width: 640px) and (max-width: 1099px) { .w-cook__tbl :is(th, td):nth-child(n+6) { display: none; } }

/* ---------- CCTV codes (/wiki/cctv/, camera block on monument pages) ---------- */
.w-cctv__grid { --min: 300px; align-items: start; }
.w-cctv__card { display: grid; gap: var(--sp-3); align-content: start; min-width: 0; }
.w-cctv__card[hidden] { display: none; }
.w-cctv__head { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; min-height: 38px; }
.w-cctv__name { display: inline-flex; align-items: center; gap: var(--sp-2); min-width: 0; font-family: var(--rc-font-display); font-weight: 700; font-size: 18px; color: var(--rc-ink); }
.w-cctv__name:hover { color: var(--rc-signal-text); }
.w-cctv__plate { flex: none; }
.w-cctv__all { margin-left: auto; flex: none; }
.w-cctv__code { cursor: pointer; transition: color .15s, border-color .15s; }
.w-cctv__code:hover { border-color: var(--rc-signal-line); }
.w-cctv__code.is-copied, .w-cctv__btn.is-copied { color: var(--rc-ok); border-color: color-mix(in srgb, var(--rc-ok) 45%, transparent); }
.w-cctv__btn-ok { display: none; }
.w-cctv__btn.is-copied > .ico { display: none; }
.w-cctv__btn.is-copied > .w-cctv__btn-ok { display: inline-flex; }
.w-cctv__btn:disabled { opacity: .45; cursor: default; }
.w-cctv__tools { display: grid; gap: var(--sp-3); }
.w-cctv__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.w-cctv__n { color: var(--rc-ink-3); font-weight: 500; }
.w-cctv__num { color: var(--rc-warn); opacity: .8; }
.w-cctv__how { display: grid; gap: var(--sp-3); }
.w-cctv__formula { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.w-cctv__plus { color: var(--rc-ink-3); font-weight: 700; }
.w-cctv__rules { margin: 0; padding-left: 1.4em; display: grid; gap: var(--sp-1); color: var(--rc-ink-2); list-style: disc; }
ol.w-cctv__rules { list-style: decimal; }
.w-cctv__rnd { flex: none; }
@media (max-width: 639px) {
  .w-cctv__code { min-height: 32px; padding: 6px 12px; font-size: 13px; }
  .w-cctv__actions > .btn { flex: 1 1 auto; }
  .w-cctv .w-gd__facts > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
