#ui { position: absolute; inset: 0; pointer-events: none; font-family: "Arial Rounded MT Bold","Trebuchet MS",ui-rounded,"Segoe UI",system-ui,sans-serif; color: #fff; }
#ui * { box-sizing: border-box; }
.hidden { display: none !important; }

/* tiny icon column, top-left (below the 12% the portal feed overlays) */
#icons { position: absolute; left: calc(8px + env(safe-area-inset-left)); top: max(12%, calc(env(safe-area-inset-top) + 8px)); display: flex; flex-direction: column; gap: 6px; pointer-events: auto; }
.ib { width: 32px; height: 32px; border-radius: 10px; border: 0; background: rgba(12,14,40,0.55); color: #dfe6ff; display: grid; place-items: center; cursor: pointer; padding: 0; -webkit-tap-highlight-color: transparent; }
.ib:active { transform: scale(0.92); }
.ib svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ib.off { color: #ff8a8a; }

.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; pointer-events: auto; }
#card { padding: max(14%, calc(env(safe-area-inset-top) + 12px)) 18px max(9%, calc(env(safe-area-inset-bottom) + 10px)); justify-content: flex-start; text-align: center; }
#card .kicker { font-size: 14px; letter-spacing: 3px; color: #aab4ff; font-weight: 800; margin-top: 4px; }
#card .big { font-size: clamp(54px, 18vw, 84px); line-height: 1; font-weight: 900; text-shadow: 0 0 22px rgba(160,190,255,0.8), 0 3px 0 rgba(8,10,30,0.6); margin: 6px 0 2px; }
#card .big.gold { color: #ffd23f; text-shadow: 0 0 24px rgba(255,200,60,0.9), 0 3px 0 rgba(60,30,0,0.6); }
.stamp { display: inline-block; transform: rotate(-6deg); border: 3px solid #ffd23f; color: #ffd23f; padding: 2px 12px; border-radius: 10px; font-weight: 900; letter-spacing: 2px; font-size: 16px; margin: 2px 0 6px; animation: stamp .45s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes stamp { from { transform: rotate(-6deg) scale(2.4); opacity: 0; } to { transform: rotate(-6deg) scale(1); opacity: 1; } }
.stats { display: flex; gap: 10px; justify-content: center; margin: 8px 0 10px; width: 100%; }
.stat { flex: 1; background: rgba(14,16,48,0.6); border-radius: 12px; padding: 6px 4px; max-width: 110px; }
.stat b { display: block; font-size: 20px; }
.stat span { font-size: 14px; color: #aab4ff; }
.mission { width: 100%; max-width: 330px; background: rgba(14,16,48,0.6); border-radius: 14px; padding: 8px 12px; margin-bottom: 4px; text-align: left; }
.mission .t { font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.mission .t i { font-style: normal; color: #ffd23f; white-space: nowrap; }
.bar { height: 8px; border-radius: 6px; background: rgba(255,255,255,0.14); margin-top: 5px; overflow: hidden; }
.bar > div { height: 100%; background: linear-gradient(90deg, #ffb347, #ffd23f); border-radius: 6px; transition: width .5s; }
.mission.small { padding: 4px 12px; opacity: 0.8; }
.mission.small .bar { height: 5px; margin-top: 3px; }
.spacer { flex: 1; min-height: 6px; }
.play { width: min(88%, 320px); height: clamp(64px, 12vh, 84px); border: 0; border-radius: 22px; font-size: clamp(24px, 7vw, 32px); font-weight: 900; color: #2a1200; background: linear-gradient(180deg, #ffe27a, #ffa72e); box-shadow: 0 6px 0 #b0600c, 0 0 28px rgba(255,170,50,0.55); cursor: pointer; font-family: inherit; animation: pulse 1.6s ease-in-out infinite; }
.play:active { transform: translateY(4px); box-shadow: 0 2px 0 #b0600c; }
@keyframes pulse { 50% { transform: scale(1.04); } }
.row { display: flex; gap: 8px; margin-top: 12px; justify-content: center; flex-wrap: wrap; }
.sec { min-width: 92px; min-height: 40px; border: 0; border-radius: 14px; padding: 8px 12px; font-size: 14px; font-weight: 800; color: #e6ebff; background: rgba(40,46,110,0.75); cursor: pointer; font-family: inherit; }
.sec:active { transform: scale(0.95); }
.coins { position: absolute; right: calc(10px + env(safe-area-inset-right)); top: max(12%, calc(env(safe-area-inset-top) + 8px)); font-size: 15px; font-weight: 800; color: #ffd23f; background: rgba(12,14,40,0.55); padding: 4px 10px; border-radius: 10px; }

.panel { background: rgba(6,8,28,0.985); justify-content: flex-start; padding: max(13%, calc(env(safe-area-inset-top) + 12px)) 16px max(9%, calc(env(safe-area-inset-bottom) + 10px)); overflow: auto; }
.panel h2 { margin: 0 0 8px; font-size: 22px; display: flex; justify-content: space-between; align-items: baseline; width: 100%; max-width: 340px; }
.tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.tab { border: 0; border-radius: 12px; padding: 8px 14px; font-size: 14px; font-weight: 800; background: rgba(40,46,110,0.6); color: #cfd6ff; font-family: inherit; cursor: pointer; }
.tab.on { background: #ffb347; color: #2a1200; }
.items { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: center; gap: 10px; background: rgba(30,34,90,0.7); border-radius: 14px; padding: 6px 10px 6px 6px; text-align: left; }
.item canvas { width: 64px; height: 64px; border-radius: 10px; background: #0b1026; flex: none; }
.item .nm { flex: 1; font-size: 15px; font-weight: 800; }
.item button { min-width: 84px; min-height: 40px; border: 0; border-radius: 12px; font-weight: 900; font-size: 14px; font-family: inherit; cursor: pointer; background: #ffb347; color: #2a1200; }
.item button.eq { background: rgba(255,255,255,0.15); color: #bdf5c8; }
.item button.dis { background: rgba(255,255,255,0.1); color: #8a93c8; }
.close { margin-top: 14px; }

.toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 320px; background: rgba(30,34,90,0.7); border-radius: 14px; padding: 10px 14px; margin-bottom: 8px; font-size: 16px; font-weight: 800; cursor: pointer; border: 0; color: #fff; font-family: inherit; min-height: 48px; }
.toggle .sw { width: 44px; height: 24px; border-radius: 14px; background: rgba(255,255,255,0.2); position: relative; transition: background .2s; }
.toggle .sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle.on .sw { background: #4cd98a; }
.toggle.on .sw::after { transform: translateX(20px); }

#pause { background: rgba(4,5,18,0.7); justify-content: center; font-size: 30px; font-weight: 900; cursor: pointer; }
#pause small { font-size: 16px; color: #aab4ff; margin-top: 8px; }
#toast { position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%); background: rgba(12,14,40,0.9); padding: 8px 16px; border-radius: 12px; font-size: 15px; font-weight: 800; pointer-events: none; opacity: 0; transition: opacity .25s; }
#toast.on { opacity: 1; }

#dbg { position: absolute; left: 6px; bottom: 9%; display: flex; flex-wrap: wrap; gap: 4px; max-width: 70%; pointer-events: auto; font: 12px monospace; }
#dbg button, #dbg input { font: 12px monospace; min-height: 28px; border-radius: 6px; border: 1px solid #456; background: rgba(0,0,0,0.6); color: #8f8; padding: 2px 6px; }
#dbg input { width: 48px; }

@media (prefers-reduced-motion: reduce) { .play { animation: none; } .stamp { animation: none; } }

.stars { font-size: 52px; letter-spacing: 8px; line-height: 1; margin: 4px 0 0; }
.star { color: rgba(255,255,255,0.18); display: inline-block; animation: starpop .5s cubic-bezier(.2,1.7,.4,1) both; }
.star.on { color: #ffd23f; text-shadow: 0 0 18px rgba(255,200,60,0.95); }
@keyframes starpop { from { transform: scale(0) rotate(-40deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
