/* ── Dungeon of Sats Styles ─────────────────────────────────────────── */

/* ── Gate / Connect Screen ─────────────────────────────────────────── */

.gate-card {
  max-width: 480px;
  margin: 60px auto;
  padding: 48px 40px;
  background: #0d0f14;
  border: 1px solid #1e2233;
  border-radius: 20px;
  text-align: center;
}
.gate-icon {
  font-size: 3rem;
  margin-bottom: 20px;
}
.gate-card h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.gate-card p {
  color: #6b7394;
  margin-bottom: 8px;
  font-size: 0.95rem;
  line-height: 1.6;
}
.gate-sub {
  margin-bottom: 28px !important;
}
.gate-card strong {
  color: #e8eaf0;
}
.btn-gate {
  display: inline-block;
  margin-top: 20px;
  padding: 12px 28px;
  background: #f7931a;
  color: #07080a;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
}
.btn-gate:hover {
  background: #e07f12;
  text-decoration: none;
  color: #07080a;
}
.btn-gate.btn-gate-green { background: #22c55e; margin-left: 10px; }
.btn-gate.btn-gate-green:hover { background: #16a34a; color: #07080a; }
.stamina-timer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.5rem;
  font-weight: 700;
  color: #f7931a;
  margin: 20px 0 28px;
  letter-spacing: 0.05em;
}

/* ── Character Selection ────────────────────────────────────────────── */

.char-header {
  text-align: center;
  padding: 0 0 36px;
}
.char-header h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.char-header p {
  color: #6b7394;
}
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  max-width: 700px;
  margin: 0 auto;
}
.char-card {
  background: #0d0f14;
  border: 2px solid #1e2233;
  border-radius: 20px;
  padding: 32px 28px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}
.char-card:hover {
  border-color: #f7931a;
  transform: translateY(-2px);
}
.char-canvas-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.char-sprite {
  image-rendering: pixelated;
}
.char-name {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.char-desc {
  font-size: 0.85rem;
  color: #6b7394;
  margin-bottom: 20px;
  line-height: 1.5;
}
.char-stats {
  margin-bottom: 24px;
  text-align: left;
}
.stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.stat-label {
  font-size: 0.75rem;
  color: #6b7394;
  min-width: 42px;
  font-family: 'JetBrains Mono', monospace;
}
.stat-bar {
  flex: 1;
  height: 6px;
  background: #1e2233;
  border-radius: 3px;
  overflow: hidden;
}
.stat-fill {
  height: 100%;
  border-radius: 3px;
}
.stat-str { background: #f7931a; }
.stat-int { background: #3b82f6; }
.stat-def { background: #22c55e; }
.stat-hp { background: #ef4444; }
.stat-mp { background: #8b5cf6; }

.btn-select-class {
  width: 100%;
  padding: 12px;
  background: #f7931a;
  color: #07080a;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.btn-select-class:hover { background: #e07f12; }

/* ── Char Warning & Nickname ─────────────────────────────────────────── */

.char-warning {
  display: inline-block;
  margin-bottom: 10px;
  padding: 8px 16px;
  background: rgba(247,147,26,0.1);
  border: 1px solid rgba(247,147,26,0.3);
  border-radius: 8px;
  color: #f7931a;
  font-size: 0.85rem;
  font-weight: 600;
}
.nickname-row {
  margin-top: 16px;
}
.nickname-input {
  width: 100%;
  max-width: 340px;
  padding: 10px 16px;
  background: #0d0f14;
  border: 1px solid #2a3050;
  border-radius: 10px;
  color: #e8eaf0;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.95rem;
  text-align: center;
}
.nickname-input::placeholder { color: #4a5068; }
.nickname-input:focus { outline: none; border-color: #f7931a; }

/* ── Visual Customization Section ────────────────────────────────────── */

.custom-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 20px auto 24px;
  padding: 18px 24px;
  background: #0d0f14;
  border: 1px solid #1e2233;
  border-radius: 14px;
  max-width: 500px;
}
.custom-attr-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.custom-attr-label {
  font-size: 0.8rem;
  color: #6b7394;
  min-width: 100px;
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
}
.custom-attr-val {
  flex: 1;
  text-align: center;
  font-size: 0.9rem;
  color: #e8eaf0;
  font-weight: 600;
}
.custom-arrow {
  padding: 4px 10px;
  background: #1e2233;
  border: 1px solid #2a3050;
  border-radius: 6px;
  color: #e8eaf0;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
}
.custom-arrow:hover { background: #2a3050; }

/* ── Stat Allocation (side panel) ────────────────────────────────────── */

.stat-alloc-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.stat-alloc-label {
  font-size: 0.75rem;
  color: #6b7394;
  min-width: 90px;
  font-family: 'JetBrains Mono', monospace;
}
.stat-alloc-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: #e8eaf0;
  font-weight: 700;
  flex: 1;
}
.stat-plus-btn {
  padding: 2px 8px;
  background: #22c55e;
  border: none;
  border-radius: 5px;
  color: #07080a;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}
.stat-plus-btn:hover { background: #16a34a; }
.stat-points-notice {
  font-size: 0.78rem;
  color: #eab308;
  font-weight: 600;
  text-align: center;
  padding-top: 4px;
}

/* ── HUD ────────────────────────────────────────────────────────────── */

.dungeon-hud {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  background: #0d0f14;
  border: 1px solid #1e2233;
  border-radius: 14px;
  padding: 14px 20px;
  margin-bottom: 8px;
}
.hud-left {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hud-bar-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hud-bar-label {
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  color: #6b7394;
  display: flex;
  align-items: center;
  gap: 4px;
}
.hud-pot-btn {
  background: rgba(247,147,26,0.15);
  border: 1px solid #f7931a;
  color: #f7931a;
  font-weight: 700;
  font-size: 0.85rem;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: background 0.15s;
  flex-shrink: 0;
}
.hud-pot-btn:hover { background: rgba(247,147,26,0.35); }
.hud-bar {
  width: 160px;
  height: 8px;
  background: #1e2233;
  border-radius: 4px;
  overflow: hidden;
}
.hud-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}
.hp-fill { background: #ef4444; }
.mp-fill { background: #8b5cf6; }
.heart-icon { color: #ef4444; font-size: 1.5rem; line-height: 1; }
#hudMpIcon { font-size: 1.5rem; line-height: 1; }
.exp-fill { background: #eab308; }

.hud-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.hud-sats-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(247,147,26,0.12);
  border: 1px solid rgba(247,147,26,0.35);
  border-radius: 20px;
  padding: 4px 12px 4px 8px;
}
.hud-sats-badge svg { flex-shrink: 0; }
.hud-sats-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: #f7931a;
  text-shadow: 0 0 12px rgba(247,147,26,0.5);
}
.hud-sats-unit {
  font-size: 0.75rem;
  font-weight: 600;
  color: #b07820;
  letter-spacing: 0.04em;
}
.hud-stat {
  font-size: 0.8rem;
  color: #6b7394;
}
.hud-stat strong {
  color: #e8eaf0;
  font-family: 'JetBrains Mono', monospace;
}
.hud-right {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: right;
}
.hud-stamina {
  display: flex;
  align-items: baseline;
  gap: 6px;
  justify-content: flex-end;
}
.hud-stat-label {
  font-size: 0.75rem;
  color: #6b7394;
}
.hud-stamina-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: #f7931a;
}
.hud-stamina-max {
  font-size: 0.75rem;
  color: #6b7394;
}
.hud-sats-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: #f7931a;
}

.hud-potion-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 20px 12px;
  flex-wrap: wrap;
}
.hud-potion-info {
  font-size: 0.75rem;
  color: #6b7394;
}
.hud-potion-info strong {
  color: #e8eaf0;
}
.btn-settings {
  margin-left: auto;
  padding: 6px 16px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  background: #f7931a;
  border: none;
  border-radius: 8px;
  color: #07080a;
  cursor: pointer;
}
.btn-settings:hover { background: #e07f12; }

/* ── Game Layout ────────────────────────────────────────────────────── */

.game-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.canvas-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.canvas-outer {
  position: relative;
  display: inline-flex;
}

/* ── Same-tile players panel ─────────────────────────────────────────── */
#sameTilePanel {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: all;
}
.stpanel-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(7,8,12,0.88);
  border: 1px solid rgba(239,68,68,0.6);
  border-radius: 7px;
  padding: 4px 8px;
  font-family: 'Space Grotesk', sans-serif;
}
.stpanel-nick {
  font-size: 0.72rem;
  font-weight: 700;
  color: #e8eaf0;
}
.stpanel-hp {
  font-size: 0.65rem;
  color: #ef4444;
  font-family: 'JetBrains Mono', monospace;
}
.stpanel-atk-btn {
  padding: 2px 8px;
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
}
.stpanel-atk-btn:hover { background: #dc2626; }
.stpanel-atk-btn:disabled { opacity: 0.5; cursor: default; }

/* ── Canvas bottom-left HUD overlay ─────────────────────────────────── */
.canvas-hud-bl {
  position: absolute;
  bottom: 12px;
  left: 10px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
}
.chud-group {
  display: flex;
  gap: 4px;
}
.chud-item {
  background: rgba(7,8,10,0.82);
  border: 1px solid rgba(42,48,80,0.9);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #e8eaf0;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
}
.chud-item span {
  margin-left: 2px;
}
.chud-pot-item {
  background: rgba(7,8,10,0.82);
  border: 1px solid rgba(42,48,80,0.9);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #e8eaf0;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: 'JetBrains Mono', monospace;
}
.chud-pip {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.canvas-wrap {
  position: relative;
  border: 2px solid #1e2233;
  border-radius: 12px;
  overflow: hidden;
  background: #07080a;
}
#dungeonCanvas {
  display: block;
  image-rendering: pixelated;
  max-width: 100%;
}

/* ── D-pad (bottom-right corner of game window) ─────────────────────── */

.dpad {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.dpad-row {
  display: flex;
  gap: 3px;
  justify-content: center;
}
.dpad-center {
  width: 40px;
}
.dpad-btn {
  width: 40px;
  height: 40px;
  background: rgba(13,15,20,0.75);
  border: 1px solid rgba(42,48,80,0.9);
  border-radius: 8px;
  color: #9ba3c0;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.dpad-btn:hover { background: rgba(20,23,33,0.9); color: #e8eaf0; }
.dpad-btn:active { background: rgba(30,34,51,0.95); }

/* ── Side Panel ─────────────────────────────────────────────────────── */

.side-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.side-card {
  background: #0d0f14;
  border: 1px solid #1e2233;
  border-radius: 12px;
  padding: 14px 16px;
}
.side-card h4 {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: #6b7394;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.side-card-title-left {
  display: flex;
  align-items: center;
  gap: 4px;
}
.btn-settings-inline {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 7px;
  border: 1px solid #2a3050;
  background: transparent;
  color: #6b7394;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  text-transform: none;
  white-space: nowrap;
}
.btn-settings-inline:hover { border-color: #f7931a; color: #f7931a; }
.side-card p {
  font-size: 0.8rem;
  color: #6b7394;
  margin-bottom: 4px;
}
.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: #6b7394;
  margin-bottom: 5px;
}
.legend-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  flex-shrink: 0;
}
.monster-dot { background: #ef4444; color: #fff; font-family: 'JetBrains Mono', monospace; }
.boss-dot { background: #f7931a; color: #fff; font-family: 'JetBrains Mono', monospace; border: 1px solid #fff4; }

/* ── Equipment Panel (Visual Grid) ───────────────────────────────────── */

.equip-panel-inner {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0;
}

.equip-grid {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  gap: 6px;
  padding: 4px 0;
}

.equip-pot-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0 4px 14px;
  margin-left: 14px;
  border-left: 1px solid #1e2233;
}

.equip-pot-slot {
  width: 52px;
  height: 52px;
  border-radius: 9px;
  border: 1.5px dashed #2a3050;
  background: #0a0c10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}
.equip-pot-slot:hover { border-color: #f7931a; background: #1a1c28; }
.equip-hp-key-row { display: flex; flex-direction: row; gap: 6px; }
.equip-pot-count {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
}

.equip-slot {
  width: 52px;
  height: 52px;
  border-radius: 9px;
  border: 1.5px dashed #2a3050;
  background: #0a0c10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}
.equip-slot:hover { border-color: #f7931a; background: #1a1c28; }
.equip-slot-icon { color: #3a4060; line-height: 1; display: flex; align-items: center; justify-content: center; }
.equip-slot-icon svg { width: 18px; height: 18px; }
.equip-slot-label { font-size: 0.5rem; font-weight: 600; color: #3a4060; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 1px; }
.equip-slot.filled { border-style: solid; }
.equip-slot.filled .equip-slot-label { display: none; }
.equip-slot.filled .equip-slot-icon { display: none; }
.equip-slot-svg { width: 36px; height: 36px; }
.equip-slot-svg svg { width: 100%; height: 100%; }

/* Grid placement */
.equip-slot[data-slot="amulet"]  { grid-column: 1; grid-row: 1; }
.equip-slot[data-slot="helmet"]  { grid-column: 2; grid-row: 1; }
.equip-slot[data-slot="weapon"]  { grid-column: 1; grid-row: 2; }
.equip-slot[data-slot="armor"]   { grid-column: 2; grid-row: 2; }
.equip-slot[data-slot="shield"]  { grid-column: 3; grid-row: 2; }
.equip-slot[data-slot="gloves"]  { grid-column: 1; grid-row: 3; }
.equip-slot[data-slot="legs"]    { grid-column: 2; grid-row: 3; }
.equip-slot[data-slot="ring"]    { grid-column: 3; grid-row: 3; }
.equip-slot[data-slot="boots"]   { grid-column: 2; grid-row: 4; }

#statCardBody {
  font-size: 0.8rem;
  color: #6b7394;
  display: block;
}
#statCardBody span {
  font-family: 'JetBrains Mono', monospace;
  color: #e8eaf0;
}
.stat-equip-bonus {
  color: #f7931a !important;
  font-size: 0.72rem;
  margin-left: 3px;
}

/* ── Stat Info Button ────────────────────────────────────────────────── */

.stat-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid #3a4060;
  background: none;
  color: #6b7394;
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 1;
  padding: 0;
  font-style: italic;
  transition: border-color 0.15s, color 0.15s;
}
.stat-info-btn:hover { border-color: #f7931a; color: #f7931a; }

.settings-gear-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: transparent;
  border: 1px solid #2a3050;
  border-radius: 6px;
  color: #6b7394;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  margin-left: 6px;
  padding: 0;
  transition: border-color 0.15s, color 0.15s;
}
.settings-gear-btn:hover { border-color: #f7931a; color: #f7931a; }

/* ── Stats Info Modal ────────────────────────────────────────────────── */

#statInfoModal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.stat-info-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
}
.stat-info-content {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: #0d0f14;
  border: 1px solid #2a3050;
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  max-height: 90vh;
  overflow-y: auto;
}
.stat-info-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: #6b7394;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.stat-info-close:hover { color: #e8eaf0; }
.stat-info-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.stat-info-subtitle {
  font-size: 0.85rem;
  color: #6b7394;
  line-height: 1.6;
  margin-bottom: 28px;
}
.stat-info-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.stat-info-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.stat-info-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}
.stat-info-row h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 3px;
  color: #e8eaf0;
}
.stat-info-row p {
  font-size: 0.8rem;
  color: #6b7394;
  line-height: 1.5;
}

.btn-withdraw {
  width: 100%;
  padding: 11px;
  background: #f7931a;
  color: #07080a;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 6px;
}
.btn-withdraw:hover { background: #e07f12; }
.btn-withdraw:disabled { background: #2a3050; color: #6b7394; cursor: not-allowed; }
.withdraw-note {
  font-size: 0.75rem;
  color: #6b7394;
  text-align: center;
}

/* ── Combat Overlay ─────────────────────────────────────────────────── */

#combatOverlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.combat-bg {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
}
.combat-modal {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 20px;
  background: #0d0f14;
  border: 1px solid #2a3050;
  border-radius: 20px;
  padding: 28px 24px;
  z-index: 1;
}
.combat-header {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: #f7931a;
  margin-bottom: 20px;
  font-family: 'JetBrains Mono', monospace;
}
.combat-arena {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.combatant {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.combatant canvas {
  image-rendering: pixelated;
}
.combatant-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #e8eaf0;
}
.combat-vs {
  font-size: 1.2rem;
  font-weight: 700;
  color: #6b7394;
  flex-shrink: 0;
}
.combat-bar-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.combat-bar {
  width: 100%;
  height: 8px;
  background: #1e2233;
  border-radius: 4px;
  overflow: hidden;
}
.combat-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s;
}
.combat-bar-label {
  font-size: 0.7rem;
  color: #6b7394;
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
}
.combat-log {
  background: #07080a;
  border: 1px solid #1e2233;
  border-radius: 10px;
  padding: 12px;
  height: 150px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: #6b7394;
  line-height: 1.6;
}
.combat-log .log-player { color: #f7931a; }
.combat-log .log-enemy { color: #ef4444; }
.combat-log .log-system { color: #22c55e; }
.combat-log .log-death { color: #ef4444; font-weight: 700; }
.combat-log .log-win { color: #22c55e; font-weight: 700; }
.combat-footer { margin-top: 12px; text-align: center; }
.combat-close-btn {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.95rem; font-weight: 600;
  padding: 10px 32px; border-radius: 10px;
  border: 1px solid #f7931a; background: #1a1200;
  color: #f7931a; cursor: pointer; transition: background 0.15s;
}
.combat-close-btn:hover { background: #2a1e00; }

/* ── Settings Modal ─────────────────────────────────────────────────── */

#settingsModal {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.settings-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
}
.settings-content {
  position: relative;
  background: #0d0f14;
  border: 1px solid #2a3050;
  border-radius: 20px;
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  margin: 20px;
  z-index: 1;
}
.settings-content h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
}
.settings-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: #6b7394;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
}
.settings-close:hover { color: #e8eaf0; }
.settings-row {
  margin-bottom: 18px;
}
.settings-row label {
  display: block;
  font-size: 0.85rem;
  color: #6b7394;
  margin-bottom: 6px;
}
.settings-row input {
  width: 80px;
  padding: 8px 10px;
  background: #07080a;
  border: 1px solid #2a3050;
  border-radius: 8px;
  color: #e8eaf0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
}
.btn-buy-potion {
  padding: 9px 14px;
  background: #3b82f6;
  color: #fff;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.btn-buy-potion:hover { background: #2563eb; }
.btn-danger {
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1px solid #ef4444;
  border-radius: 8px;
  color: #ef4444;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
.btn-danger:hover { background: rgba(239,68,68,0.1); }
.btn-save-settings {
  width: 100%;
  padding: 12px;
  background: #f7931a;
  color: #07080a;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  margin-top: 8px;
}
.btn-save-settings:hover { background: #e07f12; }
.settings-section-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #f7931a;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 0 0 10px;
}
.settings-row.settings-priority-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.settings-row.settings-priority-row label {
  width: 28px;
  flex-shrink: 0;
  margin-bottom: 0;
}
.settings-select {
  flex: 1;
  padding: 7px 10px;
  background: #07080a;
  border: 1px solid #2a3050;
  border-radius: 8px;
  color: #e8eaf0;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.85rem;
}
.hud-hybrid-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
}
.settings-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: 16px 0 4px;
}
.btn-delete-character {
  width: 100%;
  padding: 11px;
  background: transparent;
  color: #ef4444;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.88rem;
  border: 1px solid rgba(239,68,68,0.4);
  border-radius: 10px;
  cursor: pointer;
  margin-top: 0;
  transition: background 0.15s, border-color 0.15s;
}
.btn-delete-character:hover { background: rgba(239,68,68,0.12); border-color: #ef4444; }

/* ── User Account Panel ─────────────────────────────────────────────── */

#userPanel {
  position: fixed;
  inset: 0;
  z-index: 700;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 80px 24px 0;
}
.user-panel-overlay {
  position: absolute;
  inset: 0;
}
.user-panel-content {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #0d0f14;
  border: 1px solid #2a3050;
  border-radius: 18px;
  padding: 0 0 4px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.6);
  z-index: 1;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.user-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid #1e2233;
}
.user-panel-header h3 {
  font-size: 1rem;
  font-weight: 700;
}
.user-panel-close {
  background: transparent;
  border: none;
  color: #6b7394;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}
.user-panel-close:hover { color: #e8eaf0; }

.user-panel-section {
  padding: 18px 22px;
  border-bottom: 1px solid #1e2233;
}
.user-panel-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7394;
  margin-bottom: 12px;
}
.user-panel-principal-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #07080a;
  border: 1px solid #1e2233;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.user-panel-principal {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: #e8eaf0;
  word-break: break-all;
  line-height: 1.5;
}
.btn-copy {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: #1e2233;
  border: 1px solid #2a3050;
  border-radius: 8px;
  color: #6b7394;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}
.btn-copy:hover { color: #e8eaf0; border-color: #6b7394; }
.btn-copy.copied { color: #22c55e; border-color: #22c55e; }

.user-panel-notice {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.78rem;
  color: #6b7394;
  line-height: 1.55;
  background: rgba(247,147,26,0.06);
  border: 1px solid rgba(247,147,26,0.15);
  border-radius: 10px;
  padding: 10px 12px;
}
.user-panel-notice svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: #f7931a;
}
.user-panel-notice strong { color: #e8eaf0; }

.user-panel-balance {
  font-size: 0.82rem;
  color: #6b7394;
  margin-bottom: 14px;
}
.user-panel-balance strong {
  color: #f7931a;
  font-family: 'JetBrains Mono', monospace;
}
.user-panel-field {
  margin-bottom: 12px;
}
.user-panel-field label {
  display: block;
  font-size: 0.78rem;
  color: #6b7394;
  margin-bottom: 6px;
}
.user-panel-field input {
  width: 100%;
  padding: 10px 12px;
  background: #07080a;
  border: 1px solid #2a3050;
  border-radius: 10px;
  color: #e8eaf0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
}
.user-panel-field input:focus {
  outline: none;
  border-color: #f7931a;
}
.user-panel-field input::placeholder { color: #3d4566; }
.btn-withdraw-panel {
  width: 100%;
  padding: 12px;
  background: #f7931a;
  color: #07080a;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 8px;
}
.btn-withdraw-panel:hover { background: #e07f12; }
.btn-withdraw-panel:disabled { background: #2a3050; color: #6b7394; cursor: not-allowed; }
.user-panel-withdraw-note {
  font-size: 0.73rem;
  color: #6b7394;
  text-align: center;
}
.btn-disconnect-panel {
  width: calc(100% - 44px);
  margin: 12px 22px;
  padding: 11px;
  background: transparent;
  border: 1px solid #2a3050;
  border-radius: 10px;
  color: #ef4444;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
.btn-disconnect-panel:hover { background: rgba(239,68,68,0.07); border-color: #ef4444; }

@media (max-width: 480px) {
  #userPanel { padding: 70px 12px 0; }
}

/* ── Toast ──────────────────────────────────────────────────────────── */

#toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: #0d0f14;
  border: 1px solid #2a3050;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 2000;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

/* ── Equip Modal ─────────────────────────────────────────────────────── */

#equipModal {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.equip-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}
.equip-modal-content {
  position: relative;
  width: 100%;
  max-width: 460px;
  padding: 32px 28px;
  border-radius: 16px;
  background: #0d0f14;
  border: 1px solid #2a3050;
  max-height: 80vh;
  overflow-y: auto;
}
.equip-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: #6b7394;
  font-size: 1.5rem;
  cursor: pointer;
}
.equip-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  text-align: center;
}
.equip-modal-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}
.equip-modal-item-img { width: 48px; height: 48px; flex-shrink: 0; }
.equip-modal-item-img svg { width: 100%; height: 100%; }
.equip-modal-item-info { flex: 1; min-width: 0; }
.equip-modal-item-name { font-size: 0.9rem; font-weight: 700; }
.equip-modal-item-rarity { font-size: 0.75rem; color: #ffd700; font-weight: 600; }
.btn-equip, .btn-unequip {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
  flex-shrink: 0;
}
.btn-equip { background: var(--green); color: #000; }
.btn-unequip { background: var(--red); color: #fff; }
.btn-equip:hover, .btn-unequip:hover { opacity: 0.85; }
.btn-equip:disabled, .btn-unequip:disabled { opacity: 0.5; cursor: not-allowed; }
.equip-modal-equipped {
  text-align: center;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--green);
  margin-bottom: 12px;
}
.equip-modal-empty { text-align: center; color: #6b7394; padding: 16px 0; font-size: 0.9rem; }

/* ── Equip Info Modal ────────────────────────────────────────────────── */

#equipInfoModal {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.equip-info-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}
.equip-info-content {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 40px 36px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border-bright);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}
.equip-info-close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 1.5rem;
  color: #6b7394;
  background: transparent;
  border: none;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.equip-info-close:hover { color: #e8eaf0; }
.equip-info-icon { text-align: center; margin-bottom: 12px; line-height: 0; }
.equip-info-title { font-size: 1.4rem; font-weight: 700; text-align: center; margin-bottom: 8px; }
.equip-info-subtitle { font-size: 0.9rem; color: #6b7394; text-align: center; line-height: 1.6; margin-bottom: 32px; }
.equip-info-steps { display: flex; flex-direction: column; gap: 24px; margin-bottom: 28px; }
.equip-info-step { display: flex; gap: 16px; align-items: flex-start; }
.equip-info-step-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f7931a33;
  border: 1px solid rgba(247, 147, 26, 0.3);
  color: #f7931a;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.equip-info-step h4 { font-size: 0.95rem; font-weight: 600; margin-bottom: 4px; }
.equip-info-step p { font-size: 0.85rem; color: #6b7394; line-height: 1.6; }
.equip-info-step a { color: #f7931a; }

/* ── HUD Nickname ────────────────────────────────────────────────────── */

.hud-nickname {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f7931a;
  letter-spacing: 0.02em;
  text-shadow: 0 0 12px rgba(247, 147, 26, 0.4);
  font-family: 'JetBrains Mono', monospace;
}

/* ── Dungeon Vault Banner ─────────────────────────────────────────────── */

.dungeon-vault-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 28px;
  margin-bottom: 28px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(247,147,26,0.12) 0%, rgba(247,147,26,0.06) 100%);
  border: 1px solid rgba(247, 147, 26, 0.35);
  box-shadow: 0 0 28px rgba(247, 147, 26, 0.08);
}
.vault-banner-icon {
  font-size: 1.4rem;
}
.vault-banner-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: #b0b8d8;
}
.vault-banner-amount {
  font-size: 1.35rem;
  font-weight: 700;
  color: #f7931a;
  font-family: 'JetBrains Mono', monospace;
  text-shadow: 0 0 16px rgba(247, 147, 26, 0.5);
}
.vault-banner-main {
  display: flex;
  align-items: center;
  gap: 10px;
}
.vault-banner-sub {
  font-size: 0.8rem;
  color: #6b7394;
}
.vault-refresh-btn {
  background: none;
  border: 1px solid rgba(247,147,26,0.3);
  border-radius: 6px;
  color: #f7931a;
  font-size: 1rem;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, border-color 0.15s;
}
.vault-refresh-btn:hover { background: rgba(247,147,26,0.12); border-color: #f7931a; }
.vault-refresh-btn.spinning { animation: vault-spin 0.8s linear infinite; pointer-events: none; opacity: 0.7; }
@keyframes vault-spin { to { transform: rotate(360deg); } }

/* ── Potion Qty Picker ────────────────────────────────────────────────── */

.potion-status-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: #b0b8d8;
  margin: 10px 0 14px;
}
.potion-qty-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.potion-qty-label {
  font-size: 0.85rem;
  color: #6b7394;
  flex: 0 0 auto;
}
.potion-stepper {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pot-step-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid #2a3050;
  background: #0d0f14;
  color: #e8eaf0;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
}
.pot-step-btn:hover { border-color: #f7931a; color: #f7931a; }
.pot-qty-input {
  width: 52px;
  text-align: center;
  background: #0d0f14;
  border: 1px solid #2a3050;
  border-radius: 6px;
  color: #e8eaf0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  padding: 4px 6px;
}
.potion-qty-max {
  font-size: 0.8rem;
  color: #6b7394;
}
.pot-load-btn {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #f7931a;
  background: transparent;
  color: #f7931a;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.pot-load-btn:hover { background: rgba(247, 147, 26, 0.1); }
.pot-load-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Combat Animations ───────────────────────────────────────────────── */

@keyframes combatAttack {
  0%, 100% { transform: translateX(0); }
  40%      { transform: translateX(18px); }
  70%      { transform: translateX(-6px); }
}
@keyframes combatHit {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-12px); }
  50%      { transform: translateX(8px); }
  80%      { transform: translateX(-4px); }
}
@keyframes combatCrit {
  0%, 100% { transform: scale(1) translateX(0); filter: none; }
  30%      { transform: scale(1.2) translateX(16px); filter: drop-shadow(0 0 12px #f7931a); }
  70%      { transform: scale(0.95) translateX(-8px); }
}
@keyframes combatSkill {
  0%, 100% { transform: scale(1); filter: none; }
  50%      { transform: scale(1.15); filter: drop-shadow(0 0 16px #60a5fa) brightness(1.4); }
}
@keyframes combatEnemyAttack {
  0%, 100% { transform: translateX(0); }
  40%      { transform: translateX(-18px); }
  70%      { transform: translateX(6px); }
}
@keyframes combatHurt {
  0%, 100% { opacity: 1; filter: none; }
  30%      { opacity: 0.5; filter: drop-shadow(0 0 10px #ef4444) brightness(0.6); }
  60%      { opacity: 0.8; filter: drop-shadow(0 0 6px #ef4444); }
}
@keyframes combatDodge {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(-20px) scaleX(0.9); }
}

.anim-attack       { animation: combatAttack      0.35s ease; }
.anim-hit          { animation: combatHit          0.35s ease; }
.anim-crit         { animation: combatCrit         0.50s ease; }
.anim-skill        { animation: combatSkill        0.50s ease; }
.anim-enemy-attack { animation: combatEnemyAttack  0.35s ease; }
.anim-hurt         { animation: combatHurt         0.45s ease; }
.anim-dodge        { animation: combatDodge        0.40s ease; }

/* ── How it Works ───────────────────────────────────────────────────── */

.hiw-section {
  margin: 48px 0 0;
  padding-top: 40px;
  border-top: 1px solid #1e2233;
}
.hiw-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 28px;
}
.hiw-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.hiw-card {
  background: #0d0f14;
  border: 1px solid #1e2233;
  border-radius: 14px;
  padding: 22px 20px;
}
.hiw-icon {
  font-size: 1.8rem;
  margin-bottom: 10px;
  line-height: 1;
  display: flex;
  align-items: center;
}
.hiw-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #e8eaf0;
  margin-bottom: 8px;
}
.hiw-card p {
  font-size: 0.82rem;
  color: #6b7394;
  line-height: 1.65;
}

/* ── Vault USD Tooltip ──────────────────────────────────────────────── */

.vault-amount-usd { cursor: default; position: relative; display: inline-block; }
.vault-amount-usd::after {
  content: attr(data-usd);
  opacity: 0;
  pointer-events: none;
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.92);
  color: #f7931a;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  white-space: nowrap;
  z-index: 50;
  transition: opacity 0.15s;
}
.vault-amount-usd[data-usd]:not([data-usd=""]):hover::after { opacity: 1; }

/* ── Responsive ─────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .dungeon-hud { flex-wrap: wrap; gap: 12px; }
  .hud-bar { width: 120px; }
  .game-layout { flex-direction: column; }
  .side-panel { width: 100%; }
  #dungeonCanvas { width: 100% !important; height: auto !important; }
  .char-grid { grid-template-columns: 1fr; }
  .hiw-grid { grid-template-columns: 1fr; }
}
