#ui { --u: min(calc(100vw / 396), calc(100vh / 704)); --font: "Trebuchet MS", sans-serif; --plum: #5a2d5e; --pink: #ff8fc0; --mint: #7ee8cf; --lilac: #b79cff; --butter: #ffd86b;
  font-size: calc(var(--u) * 16); font-family: var(--font); color: #fff; overflow: hidden; -webkit-tap-highlight-color: transparent; }
#ui * { box-sizing: border-box; margin: 0; }
#ui .t, #ui .btn, #ui h2 { font-weight: 900; color: #fff; -webkit-text-stroke: 0.18em var(--plum); paint-order: stroke fill; text-shadow: 0 0.13em 0 var(--plum); letter-spacing: 0.02em; }
#ui .layer { position: absolute; inset: 0; }
#ui .hidden { display: none !important; }
#ui .panel { border-style: solid; border-width: 1.4em; border-image: var(--panel-img, none) 28% fill / 1.4em stretch; background: none; pointer-events: auto; }
#ui .panel:not(.has-img) { background: #fff6fb; border: 0.3em solid var(--plum); border-radius: 1.2em; }
#ui .btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 0.4em; min-width: 3em; min-height: 3em; padding: 0.2em 1em; font-size: 1.1em; font-family: inherit; cursor: pointer; pointer-events: auto;
  border-style: solid; border-width: 1em; border-image: var(--button-img, none) 30% 10% fill / 1em stretch; background: none; transition: transform 0.12s, filter 0.12s; user-select: none; border-radius: 0; outline: none; }
#ui .btn.no-img { background: var(--pink); border: 0.25em solid var(--plum); border-radius: 1em; }
#ui .btn > * { -webkit-text-stroke: 0.18em var(--plum); paint-order: stroke fill; }
#ui .btn:hover, #ui .btn.focus { filter: brightness(1.12); transform: scale(1.05); }
#ui .btn.focus { filter: brightness(1.2) drop-shadow(0 0 0.4em var(--butter)); }
#ui .btn:active { transform: scale(0.92); filter: brightness(0.95); }
#ui .btn.off { filter: grayscale(0.7) brightness(0.9); opacity: 0.85; }
#ui .btn.quiet { font-size: 0.9em; }
#ui .btn.mint { filter: hue-rotate(110deg) saturate(1.1); }
#ui .btn.mint > * { filter: hue-rotate(-110deg); }
#ui .ico { width: 1.7em; height: 1.7em; object-fit: contain; vertical-align: middle; flex: none; filter: drop-shadow(0 0.08em 0 var(--plum)); }
#ui .ico.big { width: 2.6em; height: 2.6em; }
#ui .textbtn { pointer-events: auto; background: none; border: 0; font: inherit; cursor: pointer; padding: 0.7em 1.2em; min-height: 3em; transition: transform 0.12s; }
#ui .textbtn:active { transform: scale(0.92); }

/* title */
#title { transition: opacity 0.25s; pointer-events: auto; background: #f6d9e8; }
#title.out { opacity: 0; pointer-events: none; }
#title .cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#title .logo { position: absolute; top: calc(4% + env(safe-area-inset-top)); left: 50%; max-width: 84%; max-height: 30%; transform: translateX(-50%); object-fit: contain; animation: logoDrop 0.8s cubic-bezier(.3,1.5,.5,1) both, float 3s ease-in-out 0.8s infinite; filter: drop-shadow(0 0.2em 0 rgba(90,45,94,.35)); }
@keyframes logoDrop { 0% { transform: translate(-50%, -140%); opacity: 0; } 100% { transform: translate(-50%, 0); opacity: 1; } }
@keyframes float { 0%,100% { margin-top: 0; } 50% { margin-top: 0.5em; } }
#title .prompt { position: absolute; box-sizing: border-box; left: 8%; right: 8%; top: 80%; text-align: center; font-size: 1.6em; animation: pulse 1.2s ease-in-out infinite; padding: 0 5%; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
#title .badge { position: absolute; left: 10%; right: 10%; top: 89%; text-align: center; font-size: 1em; animation: popc 0.4s 0.3s both; }
#title .trophy { position: absolute; top: calc(0.6em + env(safe-area-inset-top)); right: calc(0.6em + env(safe-area-inset-right)); width: 3.4em; height: 3.4em; min-width: 48px; min-height: 48px; padding: 0.2em; background: none; border: 0; pointer-events: auto; cursor: pointer; transition: transform 0.12s; }
#title .trophy img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 0.1em 0 var(--plum)); }
#title .trophy:active { transform: scale(0.9); }
#title .avatar { position: absolute; top: calc(0.6em + env(safe-area-inset-top)); left: calc(0.6em + env(safe-area-inset-left)); font-size: 0.9em; min-height: 3.2em; }

/* hud */
#hud { transition: opacity 0.2s; }
#hud .chip { position: absolute; display: flex; align-items: center; gap: 0.3em; font-size: 1.15em; padding: 0.15em 0.7em 0.15em 0.4em; background: rgba(255,246,251,0.85); border: 0.18em solid var(--plum); border-radius: 1em; box-shadow: 0 0.15em 0 var(--plum); }
#hud .chip span { -webkit-text-stroke: 0.14em var(--plum); }
#hud .topbar { position: absolute; top: calc(0.7em + env(safe-area-inset-top)); left: calc(0.6em + env(safe-area-inset-left)); right: 20%; display: flex; align-items: flex-start; gap: 0.6em; pointer-events: none; }
#hud .topbar .chip { position: static; }
#hud .wavebox { display: flex; flex-direction: column; gap: 0.3em; min-width: 6.2em; }
#hud .wv { background: var(--lilac); padding: 0.15em 0.8em; justify-content: center; transition: background 0.2s; }
#hud .wv.bossw { background: var(--pink); }
#hud .wv.bossw::before { content: "👑"; font-size: 0.9em; }
#hud .wbar { position: relative; height: 0.6em; margin: 0 0.3em; background: rgba(255,246,251,0.85); border: 0.14em solid var(--plum); border-radius: 1em; box-shadow: 0 0.1em 0 var(--plum); overflow: hidden; }
#hud .wbar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(var(--mint), #4fcfb0); border-radius: 1em; }
#hud .wbar.bossw i { background: linear-gradient(#ff8fc0, #ff5a9d); }
#hud .power { top: calc(4.6em + env(safe-area-inset-top)); left: calc(0.6em + env(safe-area-inset-left)); }
#hud .gold { top: calc(6.8em + env(safe-area-inset-top)); left: calc(0.6em + env(safe-area-inset-left)); }
#hud .shield { top: calc(9em + env(safe-area-inset-top)); left: calc(0.6em + env(safe-area-inset-left)); }
#hud .chip .ico { width: 1.5em; height: 1.5em; }
#hud .boss { position: absolute; left: 44%; right: 3%; top: calc(4.6em + env(safe-area-inset-top)); text-align: center; }
#hud .boss .bt { font-size: 1.2em; }
#hud .boss .hp { height: 1.3em; margin-top: 0.2em; background: rgba(255,246,251,0.85); border: 0.22em solid var(--plum); border-radius: 1em; overflow: hidden; box-shadow: 0 0.15em 0 var(--plum); }
#hud .boss .hp i { display: block; height: 100%; width: 100%; background: linear-gradient(#ff8fc0, #ff5a9d); transition: width 0.15s; }
#sub { position: absolute; left: 50%; top: 24%; transform: translateX(-50%); max-width: 86%; padding: 0.5em 1em; background: rgba(255,246,235,0.92); color: var(--plum); border: 0.18em solid var(--plum); border-radius: 1.2em; font-weight: 800; font-size: 1em; text-align: center; line-height: 1.35; box-shadow: 0 0.15em 0 var(--plum); animation: pop 0.2s ease-out; }
#ui.modal-open #hud { opacity: 0; }
#ui.modal-open #sub { display: none; }
#toast { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); max-width: 86%; padding: 0.4em 1.1em; background: var(--butter); color: var(--plum); border: 0.18em solid var(--plum); border-radius: 2em; font-weight: 900; text-align: center; box-shadow: 0 0.15em 0 var(--plum); animation: pop 0.22s ease-out; }

/* banners */
.banner { position: absolute; left: 0; right: 0; top: 34%; text-align: center; padding: 0 4%; animation: slam 0.35s cubic-bezier(.3,1.6,.5,1) both; }
.banner .big { font-size: 2.6em; line-height: 1.15; }
.banner .big .ico { width: 1em; height: 1em; margin-left: 0.2em; }
.banner .small { font-size: 1.4em; margin-top: 0.2em; }
.banner.out { animation: bout 0.25s ease-in forwards; }
.banner.bossb .big { color: #ffd0e6; }
.banner.liar { color: var(--pink); animation: slam 0.3s cubic-bezier(.3,1.6,.5,1) both, shake 0.12s linear 0.3s 6; }
.banner.liar .big { color: #ffd0e6; }
.banner.hint { top: 48%; }
.hint-bubble { position: absolute; left: 50%; top: 36%; transform: translateX(-50%); max-width: 84%; padding: 0.6em 1.1em; background: #fff6eb; color: var(--plum); border: 0.2em solid var(--plum); border-radius: 1.2em; font-weight: 800; text-align: center; box-shadow: 0 0.15em 0 var(--plum); animation: pop 0.25s ease-out; }
@keyframes slam { 0% { transform: scale(2.2); opacity: 0; } 70% { transform: scale(0.94); opacity: 1; } 100% { transform: scale(1); } }
@keyframes bout { to { transform: scale(0.8) translateY(-1em); opacity: 0; } }
@keyframes shake { 0%,100% { margin-left: 0; } 25% { margin-left: -0.4em; } 75% { margin-left: 0.4em; } }
@keyframes pop { 0% { transform: translateX(-50%) scale(0.7); opacity: 0; } 60% { transform: translateX(-50%) scale(1.05); opacity: 1; } 100% { transform: translateX(-50%) scale(1); } }
@keyframes popc { 0% { transform: scale(0.7); opacity: 0; } 60% { transform: scale(1.05); opacity: 1; } 100% { transform: scale(1); } }

/* overlays */
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(90,45,94,0.4); pointer-events: auto; padding: env(safe-area-inset-top) 3% env(safe-area-inset-bottom); animation: fadein 0.2s both; }
@keyframes fadein { from { opacity: 0; } }
.overlay .panel { width: 92%; max-width: 26em; max-height: 94%; overflow: hidden auto; display: flex; flex-direction: column; align-items: center; gap: 0.5em; animation: popc 0.22s ease-out both; text-align: center; padding: 0.2em; }
.overlay h2 { font-size: 1.9em; line-height: 1.1; }
.overlay .line { font-size: 1.05em; }
.row { display: flex; align-items: center; justify-content: center; gap: 0.5em; flex-wrap: wrap; width: 100%; }
.held { gap: 1em; font-size: 1.15em; }
.held span { display: inline-flex; align-items: center; gap: 0.2em; }
.cards { display: flex; gap: 0.5em; width: 100%; }
.card { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 0.15em; padding: 0.4em; background: rgba(255,255,255,0.7); border: 0.18em solid var(--plum); border-radius: 1em; }
.card .nm { font-size: 0.95em; line-height: 1.1; }
.card .ef { font-size: 0.8em; color: var(--plum); font-weight: 800; line-height: 1.15; }
.card .btn { font-size: 0.95em; padding: 0.1em 0.5em; }
.card .btn.pop { animation: popc 0.25s both; }
.opts { display: flex; flex-direction: column; gap: 0.5em; width: 100%; align-items: stretch; }
.opts .btn { width: 100%; justify-content: space-between; }
.toggle { font-size: 1em; }

/* results */
.results { gap: 0.4em !important; }
.results .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45em; width: 100%; }
.results .stat { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.1em; padding: 0.35em 0.3em 0.45em; background: rgba(255,255,255,0.72); border: 0.16em solid var(--plum); border-radius: 0.9em; animation: popc 0.3s both; text-align: center; min-width: 0; }
.results .stat .hd { display: flex; align-items: center; justify-content: center; gap: 0.25em; max-width: 100%; margin-top: 0.2em; }
.results .stat .ico { width: 1.5em; height: 1.5em; }
.results .stat .nm { font-size: 0.9em; line-height: 1.1; min-width: 0; }
.results .btn.wide { width: 100%; font-size: 0.95em; }
.results .recbanner { margin-bottom: 0.45em; }
.results .stat .val { font-size: 1.7em; line-height: 1.05; }
.results .stat .val small { font-size: 0.7em; }
.results .stat .bst { font-size: 0.85em; font-weight: 800; color: var(--plum); line-height: 1.1; }
.results .stat .emo { display: inline-flex; align-items: center; justify-content: center; font-size: 1.25em; width: 1.3em; height: 1.3em; filter: none; }
.results .stat .tag { position: absolute; right: -0.3em; top: -0.85em; font-size: 0.8em; background: var(--pink); padding: 0 0.6em; border-radius: 1em; border: 0.2em solid var(--plum); transform: rotate(6deg); }
.results .stat .tag.slam { animation: slam 0.4s cubic-bezier(.3,1.6,.5,1) both; }
.results .card .ico.big { width: 2em; height: 2em; }
.recbanner { font-size: 1.6em; color: var(--pink) !important; line-height: 1.1; animation: slam 0.5s cubic-bezier(.3,1.6,.5,1) both; }
.btnrow { flex-wrap: nowrap; gap: 0.4em; }
.btnrow .btn { flex: 0 1 auto; min-width: 3.2em; padding: 0.2em 0.5em; font-size: 1em; }
.btnrow .btn.retry { flex: 1 1 auto; }
.btnrow .btn span { white-space: nowrap; }
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -4%; left: var(--x); width: 0.6em; height: 0.9em; border-radius: 0.1em; opacity: 0; animation: conf var(--t) var(--d) ease-in both; }
@keyframes conf { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx), 110vh) rotate(var(--r)); opacity: 1; } }
