/* ============================================================
   FarmBrawl — Topbar HUD (farm / pixel polish)
   Converts the modern glass chips + blue/purple CTAs into the
   same wood + gold hard-edge language used by panels.
   Loads AFTER juegoprueba.css / hud-redesign.css.
   ============================================================ */

/* ─── Shell ─── */
#topbar {
  height: auto !important;
  min-height: 52px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  padding: 6px 12px !important;
  background:
    repeating-linear-gradient(90deg, rgba(255, 220, 150, 0.03) 0 2px, transparent 2px 8px),
    linear-gradient(180deg, #2a1f14 0%, #1a1410 100%) !important;
  border-bottom: 2px solid #0a0806 !important;
  box-shadow:
    0 0 0 1px rgba(196, 154, 32, 0.35),
    inset 0 1px 0 rgba(255, 220, 150, 0.07),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35) !important;
  z-index: 100;
  overflow: visible !important;
  min-width: 0;
}

#topbar-left {
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

#logo {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  font-family: var(--font-game, monospace) !important;
  font-size: 12px !important;
  color: #f0d060 !important;
  white-space: nowrap !important;
  text-shadow: 2px 2px 0 #000 !important;
  letter-spacing: 0.03em;
  margin-right: 12px !important;
  position: relative !important;
}
#logo .logo-berry {
  width: 20px !important;
  height: 20px !important;
  object-fit: contain !important;
  image-rendering: pixelated !important;
  flex-shrink: 0;
  filter: drop-shadow(1px 1px 0 #000);
}

/* Resource cards — hard farm chips */
#topbar .hud-card,
.hud-card {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 2px !important;
  min-width: 64px !important;
  padding: 5px 10px !important;
  border-radius: 0 !important;
  background: rgba(0, 0, 0, 0.45) !important;
  border: 2px solid #0a0806 !important;
  box-shadow:
    0 0 0 1px rgba(196, 154, 32, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
  backdrop-filter: none !important;
  opacity: 1 !important;
}

#topbar .hud-card .hc-top,
.hud-card .hc-top {
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
}

#topbar .hud-card .hc-label,
.hud-card .hc-label {
  font-family: var(--font-game, monospace) !important;
  font-size: 8px !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  font-weight: 700 !important;
}

#topbar .hud-card .hc-value,
.hud-card .hc-value {
  font-family: "Nunito", system-ui, sans-serif !important;
  font-weight: 800 !important;
  font-size: 13px !important;
  line-height: 1 !important;
  color: #f8f0e0 !important;
  text-align: center !important;
  font-variant-numeric: tabular-nums;
}

#topbar .hc-ic-img,
#topbar .hc-coin-icon,
.hud-card canvas.hc-coin-icon {
  width: 14px !important;
  height: 14px !important;
  image-rendering: pixelated;
  border-radius: 0 !important;
}

#topbar .hud-card svg {
  width: 13px !important;
  height: 13px !important;
}

/* Accent per resource (label + thin top edge via box-shadow) */
#topbar .card-usdc,
.hud-card.card-usdc {
  box-shadow:
    0 0 0 1px rgba(110, 231, 183, 0.45),
    inset 0 1px 0 rgba(110, 231, 183, 0.12) !important;
}
#topbar .card-usdc .hc-label,
.card-usdc .hc-label { color: #6ee7b7 !important; }

#topbar .card-bc,
.hud-card.card-bc {
  box-shadow:
    0 0 0 1px rgba(240, 208, 96, 0.5),
    inset 0 1px 0 rgba(240, 208, 96, 0.12) !important;
}
#topbar .card-bc .hc-label,
.card-bc .hc-label { color: #f0d060 !important; }

#topbar .card-gems,
.hud-card.card-gems {
  box-shadow:
    0 0 0 1px rgba(167, 139, 250, 0.45),
    inset 0 1px 0 rgba(167, 139, 250, 0.12) !important;
}
#topbar .card-gems .hc-label,
.card-gems .hc-label { color: #c4b5fd !important; }

#topbar .card-tasa,
.hud-card.card-tasa {
  box-shadow:
    0 0 0 1px rgba(196, 154, 32, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
}
#topbar .card-tasa .hc-label,
.card-tasa .hc-label { color: #c8b8a0 !important; }
#topbar .card-tasa .hc-rate,
.card-tasa .hc-rate { color: #6ee7b7 !important; font-weight: 800; }

#topbar .card-agua,
.hud-card.card-agua {
  box-shadow:
    0 0 0 1px rgba(96, 165, 250, 0.45),
    inset 0 1px 0 rgba(96, 165, 250, 0.12) !important;
}
#topbar .card-agua .hc-label,
.card-agua .hc-label { color: #7dd3fc !important; }

/* ─── Deposit CTA — farm gold (not blue/purple) ─── */
#topbar .hud-deposit,
.hud-deposit {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 6px 12px !important;
  min-height: 40px !important;
  border-radius: 0 !important;
  cursor: pointer !important;
  background: linear-gradient(180deg, #f0d060, #c49a20) !important;
  border: 2px solid #0a0806 !important;
  box-shadow: 0 3px 0 #0a0806 !important;
  transition: filter 0.12s, transform 0.1s !important;
  color: #1a1208 !important;
  flex-shrink: 0;
}

#topbar .hud-deposit:hover,
.hud-deposit:hover {
  filter: brightness(1.06) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 0 #0a0806 !important;
  background: linear-gradient(180deg, #f5dc78, #d4aa28) !important;
}

#topbar .hud-deposit:active,
.hud-deposit:active {
  transform: translate(1px, 2px) !important;
  box-shadow: 0 1px 0 #0a0806 !important;
}

#topbar .hud-deposit .hd-coin-icon,
.hud-deposit canvas.hd-coin-icon {
  width: 16px !important;
  height: 16px !important;
  border-radius: 0 !important;
  image-rendering: pixelated;
}

#topbar .hud-deposit .hd-text,
.hud-deposit .hd-text {
  display: flex !important;
  flex-direction: column !important;
  line-height: 1.05 !important;
  text-align: left !important;
}

#topbar .hud-deposit .hd-top,
#topbar .hud-deposit .hd-bottom,
.hud-deposit .hd-top,
.hud-deposit .hd-bottom {
  font-family: var(--font-game, monospace) !important;
  font-size: 8px !important;
  font-weight: 700 !important;
  color: #1a1208 !important;
  -webkit-text-fill-color: #1a1208 !important;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#topbar .hud-deposit .hd-bottom,
.hud-deposit .hd-bottom {
  font-size: 9px !important;
}

/* ─── Inicio / Ayuda links (beside Deposit) ─── */
#topbar .hud-nav-link,
#topbar .game-topbar-inicio,
.hud-nav-link,
.game-topbar-inicio {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 6px 10px !important;
  min-height: 40px !important;
  border-radius: 0 !important;
  text-decoration: none !important;
  cursor: pointer !important;
  flex-shrink: 0;
  box-sizing: border-box !important;
  font-family: var(--font-game, monospace) !important;
  font-size: 8px !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fef3c7 !important;
  -webkit-text-fill-color: #fef3c7 !important;
  background: linear-gradient(180deg, #9a6d3b 0%, #7a4f28 100%) !important;
  border: 2px solid #c49540 !important;
  box-shadow:
    0 3px 0 #5a3a1a,
    0 0 0 1px rgba(196, 149, 64, 0.5),
    inset 0 1px 0 rgba(255, 230, 160, 0.25) !important;
  transition: filter 0.12s, transform 0.1s !important;
  white-space: nowrap;
  line-height: 1;
}

#topbar .hud-nav-link:hover,
#topbar .game-topbar-inicio:hover,
.hud-nav-link:hover,
.game-topbar-inicio:hover {
  filter: brightness(1.12) !important;
  transform: translateY(-1px) !important;
  box-shadow:
    0 4px 0 #5a3a1a,
    0 0 0 1px rgba(240, 208, 96, 0.7),
    inset 0 1px 0 rgba(255, 230, 160, 0.35) !important;
  color: #fffbeb !important;
  -webkit-text-fill-color: #fffbeb !important;
}

#topbar .hud-nav-link:active,
#topbar .game-topbar-inicio:active,
.hud-nav-link:active,
.game-topbar-inicio:active {
  transform: translate(1px, 2px) !important;
  box-shadow: 0 1px 0 #5a3a1a !important;
}

#topbar .hud-nav-link i,
#topbar .game-topbar-inicio i,
.hud-nav-link i,
.game-topbar-inicio i {
  font-size: 11px !important;
  line-height: 1;
  color: inherit !important;
}

#topbar .hud-nav-link .hud-nav-label,
#topbar .game-topbar-inicio .hud-nav-label {
  font-family: inherit !important;
  font-size: inherit !important;
  color: inherit !important;
  -webkit-text-fill-color: inherit !important;
}

/* ─── Right cluster ─── */
#topbar-right {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-shrink: 0 !important;
  min-width: 0 !important;
}

#lang-select {
  background: rgba(0, 0, 0, 0.45) !important;
  border: 2px solid #0a0806 !important;
  border-radius: 0 !important;
  color: #f8f0e0 !important;
  padding: 6px 8px !important;
  font-size: 12px !important;
  cursor: pointer !important;
  font-family: var(--font-game, monospace) !important;
  box-shadow: 0 0 0 1px rgba(196, 154, 32, 0.3) !important;
  min-height: 34px;
}

#lang-select:hover {
  filter: brightness(1.05);
}

/* Phantom connect — purple (distinct from gold Deposit) */
#btn-connect-wallet.phantom-btn,
.phantom-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  padding: 6px 12px !important;
  min-height: 40px !important;
  border-radius: 0 !important;
  border: 2px solid #0a0806 !important;
  box-sizing: border-box !important;
  background: linear-gradient(180deg, #9b87f5, #6d4fd6) !important;
  color: #f5f0ff !important;
  font-family: var(--font-game, monospace) !important;
  font-size: 8px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: filter 0.12s, transform 0.1s !important;
  box-shadow: 0 3px 0 #2a1560 !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
  line-height: 1.15 !important;
  flex-shrink: 1;
  min-width: 0;
}

#btn-connect-wallet.phantom-btn:hover,
.phantom-btn:hover {
  filter: brightness(1.08) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 0 #2a1560 !important;
  background: linear-gradient(180deg, #b0a0ff, #7c5ce0) !important;
}

#btn-connect-wallet.phantom-btn:active,
.phantom-btn:active {
  transform: translate(1px, 2px) !important;
  box-shadow: 0 1px 0 #2a1560 !important;
}

.phantom-btn-ic {
  width: 16px !important;
  height: 16px !important;
  flex-shrink: 0 !important;
  filter: none !important;
}

.phantom-btn-text {
  display: flex !important;
  flex-direction: column !important;
  gap: 1px !important;
  color: #f5f0ff !important;
  text-align: left;
}

/* Connected account chip */
#account-header-chip {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  cursor: pointer !important;
  padding: 5px 10px !important;
  border: 2px solid #0a0806 !important;
  border-radius: 0 !important;
  background: rgba(0, 0, 0, 0.45) !important;
  color: #f8f0e0 !important;
  font-weight: 700 !important;
  font-size: 12px !important;
  box-shadow: 0 0 0 1px rgba(196, 154, 32, 0.4) !important;
  transition: filter 0.12s, transform 0.1s !important;
  flex-shrink: 1;
  white-space: nowrap;
  box-sizing: border-box;
  min-width: 0;
}

#account-header-chip:hover {
  filter: brightness(1.05) !important;
  box-shadow: 0 0 0 1px rgba(240, 208, 96, 0.55) !important;
}

#account-header-chip:active {
  transform: translate(1px, 1px) !important;
}

#account-header-chip.hidden {
  display: none !important;
}

#account-header-chip.connected {
  background: rgba(0, 0, 0, 0.5) !important;
  border: 2px solid #0a0806 !important;
  border-radius: 0 !important;
  gap: 8px !important;
  padding: 5px 10px !important;
  box-shadow: 0 0 0 1px rgba(196, 154, 32, 0.45) !important;
}

#account-header-chip.connected:hover {
  border-color: #0a0806 !important;
  box-shadow: 0 0 0 1px rgba(240, 208, 96, 0.6) !important;
  transform: none !important;
  filter: brightness(1.05) !important;
}

#account-header-chip .profile-avatar,
.profile-avatar {
  width: 28px !important;
  height: 28px !important;
  border-radius: 0 !important;
  border: 2px solid #c49a20 !important;
  object-fit: cover !important;
  image-rendering: pixelated !important;
  background: rgba(0, 0, 0, 0.5) !important;
  flex-shrink: 0 !important;
}

#account-header-chip .profile-name,
.profile-name {
  font-family: var(--font-game, monospace) !important;
  font-size: 9px !important;
  color: #f0d060 !important;
  text-shadow: 1px 1px 0 #000 !important;
}

#account-header-chip .profile-wallet,
.profile-wallet {
  font-family: "Nunito", system-ui, sans-serif !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  color: #a89a88 !important;
  margin-top: 2px !important;
  max-width: 90px !important;
}

/* ─── Hub buttons (bell, bug, settings) ─── */
.icon-btn {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 0 !important;
  border: 2px solid #0a0806 !important;
  background: rgba(0, 0, 0, 0.5) !important;
  box-shadow:
    0 0 0 1px rgba(232, 184, 48, 0.5),
    inset 0 0 0 1px rgba(232, 184, 48, 0.1),
    0 2px 0 #0a0806 !important;
  cursor: pointer !important;
  color: #edc050 !important;
  transition: filter 0.15s, transform 0.1s, color 0.15s, box-shadow 0.15s,
              background 0.15s !important;
  position: relative;
}

.icon-btn:hover {
  filter: brightness(1.05);
  color: #f5c840 !important;
  box-shadow:
    0 0 10px rgba(232, 184, 48, 0.25),
    0 0 0 1.5px rgba(232, 184, 48, 0.55),
    inset 0 0 0 1px rgba(232, 184, 48, 0.12),
    0 2px 0 #0a0806 !important;
}

.icon-btn:active {
  background: rgba(232, 184, 48, 0.1) !important;
  transform: translate(1px, 1px);
  box-shadow:
    0 0 0 1px rgba(232, 184, 48, 0.5),
    inset 0 0 8px rgba(232, 184, 48, 0.06),
    0 1px 0 #0a0806 !important;
}

/* ─── Panel-open selected state ─── */
.icon-btn.panel-open {
  background: rgba(232, 184, 48, 0.12) !important;
  box-shadow:
    0 0 8px rgba(232, 184, 48, 0.2),
    0 0 0 1px rgba(232, 184, 48, 0.6),
    inset 0 0 0 1px rgba(232, 184, 48, 0.15),
    0 1px 0 #0a0806 !important;
  color: #f5c840 !important;
}

.icon-btn i {
  font-size: 16px !important;
  line-height: 1 !important;
  color: inherit !important;
}

/* Hide old pixel img if still present */
.icon-btn img {
  display: none !important;
}

/* ─── Status / controls bar ─── */
#status-bar {
  padding: 5px 14px !important;
  font-size: 11px !important;
  color: #c8b8a0 !important;
  background:
    linear-gradient(180deg, rgba(20, 16, 12, 0.95), rgba(12, 10, 8, 0.98)) !important;
  border-bottom: 2px solid #0a0806 !important;
  box-shadow: inset 0 -1px 0 rgba(196, 154, 32, 0.2) !important;
  z-index: 99 !important;
  font-family: var(--font-game, monospace) !important;
  letter-spacing: 0.03em !important;
  text-shadow: 1px 1px 0 #000;
}

#status-bar #status-text {
  color: #c8b8a0 !important;
}

/* ─── Responsive ─── */
@media (max-width: 1100px) {
  #topbar {
    flex-wrap: wrap !important;
    padding: 6px 8px !important;
  }

  #topbar-center {
    order: 3;
    width: 100%;
    justify-content: flex-start !important;
  }

  #topbar .hud-card {
    min-width: 56px !important;
    padding: 4px 8px !important;
  }
}

@media (max-width: 720px) {
  #logo {
    font-size: 10px !important;
  }

  #topbar .hud-card .hc-value {
    font-size: 11px !important;
  }

  .phantom-btn-text {
    font-size: 7px !important;
  }

  #topbar .hud-deposit .hd-top,
  #topbar .hud-deposit .hd-bottom {
    font-size: 7px !important;
  }

  #topbar .hud-nav-link,
  #topbar .game-topbar-inicio {
    min-height: 34px !important;
    padding: 5px 8px !important;
    font-size: 7px !important;
  }

  #topbar .hud-nav-link .hud-nav-label,
  #topbar .game-topbar-inicio .hud-nav-label {
    display: none !important;
  }
}

/* ── BETA BADGE (Game Topbar & Preloader) ── */
.game-beta-badge {
  position: absolute;
  top: -8px;
  right: -18px;
  display: inline-block;
  font-family: "Press Start 2P", "VT323", monospace;
  font-size: 8px !important;
  line-height: 1;
  color: #fff4c0 !important;
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 60%, #a93226 100%) !important;
  padding: 3px 4px 2px !important;
  margin: 0 !important;
  border: 1.5px solid #0a0806 !important;
  border-radius: 2px !important;
  box-shadow:
    inset -1px -1px 0 rgba(0,0,0,0.3),
    inset 1px 1px 0 rgba(255,255,255,0.2),
    0 2px 5px rgba(0,0,0,0.5) !important;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.5) !important;
  image-rendering: pixelated;
  transform: rotate(10deg);
  letter-spacing: 0.05em !important;
  pointer-events: none;
  z-index: 10;
  text-transform: uppercase;
}

/* Ensure parents are relative for the absolute badge to anchor properly */
#topbar #logo,
.pl-title {
  position: relative;
  display: inline-flex;
  align-items: center;
}
