:root {
  --bg: #120b1f;
  --bg2: #1b1330;
  --panel: #231a3a;
  --panel-b: #0c0816;
  --text: #f2ecff;
  --muted: #a99cc8;
  --green: #4caf2e;
  --green-d: #2d7a17;
  --green-l: #7be04f;
  --gold: #f5c518;
  --gold-d: #a37d00;
  --stone: #6f6f78;
  --stone-l: #9a9aa6;
  --stone-d: #3d3d45;
  --red: #e53935;
  --gem: #3fe0d4;
  --px: "Press Start 2P", monospace;
  --vt: "VT323", monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  background-image: var(--dirt-bg, none);
  background-size: 64px 64px;
  image-rendering: pixelated;
  color: var(--text);
  font-family: var(--vt);
  font-size: 20px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; }

#app {
  position: relative;
  max-width: 480px;
  height: 100%;
  height: 100dvh;
  margin: 0 auto;
  background: rgba(14, 9, 25, 0.92);
  box-shadow: 0 0 0 4px #000, 0 0 60px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.screen { position: absolute; inset: 0; display: none; flex-direction: column; overflow: hidden; }
.screen.active { display: flex; }
.scroll { flex: 1; overflow-y: auto; padding: 12px 16px 24px; }

/* ---------- Ícones ---------- */
.ico { display: inline-block; width: 18px; height: 18px; background-size: contain; background-repeat: no-repeat; image-rendering: pixelated; vertical-align: -3px; margin-right: 4px; }
.ico.sm { width: 14px; height: 14px; vertical-align: -2px; }
.ico.big { width: 40px; height: 40px; }
.ico-coin { background-image: var(--coin-img); }
.ico-gem { background-image: var(--gem-img); }
.ico-bonus { background-image: var(--gem-img); filter: hue-rotate(185deg) saturate(1.6) brightness(1.15); }
.bal.bonus b { color: #ffd36b; }

/* ---------- Botões estilo bloco ---------- */
.btn {
  display: block; width: 100%;
  padding: 14px 10px;
  font-family: var(--px); font-size: 13px; letter-spacing: 1px;
  border: 3px solid #000;
  box-shadow: inset -4px -4px 0 rgba(0,0,0,0.35), inset 4px 4px 0 rgba(255,255,255,0.25);
  text-shadow: 2px 2px 0 rgba(0,0,0,0.6);
  transition: transform 0.05s;
  position: relative;
}
.btn:active { transform: translateY(2px); box-shadow: inset 4px 4px 0 rgba(0,0,0,0.35); }
.btn:disabled { filter: grayscale(0.8) brightness(0.7); cursor: not-allowed; }
.btn-green { background: var(--green); }
.btn-green:hover { background: #57c235; }
.btn-gold { background: var(--gold); color: #2b1d00; text-shadow: 1px 1px 0 rgba(255,255,255,0.4); }
.btn-stone { background: var(--stone); }
.btn-stone:hover { background: #7d7d88; }
.btn-red { background: var(--red); }
.btn-sm { padding: 9px 8px; font-size: 10px; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 18px; margin: 8px auto 16px; display: block; }

/* ---------- Auth ---------- */
#screen-auth { justify-content: center; padding: 20px 16px; overflow-y: auto; }
.logo { text-align: center; margin-bottom: 18px; }
.logo canvas { width: 96px; height: 96px; image-rendering: pixelated; animation: bob 2s ease-in-out infinite; }
.logo h1 { font-family: var(--px); font-size: 38px; margin: 8px 0 0; line-height: 1.3; color: #fff; text-shadow: 3px 3px 0 #5b2ca0, 6px 6px 0 #000; }
.logo h1 span { display: block; font-size: 18px; color: var(--gold); text-shadow: 3px 3px 0 #7a4b00, 5px 5px 0 #000; }
.tagline { color: var(--muted); margin: 10px 0 0; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-6deg); } }

.panel { background: var(--panel); border: 3px solid #000; box-shadow: inset 3px 3px 0 rgba(255,255,255,0.08), inset -3px -3px 0 rgba(0,0,0,0.4); padding: 14px; margin-bottom: 14px; }
.panel h3 { font-family: var(--px); font-size: 12px; margin: 0 0 12px; color: var(--gold); }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tab { flex: 1; padding: 10px; font-family: var(--px); font-size: 11px; background: var(--stone-d); border: 3px solid #000; color: var(--muted); }
.tab.active { background: var(--stone); color: #fff; }
form label { display: block; font-size: 18px; color: var(--muted); margin-bottom: 10px; }
form input:not([type=checkbox]) {
  display: block; width: 100%; margin-top: 4px; padding: 10px;
  font-size: 22px; color: #fff;
  background: #0b0714; border: 3px solid #000; outline: 2px solid #3a2d5c; outline-offset: -5px;
  user-select: text; -webkit-user-select: text;
}
form input:focus { outline-color: var(--gold); }
label.check { display: flex; gap: 8px; align-items: flex-start; font-size: 17px; line-height: 1.1; }
label.check input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--green); }
form .btn { margin-top: 6px; }
.form-msg { min-height: 22px; margin: 10px 0 0; color: #ff8a80; text-align: center; font-size: 18px; }
.form-msg.ok { color: var(--green-l); }
.mode-note { text-align: center; color: var(--muted); font-size: 16px; margin: 6px 0 0; }
.hint { color: var(--muted); font-size: 17px; margin: 0 0 10px; }

/* ---------- Home ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: rgba(0,0,0,0.35); border-bottom: 3px solid #000; }
.user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user b { font-family: var(--px); font-size: 11px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.user small { color: var(--muted); font-size: 17px; }
.avatar { width: 40px; height: 40px; image-rendering: pixelated; border: 3px solid #000; background: #2c2147; }
.balances { display: flex; gap: 8px; }
.bal { display: inline-flex; align-items: center; background: #000a; border: 2px solid #000; padding: 4px 8px; font-family: var(--px); font-size: 11px; }

#screen-home { overflow-y: auto; }
#screen-home > *:not(.topbar) { margin-left: 16px; margin-right: 16px; width: auto; }
.hero { margin-top: 16px; display: grid; grid-template-columns: minmax(0, 1fr) 84px; gap: 10px; }
.record b { font-size: 15px; }
.hero-card { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 3px solid #000; padding: 10px; min-width: 0; }
.hero-card canvas { width: 72px; height: 72px; image-rendering: pixelated; flex: none; }
.hero-info small { color: var(--muted); font-size: 16px; }
.hero-info b { display: block; font-family: var(--px); font-size: 13px; margin: 4px 0 8px; color: var(--gold); }
.hero-stats { display: flex; gap: 12px; font-size: 19px; }
.record { background: var(--panel); border: 3px solid #000; padding: 10px 12px; text-align: center; display: flex; flex-direction: column; justify-content: center; }
.record small { font-family: var(--px); font-size: 8px; color: var(--muted); }
.record b { font-family: var(--px); font-size: 18px; margin-top: 8px; white-space: nowrap; }
.record b small { font-size: 0.55em; color: inherit; margin-left: 1px; }
.record { padding: 10px 4px; min-width: 0; overflow: hidden; }
.btn-play { margin-top: 16px; font-size: 20px; padding: 20px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { filter: brightness(1.15); } }
/* 5 botões: 3 em cima (Shop, Forge, Wallet) e 2 embaixo (Ranking, Daily) */
.menu-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.menu-grid > .btn { grid-column: span 2; }
.menu-grid > .btn:nth-child(n+4) { grid-column: span 3; }
.menu-grid .btn { font-size: 11px; padding: 14px 6px; }
.mi { display: block; font-size: 26px; margin-bottom: 6px; text-shadow: none; }
.dot { position: absolute; top: 6px; right: 6px; width: 12px; height: 12px; background: var(--red); border: 2px solid #000; }
.info-strip { margin-top: 14px; background: rgba(63,224,212,0.08); border: 2px dashed #2a8f88; padding: 8px 12px; font-size: 18px; color: #bff7f2; }
.info-strip p { margin: 4px 0; }

/* ---------- Sub-telas ---------- */
.subbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: rgba(0,0,0,0.35); border-bottom: 3px solid #000; }
.subbar h2 { font-family: var(--px); font-size: 14px; margin: 0; flex: 1; text-align: center; }
.subbar > span:last-child:empty { width: 44px; }
.back { width: 44px; height: 40px; background: var(--stone); border: 3px solid #000; font-size: 14px; box-shadow: inset -3px -3px 0 rgba(0,0,0,0.35); }
.sec-title { font-family: var(--px); font-size: 11px; color: var(--gold); margin: 14px 0 10px; }
.cards { display: grid; gap: 10px; }
.card { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 3px solid #000; padding: 10px; }
.card { box-shadow: inset 0 0 0 2px var(--rc, transparent); }
.card canvas { width: 52px; height: 52px; image-rendering: pixelated; flex: none; background: #0004; }
.card .ci { flex: 1; min-width: 0; }
.card .ci b { font-family: var(--px); font-size: 11px; display: block; margin-bottom: 6px; }
.card .ci small { color: var(--muted); font-size: 17px; display: block; line-height: 1; }
.card .btn { width: auto; min-width: 104px; font-size: 10px; padding: 10px 8px; }
.uicon { width: 52px; height: 52px; display: grid; place-items: center; font-size: 28px; background: #0004; flex: none; border: 2px solid #000; }
.lvlbar { height: 6px; background: #000; margin-top: 6px; }
.lvlbar i { display: block; height: 100%; background: var(--green-l); }

/* ---------- Carteira ---------- */
.wallet-card { text-align: center; background: linear-gradient(180deg, #14524e, #0b2e2c); border: 3px solid #000; padding: 16px; margin-bottom: 14px; }
.wallet-card small { color: #bff7f2; font-size: 18px; }
.wallet-bal { display: flex; justify-content: center; align-items: center; gap: 6px; margin: 8px 0; }
.wallet-bal b { font-family: var(--px); font-size: 28px; }
.history { list-style: none; padding: 0; margin: 0; }
.history li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; background: var(--panel); border: 2px solid #000; margin-bottom: 6px; font-size: 18px; }
.history li small { color: var(--muted); display: block; font-size: 15px; }
.history .plus { color: var(--green-l); white-space: nowrap; }
.history .minus { color: #ff8a80; white-space: nowrap; }
.tag { font-size: 14px; padding: 1px 6px; background: #5a4a00; color: #ffe27a; border: 1px solid #000; margin-left: 4px; }
.tag.ok { background: #1f5a1a; color: #b6ff9e; }
.empty { color: var(--muted); text-align: center; padding: 20px; }

/* ---------- Ranking ---------- */
.rank { list-style: none; padding: 0; margin: 0; counter-reset: r; }
.rank li { counter-increment: r; display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--panel); border: 2px solid #000; margin-bottom: 6px; }
.rank li::before { content: counter(r); font-family: var(--px); font-size: 12px; width: 30px; text-align: center; color: var(--muted); }
.rank li:nth-child(1)::before { color: var(--gold); }
.rank li:nth-child(2)::before { color: #d0d0d0; }
.rank li:nth-child(3)::before { color: #d98b4a; }
.rank li.me { border-color: var(--gold); }
.rank .rn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .rd { font-family: var(--px); font-size: 12px; }

/* ---------- Jogo ---------- */
#screen-game { background: #000; }
#game-wrap { position: relative; flex: 1; min-height: 0; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; touch-action: none; cursor: crosshair; }
.hud-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: 10px; pointer-events: none; font-family: var(--px); font-size: 11px; text-shadow: 2px 2px 0 #000, -1px -1px 0 #000; }
.hud-left > div { margin-bottom: 6px; }
.hud-money { color: #fff; font-size: 13px; }
.hud-depth { text-align: center; position: absolute; left: 50%; transform: translateX(-50%); top: 10px; }
.hud-depth small { display: block; font-size: 8px; color: #ddd; }
.hud-depth b { display: block; font-size: 24px; margin: 4px 0; }
.hud-depth .rec { font-size: 8px; color: var(--gold); }
.hud-right { display: flex; flex-direction: column; gap: 6px; pointer-events: auto; }
.sq { width: 40px; height: 36px; background: rgba(0,0,0,0.55); border: 2px solid #000; box-shadow: inset 0 0 0 2px rgba(255,255,255,0.15); font-family: var(--px); font-size: 9px; color: #fff; }
.sq.off { opacity: 0.45; }

#boss-bar { position: absolute; top: 96px; left: 12px; right: 60px; display: flex; align-items: center; gap: 8px; font-family: var(--px); font-size: 9px; pointer-events: none; text-shadow: 2px 2px 0 #000; }
#boss-bar span { color: #e9b3ff; }
#boss-bar .bar { flex: 1; height: 14px; background: #000; border: 2px solid #000; box-shadow: 0 0 0 2px #5b3a96; }
#boss-bar .bar i { display: block; height: 100%; background: linear-gradient(90deg, #8e3cff, #d48cff); transition: width 0.1s; }

#banner { position: absolute; top: 38%; left: 0; right: 0; text-align: center; font-family: var(--px); font-size: 26px; color: #ff3b3b; text-shadow: 3px 3px 0 #000, -2px -2px 0 #000; pointer-events: none; animation: banner 1.6s ease-out forwards; }
#banner.win { color: var(--gold); font-size: 18px; }
#banner.tnt { color: #ffb020; font-size: 30px; }
@keyframes banner { 0% { transform: scale(2.4); opacity: 0; } 15% { transform: scale(1); opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-30px); } }

#toasts { position: absolute; left: 10px; bottom: 76px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast { background: rgba(10,60,57,0.92); border: 2px solid #000; box-shadow: inset 0 0 0 2px #3fe0d4; padding: 6px 10px; font-size: 18px; animation: toast 3s ease forwards; }
.toast.warn { background: rgba(80,50,0,0.92); box-shadow: inset 0 0 0 2px var(--gold); }
@keyframes toast { 0% { transform: translateX(-120%); } 10%, 85% { transform: none; opacity: 1; } 100% { opacity: 0; } }

.hud-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 10px; background: linear-gradient(transparent, rgba(0,0,0,0.75) 40%); pointer-events: none; }
.reward-timer { display: inline-flex; align-items: center; gap: 6px; font-family: var(--px); font-size: 9px; background: rgba(0,0,0,0.6); border: 2px solid #000; padding: 4px 6px; margin-bottom: 6px; }
.reward-timer.afk { box-shadow: inset 0 0 0 2px var(--gold); }
.rt-bar { width: 60px; height: 6px; background: #000; }
.rt-bar i { display: block; height: 100%; background: var(--gem); }
.dur { display: flex; align-items: center; gap: 8px; }
.heart { color: var(--red); font-size: 22px; text-shadow: 2px 2px 0 #000; }
.dur .bar { position: relative; flex: 1; height: 20px; background: #300; border: 3px solid #000; }
.dur .bar i { display: block; height: 100%; background: linear-gradient(#ff5a52, #c62828); transition: width 0.15s; }
.dur .bar b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--px); font-size: 9px; text-shadow: 1px 1px 0 #000; }
.dmg { font-family: var(--px); font-size: 10px; text-shadow: 2px 2px 0 #000; }

#upgrade-panel { flex: none; background: #131a26; border-top: 3px solid #000; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
.upg { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; background: linear-gradient(#6b3d1e, #4a2810); border: 3px solid #000; box-shadow: inset 0 0 0 2px #a8642f; font-family: var(--px); font-size: 12px; }
.upg:active { transform: translateY(2px); }
.upg.cant .upg-cost { color: #ff6b6b; }
.upg.can { animation: glow 1s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: inset 0 0 0 2px #ffd36b, 0 0 12px rgba(255,211,107,0.5); } }
.upg-val { text-align: center; }
.upg-val b { display: block; }
.upg-val small { font-family: var(--vt); font-size: 15px; color: #e8c9a8; }
.upg-cost { font-size: 13px; }
.up-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.up-tab { padding: 10px 6px; background: #26324a; border: 3px solid #000; font-family: var(--px); font-size: 10px; color: #c9d3ea; }
.up-tab.active { background: var(--gold); color: #2b1d00; }
.up-tabs.has-auto { grid-template-columns: 1fr 1fr auto; }
.up-auto { padding: 6px 10px; background: #26324a; border: 3px solid #000; font-family: var(--px); font-size: 10px; color: #c9d3ea; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.up-auto small { font-family: var(--vt); font-size: 14px; color: #ff6b6b; }
.up-auto.on { background: #2f7d32; color: #fff; }
.up-auto.on small { color: #b9ffb0; }
.auto-card .uicon { font-size: 20px; }
.auto-card .owned { color: #6fdc4a; font-family: var(--px); font-size: 10px; }

/* ---------- Modal ---------- */
.modal { position: absolute; inset: 0; z-index: 50; background: rgba(0,0,0,0.78); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { width: 100%; max-width: 380px; background: var(--panel); border: 4px solid #000; box-shadow: inset 0 0 0 3px #3a2d5c; padding: 18px 16px; text-align: center; animation: pop 0.2s ease-out; max-height: 100%; overflow-y: auto; }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } }
.modal-box h2 { font-family: var(--px); font-size: 16px; margin: 4px 0 14px; line-height: 1.4; }
.modal-box h2.danger { color: #ff4d4d; text-shadow: 3px 3px 0 #000; }
.modal-box .btn { margin-top: 10px; }
.sum { background: #0b0714; border: 3px solid #000; padding: 12px; margin-bottom: 10px; }
.sum small { font-family: var(--px); font-size: 8px; color: var(--muted); display: block; }
.sum .big { font-family: var(--px); font-size: 30px; margin: 8px 0; display: block; }
.sum-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; text-align: left; font-size: 19px; }
.sum-grid span { background: #0b0714; border: 2px solid #000; padding: 6px 8px; }
.newrec { color: var(--gold); font-family: var(--px); font-size: 10px; animation: pulse 0.8s infinite; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 10px 0; }
.days span { background: #0b0714; border: 2px solid #000; padding: 6px 0; font-size: 15px; }
.days span.done { background: var(--green-d); }
.days span.today { box-shadow: inset 0 0 0 2px var(--gold); }

/* ---------- Esquadrão ---------- */
.squad-card { text-align: left; background: var(--panel); border: 3px solid #000; padding: 10px; min-width: 0; font-family: var(--vt); }
.squad-card:hover { box-shadow: inset 0 0 0 2px var(--gold); }
.squad-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.squad-head small { font-family: var(--px); font-size: 8px; color: var(--muted); }
.squad-head span { font-family: var(--px); font-size: 9px; }
.squad-head .edit { margin-left: auto; color: var(--gold); font-size: 8px; }
.hero-stats { display: flex; gap: 12px; font-size: 19px; margin-top: 8px; }
.slots { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.squad-card { width: 100%; }
.slot { position: relative; min-width: 0; aspect-ratio: 1; background: #0b0714; border: 2px solid #000; box-shadow: inset 0 0 0 2px var(--rc, #3a2d5c); display: grid; place-items: center; }
.slot canvas { width: 80%; height: 80%; image-rendering: pixelated; }
.slot.empty::after { content: '+'; color: #4a3d6e; font-family: var(--px); font-size: 12px; }
.slot.cool canvas { filter: grayscale(1) brightness(0.5); }
.slot .cd { position: absolute; left: 0; right: 0; bottom: 1px; text-align: center; font-family: var(--px); font-size: 6px; color: #ffd36b; text-shadow: 1px 1px 0 #000; }
.slots.big { gap: 8px; margin: 10px 0; }
.slots.big .slot { cursor: pointer; }
.slots.big .slot .cd { font-size: 8px; }
.sq-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.inv { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.inv-item { position: relative; background: var(--panel); border: 3px solid #000; box-shadow: inset 0 0 0 2px var(--rc); padding: 8px 6px; text-align: center; font-family: var(--vt); }
.inv-item canvas { width: 44px; height: 44px; image-rendering: pixelated; }
.inv-item b { display: block; font-family: var(--px); font-size: 8px; margin: 4px 0; }
.inv-item small { display: block; font-size: 15px; color: var(--muted); line-height: 1; }
.inv-item .rar { color: var(--rc); font-size: 14px; }
.inv-item.in { background: #2b4a22; }
.inv-item.in::before { content: '✔'; position: absolute; top: 3px; right: 6px; color: var(--green-l); font-size: 16px; }
.inv-item.cool canvas { filter: grayscale(1) brightness(0.55); }
.inv-item .cd { color: #ffd36b; font-family: var(--px); font-size: 8px; margin-top: 4px; display: block; }
.play-note { text-align: center; color: var(--muted); font-size: 17px; margin: 6px 16px 0; min-height: 18px; }
.chest-teaser { display: flex; align-items: center; gap: 12px; background: linear-gradient(90deg, #4a2810, #2b1a40); border: 3px solid #000; box-shadow: inset 0 0 0 2px #ffb020; padding: 12px; margin-bottom: 6px; }
.chest-teaser .chest { font-size: 38px; animation: bob 1.8s ease-in-out infinite; }
.chest-teaser b { font-family: var(--px); font-size: 10px; color: #ffb020; display: block; margin-bottom: 6px; }
.chest-teaser small { font-size: 17px; color: #e8d7ff; }
.rtag { font-size: 14px; color: var(--rc); }

/* ---------- Baú na loja ---------- */
.shop-bals { display: flex; gap: 6px; }
.chest-shop { text-align: center; background: radial-gradient(circle at 50% 30%, #4a2d6e, #1d1430 70%); border: 3px solid #000; box-shadow: inset 0 0 0 2px #ffb020; padding: 16px; }
.chest-shop canvas { width: 112px; height: 112px; image-rendering: pixelated; animation: bob 1.8s ease-in-out infinite; filter: drop-shadow(0 6px 0 rgba(0,0,0,0.5)); }
.chest-shop b { display: block; font-family: var(--px); font-size: 12px; color: #ffb020; margin: 8px 0; text-shadow: 2px 2px 0 #000; }
.chest-shop small { display: block; color: #e8d7ff; font-size: 18px; margin-bottom: 12px; }
.chest-shop .btn { font-size: 14px; }
.odds { display: grid; gap: 6px; }
.odd { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 2px solid #000; box-shadow: inset 0 0 0 2px var(--rc); padding: 6px 10px; }
.odd canvas { width: 32px; height: 32px; image-rendering: pixelated; flex: none; }
.odd .on { flex: 1; min-width: 0; }
.odd .on b { font-family: var(--px); font-size: 9px; display: block; }
.odd .on small { color: var(--rc); font-size: 16px; }
.odd .pct { font-family: var(--px); font-size: 11px; color: var(--rc); }
.odd .own { color: var(--muted); font-size: 16px; min-width: 34px; text-align: right; }

/* ---------- Animação de abertura ---------- */
.modal-box.cx-box { background: radial-gradient(circle at 50% 40%, #2d1d4a, #0d0818 75%); overflow: hidden; }
.cx { position: relative; min-height: 360px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.cx-rays { position: absolute; left: 50%; top: 45%; width: 520px; height: 520px; margin: -260px 0 0 -260px; border-radius: 50%;
  background: repeating-conic-gradient(var(--rc) 0 9deg, transparent 9deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 10%, transparent 65%); mask: radial-gradient(circle, #000 10%, transparent 65%);
  opacity: 0; transition: opacity 0.4s; pointer-events: none; }
.cx.open .cx-rays { opacity: 0.55; animation: spin 7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.cx-chest { position: relative; width: 150px; height: 150px; image-rendering: pixelated; filter: drop-shadow(0 0 0 transparent); transition: filter 0.3s; }
.cx.s1 .cx-chest { animation: shake1 0.18s infinite; }
.cx.s2 .cx-chest { animation: shake2 0.09s infinite; filter: drop-shadow(0 0 14px var(--rc)); }
.cx.open .cx-chest { animation: none; width: 96px; height: 96px; margin-top: -6px; transition: width 0.3s, height 0.3s; }
@keyframes shake1 { 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
@keyframes shake2 { 25% { transform: rotate(-8deg) scale(1.05); } 75% { transform: rotate(8deg) scale(1.05); } }
.cx-flash { position: absolute; inset: -20px; background: #fff; opacity: 0; pointer-events: none; }
.cx.open .cx-flash { animation: flash 0.5s ease-out; }
@keyframes flash { 0% { opacity: 0.95; } 100% { opacity: 0; } }
.cx-reveal { position: relative; display: flex; flex-direction: column; align-items: center; }
.cx-reveal canvas { width: 120px; height: 120px; image-rendering: pixelated; animation: rise 0.7s cubic-bezier(.2,1.6,.4,1) both; filter: drop-shadow(0 0 12px var(--rc)); }
@keyframes rise { 0% { transform: translateY(120px) scale(0.2) rotate(-200deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.cx-reveal .rar { font-family: var(--px); font-size: 12px; color: var(--rc); text-shadow: 2px 2px 0 #000; margin-top: 10px; animation: pop 0.4s 0.4s both; }
.cx-reveal b { font-family: var(--px); font-size: 18px; margin: 8px 0 4px; text-shadow: 3px 3px 0 #000; animation: pop 0.4s 0.5s both; }
.cx-reveal small { font-size: 19px; color: #ddd; animation: pop 0.4s 0.6s both; }
.cx-btns { position: relative; width: 100%; margin-top: 6px; animation: pop 0.3s both; }
.spark { position: absolute; left: 50%; top: 32%; width: 8px; height: 8px; background: var(--rc); box-shadow: 0 0 6px var(--rc); pointer-events: none; animation: spark 1s ease-out forwards; }
@keyframes spark { 0% { transform: translate(-50%, -50%); opacity: 1; } 100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.3); opacity: 0; } }

/* ---------- Web3 / carteira ---------- */
.wallet-list { display: grid; gap: 10px; margin: 6px 0 4px; }
.wallet-list a { color: var(--gold); }
.hint.small { font-size: 15px; }
.hint.warn { color: #ffcf6b; }
a.btn { text-align: center; text-decoration: none; color: inherit; box-sizing: border-box; }
a.btn:not([href]) { filter: grayscale(0.8) brightness(0.7); cursor: default; }
.chest-shop .btn + .btn { margin-top: 8px; }
.wallet-sub { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; font-size: 18px; color: #d8fffb; margin-top: 8px; }
.wallet-card .addr { display: block; margin-top: 8px; font-size: 14px; color: #8fd8d2; word-break: break-all; }
.wallet-line { text-align: center; color: var(--muted); font-size: 16px; margin: 10px 16px 0; }
.quote { min-height: 20px; margin: 0 0 8px; font-size: 19px; }
.quote b { color: var(--gem); }
.muted { color: var(--muted); }
.history .amts { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
.history .bonus { color: #ffd36b; font-size: 16px; }
.slot .st { position: absolute; top: 1px; left: 2px; font-family: var(--px); font-size: 6px; color: #ffd36b; text-shadow: 1px 1px 0 #000; }
.inv-item .life { height: 5px; background: #000; margin: 5px 4px 2px; }
.inv-item .life i { display: block; height: 100%; background: var(--green-l); }
.inv-item .uses { font-size: 14px; }
.cx-note { position: relative; margin-top: 10px; }

/* ---------- Skills ---------- */
small.skill { display: block; color: var(--sc) !important; font-family: var(--vt); font-size: 15px; line-height: 1.05; margin-top: 3px; text-shadow: 0 0 6px var(--sc); }
.inv-item small.skill { font-size: 13px; }
.odd-skill { background: linear-gradient(90deg, rgba(255,255,255,0.06), transparent 70%); }
.odd-skill canvas { filter: drop-shadow(0 0 5px var(--rc)); }
.cx-reveal.has-skill canvas { animation: rise 0.7s cubic-bezier(.2,1.6,.4,1) both, skillGlow 1.2s 0.7s ease-in-out infinite; }
.cx-reveal.has-skill small.skill { font-size: 18px; max-width: 280px; text-align: center; animation: pop 0.4s 0.7s both; }
@keyframes skillGlow { 50% { filter: drop-shadow(0 0 22px var(--rc)) brightness(1.25); } }

/* ---------- Forja ---------- */
.forge-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.forge-card { background: var(--panel); border: 3px solid #000; padding: 10px 12px; opacity: 0.8; }
.forge-card.ready { opacity: 1; box-shadow: inset 0 0 0 2px var(--rb); }
.fr-row { display: flex; align-items: center; justify-content: center; gap: 14px; }
.fr-in, .fr-out { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 70px; }
.fr-in canvas, .fr-out canvas { width: 44px; height: 44px; image-rendering: pixelated; }
.fr-in small { color: var(--ra); font-family: var(--px); font-size: 8px; margin-top: 4px; }
.fr-out small { color: var(--rb); font-family: var(--px); font-size: 8px; margin-top: 4px; }
.fr-out canvas { filter: drop-shadow(0 0 8px var(--rb)); }
.fr-n { position: absolute; top: -4px; right: 2px; font-family: var(--px); font-size: 10px; text-shadow: 2px 2px 0 #000; }
.fr-arrow { font-size: 22px; color: #ff9b3d; }
.fr-info { margin: 6px 0 0; font-size: 17px; text-align: center; color: var(--muted); }
.fr-info b.ok { color: var(--green-l); }
.fr-info b.no { color: #ff6b6b; }
.forge-card .btn { margin-top: 8px; }
.fx-ring { position: absolute; left: 50%; top: 45%; width: 0; height: 0; }
.fx-in { position: absolute; width: 64px; height: 64px; margin: -32px 0 0 -32px; image-rendering: pixelated;
  transform: rotate(calc(360deg / var(--n) * var(--i))) translateY(-95px) rotate(calc(-360deg / var(--n) * var(--i)));
  animation: fxShake 0.16s infinite; filter: drop-shadow(0 0 6px var(--rc)); }
.cx.merge .fx-in { animation: none; transition: transform 0.75s cubic-bezier(.5,0,.8,.4), opacity 0.75s; transform: rotate(calc(360deg / var(--n) * var(--i) + 540deg)) translateY(0) scale(0.3); opacity: 0.2; }
@keyframes fxShake { 50% { margin-top: -35px; } }
.fx-core { position: absolute; left: 50%; top: 45%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; background: #ff9b3d; box-shadow: 0 0 25px 10px #ff6a00; animation: pulse 0.5s infinite; }
.cx.merge .fx-core { transition: transform 0.8s; transform: scale(2.4); }
.cx.open .fx-core { display: none; }
.cx.fx { min-height: 380px; }
.capline { color: var(--gem); font-family: var(--vt); font-size: 15px; }
.odd .on b .capline { font-size: 14px; margin-left: 4px; }
.inv-item .capline { font-size: 14px; }

/* HUD do esquadrão */
.squad-hud-row { display: flex; align-items: flex-end; gap: 8px; }
#squad-hud { flex: 1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.sh { background: rgba(0,0,0,0.6); border: 2px solid #000; box-shadow: inset 0 0 0 1px var(--rc); padding: 3px; display: flex; align-items: center; gap: 3px; }
.sh canvas { width: 18px; height: 18px; image-rendering: pixelated; flex: none; }
.sh .bar { flex: 1; height: 8px; background: #300; border: 1px solid #000; }
.sh .bar i { display: block; height: 100%; background: #5fd35a; transition: width 0.15s; }
.sh.dead { opacity: 0.4; }
.sh.dead canvas { filter: grayscale(1); }

@media (max-height: 640px) {
  .hud-depth b { font-size: 18px; }
  .upg { padding: 9px 12px; }
  .up-tab { padding: 8px 6px; }
}
