html, body { margin: 0; padding: 0; height: 100%; background: #08141a; overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none; }
#ui { position: fixed; inset: 0; z-index: 10; pointer-events: none; overflow: hidden; color: #f6e7c8; font-weight: 900;
  --o: #08141a; --c: #f6e7c8;
  text-shadow: 2px 0 var(--o), -2px 0 var(--o), 0 2px var(--o), 0 -2px var(--o), 2px 2px 0 var(--o), -2px 2px 0 var(--o), 2px -2px 0 var(--o), -2px -2px 0 var(--o), 3px 3px 0 var(--o); }
#ui * { box-sizing: border-box; }
#ui img { image-rendering: pixelated; display: block; flex: none; }
#ui .hidden { display: none !important; }
#ui .tl { position: absolute; inset: 0; pointer-events: auto; }
#ui .stage { position: absolute; left: 50%; top: 50%; width: 396px; height: 704px; transform-origin: 50% 50%; pointer-events: none; }
#ui .scr { position: absolute; inset: 0; pointer-events: none; }
#ui .scr > * { pointer-events: auto; }
#ui .np { pointer-events: none !important; }
#ui .row { display: flex; align-items: center; }

/* pixel panel: notched border + hard drop shadow */
#ui .panel { background: #0d1f27; box-shadow: 0 -4px 0 0 var(--bc, #f6e7c8), 0 4px 0 0 var(--bc, #f6e7c8), -4px 0 0 0 var(--bc, #f6e7c8), 4px 0 0 0 var(--bc, #f6e7c8), 0 8px 0 0 #08141a, 4px 8px 0 0 #08141a, -4px 8px 0 0 #08141a, 8px 4px 0 0 #08141a; }
#ui .btn { font: inherit; color: inherit; text-shadow: inherit; border: 0; margin: 6px; padding: 0 14px; min-height: 52px; min-width: 52px; background: #1f5a63; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 18px; position: relative;
  box-shadow: 0 -4px 0 0 #f6e7c8, 0 4px 0 0 #f6e7c8, -4px 0 0 0 #f6e7c8, 4px 0 0 0 #f6e7c8, inset 0 -6px 0 0 rgba(0,0,0,.25), 0 8px 0 0 #08141a, 4px 8px 0 0 #08141a, -4px 8px 0 0 #08141a;
  transition: transform .09s, filter .09s; outline: none; -webkit-tap-highlight-color: transparent; }
#ui .btn:active { transform: scale(.92); }
#ui .btn.focus { transform: scale(1.06); filter: brightness(1.25) drop-shadow(0 0 6px #ffcc4d) drop-shadow(0 0 2px #ffcc4d); z-index: 2; }
#ui .btn.focus:active { transform: scale(.94); }
#ui .btn.prim { background: #e0703a; }
#ui .btn.dim { filter: grayscale(.8) brightness(.7); }
#ui .btn.round { border-radius: 50%; box-shadow: 0 0 0 4px #f6e7c8, 0 0 0 8px #08141a; background: rgba(13,31,39,.65); padding: 0; margin: 0; }
#ui .shake { animation: shake .4s; }
@keyframes shake { 0%,100% { translate: 0 0; } 20% { translate: -8px 0; } 40% { translate: 8px 0; } 60% { translate: -5px 0; } 80% { translate: 5px 0; } }
@keyframes pop { 0% { transform: scale(.5); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes slideup { 0% { transform: translateY(60px); opacity: 0; } 70% { transform: translateY(-6px); opacity: 1; } 100% { transform: translateY(0); opacity: 1; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.08); opacity: .75; } }
@keyframes drop { 0% { transform: translateY(-260px) scale(1.1); opacity: 0; } 55% { transform: translateY(18px); opacity: 1; } 75% { transform: translateY(-8px); } 100% { transform: translateY(0); } }
@keyframes float { 0%,100% { translate: 0 0; } 50% { translate: 0 -6px; } }
@keyframes sweep { from { transform: translateX(-120%) skewX(-20deg); } to { transform: translateX(320%) skewX(-20deg); } }

/* title */
#ui .vig { position: absolute; inset: 0; background: linear-gradient(#08141acc 0, #08141a00 28%, #08141a00 62%, #08141ad9 100%); pointer-events: none; }
#ui .logo { position: absolute; left: 9%; width: 82%; top: 5%; max-height: 30%; height: 30%; display: flex; justify-content: center; align-items: center; animation: drop .6s both; }
#ui .logo img { max-width: 100%; max-height: 100%; image-rendering: auto; animation: float 2.6s ease-in-out .6s infinite; filter: drop-shadow(0 4px 0 #08141a); }
#ui .prompt { position: absolute; left: 24px; right: 24px; top: 78%; text-align: center; font-size: 17px; animation: pulse 1.3s infinite; }
#ui .corner { position: absolute; top: 10px; width: 48px; height: 48px; }
#ui .corner.r { right: 10px; } #ui .corner.l { left: 10px; }
#ui .corner img { margin: auto; width: 27px; height: 27px; }
#ui .cl { position: absolute; top: 62px; left: 0; width: 70px; text-align: center; font-size: 12px; margin-left: -11px; pointer-events: none; }

/* select */
#ui .dim { position: absolute; inset: 0; background: rgba(8,20,26,.82); pointer-events: none; }
#ui .htitle { position: absolute; left: 18px; top: 16px; font-size: 28px; }
#ui .gold { position: absolute; left: 18px; top: 62px; display: flex; align-items: center; gap: 6px; font-size: 20px; }
#ui .mcard { position: absolute; left: 20px; right: 20px; height: 146px; margin: 0; padding: 12px 16px; justify-content: flex-start; text-align: left; font-size: 16px; animation: pop .3s both; background: #1f5a63; }
#ui .mcard.locked { background: #26353a; filter: grayscale(.9) brightness(.75); }
#ui .mcard .mn { font-size: 24px; line-height: 1.15; }
#ui .mcard .ms { font-size: 15px; color: #ffcc4d; margin-top: 6px; }
#ui .mcard .lh { font-size: 14px; color: #f6e7c8; margin-top: 4px; }
#ui .mcard .col { display: flex; flex-direction: column; flex: 1; min-width: 0; }
#ui .badge { background: #8cff6a; color: #08141a; text-shadow: none; font-size: 14px; padding: 4px 8px; box-shadow: 0 0 0 3px #08141a; align-self: flex-start; margin-bottom: 8px; }
#ui .olab { position: absolute; left: 20px; right: 20px; top: 452px; font-size: 18px; }
#ui .orow { position: absolute; left: 20px; right: 20px; top: 484px; display: flex; justify-content: space-between; }
#ui .sw { width: 78px; height: 100px; margin: 0; padding: 4px 0; flex-direction: column; gap: 2px; font-size: 14px; background: #0d1f27; animation: pop .3s both; }
#ui .sw.eq { background: #1f5a63; box-shadow: 0 -4px 0 0 #ffcc4d, 0 4px 0 0 #ffcc4d, -4px 0 0 0 #ffcc4d, 4px 0 0 0 #ffcc4d, 0 8px 0 0 #08141a; }
#ui .sw .chk { position: absolute; right: -6px; top: -8px; width: 24px; height: 24px; background: #8cff6a; color: #08141a; text-shadow: none; font-size: 16px; line-height: 24px; text-align: center; box-shadow: 0 0 0 3px #08141a; }
#ui .sw .pr { display: flex; align-items: center; gap: 3px; font-size: 14px; }
#ui .brow { position: absolute; left: 20px; right: 20px; top: 618px; display: flex; justify-content: center; gap: 10px; }
#ui .brow .btn { flex: 1; max-width: 170px; }

/* hud */
#ui .hud { position: absolute; inset: 0; pointer-events: none; }
#ui .hl { position: absolute; left: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
#ui .hearts { display: flex; gap: 1px; } #ui .hearts img { width: 20px; height: 20px; filter: drop-shadow(1px 1px 0 #08141a); }
#ui .chip { display: flex; align-items: center; gap: 5px; font-size: 18px; padding: 3px 8px; background: rgba(8,20,26,.6); box-shadow: 0 0 0 3px #08141a; }
#ui .chip.exit { background: #8cff6a; color: #08141a; text-shadow: none; animation: pulse .6s infinite; }
#ui .bar { display: flex; gap: 2px; } #ui .bar i { display: block; width: 6px; height: 10px; background: #ffcc4d; } #ui .bar i.off { background: #1f3a42; }
#ui .hc { position: absolute; left: 0; right: 0; top: 8px; text-align: center; display: flex; flex-direction: column; align-items: center; }
#ui .stl { font-size: 14px; } #ui .score { font-size: 28px; line-height: 1.1; color: #ffcc4d; }
#ui .coins { display: flex; align-items: center; gap: 4px; font-size: 16px; }
#ui .boss { margin-top: 6px; width: 238px; } #ui .boss .bn { font-size: 14px; color: #ff8a80; text-align: center; }
#ui .boss .bb { height: 14px; background: #08141a; box-shadow: 0 0 0 3px #f6e7c8, 0 0 0 6px #08141a; margin-top: 4px; }
#ui .boss .bb i { display: block; height: 100%; background: #d8433a; transition: width .15s; }

/* upgrade */
#ui .utitle { position: absolute; left: 0; right: 0; top: 70px; text-align: center; font-size: 28px; animation: pop .3s both; }
#ui .ucard { position: absolute; left: 16px; right: 16px; height: 108px; margin: 0; padding: 10px 14px; justify-content: flex-start; text-align: left; background: #0d1f27; gap: 12px; overflow: hidden; animation: slideup .3s both; font-size: 16px; }
#ui .ucard.combo { background: #3a2a10; box-shadow: 0 -4px 0 0 #ffcc4d, 0 4px 0 0 #ffcc4d, -4px 0 0 0 #ffcc4d, 4px 0 0 0 #ffcc4d, 0 8px 0 0 #08141a; }
#ui .ucard.combo::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 25%; background: rgba(255,240,170,.35); animation: sweep 1.8s infinite; pointer-events: none; }
#ui .ucard .ib { width: 64px; height: 64px; background: #08141a; display: flex; align-items: center; justify-content: center; flex: none; }
#ui .ucard .ib img { width: 45px; height: 45px; }
#ui .ucard .col { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 4px; }
#ui .ucard .nm { font-size: 19px; } #ui .ucard .ds { font-size: 14px; font-weight: 700; line-height: 1.2; }
#ui .pips { display: flex; gap: 3px; } #ui .pips i { width: 12px; height: 8px; background: #1f3a42; } #ui .pips i.on { background: #8cff6a; }
#ui .rib { position: absolute; right: 0; top: 0; background: #ffcc4d; color: #08141a; text-shadow: none; font-size: 12px; padding: 2px 8px; }
#ui .ucard.picked { animation: pickflash .3s; }
@keyframes pickflash { 0%,60% { filter: brightness(2.2); transform: scale(1.06); } 100% { filter: brightness(1.4); transform: scale(1.06); } }

/* banners, subtitle, toast */
#ui .bnr { position: absolute; left: 0; right: 0; top: 36%; text-align: center; font-size: 44px; line-height: 1.15; padding: 0 16px; pointer-events: none; animation: slam 1.6s both; display: flex; flex-direction: column; align-items: center; gap: 6px; }
#ui .bnr.stage { color: #f6e7c8; } #ui .bnr.clear, #ui .bnr.unlock { color: #ffcc4d; font-size: 48px; }
#ui .bnr.boss { color: #ff5a4a; font-size: 46px; animation: slam 1.6s both, shake .5s .1s; }
#ui .bnr.surge { color: #e0703a; font-size: 34px; } #ui .bnr.exit { color: #8cff6a; font-size: 38px; } #ui .bnr.warn { color: #ffcc4d; font-size: 34px; }
#ui .bnr img { width: 54px; height: 54px; }
@keyframes slam { 0% { transform: scale(2.2); opacity: 0; } 12% { transform: scale(1); opacity: 1; } 18% { transform: scale(1.06); } 24% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(.96); } }
#ui .sarrow { position: absolute; font-size: 40px; color: #e0703a; animation: pulse .35s 4; pointer-events: none; }
#ui .sub.low { top: auto; bottom: 3%; z-index: 30; }
#ui .sub { position: absolute; left: 20px; right: 20px; top: 19%; text-align: center; font-size: 16px; padding: 6px 10px; background: rgba(8,20,26,.72); pointer-events: none; transition: opacity .35s; }
#ui .toast { position: absolute; left: 30px; right: 30px; top: 30%; text-align: center; font-size: 16px; padding: 10px 12px; pointer-events: none; transition: opacity .3s; --bc: #e0703a; }

/* revive, help */
#ui .dlg { position: absolute; left: 24px; right: 24px; top: 17%; padding: 20px 18px 14px; display: flex; flex-direction: column; align-items: center; animation: pop .25s both; }
#ui .dlg .dt { font-size: 28px; text-align: center; margin-bottom: 10px; }
#ui .dlg .btn { align-self: stretch; margin: 6px 4px; }
#ui .dlg .hint { font-size: 13px; color: #ffb199; margin-top: -4px; }
#ui .ring { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 26px; margin: 4px 0 8px; box-shadow: 0 0 0 4px #08141a; }
#ui .ring span { width: 48px; height: 48px; border-radius: 50%; background: #0d1f27; display: flex; align-items: center; justify-content: center; }
#ui .help { top: 14%; } #ui .help p { margin: 6px 0; font-size: 16px; line-height: 1.35; font-weight: 700; align-self: stretch; }
#ui .fadef { position: absolute; inset: 0; background: #08141a; opacity: 0; pointer-events: auto; transition: opacity .25s steps(6); }
#ui .fadef.on { opacity: 1; }
