:root { --navy: #152454; --navy2: #20357a; --ink: #0c1638; --gold: #f3cf6e; --gold2: #c08a2c; --cream: #fff6dc; --dark: #3a2406; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); font-family: Nunito, system-ui, sans-serif; color: #fff; -webkit-user-select: none; user-select: none; touch-action: none; overscroll-behavior: none; }
#bg { position: fixed; inset: 0; background: #1a2a5e center / cover no-repeat; transition: background-image .6s; }
#bg::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 70% 60% at 50% 52%, rgba(10,16,48,.08), rgba(10,16,48,.55)); }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
.cinzel { font-family: 'Cinzel', Georgia, serif; }
.goldtext { background: linear-gradient(#fff6c8, #f5cf63 45%, #c78b2a 70%, #ffe8a0); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 0 #3a2406) drop-shadow(0 3px 6px rgba(0,0,0,.5)); }
.frame { background: linear-gradient(#24387d, #142251); border: 2.5px solid var(--gold); border-radius: 16px; box-shadow: 0 0 0 2px #4a2e08, inset 0 0 0 2px rgba(255,236,170,.22), inset 0 8px 16px rgba(120,160,255,.12), 0 8px 18px rgba(0,0,0,.45); }

/* top HUD */
#hud { position: fixed; left: 0; right: 0; top: 0; padding: calc(env(safe-area-inset-top) + 8px) 10px 0; display: flex; justify-content: center; pointer-events: none; z-index: 5; }
#hud .row { display: flex; gap: 8px; width: 100%; max-width: 520px; align-items: stretch; }
#hud .plaque { padding: 5px 10px 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 64px; }
#hud .lbl { font: 800 12px/1 Nunito, sans-serif; letter-spacing: .06em; color: #f8e3a6; text-transform: uppercase; }
#hud .big { font: 900 30px/1.05 'Cinzel', Georgia, serif; color: #fff; text-shadow: 0 2px 0 #0a1230, 0 0 10px rgba(255,220,140,.35); }
#hud .lv { flex: 0 0 auto; min-width: 82px; }
#hud .lv .name { font: 800 12px/1.1 Nunito, sans-serif; color: #dfe7ff; max-width: 104px; text-align: center; }
#hud .mv { flex: 0 0 auto; min-width: 78px; }
#hud .mv.low .big { color: #ff8b7a; animation: pulse .8s infinite; }
#hud .rs { flex: 1 1 auto; }
#hud .faces { display: flex; gap: 6px; margin-top: 3px; }
#hud .face { position: relative; width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(#3a58b0, #1a2a62); border: 2px solid var(--gold); box-shadow: 0 0 0 1.5px #4a2e08; overflow: hidden; }
#hud .face img { width: 100%; height: 100%; object-fit: cover; }
#hud .face.done::after { content: '✓'; position: absolute; inset: 0; display: grid; place-items: center; font: 900 26px/1 Nunito; color: #fff; background: rgba(40,190,110,.55); text-shadow: 0 2px 2px rgba(0,0,0,.4); animation: pop .35s ease-out; }
#storm { position: fixed; left: 50%; transform: translateX(-50%); z-index: 5; pointer-events: none; padding: 5px 14px; border-radius: 999px; font: 800 14px/1.2 Nunito; color: #fff3cf; background: linear-gradient(#6b4a1c, #43290b); border: 2px solid var(--gold); box-shadow: 0 4px 10px rgba(0,0,0,.4); display: flex; gap: 6px; align-items: center; white-space: nowrap; }
#storm.soon { animation: shake .5s infinite; background: linear-gradient(#a3551c, #6a2f0b); }
#storm.held { background: linear-gradient(#2c5a8f, #173b66); }

/* boosters */
#bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 0 12px calc(env(safe-area-inset-bottom) + 10px); display: flex; justify-content: center; z-index: 5; pointer-events: none; }
#bar .row { width: 100%; max-width: 520px; display: flex; align-items: flex-end; justify-content: center; gap: 18px; position: relative; }
.boost { pointer-events: auto; position: relative; width: 72px; height: 72px; border-radius: 50%; border: none; padding: 0; cursor: pointer; background: radial-gradient(circle at 50% 38%, #2f4ea3, #142251 70%); box-shadow: 0 0 0 3px #f3cf6e, 0 0 0 5px #4a2e08, inset 0 -6px 12px rgba(0,0,0,.35), 0 8px 16px rgba(0,0,0,.45); transition: transform .12s; }
.boost img { width: 54px; height: 54px; margin-top: 4px; pointer-events: none; }
.boost .n { position: absolute; right: -6px; bottom: -4px; min-width: 28px; height: 28px; border-radius: 14px; background: #152454; border: 2px solid var(--gold); font: 900 15px/24px Nunito; color: #fff; text-align: center; }
.boost .t { position: absolute; left: 50%; bottom: -19px; transform: translateX(-50%); font: 800 12px/1 Nunito; color: #f8e3a6; text-shadow: 0 1px 2px #000; white-space: nowrap; }
.boost:active { transform: scale(.94); }
.boost.off { filter: grayscale(.85) brightness(.75); }
.boost.on { animation: glow 1s infinite; transform: scale(1.06); }
.gear { pointer-events: auto; position: absolute; left: 0; bottom: 6px; width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer; background: radial-gradient(#2f4ea3, #142251); box-shadow: 0 0 0 2.5px var(--gold), 0 0 0 4px #4a2e08, 0 6px 12px rgba(0,0,0,.4); color: var(--gold); font-size: 24px; display: grid; place-items: center; }
#bar .gear { left: 0; }

/* overlays */
.screen { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(6,10,32,.55); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); animation: fadein .25s; }
.panel { width: 100%; max-width: 360px; padding: 22px 20px 20px; text-align: center; position: relative; animation: rise .35s cubic-bezier(.2,1.4,.4,1); }
.ribbon { position: relative; margin: -46px auto 12px; width: max-content; max-width: 92%; padding: 8px 26px 10px; font: 900 22px/1.1 'Cinzel', Georgia, serif; color: #3a2406; background: linear-gradient(#fff2b3, #f2c75c 55%, #c58d2e); border-radius: 12px; box-shadow: 0 0 0 2px #4a2e08, 0 6px 14px rgba(0,0,0,.45); }
.panel p { font: 700 16px/1.4 Nunito; color: #e8eeff; margin: 8px 4px 14px; }
.btn { pointer-events: auto; display: block; width: 100%; margin: 10px 0 0; padding: 13px 16px; border: none; border-radius: 14px; cursor: pointer; font: 900 19px/1 'Cinzel', Georgia, serif; letter-spacing: .02em; color: #3a2406; background: linear-gradient(#fff3b8, #f3c95e 55%, #c99331); box-shadow: 0 0 0 2px #4a2e08, inset 0 2px 0 rgba(255,255,255,.6), 0 6px 0 #7a4d12, 0 10px 18px rgba(0,0,0,.4); transition: transform .1s; }
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 2px #4a2e08, 0 3px 0 #7a4d12; }
.btn.alt { color: #f8e3a6; background: linear-gradient(#2b4590, #172757); box-shadow: 0 0 0 2px var(--gold), 0 5px 0 #0b1434, 0 10px 18px rgba(0,0,0,.4); font-size: 17px; }
.btns2 { display: flex; gap: 10px; } .btns2 .btn { flex: 1; }
.stars { display: flex; justify-content: center; gap: 10px; margin: 2px 0 6px; }
.stars .s { width: 62px; height: 62px; filter: grayscale(1) brightness(.45); transform: scale(.6); opacity: .7; transition: all .35s cubic-bezier(.2,1.6,.4,1); }
.stars .s:nth-child(2) { transform: translateY(-12px) scale(.6); }
.stars .s.lit { filter: none; transform: scale(1); opacity: 1; } .stars .s:nth-child(2).lit { transform: translateY(-12px) scale(1.15); }
.friends { display: flex; justify-content: center; gap: 10px; margin: 6px 0 4px; }
.friends img { width: 64px; height: 64px; border-radius: 50%; border: 2.5px solid var(--gold); background: radial-gradient(#3a58b0, #1a2a62); box-shadow: 0 0 0 1.5px #4a2e08; }
.reward { font: 800 15px/1.4 Nunito; color: #ffe9a8; }
.chips { display: flex; justify-content: center; gap: 8px; margin: 6px 0; }
.chip { display: flex; align-items: center; gap: 4px; padding: 3px 10px 3px 4px; border-radius: 999px; background: rgba(10,20,60,.6); border: 1.5px solid rgba(243,207,110,.7); font: 900 15px/1 Nunito; }
.chip img { width: 28px; height: 28px; }
.toggle { display: flex; justify-content: space-between; align-items: center; padding: 10px 6px; font: 800 17px Nunito; color: #e8eeff; border-bottom: 1px solid rgba(243,207,110,.25); }
.toggle button { min-width: 76px; padding: 7px 12px; border-radius: 10px; border: 2px solid var(--gold); background: #1b2b63; color: #fff; font: 900 15px Nunito; cursor: pointer; }
.toggle button.on { background: linear-gradient(#3fc27a, #1f8a4f); }

/* map */
#map { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; padding: calc(env(safe-area-inset-top) + 14px) 16px calc(env(safe-area-inset-bottom) + 16px); }
.logo { text-align: center; margin-top: 4px; }
.logo .w { font: 700 clamp(40px, 12vw, 64px)/1 'Cinzel Decorative', 'Cinzel', Georgia, serif; }
.logo .r { display: inline-block; margin-top: -2px; padding: 4px 22px 6px; font: 900 clamp(18px, 5vw, 24px)/1 'Cinzel', Georgia, serif; letter-spacing: .12em; color: #3a2406; background: linear-gradient(#fff2b3, #f2c75c 55%, #c58d2e); border-radius: 10px; box-shadow: 0 0 0 2px #4a2e08, 0 6px 14px rgba(0,0,0,.45); }
.chapter { margin-top: 10px; font: 800 15px Nunito; color: #fff3cf; text-shadow: 0 2px 4px #000; }
.path { position: relative; flex: 1 1 auto; width: 100%; max-width: 380px; min-height: 280px; margin: 8px 0; }
.path svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.node { position: absolute; transform: translate(-50%, -50%); width: 70px; height: 70px; border-radius: 50%; border: none; cursor: pointer; pointer-events: auto; font: 900 28px/1 'Cinzel', Georgia, serif; color: #fff; background: radial-gradient(circle at 50% 35%, #3a5fc2, #172757 70%); box-shadow: 0 0 0 3.5px #f3cf6e, 0 0 0 5.5px #4a2e08, 0 8px 16px rgba(0,0,0,.5); text-shadow: 0 2px 0 #0a1230; }
.node.cur { animation: glow 1.2s infinite; }
.node.lock { background: radial-gradient(#4a4f66, #23263a); color: #9aa0b8; box-shadow: 0 0 0 3px #8c8f9e, 0 0 0 5px #2a2c38, 0 6px 12px rgba(0,0,0,.5); cursor: default; }
.node .st { position: absolute; left: 50%; bottom: -18px; transform: translateX(-50%); display: flex; gap: 1px; }
.node .st img { width: 20px; height: 20px; } .node .st img.dim { filter: grayscale(1) brightness(.4); }
.mapbar { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.mapbar .row2 { display: flex; align-items: center; gap: 10px; }
.mapbar .gear { position: static; flex: 0 0 auto; }

/* loading, toasts, praise */
#loading { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; background: radial-gradient(#1e3170, #0b1434); }
#loading .barwrap { width: 220px; height: 16px; border-radius: 8px; background: #0a1230; box-shadow: 0 0 0 2px var(--gold), 0 0 0 4px #4a2e08; overflow: hidden; }
#loading .barfill { height: 100%; width: 0; background: linear-gradient(90deg, #f3cf6e, #fff1b0); transition: width .2s; }
#toast { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 15; max-width: 86%; padding: 12px 18px; border-radius: 14px; text-align: center; font: 800 17px/1.3 Nunito; color: #fff; background: rgba(12,20,58,.9); border: 2px solid var(--gold); box-shadow: 0 8px 20px rgba(0,0,0,.5); pointer-events: none; transition: opacity .3s; }
#toast.gold { color: #3a2406; background: linear-gradient(#fff2b3, #f2c75c); }
.banner { position: fixed; left: 50%; top: 45%; z-index: 14; transform: translate(-50%, -50%); font: 900 clamp(34px, 11vw, 56px)/1 'Cinzel', Georgia, serif; pointer-events: none; white-space: nowrap; animation: bannerin 1.4s ease-out forwards; }
.banner.storm { background: linear-gradient(#fff3c4, #f0b44a 50%, #b0601a); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 3px 0 #3a1a06) drop-shadow(0 4px 10px rgba(0,0,0,.6)); }
.praise { position: fixed; left: 50%; top: 38%; z-index: 14; transform: translate(-50%, -50%); font: 900 clamp(30px, 9vw, 46px)/1 'Cinzel', Georgia, serif; pointer-events: none; animation: bannerin 1.1s ease-out forwards; }
.pop { position: fixed; z-index: 14; transform: translate(-50%, -50%); font: 900 24px/1 'Cinzel', Georgia, serif; color: #fff; text-shadow: 0 2px 0 #1a3a10, 0 0 10px rgba(80,255,160,.8); pointer-events: none; animation: floatup 1.2s ease-out forwards; }
.hint { position: fixed; left: 50%; z-index: 6; transform: translateX(-50%); padding: 6px 14px; border-radius: 999px; background: rgba(12,20,58,.85); border: 1.5px solid var(--gold); font: 800 14px Nunito; color: #fff3cf; pointer-events: none; white-space: nowrap; }

@keyframes pulse { 50% { transform: scale(1.12); } }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes glow { 0%,100% { box-shadow: 0 0 0 3.5px #f3cf6e, 0 0 0 5.5px #4a2e08, 0 0 6px 4px rgba(255,220,120,.35); } 50% { box-shadow: 0 0 0 3.5px #fff3b8, 0 0 0 5.5px #4a2e08, 0 0 22px 10px rgba(255,220,120,.75); } }
@keyframes shake { 0%,100% { transform: translateX(-50%) rotate(0); } 25% { transform: translateX(-50%) rotate(-2deg); } 75% { transform: translateX(-50%) rotate(2deg); } }
@keyframes fadein { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(30px) scale(.9); opacity: 0; } }
@keyframes bannerin { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 0; } 18% { transform: translate(-50%, -50%) scale(1.08); opacity: 1; } 30% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { transform: translate(-50%, -62%) scale(1); opacity: 0; } }
@keyframes floatup { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -160%) scale(1); } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01s !important; } }
