:root {
  --bg: #070b1d; --panel: #111a33; --panel2: #18244a; --line: #26355f;
  --text: #eef2ff; --mute: #94a3c8; --accent: #38bdf8; --accent-d: #0369a1; --good: #34d399;
  --warn: #fbbf24; --bad: #f87171; --orange: #fb923c; --violet: #a78bfa;
  --head: 'Lilita One', 'Arial Black', sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; color: var(--text); font: 600 15px/1.4 Nunito, system-ui, -apple-system, "Segoe UI", sans-serif; }
body { background: radial-gradient(120% 60% at 50% 0%, #1a2550 0%, var(--bg) 60%) fixed, var(--bg); min-height: 100vh; }
/* Full-screen on iPhone: keep everything clear of the status bar and Dynamic Island, where iOS takes the taps. */
#app { max-width: 480px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 110px calc(12px + env(safe-area-inset-left)); min-height: 100vh; }
body.on-title #app { padding: 0; }
h1, h2 { font-family: var(--head); font-weight: 400; margin: 0 0 6px; line-height: 1.15; letter-spacing: .01em; }
h2 { font-size: 20px; }
h3 { font-family: var(--head); font-weight: 400; color: var(--mute); text-transform: uppercase; letter-spacing: .08em; font-size: 13px; margin: 20px 0 6px; }
p { margin: 4px 0 8px; }
small, .mute { color: var(--mute); }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.screen.enter { animation: enter .35s cubic-bezier(.2,.8,.2,1); }
@keyframes enter { from { opacity: 0; transform: translateY(14px); } }

/* title */
.title { position: relative; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 14vh; cursor: pointer; overflow: hidden; background: linear-gradient(#03050f, #070b1d 60%); }
.scene { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: auto; }
.title > :not(.scene) { position: relative; z-index: 2; }
.logo { font-family: var(--head); font-size: 64px; line-height: 1; letter-spacing: -.01em; text-shadow: 0 6px 0 #0b1328, 0 10px 30px rgba(56,189,248,.45); animation: bob 3s ease-in-out infinite; }
.logo span, .brand span { color: var(--accent); }
.tagline { font-weight: 800; color: #cbd5f5; margin-top: 8px; letter-spacing: .04em; }
.tapstart { margin-top: 34px; font-family: var(--head); font-size: 22px; padding: 12px 30px; border-radius: 999px; background: var(--accent); color: #031522; box-shadow: 0 5px 0 var(--accent-d); animation: pulsebtn 1.4s ease-in-out infinite; }
.fine { margin-top: 18px; font-size: 11px; }
@keyframes bob { 50% { transform: translateY(-6px); } }
@keyframes pulsebtn { 50% { transform: scale(1.06); } }
.scene .rain line { animation: rain .7s linear infinite; }
@keyframes rain { from { transform: translate(0, -20px); } to { transform: translate(-40px, 270px); } }
.scene .flash { opacity: 0; animation: flash 7s infinite; }
@keyframes flash { 0%, 90%, 94%, 100% { opacity: 0; } 91%, 93% { opacity: .35; } }
.scene .beacon { animation: blink .5s steps(2) infinite; }
.scene .beam { animation: blinkop .5s steps(2) infinite; }
.scene .flicker { animation: flick 4s infinite; }
@keyframes flick { 0%, 100% { opacity: .9; } 47% { opacity: .9; } 48% { opacity: .4; } 50% { opacity: .9; } }
.scene .van { animation: vanin 1.6s cubic-bezier(.2,.8,.2,1) both; }
@keyframes vanin { from { transform: translate(420px, 170px); } to { transform: translate(200px, 170px); } }
.scene .ripple { transform-origin: 110px 220px; animation: ripple 2.4s ease-out infinite; }
.scene .ripple.r2 { animation-delay: 1.2s; }
@keyframes ripple { from { transform: scale(.3); opacity: .8; } to { transform: scale(1.1); opacity: 0; } }
@keyframes blink { 50% { fill: #78350f; } }
@keyframes blinkop { 50% { opacity: 0; } }

/* HQ */
.brand { font-family: var(--head); font-size: 30px; letter-spacing: -.01em; }
.hq-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.row.tight { display: flex; gap: 6px; align-items: center; }
.row.tight > * { flex: none; }
.lvl { font-family: var(--head); background: linear-gradient(135deg, #7c3aed, #2563eb); border-radius: 999px; padding: 5px 13px; box-shadow: 0 3px 0 #1e1b4b; }
.iconbtn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 16px; cursor: pointer; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stat { background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: 14px; padding: 9px 4px; text-align: center; box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.stat b { display: block; font-family: var(--head); font-weight: 400; font-size: 18px; }
.stat small { font-size: 11px; }
.xp { height: 8px; background: var(--panel); border-radius: 99px; margin: 12px 0 4px; overflow: hidden; border: 1px solid var(--line); }
.xp i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--violet)); border-radius: 99px; }

/* cards */
.card { display: block; width: 100%; color: var(--text); font: inherit; text-align: left; background: linear-gradient(180deg, var(--panel2), var(--panel) 40%); border: 1px solid var(--line); border-radius: 18px; padding: 14px; margin: 10px 0; box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 6px 18px rgba(0,0,0,.25); }
.offer, .academy-card, .lesson-row { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.offer > div:nth-child(2) { flex: 1; min-width: 0; }
.offer.locked { opacity: .7; }
.jicon { width: 48px; height: 48px; flex: none; border-radius: 14px; display: grid; place-items: center; font-size: 26px; background: radial-gradient(circle at 30% 30%, #2b3d72, #142046); border: 1px solid var(--line); }
.chev { font-size: 28px; color: var(--mute); }
.tag { display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); margin-right: 4px; }
.tag.cat2 { color: var(--orange); border-color: #7c3a12; }
.tag.night { color: var(--violet); }
.badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.badge { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; background: var(--panel); border: 2px dashed var(--line); filter: grayscale(1); opacity: .5; }
.badge.got { filter: none; opacity: 1; border: 2px solid var(--warn); background: radial-gradient(circle, #3b2f0a, #1a1505); box-shadow: 0 0 10px rgba(251,191,36,.35); }
.lesson-row.got { border-color: #6b5410; }

/* buttons */
.btn { appearance: none; border: 0; border-radius: 14px; background: var(--accent); color: #031522; font-family: var(--head); font-weight: 400; font-size: 16px; letter-spacing: .02em; padding: 11px 16px; cursor: pointer; box-shadow: 0 4px 0 var(--accent-d); transition: transform .06s, box-shadow .06s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--accent-d); }
.btn.ghost { background: transparent; color: var(--mute); border: 1px solid var(--line); box-shadow: none; font-family: Nunito, sans-serif; font-weight: 700; }
.btn.alt { background: var(--panel2); color: var(--text); border: 1px solid var(--line); box-shadow: 0 4px 0 #0a1126; }
.btn.danger { background: var(--bad); color: #2a0505; box-shadow: 0 4px 0 #991b1b; }
.btn.done { background: #064e3b; color: #a7f3d0; box-shadow: 0 4px 0 #022c22; }
.btn.go { background: var(--good); box-shadow: 0 4px 0 #047857; color: #022c22; }
.btn.big { width: 100%; padding: 15px; font-size: 18px; }
.btn.sm { padding: 8px 12px; font-size: 14px; border-radius: 11px; }
.row { display: flex; gap: 8px; } .row > * { flex: 1; }
.stack > * + * { margin-top: 8px; }

/* job chrome */
.jobbar { display: flex; align-items: center; gap: 10px; }
.jobbar .jt { flex: 1; min-width: 0; } .jobbar .jt b { display: block; font-family: var(--head); font-weight: 400; font-size: 18px; }
.jobbar small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x { width: 38px; height: 38px; flex: none; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); color: var(--mute); font-size: 18px; cursor: pointer; }
.x.guide { font-size: 17px; }
.steps { display: flex; gap: 3px; margin: 12px 0 8px; }
.steps span { flex: 1; text-align: center; font-size: 10.5px; font-weight: 800; padding: 5px 0; border-radius: 7px; background: var(--panel); color: var(--mute); border: 1px solid var(--line); }
.steps span.on { background: var(--accent); color: #031522; border-color: var(--accent); }
.steps span.done { color: var(--good); }
.meters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.meter { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px 8px; font-size: 11px; font-weight: 800; }
.meter b { float: right; font-family: var(--head); font-weight: 400; font-size: 13px; }
.meter .bar { height: 7px; border-radius: 99px; background: #0a1126; margin-top: 4px; overflow: hidden; }
.meter .bar i { display: block; height: 100%; border-radius: 99px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.tip { font-size: 13px; color: #c7d2fe; background: rgba(56,189,248,.08); border: 1px solid rgba(56,189,248,.25); padding: 9px 11px; border-radius: 12px; margin: 10px 0; }
.tip b { color: var(--accent); }

/* call */
.call { text-align: center; padding: 24px 16px; }
.caller { position: relative; width: 96px; height: 96px; margin: 0 auto 10px; }
.caller .avatar { width: 96px; height: 96px; position: relative; z-index: 1; border: 3px solid var(--good); }
.ringwave { position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--good); animation: wave 1.2s ease-out infinite; }
@keyframes wave { to { transform: scale(1.7); opacity: 0; } }
.ring .caller { animation: shake .5s infinite; }
@keyframes shake { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
.timer { font-family: var(--head); font-size: 40px; font-variant-numeric: tabular-nums; margin: 8px 0 14px; color: var(--warn); }
.avatar { border-radius: 50%; display: block; flex: none; }
.chat { display: flex; flex-direction: column; gap: 8px; }
.bubble { display: flex; gap: 8px; align-items: flex-end; max-width: 92%; }
.bubble p { margin: 0; padding: 9px 12px; border-radius: 16px; font-size: 14px; }
.bubble.new p { animation: enter .3s both; }
.bubble.new.late p { animation-delay: .45s; }
.bubble .avatar { width: 32px; height: 32px; }
.bubble.them p { background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble.me { align-self: flex-end; }
.bubble.me p { background: var(--accent); color: #031522; font-weight: 800; border-bottom-right-radius: 4px; }

/* site */
.ppe { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ppe-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 9px 4px; text-align: center; line-height: 1.15; min-height: 78px; border-radius: 14px; background: var(--panel); border: 2px solid var(--line); color: var(--text); font: 800 10.5px Nunito, sans-serif; cursor: pointer; }
.ppe-item span { font-size: 26px; filter: grayscale(.8); opacity: .6; transition: .15s; }
.ppe-item.on { border-color: var(--accent); background: #0c2a4a; }
.ppe-item.on span { filter: none; opacity: 1; transform: scale(1.12); }

/* tools */
.tools { display: flex; gap: 6px; }
.tool { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 6px; border-radius: 14px; background: var(--panel); border: 2px solid var(--line); color: var(--text); font: 800 13px Nunito, sans-serif; cursor: pointer; text-align: left; }
.tool .art { width: 28px; height: 28px; flex: none; }
.tool small { display: block; font-weight: 700; font-size: 11px; }
.tool.on { border-color: var(--accent); background: #0c2a4a; box-shadow: 0 0 0 3px rgba(56,189,248,.15); }

/* floor plan */
.grid { position: relative; display: grid; grid-template-columns: repeat(var(--w), 1fr); border-radius: 14px; overflow: hidden; user-select: none; touch-action: manipulation; margin: 10px 0 6px; border: 3px solid #d7deef; box-shadow: 0 10px 30px rgba(0,0,0,.45), inset 0 0 0 1px #000; }
.tile { aspect-ratio: 1; position: relative; display: flex; align-items: center; justify-content: center; font-size: 11px; cursor: pointer; border: 1px solid rgba(0,0,0,.18); }
.tile.wt { border-top: 3px solid #d7deef; } .tile.wb { border-bottom: 3px solid #d7deef; }
.tile.wl { border-left: 3px solid #d7deef; } .tile.wr { border-right: 3px solid #d7deef; }
.m-tile { background: #46597a; background-image: linear-gradient(#2f3d57 1.5px, transparent 1.5px), linear-gradient(90deg, #2f3d57 1.5px, transparent 1.5px); background-size: 50% 50%; }
.m-carpet { background: #54457a; background-image: radial-gradient(rgba(255,255,255,.09) 1px, transparent 1.3px), radial-gradient(rgba(0,0,0,.18) 1px, transparent 1.3px); background-size: 4px 4px, 5px 5px; background-position: 0 0, 2px 2px; }
.m-hardwood { background: #7a5634; background-image: repeating-linear-gradient(0deg, transparent 0 7px, rgba(0,0,0,.35) 7px 8px), linear-gradient(90deg, rgba(255,255,255,.05), rgba(0,0,0,.08) 60%, rgba(255,255,255,.04)); }
.m-vinyl { background: #3d6355; background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.05) 0 3px, transparent 3px 7px); }
.m-concrete { background: #575c66; background-image: radial-gradient(rgba(255,255,255,.08) 1px, transparent 1.5px), radial-gradient(rgba(0,0,0,.25) 1.2px, transparent 1.6px); background-size: 7px 7px, 9px 9px; background-position: 1px 2px, 4px 5px; }
.tile.read::before { content: ""; position: absolute; inset: 0; background: var(--mc); opacity: .85; }
.tile.ping::before { animation: fillin .3s ease-out; }
@keyframes fillin { from { opacity: 0; } }
.tile.has-eq { align-items: flex-start; justify-content: flex-start; }
.tile.has-eq b { font-size: 10px; margin: 0 0 0 2px; z-index: 4; }
.tile b { position: relative; z-index: 2; font-weight: 900; text-shadow: 0 1px 2px rgba(0,0,0,.8); }
.tile.ping b { animation: pop .35s cubic-bezier(.2,1.6,.4,1); }
.tile.ping::after { content: ""; position: absolute; inset: 0; z-index: 4; border: 2px solid #fff; border-radius: 50%; animation: pingring .5s ease-out forwards; }
@keyframes pop { from { transform: scale(.2); } }
@keyframes pingring { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.tile.th-wet::after, .tile.th-dry::after { content: ""; position: absolute; inset: 0; }
.tile.th-wet::after { background: radial-gradient(circle, rgba(56,189,248,.95), rgba(79,70,229,.55)); }
.tile.th-dry::after { background: radial-gradient(circle, rgba(251,146,60,.6), rgba(239,68,68,.45)); }
.tile.flashcam { animation: camflash .4s; }
@keyframes camflash { 0% { filter: brightness(3); } }
.tile.air { box-shadow: inset 0 0 0 2px rgba(125,211,252,.45); }
.grid.dry .tile.air::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(186,230,253,.18), transparent); background-size: 200% 100%; animation: breeze 1.2s linear infinite; pointer-events: none; }
@keyframes breeze { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.tile .src { position: absolute; top: 1px; left: 1px; width: 52%; z-index: 3; animation: drip 1.2s ease-in-out infinite; }
@keyframes drip { 50% { transform: translateY(2px) scale(.92); } }
.tile .eq { position: absolute; right: 0; bottom: 0; width: 62%; z-index: 3; filter: drop-shadow(0 2px 2px rgba(0,0,0,.6)); }
.tile .eq.drop-in { animation: dropin .35s cubic-bezier(.2,1.6,.4,1); }
@keyframes dropin { from { transform: translateY(-14px) scale(1.3); opacity: 0; } }
.art { display: block; width: 100%; height: auto; }
.spin { transform-box: view-box; animation: spin .45s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.blink { animation: blinkop 1s steps(2) infinite; }
.float { position: absolute; z-index: 5; top: 0; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 900; color: #a7f3d0; text-shadow: 0 1px 2px #000; animation: floatup 1.4s ease-out forwards; pointer-events: none; }
@keyframes floatup { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, -26px); } }
.rlabel { position: absolute; z-index: 1; pointer-events: none; font-size: 8.5px; font-weight: 900; padding: 1px 4px; margin: 3px; border-radius: 5px; background: rgba(5,10,24,.62); color: #e2e8f0; white-space: nowrap; letter-spacing: .02em; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11px; color: var(--mute); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-right: 3px; }

/* lists */
.room { border-top: 1px solid var(--line); padding: 10px 0 4px; }
.room:first-child { border-top: 0; }
.room-h { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--panel); border: 2px solid var(--line); color: var(--text); border-radius: 14px; padding: 10px 11px; margin: 6px 0; cursor: pointer; font: 700 14px Nunito, sans-serif; transition: border-color .15s, background .15s; }
.item .ck { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--mute); flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 900; color: var(--mute); }
.item.on { border-color: var(--accent); background: #0c2a4a; }
.item.on .ck { background: var(--accent); border-color: var(--accent); color: #021; }
.item .lbl { flex: 1; } .item .lbl small { display: block; font-size: 11px; font-weight: 700; }
.item .px { font-weight: 900; font-variant-numeric: tabular-nums; }
.item.answer.right { border-color: var(--good); background: #053527; } .item.answer.right .ck { background: var(--good); border-color: var(--good); color: #022; }
.item.answer.wrong { border-color: var(--bad); background: #3a0d0d; animation: shake .3s 2; } .item.answer.wrong .ck { background: var(--bad); border-color: var(--bad); color: #200; }
.item.answer.dim { opacity: .45; }
.chips { display: flex; gap: 6px; margin: 6px 0 12px; }
.chip { flex: 1; padding: 10px 0; border-radius: 12px; border: 2px solid var(--line); background: var(--panel); color: var(--text); font: 400 15px var(--head); cursor: pointer; }
.chip.on { background: var(--accent); color: #031522; border-color: var(--accent); box-shadow: 0 3px 0 var(--accent-d); }
.sticky { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 18px 12px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 35%); }
.sticky > div { max-width: 480px; margin: 0 auto; }
.daycard { padding: 11px 14px; }

/* academy */
.lesson .point { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.lesson .point:last-child { border: 0; }
.lesson .num { width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--accent); color: #031522; display: grid; place-items: center; font-family: var(--head); }
.lesson p { margin: 2px 0; font-size: 15px; }
.qprog { display: flex; gap: 5px; margin: 12px 0; }
.qprog i { flex: 1; height: 6px; border-radius: 9px; background: var(--panel2); }
.qprog i.on { background: var(--accent); } .qprog i.done { background: var(--good); }

/* bill */
.ln { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.ln:last-child { border-bottom: 0; }
.ln.total { font-family: var(--head); font-size: 18px; border-top: 1px solid var(--line); border-bottom: 0; margin-top: 4px; padding-top: 8px; }
.profitcard { text-align: center; }
.bigmoney { font-family: var(--head); font-size: 48px; line-height: 1.1; text-shadow: 0 4px 0 rgba(0,0,0,.35); }
.stars i { font-style: normal; font-size: 20px; color: #2a3558; }
.stars i.on { color: var(--warn); display: inline-block; animation: starpop .4s cubic-bezier(.2,1.8,.4,1) both; text-shadow: 0 0 8px rgba(251,191,36,.6); }
@keyframes starpop { from { transform: scale(0) rotate(-90deg); } }
.review-row { display: flex; gap: 10px; align-items: center; text-align: left; margin: 10px 0; }
.review-row .avatar { width: 48px; height: 48px; }
.review { font-style: italic; border-left: 3px solid var(--warn); padding: 4px 10px; flex: 1; }
.levelup { text-align: center; border-color: var(--violet); background: linear-gradient(135deg, #3b0764, #1e1b4b); animation: pulsebtn 1s 3; }
.sopbar { height: 8px; border-radius: 9px; background: #0a1126; overflow: hidden; margin: 4px 0 10px; }
.sopbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--good), var(--accent)); }
.sop { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.sop > span { width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 12px; background: var(--panel2); }
.sop.ok > span { background: var(--good); color: #022; }
.sop.no > span { background: var(--bad); color: #200; }
.sop small { color: var(--mute); }
.log { font-size: 12px; color: var(--mute); }
.log div { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.log div:last-child { border: 0; }

/* storm + lfg */
.storm { background: linear-gradient(135deg, #2e1065, #0b1328 70%); border-color: #4c1d95; }
.storm .pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); margin-right: 6px; animation: blinkop 1.2s infinite; }
.lfg { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.lfg .avatar { width: 52px; height: 52px; }
.lfg .who { color: var(--accent); font-weight: 900; font-family: ui-monospace, Consolas, monospace; }
.party { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { display: flex; gap: 8px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px 4px 4px; font-size: 11px; line-height: 1.2; }
.pill .avatar { width: 32px; height: 32px; }
.ev-head { display: flex; gap: 12px; align-items: center; }
.ev-head .avatar { width: 56px; height: 56px; }

/* modal, toast, overlays */
#modal:empty { display: none; }
#modal { position: fixed; inset: 0; z-index: 50; background: rgba(2,6,18,.75); backdrop-filter: blur(3px); display: flex; align-items: flex-end; justify-content: center; padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)); }
#modal .sheet { width: 100%; max-width: 480px; max-height: min(88vh, calc(100vh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom))); overflow: auto; background: linear-gradient(180deg, var(--panel2), var(--panel) 30%); border: 1px solid var(--line); border-radius: 22px; padding: 18px; animation: up .28s cubic-bezier(.2,1.2,.4,1); box-shadow: 0 -10px 40px rgba(0,0,0,.5); }
#modal .sheet .btn.big { margin-top: 12px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
#toast { position: fixed; left: 50%; top: 14px; transform: translate(-50%, -120px); z-index: 60; background: #eef2ff; color: #0b1220; font-weight: 800; font-size: 14px; padding: 11px 16px; border-radius: 14px; max-width: 92vw; transition: transform .3s cubic-bezier(.2,1.4,.4,1); box-shadow: 0 8px 30px rgba(0,0,0,.45); }
#toast.show { transform: translate(-50%, env(safe-area-inset-top)); }
#toast.bad { background: #fee2e2; color: #450a0a; }
.nightfall { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: radial-gradient(circle at 50% 35%, #1e2a5a, #03050f 70%); animation: fadein .3s; }
.nightfall.out { animation: fadeout .35s forwards; }
.nightfall .moon { font-size: 60px; animation: bob 1.4s ease-in-out infinite; }
.nightfall h2 { font-size: 34px; margin-top: 8px; }
.fanrow { display: flex; gap: 6px; margin-top: 14px; }
.fanrow .art { width: 38px; height: 38px; }
@keyframes fadein { from { opacity: 0; } }
@keyframes fadeout { to { opacity: 0; } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 13px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { top: 105%; transform: rotate(720deg) translateX(40px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* crew + leaderboard */
.crew-join { background: linear-gradient(135deg, #0c3b5e, var(--panel) 70%); border-color: #1e6a9a; }
.lbrow { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px dashed var(--line); border-radius: 10px; }
.lbrow:last-child { border-bottom: 0; }
.lbrow.me { background: rgba(56,189,248,.12); }
.lbrow .rank { width: 26px; text-align: center; font-family: var(--head); font-size: 18px; }
.lbrow .avatar { width: 34px; height: 34px; }
.lbrow .who { flex: 1; min-width: 0; }
.lbrow .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbrow .who small { font-size: 11px; }
.lbrow .pts { font-family: var(--head); font-size: 18px; color: var(--warn); }
.field { display: block; font-size: 13px; font-weight: 800; color: var(--mute); margin: 10px 0; }
.field input { display: block; width: 100%; margin-top: 4px; padding: 12px; border-radius: 12px; border: 2px solid var(--line); background: #0a1126; color: var(--text); font: 700 16px Nunito, sans-serif; }
.field input:focus { outline: none; border-color: var(--accent); }

/* equipment tray, power, conditions */
.tools.tray { overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.tools.tray::-webkit-scrollbar { display: none; }
.tools.tray .tool { flex: 0 0 auto; min-width: 104px; justify-content: flex-start; }
.cond { font-size: 12px; color: #fde68a; margin: 6px 0 0; }
.power { position: relative; height: 18px; margin-top: 8px; border-radius: 9px; background: #0a1126; overflow: hidden; border: 1px solid var(--line); }
.power i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #facc15, #f59e0b); opacity: .55; transition: width .3s; }
.power span { position: relative; z-index: 1; font-size: 11px; font-weight: 900; padding-left: 8px; line-height: 16px; }
.power.over { border-color: var(--bad); animation: shake .3s 2; }
.power.over i { background: var(--bad); }
.tile.ext::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, rgba(186,230,253,.28) 0 2px, transparent 2px 6px); pointer-events: none; }
.spin.slow { animation-duration: 1.4s; }
.glow { animation: blinkop 1.2s infinite; }

/* ---------- Halloween theme: black and orange (body.halloween) ---------- */
body.halloween {
  --bg: #080604; --panel: #16110c; --panel2: #221910; --line: #3d2b19;
  --text: #fff3e3; --mute: #bba489; --accent: #ff7a1a; --accent-d: #a84300; --violet: #b26bff;
  background: radial-gradient(120% 60% at 50% 0%, #3a1a05 0%, var(--bg) 60%) fixed, var(--bg);
}
body.halloween .title { background: linear-gradient(#050302, #0d0805 60%); }
body.halloween .logo { text-shadow: 0 6px 0 #2a1204, 0 10px 34px rgba(255,122,26,.6); }
body.halloween .tagline { color: #ffd6ad; }
body.halloween .lvl { background: linear-gradient(135deg, #ff7a1a, #b34700); color: #1a0b00; box-shadow: 0 3px 0 #3a1500; }
body.halloween .btn, body.halloween .steps span.on, body.halloween .bubble.me p, body.halloween .chip.on, body.halloween .lesson .num, body.halloween .tapstart, body.halloween .item.on .ck { color: #1a0b00; }
body.halloween .btn.alt { color: var(--text); box-shadow: 0 4px 0 #000; }
body.halloween .btn.ghost { color: var(--mute); }
body.halloween .meter .bar, body.halloween .sopbar, body.halloween .power, body.halloween .field input { background: #0c0906; }
body.halloween .tip { color: #ffe0c2; background: rgba(255,122,26,.08); border-color: rgba(255,122,26,.3); }
body.halloween .ppe-item.on, body.halloween .item.on { background: #3a1c06; }
body.halloween .tool.on { background: #3a1c06; box-shadow: 0 0 0 3px rgba(255,122,26,.18); }
body.halloween .jicon { background: radial-gradient(circle at 30% 30%, #4d2a0e, #1c130b); }
body.halloween .crew-join { background: linear-gradient(135deg, #4a2206, var(--panel) 70%); border-color: #9a4a12; }
body.halloween .lbrow.me { background: rgba(255,122,26,.14); }
body.halloween .levelup { background: linear-gradient(135deg, #4a1d00, #160a02); border-color: var(--accent); }
body.halloween .storm { background: linear-gradient(135deg, #2a0f3d, #080604 70%); border-color: #5b2a86; }
body.halloween .xp i { background: linear-gradient(90deg, #ff7a1a, #b26bff); }
body.halloween .card { box-shadow: inset 0 1px 0 rgba(255,180,100,.06), 0 6px 18px rgba(0,0,0,.4); }
body.halloween #modal .sheet { border-color: #4a3018; }
.scene .bat { animation: batfly 7s linear infinite; }
.scene .bat path { transform-box: fill-box; transform-origin: center; animation: flap .25s ease-in-out infinite alternate; }
.scene .bat.b2 { animation-duration: 9s; animation-delay: -3s; }
.scene .bat.b3 { animation-duration: 11s; animation-delay: -6s; }
@keyframes batfly { from { transform: translate(-40px, 0); } 50% { transform: translate(200px, -18px); } to { transform: translate(420px, 6px); } }
@keyframes flap { from { transform: scaleY(1); } to { transform: scaleY(.35); } }
.scene .lantern { animation: flick 2.6s infinite; }

.track { font-weight: 900; font-size: 13px; color: var(--accent); margin: 14px 2px 4px; }
.track small { color: var(--mute); font-weight: 700; }

/* mold conditions */
.tile.c3::before { background: radial-gradient(circle at 30% 35%, #1a0d2e 0 18%, transparent 20%), radial-gradient(circle at 70% 60%, #1a0d2e 0 14%, transparent 16%), radial-gradient(circle at 45% 75%, #1a0d2e 0 10%, transparent 12%), var(--mc); opacity: .92; }
.tile.gone::before { background: repeating-linear-gradient(90deg, #8a6a43 0 3px, #2b1e12 3px 10px); opacity: .95; }

/* fire soot */
.tile.s4::before { background: radial-gradient(circle at 50% 60%, #7c2d12 0 22%, transparent 40%), #050505; opacity: .95; }
.tile.s3::before { opacity: .9; }
.tile .src.flame { font-style: normal; font-size: 14px; width: auto; animation: flick 1.2s infinite; }

/* mold found on a water job */
.tile.growth { box-shadow: inset 0 0 0 2px #a855f7; }
.tile.growth::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 35% 40%, rgba(46,16,101,.85) 0 18%, transparent 22%), radial-gradient(circle at 65% 65%, rgba(46,16,101,.8) 0 14%, transparent 18%); pointer-events: none; }
.tile.spores { box-shadow: inset 0 0 0 2px rgba(201,165,20,.8); }
.tile .moldmark { position: absolute; left: 1px; bottom: 0; font-style: normal; font-size: 11px; z-index: 4; }

/* biohazard */
.tile .sharp { position: absolute; right: 0; top: 0; font-style: normal; font-size: 10px; z-index: 4; }
.tile.b2::before { background: radial-gradient(circle at 40% 45%, rgba(0,0,0,.35) 0 25%, transparent 30%), var(--mc); opacity: .9; }

/* storm desk */
.lead { display: flex; gap: 6px; align-items: center; }
.lead .item { flex: 1; margin: 0; }
.lead.repeat .item { border-color: var(--bad); }
.evcard { border-color: var(--warn); }
.evcard .btn.big { text-align: left; font-family: Nunito, sans-serif; font-weight: 800; font-size: 14px; }
.daycard small { display: block; margin-top: 4px; }

.unlock { font-size: 13px; color: var(--mute); margin: 4px 2px 0; }
.unlock b { color: var(--accent); }

.tile b.reg { font-size: 13px; color: #e2e8f0; text-shadow: 0 1px 2px #000; }

.ln.locked { opacity: .55; }

/* How to play */
.howto { padding: 0; }
.howto summary { display: flex; align-items: center; gap: 12px; padding: 14px; cursor: pointer; list-style: none; }
.howto summary::-webkit-details-marker { display: none; }
.howto summary b { flex: 1; font-size: 16px; }
.howto summary .chev { transition: transform .2s; }
.howto[open] summary .chev { transform: rotate(90deg); }
.howto-body { padding: 0 16px 14px; font-size: 14px; line-height: 1.5; }
.howto-body h4 { margin: 14px 0 4px; font-size: 15px; }
.howto-body ul { margin: 6px 0; padding-left: 18px; }
.howto-body li { margin: 5px 0; }
.howto-body p { margin: 6px 0; }
.howto-cta { display: flex; align-items: center; gap: 12px; }

/* Pinned leadership row */
.lbrow.pinned { background: linear-gradient(90deg, rgba(250,204,21,.16), transparent 80%); border: 1px solid rgba(250,204,21,.35); margin-bottom: 4px; }
.role-badge { display: inline-block; vertical-align: middle; margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: linear-gradient(135deg, #facc15, #b45309); color: #1a1000; font-size: 10px; font-weight: 900; letter-spacing: .06em; }
.lbrow.pinned .pts { color: #facc15; }

/* Cloud backup card */
.backup { border-color: rgba(56,189,248,.45); margin-top: 8px; }
body.halloween .backup { border-color: rgba(255,122,26,.5); }

/* Academy tabs and completed-cert gallery */
.acad-tabs { margin: 10px 0 12px; }
.certgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; margin-bottom: 12px; }
.certbadge { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 14px 8px; border-radius: 16px; border: 1px solid rgba(250,204,21,.35); background: linear-gradient(180deg, rgba(250,204,21,.12), var(--panel)); color: var(--text); font: inherit; cursor: pointer; }
.certbadge .cb-icon { font-size: 30px; }
.certbadge b { font-size: 13px; line-height: 1.2; }
.certbadge small { font-size: 11px; color: var(--mute); }

/* PM review */
.pmrow { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.pmrow:last-child { border-bottom: 0; }
.pmrow small { font-size: 12.5px; }
.chip.on.bad { border-color: var(--bad); background: rgba(248,113,113,.14); }
.est-scroll { overflow-x: auto; }
table.est { width: 100%; border-collapse: collapse; font-size: 13px; }
table.est th { text-align: left; color: var(--mute); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 5px 4px; border-bottom: 1px solid var(--line); }
table.est td { padding: 7px 4px; border-bottom: 1px dashed var(--line); vertical-align: top; }
table.est td small { display: block; font-size: 11px; }
table.est .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.est tr.gone td { opacity: .45; text-decoration: line-through; }

/* Load-out */
.loadout .notes { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-size: 13.5px; }
.officecall { border-color: rgba(251,191,36,.45); }
.gearflag { border-color: var(--bad); background: linear-gradient(180deg, rgba(248,113,113,.12), var(--panel) 50%); }
.lostbox { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; margin-bottom: 8px; border-radius: 14px; border: 2px dashed var(--bad); background: rgba(248,113,113,.08); }
.flagbig { text-align: center; display: flex; flex-direction: column; gap: 8px; }
.flagbig .flagicon { font-size: 54px; animation: pop .5s ease; }
@keyframes pop { from { transform: scale(.4); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .flagbig .flagicon { animation: none; } }
.gearflag .ln > span:last-child { white-space: nowrap; }
