:root{--gold:#ffd23f;--purple:#8b5cf6;--cyan:#14f195;--line:#2a2a3d;--muted:#9a96b8;--bg:#05050b}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:#f2f0ff;font-family:'Press Start 2P',monospace}
.dg-demo{min-height:100vh;background:radial-gradient(ellipse at 50% 0%,#1a1030,#05050b 60%)}
.dg-top{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:14px;flex-wrap:wrap;
  padding:12px 18px;background:#0a0a14ee;border-bottom:2px solid var(--gold);box-shadow:0 6px 24px #000a}
.dg-brand{display:flex;align-items:center;gap:8px;color:var(--gold);text-decoration:none;font-size:11px}
.dg-brand img{width:30px;height:30px;object-fit:contain;filter:drop-shadow(0 0 8px #22c55e88)}
.dg-brand small{display:block;font-size:5px;color:var(--muted);margin-top:4px}
.dg-live{display:flex;align-items:center;gap:7px;font-size:6px;color:var(--cyan);margin-left:auto;flex-wrap:wrap}
.dg-live em{font-style:normal;font-size:5px;color:var(--gold);border:1px solid var(--gold);padding:3px 5px}
.dg-dot{width:8px;height:8px;border-radius:50%;background:var(--cyan);box-shadow:0 0 12px var(--cyan);animation:dgPulse 1.6s ease-in-out infinite}
.dg-controls{display:flex;gap:8px;flex-wrap:wrap}
.dg-btn{font-family:inherit;font-size:7px;padding:10px 12px;cursor:pointer;color:#0a0a12;text-decoration:none;
  background:linear-gradient(180deg,#ffe77a,#d4a600);border:2px solid #fff2a8;border-radius:4px;box-shadow:0 2px 0 #000;transition:.2s}
.dg-btn:hover{transform:translateY(-2px);box-shadow:0 4px 0 #000,0 0 18px #ffd70077}
.dg-btn.alt{background:linear-gradient(180deg,#c4b5fd,#6d28d9);border-color:#ddd6fe;color:#fff}
.dg-btn.ghost{background:#12121f;color:var(--gold);border-color:var(--line)}
.dg-main{max-width:1180px;margin:0 auto;padding:28px 18px 40px}
.dg-heading{text-align:center;margin-bottom:22px}
.dg-heading h1{font-size:clamp(16px,3.4vw,26px);color:var(--gold);margin:0 0 14px;text-shadow:3px 3px 0 #000,0 0 26px #ffd70055}
.dg-heading p{font-size:7px;color:var(--muted);line-height:2;max-width:640px;margin:0 auto}
.dg-stage-wrap{border:3px solid var(--gold);border-radius:16px;padding:10px;background:linear-gradient(180deg,#141026,#080810);
  box-shadow:0 0 0 3px #000,0 0 40px #8b5cf644;position:relative}
.dg-stage{position:relative;width:100%;aspect-ratio:16/9;overflow:hidden;border-radius:8px;
  background:linear-gradient(180deg,#0e0b18,#05050a),url('../bg_dungeon.jpg') center/cover}
#dgCanvas{display:block;width:100%;height:100%;image-rendering:pixelated;image-rendering:crisp-edges;cursor:grab;touch-action:none}
#dgCanvas.dragging{cursor:grabbing}
.dg-scan,.dg-vignette{position:absolute;inset:0;pointer-events:none}
.dg-scan{background:repeating-linear-gradient(0deg,#0000 0 3px,#00000020 3px 4px);opacity:.6}
.dg-vignette{box-shadow:inset 0 0 90px #000c,inset 0 0 30px #000}
.dg-stats{display:grid;grid-template-columns:repeat(6,1fr);gap:8px;margin-top:10px}
.dg-stats div{border:1px solid var(--line);background:#07070f;padding:10px 6px;text-align:center}
.dg-stats span{display:block;font-size:5px;color:var(--muted);margin-bottom:8px}
.dg-stats b{font-size:clamp(9px,1.6vw,14px);color:var(--gold);text-shadow:0 0 12px #ffd70066}
.dg-foot{text-align:center;font-size:5px;color:var(--muted);line-height:2;margin-top:18px}
@keyframes dgPulse{0%,100%{opacity:.5;transform:scale(1)}50%{opacity:1;transform:scale(1.25)}}
/* ---------- YOUR HEROES side panel ---------- */
.dg-layout{display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:14px;align-items:start}
.dg-side{position:sticky;top:86px;border:2px solid #233a33;border-radius:12px;background:linear-gradient(180deg,#0b1714,#08100e);
  box-shadow:0 0 0 2px #000,0 12px 30px #000a;overflow:hidden}
.dg-side-toggle{display:none;width:100%;font-family:inherit;font-size:8px;padding:12px;color:var(--gold);
  background:#0d1a17;border:0;border-bottom:1px solid #233a33;cursor:pointer}
.dg-side-inner{display:block}
.dg-tabs{display:grid;grid-template-columns:repeat(4,1fr);border-bottom:1px solid #233a33;background:#0d1a17}
.dg-tab{font-family:inherit;font-size:6px;color:var(--muted);background:none;border:0;padding:14px 2px 12px;cursor:pointer;
  display:flex;flex-direction:column;align-items:center;gap:8px;position:relative;transition:color .2s}
.dg-tab span{font-size:14px;filter:grayscale(.7)}
.dg-tab.active{color:var(--gold)}
.dg-tab.active span{filter:none;text-shadow:0 0 10px #ffd70088}
.dg-tab.active::after{content:'';position:absolute;left:8px;right:8px;bottom:0;height:3px;background:var(--gold);box-shadow:0 0 10px #ffd70088}
.dg-side-view{padding:14px;max-height:calc(100vh - 190px);overflow:auto}
.dg-side-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px}
.dg-side-head h2{font-size:12px;color:var(--gold);margin:0;text-shadow:2px 2px 0 #000}
.dg-help{font-family:inherit;font-size:10px;width:28px;height:28px;border-radius:50%;cursor:pointer;
  background:#2a1b12;color:var(--gold);border:1px solid #5a3a22}
.dg-act{width:100%;font-family:inherit;font-size:9px;padding:14px 10px;margin-bottom:10px;cursor:pointer;border-radius:8px;transition:.2s}
.dg-act:hover{transform:translateY(-2px);filter:brightness(1.08)}
.dg-act-repair{display:flex;align-items:center;justify-content:center;gap:8px;color:#e6e6e6;
  background:#111c1a;border:2px solid #1e332e;box-shadow:inset 0 0 0 2px #0009}
.dg-act-repair i{font-style:normal;color:#9fb0ad}
.dg-act-repair b{margin-left:auto;font-size:8px;background:#1c3b6b;color:#9fd3ff;border:1px solid #3b82f6;padding:3px 6px;border-radius:4px}
.dg-act-level{display:flex;align-items:center;justify-content:center;gap:8px;color:#fff;
  background:linear-gradient(180deg,#d15f45,#a83a28);border:2px solid #ef8a70;box-shadow:0 3px 0 #000}
.dg-hero-card{position:relative;text-align:left;border:1px solid #22332f;border-radius:12px;padding:12px;margin-bottom:10px;
  background:linear-gradient(135deg,#101b18,#0a1210);display:grid;grid-template-columns:64px 1fr;gap:10px}
.dg-hero-card::before{content:'';position:absolute;left:0;top:10px;bottom:10px;width:3px;border-radius:3px;background:#7a8c86}
.dg-portrait{width:64px;height:64px;object-fit:contain;background:#070d0b;border:1px solid #22332f;border-radius:9px;
  image-rendering:pixelated;padding:3px}
.dg-hero-main{min-width:0}
.dg-hero-top{display:flex;justify-content:space-between;gap:6px;align-items:flex-start}
.dg-hero-name{font-size:9px;color:#fff;margin:0 0 7px}
.dg-hero-num{font-size:6px;color:#9fd3ff;background:#173355;border:1px solid #3b82f6;padding:4px 5px;border-radius:4px;white-space:nowrap}
.dg-hero-stats{font-size:6px;color:var(--muted);line-height:1.9;margin-bottom:8px}
.dg-hero-stats b{color:var(--gold)}
.dg-bars{display:flex;flex-direction:column;gap:5px;margin-bottom:8px}
.dg-bar-row{display:flex;align-items:center;gap:5px;font-size:7px}
.dg-bar-row i{font-style:normal;width:10px}
.dg-bar{flex:1;height:5px;background:#050806;border-radius:4px;overflow:hidden;border:1px solid #1b2a26}
.dg-bar em{display:block;height:100%;border-radius:4px}
.dg-bar.loot em{background:linear-gradient(90deg,#b48b2c,#ffd23f)}
.dg-bar.anvil em{background:linear-gradient(90deg,#2563eb,#60a5fa)}
.dg-bar.flame em{background:linear-gradient(90deg,#b93b28,#ff7a5a)}
.dg-hero-foot{display:flex;justify-content:space-between;font-size:6px}
.dg-hero-foot .hunting{color:#39d98a}
.dg-hero-foot .zone{color:var(--muted)}
.dg-side-msg{font-size:7px;color:var(--muted);line-height:2;text-align:center;padding:22px 6px}
.dg-side-msg b{display:block;color:var(--gold);font-size:9px;margin-bottom:12px}
@media(max-width:1100px){
  .dg-layout{grid-template-columns:minmax(0,1fr) 300px}
}
@media(max-width:900px){
  .dg-layout{grid-template-columns:1fr}
  .dg-side{position:relative;top:0}
  .dg-side-toggle{display:block}
  .dg-side:not(.open) .dg-side-inner{display:none}
  .dg-side-view{max-height:none}
}

  .dg-live{margin-left:0;width:100%;justify-content:center}
  .dg-controls{width:100%;justify-content:center}
  .dg-stats{grid-template-columns:repeat(3,1fr)}
  .dg-main{padding:18px 10px 30px}
}
@media (prefers-reduced-motion: reduce){*{animation:none !important;transition:none !important}}
