/* ===== ORIGIN TOWN & FACILITIES STYLING ===== */
.town-hub {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 2px 20px 2px;
}

.town-header-card {
  background: linear-gradient(135deg, rgba(32, 24, 46, 0.95), rgba(18, 14, 28, 0.98));
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}
.town-header-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0; width: 120px; height: 100%;
  background: radial-gradient(circle at top right, rgba(255, 215, 0, 0.08), transparent 70%);
  pointer-events: none;
}
.town-header-ico {
  width: 68px;
  height: 68px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.6));
}
.town-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.town-name {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}
.town-lvl-badge {
  background: linear-gradient(135deg, #ffd700, #b8860b);
  color: #1a0f00;
  font-weight: 700;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  letter-spacing: 0.5px;
}

.town-tax-box {
  background: rgba(20, 16, 28, 0.85);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.town-tax-val {
  font-size: 18px;
  font-weight: 700;
  color: #ffd700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.town-grid-nav {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 4px;
}
.town-facility-btn {
  background: linear-gradient(145deg, #241c33, #181324);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.town-facility-btn:hover {
  background: linear-gradient(145deg, #2f2542, #1f182f);
  border-color: rgba(255, 215, 0, 0.4);
  transform: translateY(-2px);
}
.town-facility-btn img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}
.town-facility-name {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 600;
  color: #f2ece4;
}
.town-facility-lvl {
  font-size: 11px;
  color: #a79a86;
}

/* ---------- BLACKSMITH FORGE & MASTERFORGE ---------- */
.forge-item-card {
  background: #1b1627;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s;
}
.forge-item-card.is-masterforged {
  border: 1px solid #ffd700 !important;
  background: linear-gradient(135deg, rgba(45, 36, 15, 0.8), rgba(27, 22, 39, 0.9));
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.15);
}
.forge-item-card.is-demonforged {
  border: 1px solid #ff2a55 !important;
  background: linear-gradient(135deg, rgba(50, 15, 25, 0.8), rgba(27, 22, 39, 0.9));
  box-shadow: 0 0 12px rgba(255, 42, 85, 0.2);
}
.forge-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.forge-cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
}
.forge-stat-diff {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: #4ade80;
  font-weight: 600;
}
.btn-masterforge {
  background: linear-gradient(135deg, #ffd700, #b8860b) !important;
  color: #1a0f00 !important;
  font-weight: 700 !important;
  border: none !important;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}
.btn-demonforge {
  background: linear-gradient(135deg, #ff2a55, #990022) !important;
  color: #fff !important;
  font-weight: 700 !important;
  border: none !important;
  box-shadow: 0 2px 10px rgba(255, 42, 85, 0.5);
}

/* ---------- BESTIARY / COMPANIONS ---------- */
.bestiary-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pet-card {
  background: #1b1627;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  transition: all 0.2s;
}
.pet-card.active-pet {
  border-color: #ffd700;
  background: linear-gradient(135deg, rgba(40, 32, 18, 0.7), rgba(27, 22, 39, 0.9));
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}
.pet-sprite-box {
  width: 56px;
  height: 56px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.pet-sprite-box img {
  max-width: 48px;
  max-height: 48px;
  object-fit: contain;
}
.pet-info {
  flex-grow: 1;
  min-width: 0;
}
.pet-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pet-name {
  font-weight: 600;
  font-size: 14px;
  color: #f2ece4;
}
.pet-desc {
  font-size: 11px;
  color: #a79a86;
  margin-top: 2px;
  line-height: 1.3;
}
.pet-badge-active {
  background: #ffd700;
  color: #1a0f00;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

/* ---------- ALCHEMIST HERBALISM & ADORNMENTS ---------- */
.potion-recipe-card {
  background: #1b1627;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.potion-ico-wrap {
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.potion-ico-wrap img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}
.transmute-box {
  background: rgba(20, 16, 28, 0.9);
  border: 1px dashed rgba(255, 215, 0, 0.3);
  border-radius: 8px;
  padding: 12px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===== BUILDING PLACEMENT GHOST MARKER ===== */
.building-placement-ghost {
  position: relative;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  cursor: grab;
  touch-action: none;
  pointer-events: auto;
  user-select: none;
  filter: drop-shadow(0 0 16px rgba(255, 215, 0, 0.85));
}
.building-placement-ghost:active {
  cursor: grabbing;
}
.ghost-sprite-img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  opacity: 0.72;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.ghost-ring {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 54px;
  height: 24px;
  border: 2px dashed #ffd700;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255, 215, 0, 0.35) 0%, transparent 75%);
  animation: pulseGhostRing 1.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes pulseGhostRing {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.8; }
  50% { transform: translateX(-50%) scale(1.15); opacity: 1; }
}
.ghost-tag {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(18, 12, 28, 0.92);
  color: #ffd700;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 215, 0, 0.5);
  box-shadow: 0 2px 6px rgba(0,0,0,0.7);
  pointer-events: none;
}

/* Placement HUD bar enhancements */
#place-bar .pb-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
#place-bar .pb-status {
  font-size: 11px;
  margin-top: 2px;
}
#place-bar .pb-status.green { color: #4ade80; }
#place-bar .pb-status.red { color: #f87171; }
#place-bar .pb-btn-place {
  font-weight: 700;
  padding: 6px 14px;
}

/* Dedicated building modal enhancements */
.building-header-box {
  background: linear-gradient(135deg, rgba(32, 24, 46, 0.95), rgba(18, 14, 28, 0.98));
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  margin-bottom: 12px;
  position: relative;
}
.building-header-box.demonforge-box {
  border-color: rgba(255, 42, 85, 0.5);
  background: linear-gradient(135deg, rgba(46, 15, 25, 0.95), rgba(20, 8, 14, 0.98));
}
.building-header-box.keep-box {
  border-color: rgba(180, 150, 90, 0.5);
  background: linear-gradient(135deg, rgba(36, 30, 20, 0.95), rgba(18, 15, 10, 0.98));
}
.building-upgrade-panel {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.treasury-gold-stash {
  background: rgba(20, 16, 28, 0.85);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.town-dir-card {
  background: #1b1627;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  transition: all 0.2s;
}
.town-dir-card:hover {
  border-color: rgba(255, 215, 0, 0.4);
}
