/* HUD: floating mobile-style layout over the battlefield. Logical 1280x720 px. */
:root {
  --gold: #f2c84b; --cream: #f3e6c4; --red: #ff5a4a; --green: #5fd35f; --ink: #1b120b;
  --font: 'Trebuchet MS', Verdana, sans-serif;
}
#hud { font-family: var(--font); color: #fff; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
#hud > * { pointer-events: auto; }
#hud > .tip, #hud > .toast { pointer-events: none !important; }
.fl { position: absolute; }
.num { font-weight: 900; color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 2px 0 rgba(0,0,0,.45); letter-spacing: .3px; }

/* base health bars */
.hp { position: absolute; top: 10px; width: 230px; height: 26px; box-sizing: border-box; border: 3px solid var(--ink); border-radius: 13px; background: #22301c; overflow: hidden; box-shadow: 0 3px 0 rgba(0,0,0,.45), inset 0 2px 0 rgba(255,255,255,.12); }
.hp.me { left: 12px; } .hp.en { right: 12px; }
.hp > i { position: absolute; top: 0; bottom: 0; left: 0; width: 100%; background: linear-gradient(#a6f46a, #43b52e 55%, #2a7d1d); border-radius: 10px; }
.hp.en > i { left: auto; right: 0; }
.hp .num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 15px; line-height: 1; }

/* square / round buttons */
.btn { position: relative; box-sizing: border-box; padding: 0; margin: 0; cursor: pointer; border: 3px solid var(--ink); border-radius: 12px; color: inherit; font-family: inherit; overflow: visible; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 0 rgba(0,0,0,.5), inset 0 3px 0 rgba(255,255,255,.4), inset 0 -3px 0 rgba(0,0,0,.18); transition: transform .06s, filter .1s; }
.btn:hover { filter: brightness(1.12); }
.btn:active, .btn.press { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.5), inset 0 3px 0 rgba(0,0,0,.15); }
.btn canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; border-radius: 9px; }
.btn.off canvas { filter: grayscale(.85) brightness(.6); }
.btn.off { cursor: default; }
.btn.flash { animation: hudflash .35s; }
@keyframes hudflash { 0%,60% { box-shadow: 0 0 0 40px rgba(255,40,30,.6) inset, 0 0 10px #f33; } }
.sq { width: 56px; height: 56px; }
.big { width: 64px; height: 64px; }
.blue { background: linear-gradient(#bfe6ff, #6fb4ea 60%, #4a8fcc); }
.orange { background: linear-gradient(#ffd466, #f4a21c 60%, #cf7a0c); }
.yellow { background: linear-gradient(#fff08a, #f6c61c 60%, #d99a08); }
.round { border-radius: 50%; width: 56px; height: 56px; }
.round canvas { border-radius: 50%; }
.cell { position: relative; display: flex; flex-direction: column; align-items: center; margin-bottom: 12px; }
.tag { position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 0 7px 0 3px; height: 20px; border-radius: 10px; background: rgba(20,12,6,.88); border: 2px solid var(--ink); font-size: 13px; z-index: 6; white-space: nowrap; pointer-events: none; }
.tag canvas { width: 16px; height: 16px; flex: none; }
.tag .num { -webkit-text-stroke: 0; font-weight: bold; color: #ffd34d; text-shadow: 1px 1px 0 #000; }
.cell.bad .tag .num { color: var(--red); }
.lock { position: absolute; inset: 0; z-index: 3; pointer-events: none; display: none; background: rgba(20,20,30,.55); border-radius: 9px; }
.lock canvas { position: absolute; inset: 14px; width: calc(100% - 28px); height: calc(100% - 28px); filter: none !important; }
.btn.locked .lock { display: block; }
.pips { position: absolute; left: 0; right: 0; top: 3px; display: flex; justify-content: center; gap: 3px; z-index: 3; pointer-events: none; }
.pip { width: 9px; height: 7px; border: 2px solid var(--ink); border-radius: 3px; background: #2a1a0a; box-sizing: border-box; }
.pip.on { background: #ffd34d; box-shadow: 0 0 4px #ffd34d; }
.btn.final { background: linear-gradient(#fff3a0, #f0b020 55%, #b87a08); animation: finalglow 1.4s infinite alternate; }
.btn.final.gated { animation: none; }
.btn.final.gated::after { content: 'Star Age'; position: absolute; left: 0; right: 0; bottom: 3px; text-align: center; font-size: 11px; font-weight: bold; color: #fff; text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000; z-index: 5; }
@keyframes finalglow { from { box-shadow: 0 4px 0 rgba(0,0,0,.5), 0 0 6px #ffb81c; } to { box-shadow: 0 4px 0 rgba(0,0,0,.5), 0 0 20px 3px #ffe35a; } }
.btn.maxed { box-shadow: 0 4px 0 rgba(0,0,0,.5), 0 0 0 2px #ffd34d; }

/* specials + counters */
.sp-wrap { position: absolute; left: 12px; top: 46px; display: flex; gap: 10px; }
.sp-wrap .cell { margin-bottom: 0; }
.spbar { margin-top: 5px; width: 56px; height: 7px; box-sizing: border-box; border: 2px solid var(--ink); border-radius: 4px; background: #20150c; overflow: hidden; }
.spbar > i { display: block; height: 100%; width: 100%; background: linear-gradient(#ffe27a, #e0a020); }
.cd { position: absolute; inset: 0; z-index: 3; pointer-events: none; display: none; border-radius: 9px; }
.cdtxt { position: absolute; inset: 0; z-index: 4; display: none; align-items: center; justify-content: center; font-size: 20px; pointer-events: none; }
.pills { position: absolute; left: 148px; top: 46px; display: flex; flex-direction: column; gap: 5px; }
.pill { display: flex; align-items: center; gap: 6px; height: 28px; min-width: 104px; padding: 0 12px 0 4px; box-sizing: border-box; border-radius: 14px; background: rgba(20,12,6,.8); border: 2px solid var(--ink); box-shadow: 0 2px 0 rgba(0,0,0,.4); font-size: 16px; }
.pill canvas { width: 22px; height: 22px; flex: none; }
.pill .num.bad { color: var(--red); }
.pill.xp { position: relative; overflow: hidden; }
.pill.xp i { position: absolute; left: 0; bottom: 0; height: 4px; width: 0; background: #5fb4ff; }
.rt { position: absolute; right: 12px; top: 46px; display: flex; gap: 12px; }
.rt .btn { box-shadow: 0 4px 0 rgba(0,0,0,.5), inset 0 3px 0 rgba(255,255,255,.55), inset 0 -3px 0 rgba(0,0,0,.15); }
.rt canvas { position: static; }
.rt .btn svg, .act .btn svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.spdtxt { position: absolute; right: -2px; bottom: -4px; font-size: 14px; z-index: 5; pointer-events: none; }

/* bottom-left: units */
.units { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 10px; align-items: flex-end; }
.queue { position: absolute; left: 12px; bottom: 100px; display: flex; flex-direction: column; gap: 3px; width: 150px; }
.qrow { display: flex; gap: 4px; }
.qbox { width: 26px; height: 26px; box-sizing: border-box; border: 2px solid var(--ink); border-radius: 6px; background: rgba(20,12,6,.6); overflow: hidden; }
.qbox canvas { width: 100%; height: 100%; display: block; }
.qbox.first { border-color: #ffd34d; }
.qbar { height: 8px; box-sizing: border-box; border: 2px solid var(--ink); border-radius: 4px; background: rgba(20,12,6,.7); overflow: hidden; position: relative; }
.qbar > i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(#ffe27a, #e0a020); }

/* bottom-right: actions + panels */
.act { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 12px; align-items: flex-end; }
.act .btn { width: 72px; height: 72px; border-radius: 16px; }
.act .btn.open { filter: brightness(1.15); transform: translateY(3px); }
.evwrap { position: relative; width: 84px; height: 84px; border-radius: 50%; padding: 5px; box-sizing: border-box; background: conic-gradient(#5fd35f 0deg, #20150c 0deg); border: 3px solid var(--ink); box-shadow: 0 4px 0 rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; }
.evwrap .btn { width: 66px; height: 66px; border-radius: 50%; box-shadow: inset 0 3px 0 rgba(255,255,255,.4), inset 0 -3px 0 rgba(0,0,0,.2); }
.evwrap .btn canvas { border-radius: 50%; }
.evwrap.ready { animation: evglow 1s infinite alternate; }
.evwrap.ready .btn { background: linear-gradient(#fff08a, #f6a41c 60%, #cf7a0c); }
.evwrap.off .btn canvas { filter: grayscale(.7) brightness(.75); }
.evwrap.off .btn { background: linear-gradient(#b8b0a0, #7a7468); }
@keyframes evglow { from { box-shadow: 0 4px 0 rgba(0,0,0,.5), 0 0 8px #ffcf40; } to { box-shadow: 0 4px 0 rgba(0,0,0,.5), 0 0 26px 6px #ffe35a; } }
.panel2 { position: absolute; z-index: 30; display: none; padding: 12px 14px 8px; border: 4px solid var(--ink); border-radius: 16px; background: linear-gradient(#5a4430, #3a2818); box-shadow: 0 6px 18px rgba(0,0,0,.6), inset 0 3px 0 rgba(255,255,255,.2); }
.panel2::after { content: ''; position: absolute; bottom: -14px; right: var(--arrow, 40px); width: 0; height: 0; border: 10px solid transparent; border-top: 12px solid var(--ink); }
.pgrid { display: grid; gap: 16px 12px; }
.pgrid.up { grid-template-columns: repeat(5, 64px); }
.pgrid.tu { grid-template-columns: repeat(4, 64px); }
.pgrid .cell { margin-bottom: 8px; }
.pgrid .btn { width: 64px; height: 64px; }
.slotbox { width: 64px; height: 64px; box-sizing: border-box; border: 3px dashed rgba(255,255,255,.3); border-radius: 12px; background: rgba(0,0,0,.25); }
.slotbox.locked { opacity: .5; }
.sell { background: linear-gradient(#ffb0a0, #d05a40 60%, #9a3020); }
.green { background: linear-gradient(#b4f08a, #5fc03a 60%, #3a8a22); }
.ptitle2 { font-size: 12px; font-weight: bold; color: #e8d8b0; text-shadow: 1px 1px 0 #000; margin: 0 0 6px 2px; }

/* tooltip + toast */
.tip { position: absolute; z-index: 50; max-width: 240px; padding: 7px 10px; border: 3px solid var(--ink); border-radius: 10px; background: rgba(30,20,12,.96); box-shadow: 0 4px 10px rgba(0,0,0,.6); font-size: 13px; line-height: 1.35; display: none; }
.tip b { color: var(--gold); font-size: 14px; display: block; }
.tip .c { color: var(--gold); } .tip .c.bad { color: var(--red); } .tip .d { color: #d8c9a0; } .tip .s { color: var(--cream); } .tip .w { color: var(--red); }
.toast { position: absolute; left: 50%; top: 20px; transform: translateX(-50%); z-index: 45; padding: 6px 16px; border-radius: 16px; background: rgba(150,20,10,.92); border: 3px solid var(--ink); color: #fff; font-weight: bold; font-size: 15px; text-shadow: 1px 1px 0 #000; opacity: 0; transition: opacity .25s; }
.toast.show { opacity: 1; }

/* ===== Menus ===== */
#menu { font-family: var(--font); color: var(--cream); }
.menu-bg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: auto !important; }
.menu-bg.dim { background: rgba(10,5,2,.72); }
.menu-bg.main { background: radial-gradient(ellipse at 50% 40%, rgba(40,90,40,.55), rgba(8,18,8,.92) 75%), linear-gradient(#1c3a22, #0c1a10); }
.panel {
  position: relative; box-sizing: border-box; padding: 22px 30px; text-align: center;
  background: repeating-linear-gradient(92deg, rgba(0,0,0,0) 0 7px, rgba(0,0,0,.1) 7px 8px), linear-gradient(#5b3f27, #33210f);
  border: 5px solid #120a05; border-radius: 12px; box-shadow: inset 0 0 0 3px var(--gold2), inset 0 0 0 5px #120a05, 0 10px 30px rgba(0,0,0,.7);
}
.logo { margin: 0; font-family: Impact, 'Arial Black', 'Trebuchet MS', sans-serif; font-weight: 900; font-size: 74px; line-height: .95; letter-spacing: 2px; text-transform: uppercase; color: #ffd34d;
  -webkit-text-stroke: 3px #1b120b; paint-order: stroke fill; text-shadow: 0 4px 0 #a5560f, 0 7px 0 #1b120b, 0 10px 14px rgba(0,0,0,.6); transform: rotate(-2deg); }
.logo small { display: block; font-size: 38px; color: #fff3c0; letter-spacing: 8px; }
.menu-main { display: flex; align-items: center; gap: 26px; flex-direction: row; }
.mm-left { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.mm-head { width: 230px; height: 230px; object-fit: contain; filter: drop-shadow(0 6px 0 rgba(0,0,0,.5)); animation: bob 2.4s ease-in-out infinite alternate; }
@keyframes bob { to { transform: translateY(-8px) rotate(2deg); } }
.diffs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 420px; margin: 0 auto; }
.mbtn { cursor: pointer; font-family: Impact, 'Arial Black', sans-serif; font-size: 24px; letter-spacing: 1px; color: #fff3c0; padding: 10px 18px; border: 3px solid #120a05; border-radius: 8px; text-shadow: 2px 2px 0 #000;
  background: linear-gradient(#c99a3a, #8a5a14 55%, #5f3a0a); box-shadow: inset 2px 2px 0 rgba(255,255,255,.4), inset -2px -2px 0 rgba(0,0,0,.4), 0 4px 0 #120a05; touch-action: manipulation; }
.mbtn:hover { filter: brightness(1.2); } .mbtn:active { transform: translateY(3px); box-shadow: inset 2px 2px 0 rgba(0,0,0,.4), 0 1px 0 #120a05; }
.mbtn.easy { background: linear-gradient(#7fd06a, #3f8a2f 55%, #235a1a); }
.mbtn.normal { background: linear-gradient(#e0b640, #a77a14 55%, #6a4a0a); }
.mbtn.hard { background: linear-gradient(#f08a4a, #c0501a 55%, #7a2a08); }
.mbtn.impossible { background: linear-gradient(#e0483a, #a01a10 55%, #5a0a06); }
.mbtn.plain { background: linear-gradient(#8a7a68, #54463a 55%, #352a20); }
.howto { text-align: left; font-size: 13px; line-height: 1.45; color: var(--cream); margin: 14px auto 0; width: 420px; background: rgba(0,0,0,.28); border-radius: 6px; padding: 8px 12px; }
.howto b { color: var(--gold); }
.ptitle { font-family: Impact, 'Arial Black', sans-serif; font-size: 40px; letter-spacing: 2px; margin: 0 0 12px; color: #ffd34d; -webkit-text-stroke: 2px #1b120b; paint-order: stroke fill; text-shadow: 0 3px 0 #1b120b; }
.ptitle.win { color: #ffe35a; font-size: 64px; } .ptitle.lose { color: #ff5a4a; font-size: 64px; }
.vol { display: flex; align-items: center; gap: 12px; margin: 10px 0; font-weight: bold; font-size: 16px; text-shadow: 1px 1px 0 #000; }
.vol span:first-child { width: 120px; text-align: left; } .vol input { flex: 1; width: 220px; accent-color: #e8a317; height: 22px; } .vol .vv { width: 40px; text-align: right; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.stats { display: grid; grid-template-columns: auto auto; gap: 6px 26px; justify-content: center; margin: 8px 0 14px; font-size: 18px; text-align: left; }
.stats b { color: var(--gold); text-align: right; }
