/* RED BASTION — THE PDA OF THE PEOPLE (src/ui/pda.js). Linked after hud.css.
   Palette mirrors #hud's vars with literal fallbacks so the panel survives a
   document.body mount. z-index 30: above the HUD chrome, below the scanline
   pass at 40. Selectors double up a class against #hud .menu-btn (equal id
   specificity would leave the winner to link order). */

#rb-pda {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 740px;
  max-width: 94vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--panel, rgba(13, 11, 8, 0.88));
  border: 1px solid var(--dim, rgba(201, 162, 39, 0.42));
  outline: 1px solid rgba(201, 162, 39, 0.18);
  outline-offset: 5px;
  box-shadow: 0 0 0 4px rgba(8, 6, 4, 0.35), 0 12px 40px rgba(0, 0, 0, 0.55);
  z-index: 30;
  pointer-events: auto;
  font-family: 'Consolas', 'Lucida Console', 'Courier New', monospace;
  color: var(--gold, #c9a227);
  text-transform: uppercase;
}
#rb-pda.pda-hidden, #rb-pda .pda-hidden, #rb-pda-tip.pda-hidden { display: none !important; }
/* buttons do not inherit font by default — keep the console face everywhere */
#rb-pda button { font-family: inherit; cursor: pointer; }

/* ---- header ---- */
#rb-pda .pda-header {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--dim, rgba(201, 162, 39, 0.42));
}
#rb-pda .pda-title {
  font-size: 15px; font-weight: bold; letter-spacing: 0.35em;
  color: var(--gold-hi, #e8d9a0);
}
#rb-pda .pda-title::before { content: '★ '; color: var(--redhi, #c94f3a); }
#rb-pda .pda-vouchers {
  margin-left: auto; color: var(--gold, #c9a227);
  font-size: 12px; font-weight: bold; letter-spacing: 0.15em; white-space: nowrap;
}
#rb-pda .menu-btn.pda-close {
  display: block; width: 30px; height: 30px; padding: 0;
  font-size: 14px; letter-spacing: 0; text-align: center;
}

/* ---- tabs ---- */
#rb-pda .pda-tabs {
  display: flex; gap: 6px; padding: 8px 14px;
  border-bottom: 1px solid rgba(201, 162, 39, 0.22);
}
#rb-pda .menu-btn.pda-tab {
  flex: 1; display: block; padding: 6px 10px;
  font-size: 11px; letter-spacing: 0.22em;
  opacity: 0.6;
}
#rb-pda .menu-btn.pda-tab.active {
  opacity: 1;
  background: rgba(201, 162, 39, 0.18);
  border-color: var(--gold-hi, #e8d9a0);
  color: var(--gold-hi, #e8d9a0);
}

#rb-pda .pda-body { padding: 14px 16px; overflow-y: auto; min-height: 340px; }
#rb-pda .pda-empty {
  color: rgba(216, 207, 180, 0.45); font-size: 12px; letter-spacing: 0.18em;
  text-align: center; padding: 40px 10px; line-height: 1.7;
}

/* ---- INVENTORY: 10×6 grid, 48px cells (CELL in pda.js) — GOLD grid lines ---- */
#rb-pda .pda-grid {
  position: relative;
  width: 480px; height: 288px;
  margin: 2px auto 0;
  border: 1px solid var(--dim, rgba(201, 162, 39, 0.42));
  background-color: rgba(201, 162, 39, 0.04);
  background-image:
    repeating-linear-gradient(90deg, rgba(201, 162, 39, 0.25) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(0deg, rgba(201, 162, 39, 0.25) 0 1px, transparent 1px 48px);
}
#rb-pda .menu-btn.pda-item {
  position: absolute;
  display: flex; align-items: center; justify-content: center;
  padding: 0; margin: 0;
  background: rgba(142, 47, 42, 0.22);
  border: 1px solid var(--red, #8e2f2a);
  color: var(--bone, #d8cfb4);
  letter-spacing: 0.05em;
  overflow: hidden;
  cursor: pointer;
}
#rb-pda .menu-btn.pda-item.usable {
  border-color: var(--gold, #c9a227);
  background: rgba(201, 162, 39, 0.12);
}
#rb-pda .menu-btn.pda-item:hover {
  background: rgba(201, 162, 39, 0.3);
  border-color: var(--gold-hi, #e8d9a0);
}
#rb-pda .pda-item .glyph {
  font-size: 16px; font-weight: bold;
  color: var(--gold, #c9a227);
  text-shadow: 1px 1px 0 #000;
  pointer-events: none;
}
#rb-pda .pda-item:hover .glyph { color: var(--gold-hi, #e8d9a0); }
#rb-pda .pda-item .qty {
  position: absolute; right: 3px; bottom: 1px;
  font-size: 10px; font-weight: bold;
  color: var(--bone, #d8cfb4);
  text-shadow: 1px 1px 0 #000;
  pointer-events: none;
}

/* ---- THE COMMON STORE strip (the world.resources pool) ---- */
#rb-pda .pda-store { margin: 12px auto 0; width: 480px; max-width: 100%; }
#rb-pda .pda-store-head {
  font-size: 10px; letter-spacing: 0.3em; color: var(--gold, #c9a227);
  border-bottom: 1px solid rgba(201, 162, 39, 0.18);
  padding-bottom: 3px; margin-bottom: 6px;
}
#rb-pda .pda-store-row { display: flex; flex-wrap: wrap; gap: 6px; }
#rb-pda .pda-store-chip {
  padding: 3px 8px; border: 1px solid var(--dim, rgba(201, 162, 39, 0.42));
  background: rgba(20, 16, 8, 0.5);
  font-size: 10px; letter-spacing: 0.12em; color: rgba(216, 207, 180, 0.7);
}
#rb-pda .pda-store-chip b { color: var(--gold-hi, #e8d9a0); margin-left: 2px; }

#rb-pda .pda-legend {
  margin-top: 12px; text-align: center;
  color: rgba(216, 207, 180, 0.4);
  font-size: 10px; letter-spacing: 0.18em;
}

/* ---- tooltip (fixed, follows the cursor, clamped by pda.js) ---- */
#rb-pda-tip {
  position: fixed;
  z-index: 38;
  pointer-events: none;
  max-width: 260px;
  background: var(--panel, rgba(13, 11, 8, 0.88));
  border: 1px solid var(--gold, #c9a227);
  box-shadow: 0 0 0 3px rgba(8, 6, 4, 0.35);
  padding: 8px 12px;
  color: var(--bone, #d8cfb4);
  font-family: 'Consolas', 'Lucida Console', 'Courier New', monospace;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
#rb-pda-tip .t-name {
  color: var(--gold-hi, #e8d9a0); font-size: 12px; font-weight: bold;
  letter-spacing: 0.14em; margin-bottom: 2px;
}
#rb-pda-tip .t-line.gold { color: var(--gold, #c9a227); }
#rb-pda-tip .t-line.dim { color: rgba(216, 207, 180, 0.45); }

/* ---- JOURNAL ---- */
#rb-pda .pda-act {
  color: var(--gold, #c9a227);
  font-size: 12px; font-weight: bold; letter-spacing: 0.25em;
  border-bottom: 1px solid rgba(201, 162, 39, 0.25);
  padding-bottom: 6px; margin-bottom: 12px;
}
#rb-pda .pda-act.done-h { margin-top: 20px; }
#rb-pda .pda-quest {
  background: rgba(20, 16, 8, 0.5);
  border: 1px solid var(--dim, rgba(201, 162, 39, 0.42));
  border-left: 3px solid var(--gold, #c9a227);
  padding: 9px 13px;
  margin-bottom: 9px;
}
#rb-pda .pda-quest .q-title {
  color: var(--gold-hi, #e8d9a0); font-size: 12px; font-weight: bold; letter-spacing: 0.14em;
}
#rb-pda .pda-quest .q-obj {
  color: var(--bone, #d8cfb4); font-size: 11.5px; margin-top: 4px;
  letter-spacing: 0.08em; text-transform: none;
}
#rb-pda .pda-quest.pda-done { opacity: 0.55; border-left-color: var(--dim, rgba(201, 162, 39, 0.42)); }

/* ---- SHOP ---- */
#rb-pda .pda-shop-name {
  color: var(--gold-hi, #e8d9a0);
  font-size: 12px; font-weight: bold; letter-spacing: 0.22em;
  margin-bottom: 12px;
}
#rb-pda .pda-shop-cols { display: flex; gap: 16px; align-items: flex-start; }
#rb-pda .pda-col { flex: 1; min-width: 0; }
#rb-pda .pda-col h3 {
  color: var(--gold, #c9a227);
  font-size: 11px; letter-spacing: 0.2em; font-weight: bold;
  border-bottom: 1px solid rgba(201, 162, 39, 0.25);
  padding-bottom: 6px; margin: 0 0 9px;
}
/* trade rows: menu-btn base, remade as compact ledger lines. NEVER :disabled —
   a refusal answers on the press (toast + dryfire), the pad must reach it. */
#rb-pda .menu-btn.pda-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%;
  padding: 6px 10px;
  margin-bottom: 6px;
  font-size: 11px; letter-spacing: 0.08em;
  text-align: left;
}
#rb-pda .pda-row .price { color: var(--gold, #c9a227); font-weight: bold; white-space: nowrap; }
#rb-pda .pda-row:hover .price { color: #fff0c8; }
#rb-pda .pda-row .have { font-style: normal; color: rgba(216, 207, 180, 0.45); font-size: 9.5px; }
