:root { --red: #c8102e; --red-2: #e63946; --green: #1b6b3a; --gold: #f4c542; --snow: #f7fbff; --ink: #13213f; --glass: rgba(12, 20, 44, .72); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #050b1e; font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif; color: var(--ink); user-select: none; -webkit-user-select: none; }
#stage, #stage canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
.hidden { display: none !important; }

.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 30; background: rgba(4, 10, 28, .55); backdrop-filter: blur(4px); }
#loading { background: radial-gradient(ellipse at 50% 70%, #1d2f5e, #050b1e 70%); }
.load-box { width: min(420px, 100%); text-align: center; color: #fff; }
.load-title { font: bold 34px Georgia, serif; margin-bottom: 18px; text-shadow: 0 0 18px rgba(255, 200, 120, .6); }
.bar { height: 10px; border-radius: 6px; background: rgba(255,255,255,.15); overflow: hidden; }
#load-bar { height: 100%; width: 0; background: linear-gradient(90deg, #ffcf7a, #ff9a3c); transition: width .2s; }
#load-text { margin-top: 10px; opacity: .8; font-size: 14px; }

.card { background: var(--snow); border-radius: 20px; padding: 22px 24px; max-width: 520px; width: 100%; max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 14px 50px rgba(0,0,0,.6); border: 4px solid var(--red); position: relative; user-select: text; }
h1 { margin: 0 0 6px; color: var(--red); font: bold 30px Georgia, serif; text-align: center; }
h2 { margin: 0; color: var(--red); font: bold 22px Georgia, serif; }
.sub { color: #44506a; margin: 6px 0 12px; line-height: 1.4; }
label, .label { display: block; font-weight: 700; margin: 12px 0 6px; }
input { display: block; width: 100%; margin-top: 6px; padding: 11px 12px; font-size: 16px; border-radius: 10px; border: 2px solid #cbd5e1; font-family: inherit; }
#avatars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.av { border: 3px solid #e2e8f0; border-radius: 12px; padding: 5px; text-align: center; cursor: pointer; background: #fff; font-weight: 700; font-size: 14px; }
.av img { display: block; width: 100%; height: 92px; object-fit: contain; background: #0b1328; border-radius: 8px; margin-bottom: 4px; }
.av small { display: block; font-weight: 400; color: #64748b; font-size: 11px; }
.av.on { border-color: var(--red); background: #fff1f2; }
#colors { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px #cbd5e1; cursor: pointer; }
.swatch.on { box-shadow: 0 0 0 3px var(--ink); }
button { font-family: inherit; }
button.big { margin-top: 18px; width: 100%; padding: 14px; font-size: 18px; font-weight: 800; border: none; border-radius: 12px; background: linear-gradient(180deg, var(--red-2), var(--red)); color: #fff; cursor: pointer; box-shadow: 0 4px 0 #8a0b20; }
.tiny { font-size: 13px; color: #5b6680; text-align: center; margin: 12px 0 0; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.x { border: none; background: #e2e8f0; width: 36px; height: 36px; border-radius: 50%; font-size: 18px; cursor: pointer; flex: none; }

#hud { position: fixed; top: 12px; left: 12px; display: flex; gap: 8px; flex-wrap: wrap; z-index: 10; pointer-events: none; max-width: calc(100vw - 180px); }
.pill { background: var(--glass); color: #fff; border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 14px; border: 1px solid rgba(255,255,255,.25); backdrop-filter: blur(6px); }
.pill.gold { background: rgba(244, 197, 66, .92); color: var(--ink); }
#hud-right { position: fixed; top: 12px; right: 12px; display: flex; gap: 8px; z-index: 10; }
.round { width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255,255,255,.3); background: var(--glass); color: #fff; font-size: 17px; cursor: pointer; }
.round.off { opacity: .45; }
.pillbtn { height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid rgba(255,255,255,.3); background: var(--glass); color: #fff; font: 700 14px inherit; font-family: inherit; cursor: pointer; }
.pillbtn.on { background: rgba(244,197,66,.92); color: var(--ink); }
body.touch .pillbtn { display: none; }
#minimap { position: fixed; right: 12px; top: 62px; border-radius: 12px; border: 2px solid rgba(255,255,255,.35); z-index: 10; background: rgba(10,18,40,.7); }

#prompt { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: var(--glass); color: #fff; padding: 12px 20px; border-radius: 14px; font-weight: 700; font-size: 16px; border: 1px solid rgba(255, 207, 122, .7); box-shadow: 0 0 24px rgba(255, 180, 80, .35); text-align: center; max-width: calc(100vw - 32px); z-index: 10; backdrop-filter: blur(6px); }
#prompt kbd { background: #ffcf7a; color: var(--ink); border-radius: 6px; padding: 1px 7px; font-family: inherit; }

#cross { position: fixed; width: 36px; height: 36px; margin: -18px 0 0 -18px; border: 2.5px solid rgba(255,255,255,.95); border-radius: 50%; z-index: 9; pointer-events: none; box-shadow: 0 0 8px rgba(0,0,0,.5), inset 0 0 6px rgba(0,0,0,.4); }
#cross::before, #cross::after { content: ""; position: absolute; background: #fff; left: 50%; top: 50%; }
#cross::before { width: 2px; height: 50px; margin: -25px 0 0 -1px; opacity: .8; }
#cross::after { width: 50px; height: 2px; margin: -1px 0 0 -25px; opacity: .8; }
#floats div { position: fixed; z-index: 9; transform: translate(-50%, -50%); font: bold 22px Georgia, serif; text-shadow: 0 2px 6px rgba(0,0,0,.8); pointer-events: none; white-space: nowrap; }
#center { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 12; color: #fff; font: bold 90px Georgia, serif; text-shadow: 0 0 30px rgba(255,190,90,.8), 0 4px 10px rgba(0,0,0,.7); pointer-events: none; }

#meter { position: fixed; left: 50%; bottom: 128px; transform: translateX(-50%); width: min(360px, 80vw); height: 22px; border-radius: 12px; background: rgba(0,0,0,.55); border: 2px solid rgba(255,255,255,.8); overflow: hidden; z-index: 11; }
#meter .fill { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #2a9d5c, #f4c542 60%, #e63946); }
#meter .zone { position: absolute; top: 0; bottom: 0; background: rgba(80,255,140,.45); border-left: 2px solid #7dffb0; border-right: 2px solid #7dffb0; z-index: 2; }
#meter .marks i { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,.9); z-index: 2; }
#meter span { position: absolute; inset: 0; text-align: center; color: #fff; font-weight: 800; font-size: 12px; line-height: 18px; letter-spacing: 2px; z-index: 3; text-shadow: 0 1px 3px #000; }

#gamebar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(640px, calc(100vw - 24px)); background: var(--glass); color: #fff; border-radius: 16px; padding: 10px 14px; z-index: 11; border: 1px solid rgba(255,255,255,.25); backdrop-filter: blur(6px); display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.gb-top { display: flex; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.gb-top b { color: #ffcf7a; font: bold 17px Georgia, serif; }
#gb-hint { grid-column: 1; font-size: 13px; opacity: .85; }
#gb-leave { grid-column: 2; grid-row: 1 / span 2; border: 1px solid rgba(255,255,255,.4); background: rgba(255,255,255,.12); color: #fff; border-radius: 10px; padding: 8px 12px; cursor: pointer; font-weight: 700; }

#panel { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); width: min(460px, calc(100vw - 24px)); background: rgba(247, 251, 255, .96); border: 3px solid var(--red); border-radius: 18px; padding: 16px 18px; z-index: 13; box-shadow: 0 12px 40px rgba(0,0,0,.5); text-align: center; }
#panel h3 { margin: 0 0 6px; color: var(--red); font: bold 22px Georgia, serif; }
#panel p { margin: 6px 0; color: #44506a; line-height: 1.4; }
#panel .big-num { font: bold 46px Georgia, serif; color: var(--red); line-height: 1.1; }
#panel .row { display: flex; gap: 10px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
#panel button { border: none; border-radius: 12px; padding: 11px 18px; font-size: 16px; font-weight: 800; cursor: pointer; }
#panel .go { background: linear-gradient(180deg, #2fb36b, #1b6b3a); color: #fff; box-shadow: 0 3px 0 #0e4425; }
#panel .no { background: #e2e8f0; color: var(--ink); }
#panel .meta { font-size: 13px; color: #64748b; }

.prize { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: #fff; margin-bottom: 8px; border: 2px solid #e2e8f0; }
.prize .ic { font-size: 30px; }
.prize .nm { flex: 1; font-weight: 700; }
.prize .nm small { display: block; font-weight: 400; color: #64748b; }
.prize button { font-weight: 800; padding: 8px 14px; border-radius: 10px; border: none; background: #2a9d5c; color: #fff; cursor: pointer; white-space: nowrap; }
.prize button:disabled { background: #cbd5e1; color: #64748b; cursor: not-allowed; }
/* Google ads (adsense.js): labelled, set apart from the buttons so they're never tapped by mistake */
.fair-slot { margin-top: 18px; padding-top: 8px; border-top: 1px solid #dbe3ee; text-align: center; }
.fair-slot-label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #8a96a8; margin-bottom: 4px; }
.fair-slot-result ins { min-height: 50px; max-height: 120px; overflow: hidden; }
.fair-slot-preview { border: 2px dashed #b8c4d4; border-radius: 10px; color: #8a96a8; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.fair-slot-result .fair-slot-preview { height: 90px; } .fair-slot-shop .fair-slot-preview { height: 200px; }
#shop-ad:empty { display: none; }
#panel { max-height: calc(100vh - 90px); overflow: auto; }
.claim { background: #fff7dc; border: 2px dashed var(--gold); border-radius: 12px; padding: 10px 12px; margin-top: 8px; }
.claim code { font-size: 17px; font-weight: 800; color: var(--red); }
ul.help { padding-left: 4px; list-style: none; line-height: 1.8; }
.hg { padding: 8px 10px; background: #fff; border-radius: 10px; margin-bottom: 6px; border: 1px solid #e2e8f0; font-size: 14px; }

#toast { position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); z-index: 40; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
#toast div { background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; font-weight: 700; box-shadow: 0 4px 14px rgba(0,0,0,.4); animation: fade 3.2s forwards; text-align: center; }
@keyframes fade { 0% { opacity: 0; transform: translateY(8px); } 10%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }

#touch { position: fixed; inset: auto 0 0 0; height: 0; z-index: 14; }
#touch button { position: fixed; border: 2px solid rgba(255,255,255,.7); background: rgba(10,20,45,.45); color: #fff; font-weight: 800; touch-action: none; user-select: none; -webkit-user-select: none; backdrop-filter: blur(4px); }
.dpad button { width: 58px; height: 58px; border-radius: 14px; font-size: 20px; }
.dpad .up { left: 76px; bottom: 140px; } .dpad .down { left: 76px; bottom: 20px; }
.dpad .left { left: 16px; bottom: 80px; } .dpad .right { left: 136px; bottom: 80px; }
.t-run { right: 110px; bottom: 30px; width: 70px; height: 70px; border-radius: 50%; font-size: 14px; }
.t-run.on { background: rgba(244,197,66,.85) !important; color: var(--ink) !important; }
.t-act { right: 18px; bottom: 90px; width: 84px; height: 84px; border-radius: 50%; background: rgba(200,16,46,.85) !important; font-size: 15px; }
body.touch #prompt { bottom: 220px; }
body.touch.playing #touch .dpad, body.touch.playing .t-run, body.touch.playing .t-act { display: none; }
body.touch.playing.follow #touch .dpad, body.touch.playing.follow .t-run { display: block; }
body.touch #meter { bottom: 150px; }
@media (max-width: 640px) { #minimap { transform: scale(.75); transform-origin: top right; } #center { font-size: 64px; } .pill { font-size: 12px; padding: 6px 10px; } }
.site-links a { color: #8a0b20; font-weight: 700; }
