/* =============================================
   DOM-QUEST · Game UI Stylesheet v2.0
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Share+Tech+Mono&family=Exo+2:wght@300;400;600;800&display=swap');

:root {
  --bg:        #050a0f;
  --bg2:       #0a1420;
  --panel:     rgba(8, 18, 30, 0.92);
  --border:    rgba(0, 220, 180, 0.22);
  --border-hi: rgba(0, 220, 180, 0.6);
  --text:      #c8e8e0;
  --muted:     #4a7a70;
  --accent:    #00dca8;
  --accent2:   #00a8ff;
  --danger:    #ff4466;
  --warn:      #ffb84a;
  --gold:      #ffd166;
  --mono:      'Share Tech Mono', monospace;
  --pixel:     'Press+Start+2P', monospace;
  --sans:      'Exo 2', sans-serif;
  --glow:      0 0 20px rgba(0, 220, 168, 0.35);
  --glow2:     0 0 30px rgba(0, 168, 255, 0.3);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  overflow: hidden;
}

/* ─── SCREENS ─────────────────────────────────── */
.screen {
  position: fixed; inset: 0;
  display: none; flex-direction: column;
  overflow: hidden;
}
.screen.active { display: flex; }

/* ─── SCANLINES ──────────────────────────────── */
.scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 999;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 3px,
    rgba(0,0,0,0.08) 3px, rgba(0,0,0,0.08) 4px
  );
}
.game-scanlines { z-index: 10; }

/* ─── TITLE SCREEN ────────────────────────────── */
#screen-title {
  align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse 80% 50% at 50% 40%, rgba(0,180,130,0.12), transparent),
    radial-gradient(ellipse 60% 80% at 80% 80%, rgba(0,100,200,0.1), transparent),
    var(--bg);
}

#title-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
}

.title-content {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  gap: 18px; text-align: center; padding: 20px;
}

.title-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.2em;
  animation: blink 1.8s step-end infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.title-logo {
  font-family: var(--pixel);
  font-size: clamp(28px, 6vw, 72px);
  color: #fff;
  text-shadow:
    0 0 20px var(--accent),
    0 0 60px rgba(0,220,168,0.4),
    4px 4px 0 rgba(0,180,130,0.5);
  line-height: 1.2;
  letter-spacing: 0.05em;
  animation: glitch 6s infinite;
}

.title-dash { color: var(--accent); }

@keyframes glitch {
  0%, 94%, 100% { transform: none; filter: none; }
  95% { transform: translateX(-3px); filter: hue-rotate(30deg); }
  96% { transform: translateX(3px); filter: hue-rotate(-30deg); }
  97% { transform: none; filter: none; }
}

.title-sub {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.title-menu {
  display: flex; flex-direction: column; gap: 12px;
  margin-top: 16px; width: 280px;
}

.title-hint {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}

/* ─── BUTTONS ────────────────────────────────── */
.menu-btn {
  font-family: var(--pixel);
  font-size: 11px;
  padding: 14px 24px;
  border-radius: 6px;
  border: 2px solid var(--accent);
  background: rgba(0, 220, 168, 0.1);
  color: var(--accent);
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: all 0.15s;
  width: 100%;
}
.menu-btn:hover {
  background: rgba(0, 220, 168, 0.25);
  box-shadow: var(--glow);
  transform: translateY(-2px);
}
.menu-btn.secondary {
  border-color: var(--accent2);
  background: rgba(0, 168, 255, 0.08);
  color: var(--accent2);
}
.menu-btn.secondary:hover {
  background: rgba(0, 168, 255, 0.2);
  box-shadow: var(--glow2);
}

.action-btn {
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--border-hi);
  background: rgba(0, 220, 168, 0.08);
  color: var(--accent);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.action-btn:hover { background: rgba(0,220,168,0.18); box-shadow: var(--glow); }
.action-btn.cancel { border-color: var(--danger); color: var(--danger); }
.action-btn.cancel:hover { background: rgba(255,68,102,0.15); }

/* ─── AUTH SCREEN ─────────────────────────────── */
#screen-auth {
  align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse 60% 60% at 50% 50%, rgba(0,100,200,0.1), transparent),
    var(--bg);
}

.auth-box {
  position: relative; z-index: 2;
  background: var(--panel);
  border: 1px solid var(--border-hi);
  border-radius: 12px;
  padding: 36px 40px;
  width: 360px;
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 0 60px rgba(0,220,168,0.12), 0 20px 60px rgba(0,0,0,0.5);
}
.auth-box h2 {
  font-family: var(--pixel);
  font-size: 14px;
  color: var(--accent);
  text-align: center;
  margin-bottom: 8px;
}

.field-group {
  display: flex; flex-direction: column; gap: 6px;
}
.field-group label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.field-group input {
  font-family: var(--mono);
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.4);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.field-group input:focus { border-color: var(--accent); box-shadow: 0 0 10px rgba(0,220,168,0.2); }

.auth-error {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--danger);
  text-align: center;
  min-height: 16px;
}
.back-btn {
  font-family: var(--mono);
  font-size: 11px;
  background: none; border: none;
  color: var(--muted); cursor: pointer;
  text-align: left; padding: 0;
  transition: color 0.15s;
}
.back-btn:hover { color: var(--accent); }

/* ─── HUD TOP BAR ─────────────────────────────── */
.hud-top {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px;
  background: rgba(5, 10, 20, 0.95);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; flex-wrap: wrap;
  z-index: 100;
}

.hud-player { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.hud-avatar {
  width: 40px; height: 40px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(0,220,168,0.3), rgba(0,120,220,0.3));
  border: 1px solid var(--accent);
  display: grid; place-items: center;
  font-size: 20px;
}
.hud-info { display: flex; flex-direction: column; gap: 2px; }
.hud-name { font-family: var(--mono); font-size: 13px; color: var(--text); }
.hud-level { font-family: var(--pixel); font-size: 9px; color: var(--accent); }

.hud-bars { display: flex; flex-direction: column; gap: 5px; flex-shrink: 0; min-width: 160px; }
.hud-bar-row { display: flex; align-items: center; gap: 6px; }
.hud-bar-label { font-family: var(--pixel); font-size: 7px; color: var(--muted); width: 20px; }
.hud-bar-track {
  flex: 1; height: 8px; border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden; min-width: 80px;
}
.hud-bar-fill { height: 100%; border-radius: 999px; transition: width 0.4s ease; }
.hud-bar-fill.hp { background: linear-gradient(90deg, #ff4466, #ff8866); }
.hud-bar-fill.en { background: linear-gradient(90deg, #00a8ff, #00dca8); }
.hud-bar-val { font-family: var(--mono); font-size: 10px; color: var(--muted); min-width: 52px; }

.hud-currency { display: flex; gap: 8px; flex-shrink: 0; }
.currency-chip {
  font-family: var(--mono); font-size: 11px;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid;
}
.currency-chip.commits { border-color: rgba(0,220,168,0.4); color: var(--accent); }
.currency-chip.tokens  { border-color: rgba(255,209,102,0.4); color: var(--gold); }
.skill-chip {
  position: relative;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.55);
  font-size: 16px;
  overflow: hidden;
}
.skill-chip .skill-icon {
  position: relative;
  z-index: 2;
  font-size: 14px;
}
.skill-chip .skill-cooldown {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  font-family: var(--mono);
  font-size: 10px;
  color: rgba(255,255,255,0.95);
}
.skill-chip.ready {
  border-color: rgba(0,220,168,0.6);
  background: rgba(0,220,168,0.08);
  color: var(--accent);
}
.skill-progress {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 50%;
  background: conic-gradient(rgba(0,220,168,0.75) 0deg, rgba(0,220,168,0.75) var(--progress, 0), rgba(255,255,255,0.08) var(--progress, 0), rgba(255,255,255,0.08) 100%);
  transform: rotate(-90deg);
  transition: background 0.25s ease;
}

.hud-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.tab-btn {
  font-family: var(--mono); font-size: 11px;
  padding: 6px 12px; border-radius: 6px;
  border: 1px solid transparent;
  background: transparent; color: var(--muted);
  cursor: pointer; transition: all 0.15s;
}
.tab-btn:hover { color: var(--text); border-color: var(--border); }
.tab-btn.active { background: rgba(0,220,168,0.12); border-color: var(--accent); color: var(--accent); }
.tab-btn.logout-tab { color: var(--danger); }
.tab-btn.logout-tab:hover { background: rgba(255,68,102,0.1); border-color: var(--danger); }

/* ─── TAB CONTENTS ────────────────────────────── */
.tab-content {
  display: none; flex: 1; overflow-y: auto;
  padding: 20px 24px;
}
.tab-content.active { display: flex; flex-direction: column; gap: 16px; }

.section-header {
  display: flex; justify-content: space-between;
  align-items: center; gap: 12px;
}
.section-header h2 {
  font-family: var(--pixel);
  font-size: 13px; color: var(--accent);
}

/* ─── MAP ─────────────────────────────────────── */
#tab-map { flex-direction: row; gap: 20px; padding: 16px 20px; overflow: hidden; }

.map-wrapper {
  display: flex; flex-direction: column; gap: 10px;
  flex-shrink: 0;
}
.map-zone-label {
  font-family: var(--pixel);
  font-size: 9px; color: var(--accent);
  letter-spacing: 0.15em;
}
.map-grid {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 4px;
}
.map-tile {
  width: 52px; height: 52px;
  border-radius: 8px;
  border: 1px solid rgba(0,220,168,0.1);
  background: rgba(5,15,25,0.8);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 18px;
  cursor: default;
  transition: all 0.12s;
  position: relative;
}
.map-tile.walkable { border-color: rgba(0,220,168,0.08); }
.map-tile.player {
  background: linear-gradient(135deg, rgba(0,220,168,0.25), rgba(0,120,220,0.2));
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(0,220,168,0.4);
  animation: pulse-tile 1.8s ease-in-out infinite;
}
@keyframes pulse-tile {
  0%,100% { box-shadow: 0 0 14px rgba(0,220,168,0.4); }
  50%      { box-shadow: 0 0 26px rgba(0,220,168,0.7); }
}
.map-tile.bug { background: rgba(255,50,80,0.15); border-color: rgba(255,68,102,0.4); }
.map-tile.cache { background: rgba(255,180,50,0.12); border-color: rgba(255,184,74,0.35); }
.map-tile.node_server, .map-tile.node { background: rgba(0,120,220,0.15); border-color: rgba(0,168,255,0.35); }
.map-tile.wall, .map-tile.mountain { background: rgba(0,0,0,0.6); border-color: rgba(40,40,40,0.5); opacity: 0.4; }
.map-tile.tree { background: rgba(30,120,60,0.2); border-color: rgba(40,160,80,0.4); text-shadow: 0 0 8px rgba(40,160,80,0.6); }
.map-tile.house { background: rgba(120,60,30,0.2); border-color: rgba(160,80,40,0.4); text-shadow: 0 0 8px rgba(160,80,40,0.6); }
.map-tile.cleared {
  background: rgba(0,220,168,0.05);
  border-color: rgba(0,220,168,0.14);
  opacity: 0.72;
}

.party-actions .header-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.quiz-modal-box {
  max-width: 440px;
}
.quiz-modal-box h3 {
  font-family: var(--pixel);
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 8px;
}
.quiz-question {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
  margin-bottom: 14px;
}
.quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.quiz-choices button {
  font-family: var(--mono);
  font-size: 12px;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0,220,168,0.06);
  color: var(--text);
  cursor: pointer;
}
.quiz-choices button:hover {
  border-color: var(--accent);
  background: rgba(0,220,168,0.12);
}
.quiz-feedback {
  font-family: var(--mono);
  font-size: 12px;
  min-height: 18px;
  color: var(--muted);
}

.map-tile-label {
  font-family: var(--mono);
  font-size: 9px; color: var(--muted);
  position: absolute; bottom: 2px;
}

.map-hint {
  font-family: var(--mono);
  font-size: 10px; color: var(--muted);
  display: flex; gap: 4px; align-items: center; flex-wrap: wrap;
}
kbd {
  background: rgba(0,220,168,0.1);
  border: 1px solid var(--border-hi);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: var(--mono);
  color: var(--accent);
}

.map-tile-info {
  font-family: var(--mono);
  font-size: 11px; color: var(--accent);
  min-height: 20px;
}

.map-log {
  flex: 1;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  max-height: calc(100vh - 140px);
}
.log-entry {
  font-family: var(--mono);
  font-size: 11px; color: var(--muted);
  line-height: 1.5;
  border-bottom: 1px solid rgba(0,220,168,0.05);
  padding-bottom: 4px;
}
.log-entry.good { color: var(--accent); }
.log-entry.bad  { color: var(--danger); }
.log-entry.info { color: var(--accent2); }
.log-entry.warn { color: var(--warn); }

/* ─── HERO / PARTY ────────────────────────────── */
.hero-grid, .item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.hero-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
  transition: all 0.15s;
}
.hero-card:hover { border-color: var(--border-hi); box-shadow: var(--glow); }
.hero-card.in-party { border-color: var(--accent); background: rgba(0,220,168,0.06); }

.hero-rarity {
  font-family: var(--pixel); font-size: 8px;
  padding: 3px 8px; border-radius: 999px;
  display: inline-block; width: fit-content;
}
.rarity-C   { background: rgba(150,150,150,0.2); color: #aaa; }
.rarity-R   { background: rgba(0,168,255,0.2);   color: #66c8ff; }
.rarity-SR  { background: rgba(160,80,255,0.2);  color: #cc88ff; }
.rarity-SSR { background: rgba(255,160,0,0.2);   color: var(--gold); border: 1px solid var(--gold); }

.hero-pixel-sprite {
  display: flex; align-items: center; justify-content: center;
  height: 60px; margin: 4px auto;
  animation: float 3s ease-in-out infinite;
}
.hero-pixel-sprite svg { display: block; }
.hero-sprite-emoji { font-size: 36px; }

.hero-name  { font-family: var(--sans); font-weight: 600; font-size: 13px; }
.hero-role  { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.hero-skill { font-family: var(--mono); font-size: 10px; color: var(--accent2); }
.hero-toggle-btn {
  font-family: var(--mono); font-size: 10px;
  padding: 6px 10px; border-radius: 6px;
  border: 1px solid var(--border-hi);
  background: transparent; color: var(--accent);
  cursor: pointer; transition: all 0.15s;
  margin-top: auto;
}
.hero-toggle-btn:hover { background: rgba(0,220,168,0.15); }
.hero-toggle-btn.in-party { border-color: var(--danger); color: var(--danger); }

/* ─── ITEMS ───────────────────────────────────── */
.item-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex; flex-direction: column; gap: 6px;
  transition: all 0.15s;
}
.item-card:hover { border-color: var(--border-hi); }
.item-card.equipped { border-color: var(--accent); background: rgba(0,220,168,0.05); }

.item-name { font-family: var(--sans); font-weight: 600; font-size: 13px; }
.item-type { font-family: var(--mono); font-size: 10px; color: var(--muted); text-transform: uppercase; }
.item-desc { font-family: var(--mono); font-size: 10px; color: var(--muted); line-height: 1.5; }
.item-stats { font-family: var(--mono); font-size: 10px; color: var(--accent); }
.item-qty   { font-family: var(--mono); font-size: 10px; color: var(--warn); }
.item-price { font-family: var(--mono); font-size: 11px; color: var(--gold); }

.item-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.item-btn {
  font-family: var(--mono); font-size: 10px;
  padding: 5px 10px; border-radius: 5px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text); cursor: pointer; transition: all 0.12s;
}
.item-btn:hover { border-color: var(--accent); color: var(--accent); }
.item-btn.equip  { border-color: var(--accent2); color: var(--accent2); }
.item-btn.use    { border-color: var(--warn); color: var(--warn); }
.item-btn.buy    { border-color: var(--gold); color: var(--gold); }
.item-btn.sell   { border-color: var(--danger); color: var(--danger); }
.item-btn.sell:hover { background: rgba(255,68,102,0.12); }
.item-btn.unequip { border-color: var(--danger); color: var(--danger); }

.shop-msg { font-family: var(--mono); font-size: 12px; color: var(--accent); text-align: center; }

/* ─── SHOP SECTIONS ───────────────────────────── */
.shop-section-label {
  grid-column: 1 / -1;
  font-family: var(--pixel);
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 4px 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.shop-empty-msg {
  grid-column: 1 / -1;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}
.item-card.sell-mode { border-color: rgba(255,68,102,0.18); }
.item-card.sell-mode:hover { border-color: rgba(255,68,102,0.45); }
.item-price {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ─── GACHA RESULT ────────────────────────────── */
.gacha-result {
  font-family: var(--mono); font-size: 13px;
  text-align: center; color: var(--accent);
  min-height: 30px;
}

/* ─── QUESTS ──────────────────────────────────── */
.quest-list { display: flex; flex-direction: column; gap: 10px; }
.quest-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  display: flex; align-items: center; gap: 16px;
}
.quest-card.claimed { opacity: 0.5; }
.quest-info { flex: 1; }
.quest-title { font-family: var(--sans); font-weight: 600; font-size: 14px; }
.quest-desc { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 3px; }
.quest-reward {
  font-family: var(--mono); font-size: 11px; color: var(--gold);
  white-space: nowrap;
}
.quest-progress {
  font-family: var(--mono); font-size: 10px; color: var(--accent);
}
.quest-claim-btn {
  font-family: var(--pixel); font-size: 8px;
  padding: 8px 14px; border-radius: 6px;
  border: 1px solid var(--accent);
  background: rgba(0,220,168,0.1); color: var(--accent);
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.quest-claim-btn:hover { background: rgba(0,220,168,0.25); box-shadow: var(--glow); }
.quest-claim-btn:disabled { opacity: 0.4; cursor: default; pointer-events: none; }

/* ─── LEADERBOARD ─────────────────────────────── */
.lb-table {
  width: 100%; border-collapse: collapse;
  font-family: var(--mono); font-size: 12px;
}
.lb-table th {
  padding: 10px 14px; text-align: left;
  color: var(--muted); border-bottom: 1px solid var(--border);
  font-weight: normal; text-transform: uppercase; font-size: 10px; letter-spacing: 0.1em;
}
.lb-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0,220,168,0.06);
}
.lb-table tr:hover td { background: rgba(0,220,168,0.04); }
.lb-rank-1 td { color: var(--gold); }
.lb-rank-2 td { color: #c0c0c0; }
.lb-rank-3 td { color: #cd7f32; }
.lb-me td { background: rgba(0,220,168,0.06); }
.lb-badge {
  display: inline-block;
  padding: 2px 8px; border-radius: 999px;
  font-size: 9px; border: 1px solid var(--border);
}

/* ─── BATTLE OVERLAY ──────────────────────────── */
.battle-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(2, 5, 10, 0.97);
  display: flex; align-items: center; justify-content: center;
}
.battle-overlay.hidden { display: none; }

.battle-screen {
  width: 100%; max-width: 720px;
  display: flex; flex-direction: column; gap: 16px;
  padding: 28px 24px;
}

.battle-header {
  display: flex; justify-content: space-between; align-items: center;
}
.battle-header span {
  font-family: var(--pixel); font-size: 10px; color: var(--accent);
  letter-spacing: 0.15em;
}
.flee-btn {
  font-family: var(--mono); font-size: 11px;
  padding: 6px 14px; border-radius: 6px;
  border: 1px solid var(--danger); color: var(--danger);
  background: transparent; cursor: pointer; transition: all 0.15s;
}
.flee-btn:hover { background: rgba(255,68,102,0.15); }

.battle-arena {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 12px;
}
.fighter {
  flex: 1; display: flex; flex-direction: column; gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px; padding: 16px;
}
.battle-vs {
  font-family: var(--pixel); font-size: 14px; color: var(--danger);
  align-self: center; flex-shrink: 0;
  text-shadow: 0 0 12px rgba(255,68,102,0.6);
}
.fighter-sprite {
  font-size: 48px; text-align: center;
  animation: float 3s ease-in-out infinite;
  display: flex; align-items: center; justify-content: center;
}
.fighter-sprite svg { display: block; }
.enemy-sprite { animation-direction: reverse; animation-duration: 2.5s; }
.fighter.enemy-side { position: relative; }
@keyframes float {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
/* ─── Rank badge ─── */
.enemy-rank-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-family: var(--pixel); font-size: 7px;
  text-align: center; padding: 2px 6px; border-radius: 3px;
  letter-spacing: 1px;
  background: rgba(0, 0, 0, 0.18);
}
.rank-normal { color: var(--muted);  border: 1px solid var(--muted); }
.rank-elite  { color: var(--warn);   border: 1px solid var(--warn);  box-shadow: 0 0 6px rgba(255,184,74,0.4); }
.rank-boss   { color: var(--danger); border: 1px solid var(--danger);box-shadow: 0 0 10px rgba(255,68,102,0.6); }

/* ─── Set bonus tag ─── */
.set-bonus-tag {
  font-family: var(--pixel); font-size: 7px;
  padding: 3px 8px; border-radius: 3px;
  background: rgba(255,209,102,0.12);
  border: 1px solid var(--gold);
  color: var(--gold);
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.fighter-name { font-family: var(--sans); font-weight: 600; font-size: 14px; text-align: center; }

.battle-bar-row { display: flex; align-items: center; gap: 6px; }
.battle-bar-row span:first-child { font-family: var(--pixel); font-size: 7px; color: var(--muted); width: 18px; }
.battle-bar-row span:last-child  { font-family: var(--mono); font-size: 10px; color: var(--muted); min-width: 50px; text-align: right; }
.battle-track {
  flex: 1; height: 10px; border-radius: 999px;
  background: rgba(255,255,255,0.06); overflow: hidden;
}
.battle-fill { height: 100%; border-radius: 999px; transition: width 0.5s ease; }
.battle-fill.hp        { background: linear-gradient(90deg, #ff4466, #ff8866); }
.battle-fill.enemy-hp  { background: linear-gradient(90deg, #ff2244, #ff6644); }
.battle-fill.en        { background: linear-gradient(90deg, #00a8ff, #00dca8); }

.battle-log-box {
  background: rgba(0,0,0,0.6);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 12px;
  min-height: 80px; max-height: 100px; overflow-y: auto;
  font-family: var(--mono); font-size: 12px; color: var(--text);
  line-height: 1.6;
}

.battle-actions {
  display: flex; gap: 12px; justify-content: center;
}
.battle-btn {
  font-family: var(--pixel); font-size: 9px;
  padding: 14px 20px; border-radius: 8px;
  border: 2px solid; cursor: pointer;
  transition: all 0.15s; text-align: center;
  line-height: 1.8; flex: 1; max-width: 160px;
}
.battle-btn.attack { border-color: var(--danger); color: var(--danger); background: rgba(255,68,102,0.08); }
.battle-btn.attack:hover { background: rgba(255,68,102,0.22); box-shadow: 0 0 14px rgba(255,68,102,0.4); }
.battle-btn.skill  { border-color: var(--accent2); color: var(--accent2); background: rgba(0,168,255,0.08); }
.battle-btn.skill:hover  { background: rgba(0,168,255,0.2); box-shadow: 0 0 14px rgba(0,168,255,0.4); }
.battle-btn.item   { border-color: var(--warn); color: var(--warn); background: rgba(255,184,74,0.08); }
.battle-btn.item:hover   { background: rgba(255,184,74,0.2); }

.battle-turn {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  text-align: center;
}
.battle-btn:disabled { opacity: 0.3; cursor: default; }

/* ─── ENEMY MODAL ─────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--panel);
  border: 1px solid var(--border-hi);
  border-radius: 12px; padding: 28px;
  min-width: 300px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: var(--glow);
}
.modal-box h3 {
  font-family: var(--pixel); font-size: 11px; color: var(--accent);
}
.enemy-list { display: flex; flex-direction: column; gap: 8px; }
.enemy-btn {
  font-family: var(--mono); font-size: 12px;
  padding: 10px 14px; border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent; color: var(--text);
  cursor: pointer; text-align: left; transition: all 0.12s;
}
.enemy-btn:hover { border-color: var(--danger); color: var(--danger); background: rgba(255,68,102,0.08); }

/* ─── TOAST ───────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 700; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  font-family: var(--mono); font-size: 12px;
  padding: 10px 18px; border-radius: 8px;
  border: 1px solid;
  animation: toast-in 0.3s ease, toast-out 0.3s ease 2.7s forwards;
  max-width: 320px;
}
.toast.good { border-color: var(--accent); color: var(--accent); background: rgba(0,220,168,0.1); }
.toast.bad  { border-color: var(--danger); color: var(--danger); background: rgba(255,68,102,0.1); }
.toast.info { border-color: var(--accent2); color: var(--accent2); background: rgba(0,168,255,0.1); }

@keyframes toast-in  { from { opacity:0; transform: translateX(40px); } to { opacity:1; transform:none; } }
@keyframes toast-out { from { opacity:1; } to { opacity:0; } }

/* ─── BATTLE RESULT ───────────────────────────── */
.battle-result-box {
  background: var(--panel);
  border: 2px solid var(--border-hi);
  border-radius: 16px;
  padding: 40px 48px;
  min-width: 340px; max-width: 440px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  text-align: center;
  animation: result-pop 0.35s cubic-bezier(.2,1.4,.5,1);
}
@keyframes result-pop {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.battle-result-box.won  { border-color: var(--accent); box-shadow: 0 0 60px rgba(0,220,168,0.25); }
.battle-result-box.lost { border-color: var(--danger); box-shadow: 0 0 60px rgba(255,68,102,0.2); }

.br-icon  { font-size: 56px; line-height: 1; animation: float 2s ease-in-out infinite; }
.br-title {
  font-family: var(--pixel); font-size: 18px;
  color: var(--accent); letter-spacing: 0.08em;
}
.battle-result-box.lost .br-title { color: var(--danger); }
.br-sub   { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.br-rewards {
  display: flex; gap: 16px; flex-wrap: wrap; justify-content: center;
  background: rgba(0,220,168,0.06);
  border: 1px solid rgba(0,220,168,0.2);
  border-radius: 8px; padding: 12px 20px;
}
.br-reward-item {
  font-family: var(--pixel); font-size: 10px; color: var(--accent);
}
.br-drop {
  font-family: var(--mono); font-size: 12px; color: var(--gold);
  background: rgba(255,209,102,0.08);
  border: 1px solid rgba(255,209,102,0.25);
  border-radius: 6px; padding: 8px 16px;
}
.br-drop strong { color: var(--gold); }

.br-close-btn {
  font-family: var(--pixel); font-size: 10px;
  padding: 14px 32px; border-radius: 8px;
  border: 2px solid var(--accent);
  background: rgba(0,220,168,0.12); color: var(--accent);
  cursor: pointer; transition: all 0.15s; margin-top: 4px;
  letter-spacing: 0.06em;
}
.br-close-btn:hover { background: rgba(0,220,168,0.28); box-shadow: var(--glow); transform: translateY(-2px); }
.battle-result-box.lost .br-close-btn { border-color: var(--danger); color: var(--danger); background: rgba(255,68,102,0.08); }
.battle-result-box.lost .br-close-btn:hover { background: rgba(255,68,102,0.2); }

.br-hint { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: -4px; }

/* ─── SCROLLBAR ───────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,220,168,0.25); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ─── GLOBAL TOOLTIP ──────────────────────────── */
.global-tooltip {
  position: fixed;
  background: rgba(5, 10, 15, 0.95);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 4px 15px rgba(0, 220, 168, 0.2);
  max-width: 250px;
  line-height: 1.4;
  transition: opacity 0.15s ease;
  white-space: pre-wrap;
}
.global-tooltip.hidden {
  opacity: 0;
}

/* ─── EQUIPMENT UI ────────────────────────────── */
.equip-layout {
  display: flex;
  gap: 20px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  flex-wrap: wrap;
}
.equip-doll {
  display: grid;
  grid-template-columns: repeat(3, 80px);
  grid-template-rows: repeat(4, 80px);
  gap: 10px;
  /* Basic layout:
     Row 1: [ empty ] [ helmet ] [ empty ]
     Row 2: [ arms  ] [ chest  ] [ necklace ]
     Row 3: [ ring_l] [ legs   ] [ ring_r ]
     Row 4: [ empty ] [ accessory] [ empty ]
  */
}
#slot-helmet { grid-column: 2; grid-row: 1; }
#slot-arms { grid-column: 1; grid-row: 2; }
#slot-chest { grid-column: 2; grid-row: 2; }
#slot-necklace { grid-column: 3; grid-row: 2; }
#slot-ring_l { grid-column: 1; grid-row: 3; }
#slot-legs { grid-column: 2; grid-row: 3; }
#slot-ring_r { grid-column: 3; grid-row: 3; }
#slot-accessory { grid-column: 2; grid-row: 4; }

.equip-slot {
  border: 1px dashed var(--border-hi);
  border-radius: 8px;
  background: rgba(0,220,168,0.03);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.15s;
  padding: 4px;
}
.equip-slot > span {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  pointer-events: none;
}
.equip-slot .item-card {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 4px;
  border: none;
  background: rgba(0,220,168,0.1);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}
.equip-slot .item-card:hover {
  background: rgba(0,220,168,0.25);
  box-shadow: var(--glow);
}
.equip-slot .item-name {
  font-size: 10px;
  text-align: center;
  word-break: break-word;
  line-height: 1.2;
}
.equip-slot .item-type, 
.equip-slot .item-desc, 
.equip-slot .item-stats, 
.equip-slot .item-actions,
.equip-slot .item-equipped-label {
  display: none !important; /* Hide details and Equipado text inside the slot */
}

.equip-stats {
  flex: 1;
  min-width: 150px;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

/* ─── RESPONSIVE ──────────────────────────────── */
@media (max-width: 900px) {
  #tab-map { flex-direction: column; overflow-y: auto; }
  .map-tile { width: 40px; height: 40px; font-size: 14px; }
  .battle-arena { flex-direction: column; align-items: stretch; }
  .battle-vs { text-align: center; }
}
@media (max-width: 600px) {
  .hud-top { padding: 8px 12px; gap: 8px; }
  .hud-bars { min-width: 120px; }
  .map-tile { width: 34px; height: 34px; font-size: 12px; }
}
