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

body {
  background: #0a0a0f;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1rem;
  font-family: 'Courier New', monospace;
}

#page-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 1152px;
  max-width: 100%;
  position: relative;
}

/* ── Logo ── */
#game-logo {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0 8px;
  overflow: hidden;
  max-height: 200px;
  transition: opacity 0.6s ease, max-height 0.7s ease 0.4s, padding 0.7s ease 0.4s;
}

#game-logo.hidden {
  opacity: 0;
  max-height: 0;
  padding: 0;
  pointer-events: none;
}

#logo-img {
  max-height: 190px;
  image-rendering: pixelated;
}

#logo-placeholder {
  font-size: 18px;
  color: #f0c040;
  letter-spacing: 4px;
  display: none;
}

/* mostra placeholder se imagem não carregar */
#logo-img:not([src]), #logo-img[src=""] {
  display: none;
}
#logo-img.error { display: none; }

/* ── Hero Select ── */
#hero-select-overlay {
  width: 1152px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #0d0d1a;
  border: 2px solid #222;
}

#hs-top {
  width: 100%;
  padding: 20px 40px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid #222;
}

#hs-hero-name {
  font-size: 16px;
  color: #f0c040;
  letter-spacing: 3px;
}

#hs-hero-level {
  font-size: 14px;
  color: #888;
}

#hs-hero-desc {
  font-size: 14px;
  color: #aaa;
  text-align: center;
  max-width: 500px;
  line-height: 1.8;
}

#hs-stats {
  display: flex;
  gap: 24px;
  margin-top: 6px;
}

.hs-stat {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hs-stat-label {
  font-size: 11px;
  color: #888;
  width: 36px;
}

.hs-stat-bar-bg {
  width: 120px;
  height: 8px;
  background: #222;
  border-radius: 2px;
  overflow: hidden;
}

.hs-stat-bar {
  height: 100%;
  background: #f0c040;
  border-radius: 2px;
  transition: width 0.3s;
}

#hs-scene {
  width: 100%;
  flex: 1;
  position: relative;
}

#hs-reset-all-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(30,10,10,0.75);
  border: 1px solid #e94560;
  color: #e94560;
  border-radius: 4px;
  padding: 4px 10px;
  font-family: 'Courier New', monospace;
  font-size: 8px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity .15s;
  z-index: 5;
}

#hs-reset-all-btn:hover {
  opacity: 1;
  background: #e94560;
  color: #fff;
}

#hs-canvas {
  display: block;
  width: 100%;
  height: 320px;
}

#hs-bottom {
  width: 100%;
  padding: 16px;
  display: flex;
  justify-content: center;
  border-top: 1px solid #222;
}

#hs-confirm-btn {
  background: #f0c040;
  color: #0a0a0f;
  border: none;
  border-radius: 4px;
  padding: 12px 48px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  cursor: pointer;
  letter-spacing: 2px;
  transition: background .15s, transform .1s;
}

#hs-confirm-btn:hover { background: #ffd860; transform: scale(1.03); }
#hs-confirm-btn:active { transform: scale(0.98); }

/* ── Phase Complete ── */
#phase-complete {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  flex-direction: column;
  align-items: center;
  gap: 20px;
  z-index: 25;
  background: rgba(0,0,0,0.75);
  border: 2px solid #f0c040;
  border-radius: 8px;
  padding: 40px 60px;
}

#phase-complete.visible { display: flex; }

#phase-complete-title {
  font-size: 22px;
  color: #f0c040;
  letter-spacing: 3px;
  text-shadow: 0 0 20px #f0c040aa;
}

#phase-complete-sub {
  font-size: 10px;
  color: #aaa;
  letter-spacing: 1px;
}

#btn-next-phase {
  background: #f0c040;
  color: #0a0a0f;
  border: none;
  border-radius: 4px;
  padding: 14px 32px;
  font-family: 'Courier New', monospace;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 1px;
  transition: background .15s, transform .1s;
}

#btn-next-phase:hover { background: #ffd860; transform: scale(1.03); }

/* ── Death Buttons ── */
#death-btns {
  display: none;
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translateX(-50%);
  gap: 16px;
  flex-direction: row;
  z-index: 20;
}

#death-btns.visible {
  display: flex;
}

#death-btns button {
  background: #0d0d1a;
  color: #fff;
  border: 2px solid #e94560;
  border-radius: 4px;
  padding: 12px 24px;
  font-family: 'Courier New', monospace;
  font-size: 10px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: background .15s, border-color .15s;
}

#death-btns button:hover {
  background: #e94560;
}

/* ── Combat Log ── */
#combat-log {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-direction: column-reverse;
  gap: 4px;
  pointer-events: none;
  z-index: 10;
}

.log-line {
  font-size: 9px;
  font-family: 'Courier New', monospace;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
  white-space: nowrap;
  transition: opacity 0.3s;
}

/* ── Canvas ── */
#canvas-wrap {
  width: 1152px;
  max-width: 100%;
  aspect-ratio: 16/9;
  border: 2px solid #222;
  position: relative;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

/* ── HUD ── */
#hud {
  width: 1152px;
  max-width: 100%;
  background: #111118;
  border: 2px solid #222;
  border-top: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  gap: 12px;
}

#hud-left {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 220px;
}

#hero-name {
  font-size: 13px;
  color: #f0c040;
  letter-spacing: 1px;
}

#hero-level {
  font-size: 11px;
  color: #888;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bar-label {
  font-size: 10px;
  color: #666;
  width: 22px;
}

.bar-bg {
  flex: 1;
  height: 10px;
  background: #222;
  border-radius: 2px;
  overflow: hidden;
  max-width: 180px;
}

.bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.2s;
}

.hp-fill { background: #e94560; }
.xp-fill { background: #4e9af1; }

.bar-text {
  font-size: 10px;
  color: #666;
  min-width: 64px;
}

#hud-center {
  flex: 1;
  text-align: center;
}

#zone-label {
  font-size: 11px;
  color: #444;
  letter-spacing: 2px;
}

#hud-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 140px;
  justify-content: flex-end;
}

#gold-display {
  font-size: 12px;
  color: #f0c040;
}

#menu-btns {
  display: flex;
  gap: 6px;
}

#menu-btns button {
  background: #1a1a2e;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 14px;
  cursor: pointer;
  transition: border-color .15s;
}

#menu-btns button:hover {
  border-color: #f0c040;
}

/* ── Chest Bar ── */
#chest-bar {
  width: 1152px;
  max-width: 100%;
  background: #0d0d1a;
  border: 2px solid #222;
  border-top: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
}

#chest-bar-label {
  font-size: 9px;
  color: #444;
  letter-spacing: 2px;
  min-width: 36px;
}

#chest-slots {
  display: flex;
  gap: 12px;
  align-items: center;
}

.chest-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.chest-btn {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  border: 2px solid #3a3a3a;
  background: #111118;
  color: #fff;
  font-family: 'Courier New', monospace;
  font-size: 10px;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .1s, border-color .15s, background .15s, opacity .2s;
  opacity: 0.35;
}

.chest-btn:not(:disabled):hover {
  transform: scale(1.08);
  filter: brightness(1.3);
}

.chest-btn:not(:disabled):active {
  transform: scale(0.95);
}

.chest-dots {
  display: flex;
  gap: 3px;
}

.chest-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #2a2a3a;
}

.chest-dot-filled {
  background: var(--dot-color, #888);
}
