/* Lair scene layout (owned by the lair work): the single-room scene, its "Salas" button and dialog,
   the decorative electric rocket and the power cables.
   The scene (.room.lair-scene) is 512×336 logical px; every in-scene size here is a multiple of
   --s, the integer scale set inline on the scene. Colours of the chrome (buttons, dialogs) come
   from the site classes (.btn, .modal-drawer, .drawer-item); only layout lives here. */

/* overflow: clip (not hidden) so the scene is not a scroll container and the "Salas" button can
   stick to the visible corner while .room-scroll scrolls sideways. Older browsers keep hidden. */
.room.lair-scene { overflow: clip; }

.lair-scene .lair-rocket,
.lair-scene .power-cables { position: absolute; }
.lair-scene .lair-rocket { line-height: 0; }
.lair-scene .room-hits > .lair-rocket-hit { position: absolute; cursor: help; }
.lair-scene .npc.flip .rr-sprite { transform: scaleX(-1); }

/* ------------------------------------------------------------------ "Salas" button */
.lair-scene > .lair-rooms-btn {
  position: sticky;
  left: calc(var(--s, 1) * 6px);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: calc(var(--s, 1) * 6px) 0 0 calc(var(--s, 1) * 6px);
  vertical-align: top;
  line-height: 1.2;
  white-space: nowrap;
}
.lair-rooms-count {
  padding: 2px 5px 0;
  font-variant-numeric: tabular-nums;
  color: var(--text-2, inherit);
  background: rgba(7, 4, 15, 0.45);
}
.lair-rooms-dot {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 10px;
  height: 10px;
  background: var(--gold, #F7C948);
  box-shadow: 0 0 0 2px var(--ink, #07040F);
}

/* ------------------------------------------------------------------ "Salas" dialog */
.modal-rooms .lair-room { text-align: left; }
.modal-rooms .lair-room .drawer-text { flex: 1 1 160px; min-width: 0; }
.modal-rooms .lair-room-num {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding-top: 2px;
  line-height: 1;
  font-family: var(--f-display, inherit);
  font-size: var(--px-s, 20px);
  color: var(--text-2, inherit);
  background: var(--well, rgba(0, 0, 0, 0.22));
  box-shadow: var(--ring2, none);
}
.modal-rooms .lair-room.is-here .lair-room-num { background: var(--violet, #7655E3); color: #FFFFFF; box-shadow: inset 0 2px 0 var(--violet-hi, transparent), var(--ring2, none); }
.modal-rooms .lair-room-here { font-weight: 500; color: var(--text-2, inherit); }
.modal-rooms .lair-room-cost { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 2px; }
/* rows that are not buttons: no hover glow, only their own "Comprar" button reacts */
.modal-rooms .lair-room-next,
.modal-rooms .lair-room-locked { pointer-events: none; cursor: default; }
.modal-rooms .lair-room-next { flex-wrap: wrap; }
.modal-rooms .lair-room-locked { opacity: 0.62; }
.modal-rooms .lair-room-buy { pointer-events: auto; flex: none; margin-left: auto; }

/* ------------------------------------------------------------------ power cables */
.lair-scene .power-cables {
  left: 0;
  top: 0;
  display: block;
  overflow: hidden;
  pointer-events: none;
}
.power-cables .cable-body { stroke: #0C0911; }
.power-cables .cable-core { stroke: #4E4060; }
.power-cables .cable-glow {
  stroke: var(--pulse-color, #8CF2C8);
  opacity: var(--glow-op, 0.2);
}
.power-cables .cable-pulse {
  stroke: var(--pulse-color, #8CF2C8);
  opacity: var(--pulse-op, 0.7);
}
/* The pulse moves 1 logical px per step toward the rocket (paths start at the rocket). */
.power-cables .cable-glow path,
.power-cables .cable-pulse path {
  animation: rr-cable-flow var(--pulse-dur, 1.2s) steps(16, end) var(--pulse-delay, 0s) infinite;
}
@keyframes rr-cable-flow {
  from { stroke-dashoffset: 0px; }
  to { stroke-dashoffset: 16px; }
}
html[data-reduced-motion="true"] .power-cables .cable-glow path,
html[data-reduced-motion="true"] .power-cables .cable-pulse path,
html[data-reduced-motion="on"] .power-cables .cable-glow path,
html[data-reduced-motion="on"] .power-cables .cable-pulse path { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  .power-cables .cable-glow path,
  .power-cables .cable-pulse path { animation: none !important; }
}

/* ================================================================== iteration 4: machines & racks */

/* Machines sit still on their shelf: no bob (overrides the old .mach "beat" in screens.css).
   Animated strips (frames > 1 in the manifest) play inside their canvas, in place. */
.lair-scene .mach { animation: none; transform: none; }

/* ---- rack bonus tag: centred on the rack's top bar; opens the rack sheet */
.lair-scene .room-hits > .rack-tag {
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  font: 800 calc(3px + var(--s, 1) * 5px) / 1 var(--f-body, sans-serif);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  white-space: nowrap;
  color: #1E1230;
  background: var(--rack-c, #C9B8A8);
  border: 0;
  border-radius: calc(var(--s, 1) * 3px);
  box-shadow: 0 0 0 calc(var(--s, 1) * 1px) rgba(18, 10, 30, 0.85);
  cursor: pointer;
  opacity: 0.9;
  transition: opacity 120ms ease, transform 120ms ease;
}
.lair-scene .room-hits > .rack-tag.is-basic {
  color: var(--c-parchment, #F4EBDD);
  background: rgba(18, 14, 26, 0.72);
  box-shadow: inset 0 0 0 1px rgba(244, 235, 221, 0.3);
  opacity: 0; /* basic racks have no bonus: the "Mejorar" tag only appears while hovering the room or on focus */
}
.lair-scene:hover .room-hits > .rack-tag.is-basic { opacity: 0.6; }
.lair-scene .room-hits > .rack-tag:hover,
.lair-scene .room-hits > .rack-tag:focus-visible { opacity: 1; transform: translateY(calc(var(--s, 1) * -1px)); }
.lair-scene .room-hits > .rack-tag:focus-visible { outline: 2px solid var(--c-mint, #8CF2C8); outline-offset: 1px; }
.lair-scene.is-placing .room-hits > .rack-tag { opacity: 0.35; }
html[data-reduced-motion="true"] .lair-scene .rack-tag,
html[data-reduced-motion="on"] .lair-scene .rack-tag { transition: none; transform: none !important; }

.spot-empty .spot-spare { color: var(--c-mint, #8CF2C8); font-weight: 700; font-size: 0.85em; }

/* ---- shared chips (shop, inventory, dialogs — not the scene): dark pixel plates; the rack material
   shows as a small gem, never as the text colour */
.rack-bonus-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  vertical-align: middle;
  height: 22px;
  padding: 2px 6px 0 4px;
  font-family: var(--f-display);
  font-size: var(--px-s);
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--well);
  box-shadow: var(--ring2);
}
.rack-bonus-chip::before {
  content: '';
  flex: none;
  width: 10px;
  height: 10px;
  margin-top: -2px;
  background: var(--rack-c, var(--text-3));
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.35), inset -2px -2px 0 rgba(0, 0, 0, 0.35);
}
.rack-bonus-chip.is-basic { color: var(--text-2); }
.excl-badge {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  height: 22px;
  padding: 2px 6px 0;
  font-family: var(--f-display);
  font-size: var(--px-s);
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  color: #fff;
  background: var(--violet);
  box-shadow: inset 0 2px 0 var(--violet-hi), var(--ring2);
}

/* ---- rack pickers (empty slot dialog, rack sheet, inventory spares) */
.drawer-sub {
  margin-top: 6px;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: var(--px-s);
  line-height: 1;
  color: var(--text);
}
.drawer-sprite.rack-thumb {
  width: 80px;
  height: 58px;
  min-height: 0;
  overflow: hidden;
  place-items: start center;
  padding-top: 5px;
}
.rack-option .drawer-text { flex: 1 1 0; min-width: 0; }
.rack-option .drawer-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.rack-option-price { flex: none; margin-left: auto; padding-left: 8px; text-align: right; }
.rack-option-price .amount-num { font: var(--px-s)/1 var(--f-display); }
.rack-option-price.is-free { font: var(--px-s)/1 var(--f-display); color: var(--success); }
.rack-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 12px;
  padding: 8px 10px 10px 14px;
  font-weight: 600;
  background: var(--well);
  box-shadow: var(--sunk-2);
}
@media (max-width: 479.98px) {
  .rack-option { flex-wrap: wrap; }
  .rack-option .drawer-text { flex-basis: calc(100% - 92px); }
  .rack-option-price { flex-basis: 100%; margin-left: 0; padding-left: 92px; text-align: left; }
  .drawer-sprite.rack-thumb { width: 72px; }
}

/* ---- rack sheet: the rack drawn with what it holds */
.rack-sheet-art { padding: 14px; }
.rack-preview { position: relative; line-height: 0; }
.rack-preview > .rr-sprite { position: absolute; left: 0; top: 0; }
.rack-preview-mach { position: absolute; line-height: 0; }
.rack-sheet-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-family: var(--f-display); font-weight: 400; font-size: var(--px-s); line-height: 1.1; color: var(--text); }
.rack-sheet .kv { margin-top: 2px; }

/* ---- shop: rack types */
.rack-shop-wrap { display: flex; flex-direction: column; gap: 20px; }
.rack-shop-spares { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.rack-card .shop-art.rack-card-art { height: 168px; padding-bottom: 18px; }
.rack-card .shop-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.rack-card .rack-card-bonus { font-weight: 600; color: var(--text); }

/* ---- inventory: pass exclusives (spare racks have their own tab: css/screens.css, ALMACÉN) */
.inv-row.is-exclusive .inv-art { background: color-mix(in srgb, var(--violet) 22%, var(--well)); }
.inv-name .excl-badge { margin-left: 2px; }

/* Depósitos y Fondo de la red (js/bank.js, js/ui/deposit.js) */
.fund-box { margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 2px solid var(--s1-lo); }
.fund-box .panel-sub { margin: 0 0 var(--sp-2); padding: 0; border: 0; }
.fund-rule { margin: 0 0 var(--sp-3); font-size: var(--fs-6); color: var(--text-2); line-height: 1.5; }
.fund-box .kv { font-size: var(--fs-5); }
.fund-deposit { margin-top: 10px; }
.payouts .payout-fund { flex-basis: 100%; font-size: var(--fs-6); color: var(--text-3); }
.deposit-test {
  margin: 0 0 var(--sp-3);
  font-size: var(--fs-5);
  color: var(--text-2);
  padding: 10px 14px 10px 18px;
  background: var(--well);
  box-shadow: inset 4px 0 0 var(--violet-text), var(--sunk-2);
}
.deposit-amounts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4) var(--sp-3); margin-bottom: var(--sp-2); padding: 3px 3px 7px; }
.deposit-amounts .btn[aria-pressed="true"] {
  --face: var(--violet);
  --face-hover: var(--violet-face-hi);
  --hi: var(--violet-hi);
  --lo: var(--violet-lo);
  --side: var(--violet-side);
  --fg: #FFFFFF;
}
.deposit-preview { margin: 0 0 var(--sp-3); line-height: 1.5; }
.deposit-kv dd small { display: block; color: var(--text-2); font-weight: 500; }
.deposit-amounts .btn { flex-direction: column; gap: 2px; }
.deposit-chip-rbit { color: var(--text-2); font-size: var(--fs-6); font-weight: 500; font-family: var(--f-body); }
