/* ============ ECLIPSE OF THE FIRST GOD ============ */
* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; }

:root {
  --gold: #d4af37;
  --gold-dim: #8a7326;
  --bg-dark: #0b0a12;
  --panel-bg: rgba(14, 12, 22, 0.96);
  --border: 1px solid rgba(212, 175, 55, 0.35);
  --hp: linear-gradient(90deg, #a01818, #e04040);
  --mp: linear-gradient(90deg, #16408a, #3a7bd5);
  --xp: linear-gradient(90deg, #6a1b9a, #ab47bc);
}

html, body { width: 100%; height: 100%; overflow: hidden; background: var(--bg-dark); }
body { font-family: Georgia, 'Times New Roman', serif; color: #e8e0cc; }

.hidden { display: none !important; }
button {
  font-family: inherit; cursor: pointer; color: #e8e0cc;
  background: rgba(30, 26, 44, 0.9); border: var(--border);
  padding: 10px 22px; font-size: 15px; border-radius: 4px;
  transition: all 0.15s;
}
button:hover { background: rgba(60, 50, 90, 0.9); border-color: var(--gold); }
.btn-gold {
  background: linear-gradient(180deg, #3a2f10, #241d08);
  border: 1px solid var(--gold); color: var(--gold);
  font-size: 17px; letter-spacing: 1px;
}
.btn-gold:hover { background: linear-gradient(180deg, #574716, #37300c); box-shadow: 0 0 18px rgba(212, 175, 55, 0.35); }

/* ============ TELAS ============ */
.screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, #1a1530 0%, #0b0a12 70%);
  z-index: 100; overflow-y: auto;
}
.intro-box, .creation-box {
  max-width: 780px; width: 92%; text-align: center; padding: 40px 20px;
}
.logo {
  font-size: 58px; letter-spacing: 8px; color: var(--gold);
  text-shadow: 0 0 30px rgba(212, 175, 55, 0.5), 0 2px 0 #000;
  line-height: 1.05; margin-bottom: 6px;
}
.logo span { display: block; font-size: 18px; letter-spacing: 14px; color: #9a8f6d; }
.tagline { font-style: italic; color: #b0a486; margin-bottom: 24px; font-size: 17px; }
.lore-scroll {
  max-height: 320px; overflow-y: auto; text-align: left; margin: 0 auto 26px;
  padding: 22px 28px; background: rgba(0,0,0,0.45); border: var(--border);
  border-radius: 6px; line-height: 1.7; font-size: 15px; color: #cfc6ad;
}
.lore-scroll p { margin-bottom: 12px; }
.lore-scroll em { color: var(--gold); font-style: normal; }
.intro-buttons { display: flex; gap: 14px; justify-content: center; margin-bottom: 14px; flex-wrap: wrap; }
.footnote { font-size: 12px; color: #6b6350; font-style: italic; }

/* ============ CRIAÇÃO ============ */
.creation-box h2 { color: var(--gold); font-size: 32px; letter-spacing: 4px; margin-bottom: 18px; }
.creation-box h3 { color: #b0a486; letter-spacing: 3px; margin: 18px 0 10px; font-size: 15px; text-transform: uppercase; }
.creation-row { margin-bottom: 8px; }
.creation-row label { display: block; font-size: 13px; color: #9a8f6d; margin-bottom: 6px; }
#char-name {
  background: rgba(0,0,0,0.5); border: var(--border); color: var(--gold);
  padding: 10px 16px; font-size: 18px; font-family: inherit; text-align: center;
  border-radius: 4px; width: 300px; outline: none;
}
.card-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.card {
  background: rgba(20, 17, 32, 0.85); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px; padding: 10px 6px; cursor: pointer; transition: all 0.12s;
  text-align: center;
}
.card:hover { border-color: rgba(212, 175, 55, 0.5); transform: translateY(-2px); }
.card.selected { border-color: var(--gold); background: rgba(58, 47, 16, 0.55); box-shadow: 0 0 14px rgba(212,175,55,0.25); }
.card .card-emoji { font-size: 30px; display: block; }
.card .card-name { color: var(--gold); font-size: 14px; margin: 4px 0 2px; }
.card .card-desc { font-size: 11px; color: #9a917d; line-height: 1.35; }
#creation-summary {
  margin: 16px auto; padding: 12px; min-height: 44px; max-width: 620px;
  font-size: 13px; color: #cfc6ad; background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.07); border-radius: 6px; line-height: 1.5;
}

/* ============ JOGO / HUD ============ */
#game { position: fixed; inset: 0; }
#canvas { display: block; background: #000; }

#hud-top-left { position: absolute; top: 12px; left: 12px; z-index: 10; }
#player-plate {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-bg); border: var(--border); border-radius: 8px; padding: 8px 14px 8px 8px;
}
#player-portrait {
  width: 52px; height: 52px; font-size: 30px; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.5); border: 1px solid var(--gold-dim); border-radius: 50%;
}
.hud-name { font-size: 14px; color: var(--gold); margin-bottom: 3px; }
.bar {
  position: relative; width: 210px; height: 14px; background: rgba(0,0,0,0.65);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 3px; margin-bottom: 3px; overflow: hidden;
}
.bar .fill { height: 100%; width: 100%; transition: width 0.15s; }
.bar.hp .fill { background: var(--hp); }
.bar.mp .fill { background: var(--mp); }
.bar.xp .fill { background: var(--xp); }
.bar.xp { height: 8px; }
.bar span {
  position: absolute; inset: 0; text-align: center; font-size: 10px; line-height: 14px;
  color: #fff; text-shadow: 0 1px 2px #000;
}
#hud-gold {
  margin-top: 6px; display: inline-block; background: var(--panel-bg); border: var(--border);
  border-radius: 6px; padding: 4px 12px; font-size: 14px; color: var(--gold);
}

#hud-zone { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); text-align: center; z-index: 10; pointer-events: none; }
#zone-name { font-size: 24px; letter-spacing: 5px; color: var(--gold); text-shadow: 0 2px 8px #000; }
#zone-sub { font-size: 12px; color: #b0a486; font-style: italic; text-shadow: 0 1px 4px #000; }

#hud-top-right { position: absolute; top: 12px; right: 12px; z-index: 10; text-align: right; }
#minimap { border: var(--border); border-radius: 6px; background: #000; display: block; }
#daynight { font-size: 22px; margin-top: 6px; text-shadow: 0 0 10px rgba(255,255,255,0.3); }

#boss-banner {
  position: absolute; top: 74px; left: 50%; transform: translateX(-50%);
  z-index: 10; text-align: center; pointer-events: none;
}
#boss-name { font-size: 18px; letter-spacing: 4px; color: #ff4a4a; text-shadow: 0 0 12px rgba(255,0,0,0.6); margin-bottom: 4px; }
.bar.boss { width: 380px; height: 10px; margin: 0 auto; }
.bar.boss .fill { background: linear-gradient(90deg, #7a0e0e, #ff3030); }

#announce {
  position: absolute; top: 32%; left: 50%; transform: translateX(-50%);
  text-align: center; z-index: 40; pointer-events: none; animation: announceFade 4s forwards;
}
#announce-main { font-size: 38px; letter-spacing: 6px; color: var(--gold); text-shadow: 0 0 24px rgba(212,175,55,0.7), 0 2px 4px #000; }
#announce-sub { font-size: 16px; color: #cfc6ad; font-style: italic; text-shadow: 0 1px 4px #000; margin-top: 6px; }
@keyframes announceFade {
  0% { opacity: 0; transform: translateX(-50%) scale(0.9); }
  10% { opacity: 1; transform: translateX(-50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

#log {
  position: absolute; bottom: 96px; left: 12px; z-index: 10; pointer-events: none;
  display: flex; flex-direction: column; gap: 3px; max-width: 420px;
}
.log-msg {
  font-size: 13px; padding: 3px 10px; background: rgba(0,0,0,0.55);
  border-left: 2px solid var(--gold-dim); border-radius: 0 4px 4px 0;
  animation: logFade 8s forwards; line-height: 1.4;
}
@keyframes logFade { 0% { opacity: 0; } 5% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }

/* ============ HOTBAR ============ */
#hotbar {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; z-index: 10;
}
.slot {
  position: relative; width: 58px; height: 58px;
  background: var(--panel-bg); border: var(--border); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.slot:hover { border-color: var(--gold); }
.slot-emoji { font-size: 27px; }
.slot .key {
  position: absolute; bottom: 1px; right: 4px; font-size: 9px; color: #9a8f6d;
}
.slot .count { position: absolute; top: 2px; right: 5px; font-size: 11px; color: var(--gold); }
.slot .cd {
  position: absolute; left: 0; bottom: 0; width: 100%; height: 0%;
  background: rgba(0,0,0,0.72); z-index: 2; pointer-events: none; border-radius: 0 0 8px 8px;
}

#menu-buttons { position: absolute; bottom: 14px; right: 12px; display: flex; flex-direction: column; gap: 5px; z-index: 10; }
#menu-buttons button { padding: 5px 12px; font-size: 12px; text-align: left; }
#menu-buttons b { color: var(--gold); }

#interact-hint {
  position: absolute; z-index: 9; width: 30px; height: 30px; border-radius: 6px;
  background: var(--gold); color: #000; font-weight: bold; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 14px rgba(212,175,55,0.8); pointer-events: none;
  animation: bounce 0.9s infinite alternate;
}
@keyframes bounce { from { transform: translateY(0); } to { transform: translateY(-5px); } }

/* ============ PAINEL ============ */
#panel {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 560px; max-width: 94vw; max-height: 78vh; z-index: 50;
  background: var(--panel-bg); border: var(--border); border-radius: 10px;
  display: flex; flex-direction: column; box-shadow: 0 10px 60px rgba(0,0,0,0.8);
}
#panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px; border-bottom: 1px solid rgba(212,175,55,0.2);
}
#panel-title { color: var(--gold); font-size: 19px; letter-spacing: 2px; }
#panel-close { padding: 2px 10px; font-size: 14px; }
#panel-body { padding: 16px 18px; overflow-y: auto; font-size: 14px; line-height: 1.5; }

.inv-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 14px; }
.inv-slot {
  position: relative; aspect-ratio: 1; background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 6px;
  display: flex; align-items: center; justify-content: center; font-size: 24px; cursor: pointer;
}
.inv-slot:hover { border-color: var(--gold); }
.inv-slot .qty { position: absolute; bottom: 1px; right: 4px; font-size: 11px; color: #fff; text-shadow: 0 1px 2px #000; }
.inv-slot.rare { border-color: #3a7bd5; }
.inv-slot.legendary { border-color: #d4af37; box-shadow: 0 0 8px rgba(212,175,55,0.4) inset; }

.equip-row { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 13px; }
.equip-row .inv-slot { width: 44px; flex: none; font-size: 20px; }

.skill-row { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.skill-row .sk-name { width: 130px; font-size: 13px; color: #cfc6ad; }
.skill-row .sk-lvl { width: 34px; text-align: right; color: var(--gold); font-size: 14px; }
.skill-row .bar { flex: 1; height: 9px; margin: 0; }
.skill-row .bar .fill { background: linear-gradient(90deg, #6b5a1a, #d4af37); }

.shop-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.shop-item .si-emoji { font-size: 22px; width: 30px; text-align: center; }
.shop-item .si-name { flex: 1; }
.shop-item .si-name small { display: block; color: #8d8470; font-size: 11px; }
.shop-item button { padding: 4px 12px; font-size: 12px; }
.shop-item .disabled { opacity: 0.4; pointer-events: none; }

.eco-entry { margin-bottom: 14px; padding: 12px 14px; background: rgba(0,0,0,0.35); border-left: 3px solid var(--gold); border-radius: 0 6px 6px 0; }
.eco-entry.locked { border-left-color: #444; color: #6b6350; font-style: italic; }
.eco-entry h4 { color: var(--gold); margin-bottom: 5px; font-size: 14px; letter-spacing: 1px; }

.quest-entry { margin-bottom: 10px; padding: 10px 12px; background: rgba(0,0,0,0.35); border-radius: 6px; border: 1px solid rgba(255,255,255,0.06); }
.quest-entry.done { opacity: 0.55; }
.quest-entry.done h4::before { content: "✓ "; color: #6dbd6d; }
.quest-entry h4 { color: var(--gold); font-size: 14px; margin-bottom: 3px; }
.quest-entry p { font-size: 12px; color: #b0a793; }

/* ============ MORTE / DESPERTAR ============ */
#death-overlay {
  position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: rgba(30, 0, 0, 0.82);
  text-align: center;
}
#death-overlay h2 { font-size: 52px; letter-spacing: 12px; color: #b81f1f; text-shadow: 0 0 30px rgba(255,0,0,0.6); margin-bottom: 12px; }
#death-overlay p { color: #cfa9a9; font-style: italic; }
#death-timer { margin-top: 14px; font-size: 22px; color: #fff; }

#awakening {
  position: fixed; inset: 0; z-index: 95; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(90, 70, 10, 0.92), rgba(10, 8, 2, 0.97));
}
.awakening-box { max-width: 680px; width: 92%; text-align: center; padding: 30px; }
.awakening-box h2 {
  font-size: 46px; letter-spacing: 14px; color: var(--gold);
  text-shadow: 0 0 40px rgba(255, 220, 100, 0.9); margin-bottom: 20px;
  animation: pulseGold 2s infinite alternate;
}
@keyframes pulseGold { from { text-shadow: 0 0 20px rgba(255,220,100,0.5); } to { text-shadow: 0 0 60px rgba(255,220,100,1); } }
#awakening-text {
  text-align: left; line-height: 1.8; font-size: 15px; color: #efe6c8;
  max-height: 44vh; overflow-y: auto; padding: 18px 22px; margin-bottom: 22px;
  background: rgba(0,0,0,0.4); border: var(--border); border-radius: 8px;
}
#awakening-text p { margin-bottom: 10px; }
#awakening-text em { color: var(--gold); font-style: normal; }

/* Pixel art nítida */
.pix, #canvas { image-rendering: pixelated; }
.inv-slot img { display: block; }
.si-emoji img, .skill-row img { vertical-align: middle; }
#player-portrait img { border-radius: 50%; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); }
::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 4px; }
