html, body { margin: 0; padding: 0; background: #0b0d1c; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
canvas#scene, body > canvas { position: absolute; z-index: 0; }
#ui { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; z-index: 10; pointer-events: none; overflow: hidden; }
#ui .stage { position: absolute; left: 0; top: 0; width: 396px; height: 704px; transform-origin: 0 0; pointer-events: none; overflow: hidden;
  --ts: -2px 0 #0f1226, 2px 0 #0f1226, 0 -2px #0f1226, 0 2px #0f1226, -2px -2px #0f1226, 2px -2px #0f1226, -2px 2px #0f1226, 2px 2px #0f1226, 0 3px 0 #0f1226;
  color: #f4ead2; font-weight: 900; font-size: 16px; line-height: 1.2; }
#ui .stage * { box-sizing: border-box; }
#ui .stage img, #ui .stage canvas { image-rendering: pixelated; -webkit-user-drag: none; }
#ui .t { text-shadow: var(--ts); }

/* ---- title ---- */
#ui .title { position: absolute; inset: 0; pointer-events: auto; display: none; }
#ui .title.on { display: block; }
#ui .title.on.hide { visibility: hidden; }
#ui .logo-wrap { position: absolute; left: 0; right: 0; top: 56px; display: flex; justify-content: center; animation: float 3.2s ease-in-out infinite; pointer-events: none; }
#ui .logo { width: 82%; max-height: 234px; object-fit: contain; filter: drop-shadow(0 4px 0 rgba(15,18,38,.7)); }
#ui .best { position: absolute; left: 0; right: 0; top: 196px; text-align: center; font-size: 18px; color: #f3cf7a; text-shadow: var(--ts); }
#ui .prompt { position: absolute; left: 28px; right: 28px; top: 606px; text-align: center; font-size: 22px; text-shadow: var(--ts); animation: pulse 1.2s ease-in-out infinite; }
#ui .ibtn { position: absolute; top: 10px; width: 48px; height: 48px; border-radius: 50%; border: 3px solid #d9a441; background: rgba(20,24,52,.7); padding: 0; display: flex; align-items: center; justify-content: center; pointer-events: auto; cursor: pointer; transition: transform .1s; color: #f3cf7a; }
#ui .ibtn:active { transform: scale(.92); }
#ui .ibtn svg { width: 26px; height: 26px; }
#ui .ibtn.snd .slash { display: none; }
#ui .ibtn.snd.off { border-color: #6a6f8e; color: #8a8fae; background: rgba(20,24,52,.55); }
#ui .ibtn.snd.off .slash { display: inline; }
#ui .ibtn.snd.off .waves { display: none; }
#ui .keyhint { position: absolute; top: 62px; width: 48px; text-align: center; font-size: 14px; color: #f4ead2; opacity: .8; text-shadow: var(--ts); }

/* ---- panels ---- */
#ui .panel { position: absolute; background: rgba(20,24,52,.9); border: 3px solid #d9a441; border-radius: 3px; padding: 11px;
  box-shadow: 0 0 0 3px #0f1226, 3px 3px 0 3px #0f1226, 0 6px 0 3px #0f1226, inset 0 0 0 2px rgba(243,207,122,.18); pointer-events: auto; animation: pop .22s ease-out; }
#ui .panel .rv { position: absolute; width: 6px; height: 6px; background: #f3cf7a; border: 1px solid #5a3a14; border-radius: 1px; }
#ui .panel .rv.a { left: 3px; top: 3px; } #ui .panel .rv.b { right: 3px; top: 3px; } #ui .panel .rv.c { left: 3px; bottom: 3px; } #ui .panel .rv.d { right: 3px; bottom: 3px; }
#ui .inner { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
#ui .ov { position: absolute; inset: 0; background: rgba(8,10,24,.55); pointer-events: auto; animation: fadein .15s ease-out; }
#ui .ov.out, #ui .ov.out .panel { animation: fadeout .12s ease-in forwards; }
#ui .ptitle { text-align: center; font-size: 24px; color: #f3cf7a; text-shadow: var(--ts); flex: 0 0 auto; }
#ui .tabs { display: flex; gap: 6px; flex: 0 0 auto; }
#ui .tab { flex: 1 1 0; min-width: 0; min-height: 48px; padding: 4px 4px; font: inherit; font-size: 15px; font-weight: 900; color: #f4ead2; background: rgba(15,18,38,.8); border: 3px solid #5a3a14; border-radius: 3px; cursor: pointer; text-shadow: var(--ts); transition: transform .1s; }
#ui .tab.act { background: linear-gradient(#f3cf7a, #d9a441); color: #0f1226; border-color: #5a3a14; text-shadow: none; }
#ui .scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; touch-action: pan-y; padding: 4px 4px 8px; scrollbar-width: thin; scrollbar-color: #d9a441 transparent; }
#ui .prog { text-align: center; font-size: 16px; color: #f4ead2; margin-bottom: 8px; text-shadow: var(--ts); }
#ui .grid { display: grid; gap: 8px; }
#ui .grid.c2 { grid-template-columns: 1fr 1fr; } #ui .grid.c3 { grid-template-columns: 1fr 1fr 1fr; }
#ui .card { position: relative; background: rgba(27,31,58,.9); border: 3px solid #3a4070; border-radius: 3px; padding: 6px 4px; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; cursor: pointer; transition: transform .1s; text-align: center; }
#ui .card.lit { border-color: #d9a441; background: rgba(60,48,30,.85); }
#ui .card .nm { font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: var(--ts); }
#ui .card .sub { font-size: 14px; color: #ffe27a; text-shadow: var(--ts); white-space: nowrap; }
#ui .card svg { width: 100%; height: 64px; }
#ui .mini { width: 56px; height: 56px; display: block; image-rendering: pixelated; }
#ui .mini.dark { filter: grayscale(1) brightness(.45) contrast(1.4); }
#ui .desc { flex: 0 0 auto; min-height: 40px; font-size: 14px; color: #f4ead2; text-align: center; font-weight: 700; text-shadow: var(--ts); display: flex; align-items: center; justify-content: center; }
#ui .wallet { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 20px; color: #ffe27a; text-shadow: var(--ts); }
#ui .gold { display: inline-flex; align-items: center; gap: 5px; }
#ui .gold img { width: 18px; height: 18px; }
#ui .help-line { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 16px; font-weight: 700; line-height: 1.3; text-shadow: var(--ts); }
#ui .help-line svg { width: 36px; height: 36px; flex: 0 0 36px; }

/* ---- buttons ---- */
#ui .btn { min-height: 48px; min-width: 96px; padding: 6px 16px; font: inherit; font-size: 18px; font-weight: 900; color: #0f1226; background: linear-gradient(#f3cf7a, #d9a441); border: 3px solid #5a3a14; border-radius: 4px; box-shadow: 0 4px 0 #5a3a14; cursor: pointer; transition: transform .1s, filter .1s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; pointer-events: auto; }
#ui .btn img { width: 20px; height: 20px; }
#ui .btn:active, #ui .tab:active, #ui .card:active { transform: scale(.94); }
#ui .btn[disabled] { filter: grayscale(.8) brightness(.7); cursor: default; }
#ui .btn.quiet { background: rgba(15,18,38,.85); color: #f4ead2; border-color: #5a3a14; font-size: 15px; min-height: 48px; }
#ui .btn.small { min-height: 48px; font-size: 15px; min-width: 0; padding: 4px 10px; width: 100%; }
#ui .btn.wide { width: 100%; justify-content: center; min-height: 52px; }
#ui .closebtn { align-self: center; flex: 0 0 auto; min-width: 160px; }
@media (hover: hover) {
  #ui .btn:hover:not([disabled]), #ui .tab:hover, #ui .card:hover, #ui .ibtn:hover { transform: scale(1.05); filter: brightness(1.12); }
}
#ui .kf { transform: scale(1.05); outline: 3px solid #f4ead2; outline-offset: 1px; box-shadow: 0 0 14px 2px #ffe27a; filter: brightness(1.12); }
#ui .btn.kf { box-shadow: 0 4px 0 #5a3a14, 0 0 14px 2px #ffe27a; }

/* ---- HUD ---- */
#ui .hud { position: absolute; inset: 0; display: none; }
#ui .hud.on { display: block; }
#ui .hpanel { position: absolute; background: rgba(20,24,52,.82); border: 3px solid #d9a441; border-radius: 3px; box-shadow: 0 3px 0 #0f1226; padding: 6px 8px; pointer-events: none; animation: pop .22s ease-out; }
#ui .hud-l { left: 10px; top: 10px; width: 150px; }
#ui .score { font-size: 30px; line-height: 1.05; text-shadow: var(--ts); font-variant-numeric: tabular-nums; color: #f4ead2; }
#ui .goldrow { display: flex; align-items: center; gap: 5px; margin-top: 2px; font-size: 18px; color: #ffe27a; text-shadow: var(--ts); }
#ui .goldrow img { width: 18px; height: 18px; }
#ui .combo { margin-top: 4px; display: none; transform-origin: 0 50%; }
#ui .combo.on { display: block; }
#ui .combo .cm { font-size: 20px; color: #ff8fa3; text-shadow: var(--ts); }
#ui .combo .cl { font-size: 14px; color: #f4ead2; margin-left: 4px; text-shadow: var(--ts); }
#ui .combo .bar { height: 5px; background: #0f1226; border: 1px solid #5a3a14; margin-top: 2px; }
#ui .combo .bar i { display: block; height: 100%; background: #ff8fa3; width: 100%; }
#ui .combo.pulse { animation: cpop .25s ease-out; }
#ui .hud-c { left: 160px; top: 10px; width: 160px; padding: 4px 5px 5px; }
#ui .hud-c svg { display: block; width: 148px; height: 80px; }
#ui .hud-c .cn { font-size: 14px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: var(--ts); }
#ui .hud-c .cc { font-size: 16px; text-align: center; color: #ffe27a; text-shadow: var(--ts); }
#ui .chart .e { stroke: rgba(244,234,210,.25); stroke-width: 1; stroke-dasharray: 3 3; }
#ui .chart .e.lit { stroke: #ffe27a; stroke-width: 2; stroke-dasharray: none; filter: drop-shadow(0 0 2px #ffe27a); }
#ui .chart .s { fill: rgba(244,234,210,.4); }
#ui .chart .s.lit { fill: #ffe27a; filter: drop-shadow(0 0 3px #ffe27a); }
#ui .chart .s.pop { animation: spop .4s ease-out; transform-box: fill-box; transform-origin: center; }
#ui .ready { position: absolute; left: 28px; right: 28px; top: 422px; text-align: center; font-size: 19px; display: none; animation: pulse 1.2s ease-in-out infinite; padding: 0 4px; text-shadow: var(--ts); }
#ui .ready.on { display: block; }

/* ---- floating things ---- */
#ui .pop-t { position: absolute; left: 0; top: 0; font-size: 20px; opacity: 0; white-space: nowrap; text-shadow: var(--ts); pointer-events: none; }
#ui .banner { position: absolute; left: 50%; top: 38%; width: 380px; text-align: center; opacity: 0; pointer-events: none; transform: translate(-50%, -50%); }
#ui .banner .bt { font-size: 38px; color: #ffe27a; text-shadow: var(--ts); line-height: 1.15; }
#ui .banner .bs { font-size: 20px; margin-top: 6px; color: #f4ead2; text-shadow: var(--ts); }
#ui .toasts { position: absolute; left: 0; right: 0; top: 150px; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
#ui .toast { background: rgba(20,24,52,.92); border: 3px solid #d9a441; border-radius: 3px; padding: 6px 12px; font-size: 16px; max-width: 360px; text-align: center; text-shadow: var(--ts); box-shadow: 0 3px 0 #0f1226; }
#ui .toast.discover { border-color: #ffe27a; color: #ffe27a; }
#ui .sub-t { position: absolute; left: 50%; top: 244px; transform: translateX(-50%); max-width: 340px; background: rgba(20,24,52,.88); border: 3px solid #d9a441; border-radius: 3px; padding: 8px 12px; font-size: 16px; text-align: center; opacity: 0; pointer-events: none; text-shadow: var(--ts); }
#ui .flash { position: absolute; inset: 0; opacity: 0; pointer-events: none; }

/* ---- revive ---- */
#ui .rv-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: 0 0 auto; }
#ui .rv-head .ptitle { text-align: left; flex: 1; font-size: 22px; }
#ui .ring { position: relative; width: 56px; height: 56px; flex: 0 0 56px; }
#ui .ring svg { width: 56px; height: 56px; transform: rotate(-90deg); }
#ui .ring b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; text-shadow: var(--ts); }
#ui .rv-btns { display: flex; flex-direction: column; gap: 8px; }

@keyframes pop { 0% { transform: scale(.85); opacity: 0; } 70% { transform: scale(1.04); opacity: 1; } 100% { transform: scale(1); } }
@keyframes cpop { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes spop { 0% { transform: scale(.3); } 60% { transform: scale(1.8); } 100% { transform: scale(1); } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeout { to { opacity: 0; transform: scale(.96); } }
@keyframes pulse { 0%, 100% { opacity: .65; transform: scale(1); } 50% { opacity: 1; transform: scale(1.05); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
