#topbar { position: absolute; left: 0; right: 0; top: 0; display: flex; gap: 8px; align-items: center; padding: 8px 10px; background: linear-gradient(#0d0a10ee, #0d0a1000); z-index: 5; }
#topbar .spacer { flex: 1; }
.stat { background: var(--panel); border: 2px solid var(--line); border-radius: 0; padding: 6px 10px; display: flex; gap: 6px; align-items: center; font-size: 15px; white-space: nowrap; }
.stat b { color: var(--gold); font-size: 17px; }
.coin { width: 14px; height: 14px; background: var(--gold); border: 2px solid #b8860b; border-radius: 50%; display: inline-block; }
#hearts { display: flex; gap: 3px; font-size: 20px; }
#hearts i { font-style: normal; color: #ff5a6a; }
#hearts i.lost { color: #4a3a4a; }
#speedBtns { display: flex; gap: 4px; }
#speedBtns button { padding: 6px 10px; min-height: 36px; }

#bottom { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; background: linear-gradient(#0d0a1000, #0d0a10f2 30%); padding: 18px 10px 10px; }
#buildBar { display: flex; gap: 10px; align-items: stretch; }
#tabs { display: flex; flex-direction: column; gap: 4px; }
#tabs button { padding: 4px 10px; min-height: 30px; font-size: 14px; text-align: left; }
#items { flex: 1; display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; touch-action: pan-x; }
.card { flex: 0 0 auto; width: 112px; background: var(--panel); border: 2px solid var(--line); border-radius: 0; padding: 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; text-align: center; font-size: 13px; }
.card.sel { border-color: var(--accent); background: #3a2812; }
.card.poor .price { color: var(--bad); }
.card canvas { width: 48px; height: 48px; image-rendering: pixelated; }
.card .nm { font-weight: normal; line-height: 1.1; min-height: 28px; display: flex; align-items: center; }
.card .price { color: var(--gold); font-weight: normal; }
.infotext { padding: 6px 10px; font-size: 14px; color: var(--dim); max-width: 520px; line-height: 1.35; }
#startWave { align-self: center; min-width: 150px; min-height: 64px; font-size: 17px; background: #a85a1a; border-color: #ffb066; font-weight: normal; }
#defenseBar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#defenseBar .lbl { color: var(--dim); }
#waveProg { margin-left: auto; color: var(--dim); font-size: 14px; }

#panel { position: absolute; right: 10px; top: 60px; width: 250px; background: var(--panel); border: 2px solid var(--line); border-radius: 0; padding: 10px; z-index: 6; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
#panel h3 { margin: 0; font-size: 17px; color: var(--gold); }
#panel .row { display: flex; gap: 6px; flex-wrap: wrap; }
#panel .row button { flex: 1 1 45%; padding: 6px; font-size: 13px; }
#panel p { margin: 0; color: var(--dim); line-height: 1.35; }
.bar { height: 8px; background: #120e17; border-radius: 0; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ok); }

#hint { position: absolute; left: 50%; top: 56px; transform: translateX(-50%); z-index: 6; background: #3a2812ee; border: 2px solid var(--accent); border-radius: 0; padding: 8px 14px; max-width: min(560px, 90vw); font-size: 15px; text-align: center; }
#toast { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); z-index: 9; background: #000c; border: 2px solid var(--line); border-radius: 0; padding: 8px 14px; max-width: 90vw; text-align: center; }
#toast.bad { border-color: var(--bad); }
#confirmBar { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); display: flex; gap: 8px; z-index: 8; }
#confirmBar button { min-width: 90px; min-height: 48px; }

#modal { position: absolute; inset: 0; background: #0009; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 12px; touch-action: auto; }
#modalBox { background: var(--panel); border: 3px solid var(--line); border-radius: 0; padding: 18px; width: min(560px, 100%); max-height: 92vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
#modalBox h2 { margin: 0; color: var(--gold); }
#modalBox p { margin: 0; line-height: 1.45; color: var(--text); }
#modalBox .row { display: flex; gap: 8px; flex-wrap: wrap; }
#modalBox .row > button { flex: 1 1 140px; }
.dm { display: flex; gap: 12px; align-items: flex-start; }
.dm canvas { width: 72px; height: 72px; image-rendering: pixelated; background: #120e17; border: 2px solid var(--line); border-radius: 0; flex: 0 0 auto; }
.dm .who { color: var(--accent); font-weight: normal; margin-bottom: 2px; }
.slot { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--panel2); border: 2px solid var(--line); border-radius: 0; padding: 8px; }
.slot small { color: var(--dim); display: block; }
.title-art { font-size: 34px; font-weight: normal; color: var(--gold); text-shadow: 0 3px 0 #6a3a10; letter-spacing: 1px; line-height: 1; }
.subtitle { color: var(--accent); font-style: italic; margin-top: -4px; }
input[type=text], input[type=range] { font: inherit; width: 100%; padding: 8px; background: #120e17; color: var(--text); border: 2px solid var(--line); border-radius: 0; }

/* ---------- full-game additions ---------- */
#modalBox.wide { width: min(860px, 100%); }
.row.tabs2 { gap: 4px; } .row.tabs2 > button { flex: 1 1 90px; min-height: 36px; padding: 4px 8px; }
.dim, small { color: var(--dim); font-size: 13px; display: block; line-height: 1.3; }
.cards { display: flex; gap: 6px; flex-wrap: wrap; }
.cls { flex: 1 1 130px; display: flex; flex-direction: column; text-align: left; gap: 2px; } .cls.on { background: #5a3a1a; border-color: var(--accent); }
.attrs .attr { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 2px solid #ffffff10; align-items: center; }
.attr .val { display: flex; align-items: center; gap: 8px; } .attr .val span { color: var(--gold); font-size: 20px; min-width: 24px; text-align: center; } .attr .val button { min-height: 34px; padding: 2px 12px; }
.tree { display: flex; flex-direction: column; gap: 6px; }
.tier { display: flex; gap: 6px; flex-wrap: wrap; align-items: stretch; } .tier > small { width: 100%; }
.node { flex: 1 1 190px; text-align: left; display: flex; flex-direction: column; gap: 2px; } .node.got { border-color: var(--ok); background: #1a3a26; } .node .lock { color: #f0a0a0; }
.relics, .items2, .entries { display: flex; flex-direction: column; gap: 6px; }
.relic { display: flex; gap: 10px; text-align: left; align-items: center; } .relic.on { border-color: var(--ok); background: #1a3a26; } .relic canvas { width: 48px; height: 48px; image-rendering: pixelated; flex: 0 0 auto; }
.relic.rare { border-left: 6px solid #4a8ae0; } .relic.epic { border-left: 6px solid #a24ae0; } .relic.boss { border-left: 6px solid #e8a030; } .relic.common { border-left: 6px solid #9aa3ad; }
.item, .entry { display: flex; gap: 10px; align-items: center; background: var(--panel2); border: 2px solid var(--line); padding: 8px; } .item canvas, .entry canvas { width: 48px; height: 48px; image-rendering: pixelated; flex: 0 0 auto; }
.noicon { width: 8px; flex: 0 0 8px; }
.tag { color: var(--gold); }
.group { border: 3px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.group label { display: flex; flex-direction: column; font-size: 12px; color: var(--dim); gap: 2px; }
select { font: inherit; color: var(--text); background: #120e1a; border: 2px solid var(--line); padding: 6px; min-height: 36px; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; } .chip { min-height: 32px; padding: 2px 8px; font-size: 13px; display: flex; align-items: center; gap: 4px; } .chip canvas { image-rendering: pixelated; }
.dmbox canvas { width: 96px; height: 96px; image-rendering: pixelated; background: #120e1a; border: 2px solid var(--line); }
.introcv { width: 100%; image-rendering: pixelated; border: 2px solid var(--line); cursor: pointer; background: #000; }
.dtext { min-height: 4.2em; }
#dm { position: absolute; left: 10px; top: 56px; z-index: 6; display: flex; gap: 8px; align-items: center; background: var(--panel); border: 2px solid var(--accent); padding: 6px 10px; max-width: min(440px, 80vw); font-size: 14px; }
#dm canvas { width: 40px; height: 40px; image-rendering: pixelated; flex: 0 0 auto; }
#bossBar { position: absolute; left: 50%; top: 52px; transform: translateX(-50%); z-index: 6; width: min(420px, 70vw); text-align: center; color: var(--gold); text-shadow: 0 2px 0 #000; }
#bossBar .bar { height: 12px; border: 2px solid #000; } #bossBar .bar i { background: #e8463c; }
#targetBar { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); z-index: 9; display: flex; gap: 10px; align-items: center; background: #3a2812; border: 2px solid var(--accent); padding: 8px 12px; }
#eventBtn { background: #6a2020; border-color: #ff6a6a; animation: pulse 1s infinite alternate; }
@keyframes pulse { to { transform: scale(1.12); } }
.ability { min-width: 130px; position: relative; } .ability.cool { opacity: .6; }
#battleItems { display: inline-flex; gap: 4px; }
#orderTarget { max-width: 150px; }
.card .nm { font-size: 12px; } .card.lockedc { opacity: .35; }
#panel .row select { flex: 1 1 100%; }
.qmark { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; font-size: 28px; color: var(--dim); }
