:root { --bg: #0b1410; --panel: rgba(8, 14, 11, 0.86); --border: #2f4a38; --gold: #ffd54f; --hp: #e53935; --xp: #42a5f5; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: #e8f0ea; font-family: "Courier New", Consolas, monospace; overflow: hidden; user-select: none; }
canvas#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; cursor: crosshair; }
button { font-family: inherit; background: #1b2a21; color: #e8f0ea; border: 1px solid var(--border); border-radius: 4px; padding: 4px 8px; cursor: pointer; }
button:hover { background: #26392d; border-color: #6c9; }
button:active { transform: translateY(1px); }
.hidden { display: none !important; }

#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
#top { position: absolute; left: 10px; top: 10px; width: 420px; }
.bar { position: relative; height: 18px; background: #1a1a1a; border: 1px solid #000; border-radius: 3px; margin-bottom: 4px; overflow: hidden; }
.bar .fill { height: 100%; transition: width .15s; }
.bar.hp .fill { background: linear-gradient(#ff6b6b, var(--hp)); }
.bar.xp .fill { background: linear-gradient(#90caf9, var(--xp)); }
.bar span { position: absolute; inset: 0; text-align: center; font-size: 12px; line-height: 18px; text-shadow: 0 1px 2px #000; }
#stats { font-size: 13px; display: flex; gap: 12px; flex-wrap: wrap; text-shadow: 0 1px 2px #000; margin: 4px 0; }
#stats b { color: var(--gold); }
.slotrow { display: flex; gap: 4px; margin-bottom: 4px; }
.slot { width: 44px; height: 44px; background: var(--panel); border: 1px solid var(--border); border-radius: 4px; position: relative; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.slot.empty { opacity: .35; }
.slot .lv { position: absolute; right: 2px; bottom: 0; font-size: 10px; color: var(--gold); }
.slot .cd { position: absolute; left: 0; bottom: 0; height: 3px; background: #6cf; }
.slot.evo { border-color: var(--gold); box-shadow: 0 0 6px var(--gold); }
.slot.ready { border-color: #6f6; }

#minimapwrap { position: absolute; right: 10px; top: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 4px; padding: 4px; }
#minimap { display: block; cursor: pointer; image-rendering: pixelated; }
#minihint { font-size: 10px; color: #9ab; text-align: center; margin-top: 2px; }

#log { position: absolute; left: 10px; bottom: 90px; width: 420px; font-size: 12px; text-shadow: 0 1px 2px #000; }
#log div { opacity: .9; }
#belt { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; gap: 6px; }
.cons { width: 58px; height: 64px; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 24px; position: relative; cursor: pointer; }
.cons:hover { border-color: #fff; }
.cons.selected { border-color: #ff5252; box-shadow: 0 0 8px #ff5252; }
.cons .n { position: absolute; right: 4px; top: 2px; font-size: 12px; color: var(--gold); }
.cons .k { position: absolute; left: 4px; top: 2px; font-size: 10px; color: #9ab; }
.cons .nm { font-size: 9px; color: #cde; text-align: center; line-height: 1; margin-top: 2px; }
.cons.zero { opacity: .3; }
#hint { position: absolute; left: 50%; bottom: 82px; transform: translateX(-50%); font-size: 13px; background: var(--panel); padding: 4px 10px; border-radius: 4px; border: 1px solid var(--border); }
#hint:empty { display: none; }
#tooltip { position: absolute; background: var(--panel); border: 1px solid var(--border); padding: 4px 8px; font-size: 12px; border-radius: 4px; pointer-events: none; max-width: 260px; }
#tooltip:empty { display: none; }
#buttons { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 6px; }

#debug { position: fixed; left: 0; top: 0; bottom: 0; width: 340px; background: rgba(5, 10, 7, 0.95); border-right: 1px solid var(--border); overflow-y: auto; z-index: 20; font-size: 12px; }
.dbg-head { display: flex; justify-content: space-between; align-items: center; padding: 8px; position: sticky; top: 0; background: #0a140e; border-bottom: 1px solid var(--border); }
#dbg-body { padding: 8px; }
.dbg-sec { margin-bottom: 10px; }
.dbg-sec h4 { margin: 6px 0 4px; color: var(--gold); font-size: 12px; }
.dbg-grid { display: flex; flex-wrap: wrap; gap: 3px; }
.dbg-grid button { font-size: 11px; padding: 3px 5px; }
.dbg-grid button.on { background: #2e7d32; }
.dbg-grid button.owned { border-color: #6c9; }
.dbg-row { display: flex; gap: 4px; align-items: center; margin: 3px 0; }
.dbg-row input { width: 60px; background: #111; color: #fff; border: 1px solid var(--border); font-family: inherit; }

#modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.72); display: flex; align-items: center; justify-content: center; z-index: 30; }
#modal-body { background: #0e1a13; border: 2px solid var(--border); border-radius: 8px; padding: 20px; max-width: 920px; width: 92vw; max-height: 92vh; overflow-y: auto; box-shadow: 0 0 40px #000; }
#modal-body h1 { margin: 0 0 6px; color: var(--gold); letter-spacing: 2px; }
#modal-body h2 { margin: 0 0 12px; color: var(--gold); }
#modal-body p { color: #bcd; }
.cards { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.card { background: #15261c; border: 1px solid var(--border); border-radius: 6px; padding: 12px; width: 200px; cursor: pointer; transition: transform .1s; }
.card:hover { transform: translateY(-3px); border-color: var(--gold); }
.card .ic { font-size: 36px; text-align: center; }
.card .nm { font-weight: bold; text-align: center; margin: 4px 0; }
.card .lv { color: var(--gold); text-align: center; font-size: 12px; }
.card .ds { font-size: 12px; color: #bcd; margin-top: 6px; }
.card.new { border-color: #6cf; }
.chars { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.chars .card { width: auto; }
.chars .card .wp { font-size: 11px; color: #9fd; text-align: center; }
.statsgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; font-size: 14px; margin: 10px 0; }
kbd { background: #222; border: 1px solid #555; border-radius: 3px; padding: 0 4px; font-size: 11px; }
.help td { padding: 2px 8px; font-size: 13px; vertical-align: top; }
.center { text-align: center; }
