:root { --green: #39c45a; --green2: #2aa348; --gold: #ffd45a; --ink: #0d1210; --panel: #17201b; --line: #2a3a31; --txt: #eef6f0; --mut: #9db3a4; --red: #ff4d4d; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--txt); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; user-select: none; -webkit-user-select: none; touch-action: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; }

/* screens */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: calc(18px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom)); background: radial-gradient(120% 80% at 50% 0%, #1d3a29 0%, var(--ink) 60%); overflow-y: auto; touch-action: pan-y; z-index: 5; }
.screen.dim { background: rgba(6, 10, 8, .82); backdrop-filter: blur(4px); justify-content: center; }
.screen header { width: 100%; max-width: 520px; display: flex; align-items: center; gap: 10px; }
.screen header h2 { flex: 1; margin: 0; font-size: 22px; }
h2 { margin: 0; font-size: 26px; }
.btn { min-width: 220px; padding: 14px 22px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); font-weight: 700; font-size: 16px; transition: transform .08s; }
.btn:active { transform: scale(.96); }
.btn.primary { background: linear-gradient(180deg, #4fe074, var(--green2)); color: #05230f; border: 0; font-size: 20px; letter-spacing: .06em; box-shadow: 0 6px 0 #1b6e31, 0 14px 30px rgba(57, 196, 90, .35); }
.btn.icon { min-width: 0; width: 52px; padding: 14px 0; }
.row { display: flex; gap: 10px; }
.row .btn { min-width: 0; }
.wallet { display: flex; gap: 6px; font-weight: 800; font-size: 14px; }
.wallet span { padding: 6px 10px; border-radius: 999px; background: #0c1410; border: 1px solid var(--line); white-space: nowrap; }
.wallet .g { color: var(--gold); }

/* title */
#s-title { justify-content: center; text-align: center; }
.logo small { letter-spacing: .3em; font-size: 11px; color: var(--mut); }
.logo h1 { margin: 4px 0 0; font-size: 58px; line-height: .9; font-weight: 900; letter-spacing: -.02em; text-shadow: 0 4px 0 #0a2a14; }
.logo h1 b { color: var(--green); }
#hero { width: min(300px, 70vw); height: auto; margin: -6px 0; }
.tag { margin: 0; color: var(--mut); line-height: 1.4; }
.fine { color: #5d7266; font-size: 11px; max-width: 300px; margin: 6px 0 0; }

/* lists */
.list { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 10px; padding-bottom: 20px; }
.list.grid { display: grid; grid-template-columns: 1fr 1fr; }
.lvl { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); text-align: left; width: 100%; }
.lvl .n { width: 44px; height: 44px; flex: none; border-radius: 12px; display: grid; place-items: center; font-weight: 900; font-size: 20px; background: var(--green); color: #05230f; }
.lvl.locked { opacity: .45; }
.lvl.locked .n { background: #33423a; color: var(--mut); }
.lvl .t { flex: 1; min-width: 0; }
.lvl .t b { display: block; font-size: 17px; }
.lvl .t small { color: var(--mut); display: block; font-size: 12.5px; line-height: 1.3; }
.lvl .s { color: var(--gold); letter-spacing: 2px; white-space: nowrap; }
.lvl .s i { color: #3b4a41; font-style: normal; }

.tabs { display: flex; gap: 6px; width: 100%; max-width: 520px; background: #0c1410; padding: 4px; border-radius: 14px; }
.tabs button { flex: 1; padding: 10px 0; border-radius: 10px; background: none; font-weight: 700; color: var(--mut); }
.tabs button.on { background: var(--panel); color: var(--txt); }
.item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 10px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); text-align: center; }
.item.on { border-color: var(--green); box-shadow: 0 0 0 2px rgba(57, 196, 90, .35) inset; }
.item canvas { width: 84px; height: 96px; }
.item .em { font-size: 44px; line-height: 96px; height: 96px; }
.item b { font-size: 14.5px; }
.item small { color: var(--mut); font-size: 12px; min-height: 30px; line-height: 1.25; }
.item .buy { width: 100%; padding: 9px 0; border-radius: 10px; background: #0c1410; border: 1px solid var(--line); font-weight: 800; font-size: 14px; }
.item .buy.c { color: #8df0a6; } .item .buy.g { color: var(--gold); }
.item .buy.eq { background: var(--green); color: #05230f; border: 0; }
.item .buy.pay { background: #fff; color: #000; border: 0; }
.wide { grid-column: 1 / -1; color: var(--mut); font-size: 12.5px; text-align: center; line-height: 1.4; }

/* result */
.card { text-align: center; padding: 22px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line); width: min(360px, 92vw); animation: pop .45s cubic-bezier(.2, 1.5, .4, 1); }
.card p { color: var(--mut); margin: 8px 0 12px; }
.stars { font-size: 46px; letter-spacing: 6px; color: var(--gold); }
.stars i { font-style: normal; color: #3b4a41; }
.stars span { display: inline-block; animation: pop .5s cubic-bezier(.2, 1.8, .4, 1) backwards; }
.reward { font-weight: 800; color: #8df0a6; font-size: 18px; }
.paper { width: min(340px, 90vw); padding: 18px 18px 22px; background: #f3ead8; color: #17130d; border-radius: 4px; font-family: Georgia, "Times New Roman", serif; text-align: center; box-shadow: 0 20px 50px rgba(0, 0, 0, .6); animation: spin .7s cubic-bezier(.2, .9, .3, 1); transform: rotate(-3deg); }
.paper .mast { font-weight: 900; font-size: 24px; border-bottom: 3px double #17130d; padding-bottom: 6px; letter-spacing: .04em; }
.paper .head { font-weight: 900; font-size: 27px; line-height: 1.05; margin: 14px 0 10px; text-transform: uppercase; }
.paper .sub { font-style: italic; font-size: 15px; color: #4a4030; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
@keyframes spin { from { transform: rotate(-720deg) scale(.05); opacity: 0; } }

/* hud */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 3; padding: calc(10px + env(safe-area-inset-top)) 12px calc(14px + env(safe-area-inset-bottom)); }
#hud button { pointer-events: auto; }
#hud .top { display: flex; align-items: center; gap: 10px; }
.round { width: 44px; height: 44px; border-radius: 50%; background: rgba(10, 16, 12, .7); border: 1px solid rgba(255, 255, 255, .15); font-weight: 900; }
.pill { padding: 9px 14px; border-radius: 999px; background: rgba(10, 16, 12, .7); border: 1px solid rgba(255, 255, 255, .15); font-weight: 800; color: #8df0a6; white-space: nowrap; }
.meter { flex: 1; height: 26px; border-radius: 999px; background: rgba(10, 16, 12, .7); border: 1px solid rgba(255, 255, 255, .15); position: relative; overflow: hidden; }
.meter span { position: absolute; left: 8px; top: 2px; font-size: 15px; z-index: 1; }
.meter i { position: absolute; inset: 0; width: 0; background: linear-gradient(90deg, #ffd45a, #ff8a3a, var(--red)); border-radius: 999px; }
#alertBar { margin: 12px auto 0; width: min(300px, 80%); height: 34px; border-radius: 10px; background: rgba(60, 0, 0, .8); border: 2px solid var(--red); position: relative; overflow: hidden; animation: pulse .35s infinite alternate; }
#alertBar b { position: absolute; inset: 0; display: grid; place-items: center; letter-spacing: .2em; z-index: 1; }
#alertBar i { position: absolute; inset: 0; background: var(--red); transform-origin: left; }
@keyframes pulse { to { transform: scale(1.05); } }
#hint { position: absolute; left: 0; right: 0; top: calc(108px + env(safe-area-inset-top)); text-align: center; font-weight: 700; font-size: 15px; text-shadow: 0 2px 6px #000, 0 0 2px #000; padding: 0 20px; }
.perks { position: absolute; right: 14px; bottom: calc(22px + env(safe-area-inset-bottom)); display: flex; align-items: flex-end; gap: 10px; }
.perk { width: 58px; height: 58px; border-radius: 50%; background: rgba(10, 16, 12, .75); border: 2px solid rgba(255, 255, 255, .25); font-size: 24px; position: relative; overflow: hidden; }
.perk.big { width: 74px; height: 74px; font-size: 32px; border-color: var(--green); }
.perk span { position: relative; z-index: 1; }
.perk em { position: absolute; right: 2px; top: 0; font-style: normal; font-size: 12px; font-weight: 900; background: var(--green); color: #05230f; border-radius: 999px; min-width: 20px; padding: 1px 4px; z-index: 2; }
.perk i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0, 0, 0, .7); }
.perk.off { opacity: .4; }
.perk.live { border-color: var(--gold); box-shadow: 0 0 18px var(--gold); }

#toast { position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: #fff; color: #111; padding: 10px 16px; border-radius: 12px; font-weight: 700; opacity: 0; transition: all .25s; z-index: 20; pointer-events: none; max-width: 86vw; text-align: center; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
