/* ============================================================
   home.css — Home base interface

   Loaded after hud.css. The camp shares the HUD's palette but not its
   layout: nothing here is a combat readout, so it sits out of the way
   until the player is actually standing next to something.
   ============================================================ */

.home-ui {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-med, 0.2s);
}

.home-ui.active { opacity: 1; visibility: visible; }

/* ── Material counters ── */
.home-materials {
  position: absolute;
  top: var(--sp-4);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-2);
  border-radius: var(--radius-pill);
  background: rgba(13, 17, 23, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--color-border);
}

.home-mat {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  font-size: var(--fs-sm);
  line-height: 1;
}

.home-mat-name {
  color: var(--color-text-muted);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.home-mat-value {
  min-width: 2ch;
  text-align: right;
  color: var(--color-text);
  font-family: var(--font-crypto);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.home-mat--wood  { color: #d09a5e; }
.home-mat--stone { color: #b6bec8; }
.home-mat--iron  { color: #86bdff; }

/* A gather should be visible without reading the number. */
@keyframes mat-bump {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.16); background: rgba(63, 185, 80, 0.22); }
  100% { transform: scale(1); }
}

.home-mat.is-bump { animation: mat-bump 0.34s ease-out; }

/* ── Interact prompt ── */
.home-prompt {
  position: absolute;
  left: 50%;
  bottom: 18%;
  transform: translate(-50%, 8px);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-pill);
  background: rgba(13, 17, 23, 0.86);
  border: 1px solid rgba(63, 185, 80, 0.35);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.14s, transform 0.14s;
}

.home-prompt.active { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.home-prompt.is-locked { border-color: rgba(248, 81, 73, 0.5); }

.home-prompt-key {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  border-bottom-width: 2px;
  background: var(--color-bg-light);
  color: var(--color-text);
  font-family: ui-monospace, 'SFMono-Regular', 'Menlo', monospace;
  font-size: var(--fs-xs);
  font-weight: 700;
}

.home-prompt-label { color: var(--color-text); font-size: var(--fs-sm); font-weight: 600; }
.home-prompt.is-locked .home-prompt-label { color: #ff9d97; }

.home-prompt-bar {
  width: 0;
  height: 4px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  transition: width 0.15s;
}

.home-prompt.is-gathering .home-prompt-bar { width: 70px; }

.home-prompt-bar-fill {
  width: 0;
  height: 100%;
  background: var(--color-primary);
  transition: width 0.06s linear;
}

/* ── Grand Master dialogue ── */
.home-dialogue {
  position: absolute;
  left: 50%;
  bottom: var(--sp-10);
  transform: translate(-50%, 12px);
  width: min(92vw, 620px);
  padding: var(--sp-5) var(--sp-6);
  border-radius: var(--radius-xl);
  background: rgba(13, 17, 23, 0.94);
  border: 1px solid rgba(212, 160, 37, 0.4);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s, transform 0.18s;
}

.home-dialogue.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.home-dialogue-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
  color: var(--color-accent);
}

.home-dialogue-who {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: 0.03em;
}

.home-dialogue-text {
  margin: 0 0 var(--sp-5);
  color: var(--color-text);
  font-size: var(--fs-md);
  line-height: var(--lh-loose);
}

.home-dialogue-next {
  display: block;
  margin-left: auto;
  padding: var(--sp-2) var(--sp-6);
  border: none;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: #1a1206;
  font-family: var(--font-crypto);
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
}

.home-dialogue-next:hover { background: var(--color-accent-hover); }

/* ── Modal shell ── */
.home-modal-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  background: rgba(5, 8, 12, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s;
}

.home-modal-overlay.active { opacity: 1; visibility: visible; pointer-events: auto; }

.home-modal {
  width: min(96vw, 880px);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.home-modal-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--color-border);
}

.home-modal-icon { display: inline-flex; color: var(--color-primary); }

.home-modal-title {
  margin: 0;
  flex: 1;
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 700;
}

.home-modal-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}

.home-modal-close:hover { background: var(--color-surface-hover); color: var(--color-text); }

.home-modal-body { padding: var(--sp-6); overflow-y: auto; }

.home-modal-intro {
  margin: 0 0 var(--sp-5);
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
}

/* ── Forge ── */
.forge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-4);
}

.forge-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg-mid);
}

.forge-card.is-owned    { border-color: rgba(63, 185, 80, 0.35); }
.forge-card.is-equipped { border-color: var(--color-primary); box-shadow: var(--shadow-glow-green); }

.forge-card-head { display: flex; align-items: center; gap: var(--sp-2); }
.forge-card-icon { color: var(--color-primary); flex: none; }

.forge-card-name {
  margin: 0;
  flex: 1;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
}

.forge-badge {
  padding: 2px var(--sp-2);
  border-radius: var(--radius-sm);
  background: var(--color-primary-dim);
  color: var(--color-primary);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.forge-badge.is-muted { background: rgba(255,255,255,0.06); color: var(--color-text-muted); }

.forge-card-blurb {
  margin: 0;
  flex: 1;
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
}

.forge-cost { display: flex; flex-wrap: wrap; gap: var(--sp-3); }

.forge-cost-item {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  color: var(--color-text);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

.forge-cost-item.is-short { color: var(--color-danger); }

.forge-moves { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-1); }

.forge-moves li {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
}

.forge-move-slot {
  min-width: 40px;
  padding: 1px var(--sp-2);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  text-align: center;
}

.forge-action {
  padding: var(--sp-3);
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: #08130c;
  font-family: var(--font-crypto);
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.forge-action:hover:not(:disabled) { background: var(--color-primary-hover); }
.forge-action.is-equip { background: var(--color-accent); color: #1a1206; }
.forge-action.is-equip:hover { background: var(--color-accent-hover); }

.forge-action:disabled {
  background: var(--color-bg-light);
  color: var(--color-text-dim);
  cursor: not-allowed;
}

/* ── Marketplace ── */
.market-section { margin-bottom: var(--sp-8); }

.market-section-title {
  margin: 0 0 var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-crypto);
  font-size: var(--fs-md);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

.market-empty { margin: 0; color: var(--color-text-dim); font-size: var(--fs-sm); }

.market-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-mid);
}

.market-row-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.market-row-name { color: var(--color-text); font-weight: 600; font-size: var(--fs-sm); }
.market-row-meta { color: var(--color-text-dim); font-size: var(--fs-xs); }

.market-row-price {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  color: var(--color-accent);
  font-family: var(--font-crypto);
  font-size: var(--fs-sm);
  font-weight: 700;
  white-space: nowrap;
}

.market-price-input {
  width: 120px;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-dark);
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--fs-sm);
}

.market-price-input:focus { outline: none; border-color: var(--color-primary); }

.market-action {
  padding: var(--sp-2) var(--sp-5);
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: #08130c;
  font-family: var(--font-crypto);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

.market-action.is-bid { background: var(--color-accent); color: #1a1206; }

.market-action:disabled {
  background: var(--color-bg-light);
  color: var(--color-text-dim);
  cursor: not-allowed;
}

.rarity-common     { color: var(--color-text-muted); }
.rarity-rare       { color: var(--color-mana); }
.rarity-legendary  { color: var(--color-accent); }

@media (max-width: 640px) {
  .home-materials { top: auto; bottom: var(--sp-2); }
  .home-prompt { bottom: 28%; }
  .market-row { flex-wrap: wrap; }
  .market-price-input { width: 100%; }
}

/* ── Run summary: relic lines on the stage-clear screen ── */
.stage-clear-relic { font-weight: 600; }
.stage-clear-relic.rarity-common    { color: var(--color-text-muted); }
.stage-clear-relic.rarity-rare      { color: var(--color-mana); }
.stage-clear-relic.rarity-legendary { color: var(--color-accent); }

/* Route stops on the intro card. The two that hold a keeper are coloured
   so the player can see where the run will actually stall. */
.stage-intro-enemy.is-elite { color: var(--color-mana); border-color: rgba(88, 166, 255, 0.4); }
.stage-intro-enemy.is-boss  { color: var(--color-danger); border-color: rgba(248, 81, 73, 0.45); }

/* ── Camp mode HUD ──
   The camp keeps movement and interact; everything that only reads during a
   fight comes off, because a safe field showing a boss bar and a skill row
   is telling the player things that are not true. */
/* Nothing in the camp can be fought, so the combat action buttons come off
   the touch row and leave interact alone in it. */
.hud--camp .touch-actions .skill-btn:not(.touch-action--interact) { display: none !important; }

.hud--camp .hud-bars,
.hud--camp .hud-stats,
.hud--camp .hud-skills,
.hud--camp .boss-health-container,
.hud--camp #boss-health-container,
.hud--camp #minimap-container { display: none !important; }

/* Interact is the camp's one action button, so it reads as a key cap
   rather than as another combat glyph. */
.touch-action--interact {
  font-family: ui-monospace, 'SFMono-Regular', 'Menlo', monospace !important;
  font-weight: 700;
  border-color: rgba(63, 185, 80, 0.55) !important;
  color: var(--color-primary) !important;
}

/* SVG icons inherit the button's colour and sit on the text baseline. */
.skill-icon svg,
.skill-btn svg,
.landing-nav-mark svg,
.page-brand-mark svg,
.landing-feature-icon svg { display: block; }

.landing-feature-icon { color: var(--color-primary); }

/* Inventory slots hold an SVG now, so the glyph needs centring in the box. */
.inventory-slot svg { display: block; margin: 0 auto; }

/* ── Camp tool bar ──
   Sits where the combat skill bar sits during a run, so "bottom bar =
   what your hands can do" holds in both worlds. Slots are dark until the
   Grand Master hands the tool over. */
.home-tools {
  position: absolute;
  bottom: var(--sp-5);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-2);
  border-radius: var(--radius-lg);
  background: rgba(13, 17, 23, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--color-border);
}

.home-tool-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 64px;
  height: 58px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-bg-mid);
  color: var(--color-text-dim);
  opacity: 0.55;
}

.home-tool-slot.is-owned {
  color: var(--color-primary);
  border-color: rgba(63, 185, 80, 0.5);
  background: rgba(63, 185, 80, 0.08);
  opacity: 1;
}

.home-tool-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

@keyframes tool-earned {
  0%   { transform: scale(1); box-shadow: none; }
  40%  { transform: scale(1.18); box-shadow: var(--shadow-glow-green); }
  100% { transform: scale(1); box-shadow: none; }
}

.home-tool-slot.is-new { animation: tool-earned 0.6s ease-out; }

/* The interact prompt sat at bottom 18% — fine when nothing else lived
   down there; now it clears the tool bar. */
.home-prompt { bottom: calc(var(--sp-5) + 78px); }
