@font-face { font-family: 'Lilita One'; src: url(../fonts/lilita-one.woff2) format('woff2'); font-display: swap; }
:root {
  --bg: #140e26; --panel: #1d1534; --card: #2a2048; --card2: #342860; --line: #4a3d7a; --ink: #1e1633;
  --text: #f6f1ff; --muted: #b0a6d4; --accent: #a855f7; --spore: #c77dff; --lime: #a3e635; --gold: #fbbf24; --pink: #ff5fa2; --red: #ff4d5e; --blue: #3a8cff;
  --hud-h: 54px; --font-d: 'Lilita One', 'Arial Rounded MT Bold', 'Trebuchet MS', system-ui, sans-serif;
  --font-b: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font-b); overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: manipulation; overscroll-behavior: none; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; touch-action: manipulation; }
.ic { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; }
.d { font-family: var(--font-d); letter-spacing: 0.02em; font-weight: 400; }

/* ---------- layout ---------- */
#app { position: fixed; inset: 0; display: flex; flex-direction: column; padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
#hud { height: var(--hud-h); flex: none; display: flex; align-items: center; gap: 8px; padding: 0 10px; background: linear-gradient(180deg, #2a1f4c, #1d1534); border-bottom: 3px solid var(--ink); box-shadow: 0 3px 0 rgba(168, 85, 247, 0.25); z-index: 5; }
.brand { display: flex; align-items: center; gap: 8px; margin-right: 6px; }
.brand-logo { width: 30px; height: 30px; border-radius: 9px; background: radial-gradient(circle at 35% 35%, #e3c6ff, #a855f7 55%, #6d28d9); border: 3px solid var(--ink); box-shadow: 0 0 14px rgba(199, 125, 255, 0.6); }
.brand-txt { font-family: var(--font-d); font-size: 19px; line-height: 1; color: #fff; text-shadow: 0 2px 0 var(--ink), 0 0 12px rgba(199, 125, 255, 0.6); }
.brand-txt small { font-size: 12px; margin-left: 4px; color: var(--lime); }
.cur { display: flex; align-items: center; gap: 6px; background: rgba(0, 0, 0, 0.35); border: 2px solid var(--ink); border-radius: 999px; padding: 4px 12px 4px 6px; font-family: var(--font-d); font-size: 18px; min-width: 70px; position: relative; }
.cur .ico .ic { width: 24px; height: 24px; }
.cur .sub { font-family: var(--font-b); font-size: 11px; color: var(--lime); font-weight: 700; margin-left: 2px; }
/* click / hold-fire earnings: floats under the crystal pill so the HUD never reflows; fades in while clicking, out ~2 s after */
.cur .sub.clickinc { position: absolute; left: 50%; top: calc(100% + 3px); transform: translate(-50%, -3px); margin: 0; padding: 1px 7px; border-radius: 999px;
  background: rgba(20, 14, 40, 0.82); border: 1.5px solid rgba(255, 210, 58, 0.7); color: #ffd23a; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity 0.6s ease, transform 0.6s ease; z-index: 5; }
.cur .sub.clickinc.on { opacity: 1; transform: translate(-50%, 0); transition: opacity 0.2s ease, transform 0.2s ease; }
.cur .sub.clickinc:empty { display: none; }
.cur.bump { animation: bump 0.25s ease; }
@keyframes bump { 50% { transform: scale(1.12); } }
.spacer { flex: 1; }
.hbtn { height: 38px; min-width: 40px; border-radius: 12px; background: var(--card2); border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink); font-size: 18px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 8px; transition: transform 0.08s, box-shadow 0.08s, filter 0.15s; }
.hbtn:hover { filter: brightness(1.15); }
.hbtn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.hbtn.boost { background: linear-gradient(180deg, #ffd23a, #f59e0b); color: var(--ink); font-family: var(--font-d); font-size: 16px; }
.hbtn.boost.on { background: linear-gradient(180deg, #a3e635, #65a30d); animation: pulse 1.6s infinite; }
.hbtn .ic { width: 20px; height: 20px; }
#main { flex: 1; display: flex; min-height: 0; }
#stage { position: relative; flex: 1; min-width: 0; overflow: hidden; background: #2a1f4c; cursor: crosshair; touch-action: none; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#vig { position: absolute; inset: 0; pointer-events: none; z-index: 1; background: radial-gradient(ellipse 78% 92% at 50% 45%, rgba(20, 10, 40, 0) 48%, rgba(20, 10, 40, 0.12) 72%, rgba(20, 10, 40, 0.38) 100%); }
#panel { width: clamp(340px, 32vw, 470px); flex: none; display: flex; flex-direction: column; background: var(--panel); border-left: 3px solid var(--ink); min-height: 0; }
#tabs { display: flex; flex: none; background: #170f2c; border-bottom: 3px solid var(--ink); padding: 6px 6px 0; gap: 4px; }
#tabs button { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px 7px; border-radius: 12px 12px 0 0; color: var(--muted); font-family: var(--font-d); font-size: 13px; transition: background 0.15s, color 0.15s, transform 0.1s; }
#tabs button i { font-style: normal; font-size: 20px; transition: transform 0.2s; }
#tabs button:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
#tabs button.on { background: var(--card); color: #fff; box-shadow: inset 0 3px 0 var(--spore); }
#tabs button.on i { transform: scale(1.15) rotate(-6deg); }
#tabs .badge { position: absolute; top: 2px; right: 8px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); border: 2px solid var(--ink); color: #fff; font-size: 11px; line-height: 14px; font-family: var(--font-b); font-weight: 800; display: none; }
#tabs .badge.show { display: block; animation: pop 0.3s ease; }
#tabs button.locked { opacity: 0.45; }
#tabBody { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px; background: var(--card); scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
#tabBody.anim > * { animation: slideIn 0.22s ease both; }
@keyframes slideIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- stage overlays ---------- */
#waveBox { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: min(340px, 60%); background: rgba(20, 14, 38, 0.82); border: 3px solid var(--ink); border-radius: 14px; padding: 6px 12px 8px; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3); pointer-events: none; }
.wtop { display: flex; justify-content: space-between; font-family: var(--font-d); font-size: 16px; }
#wNum { color: var(--lime); }
.wbar, .bbar, #barBox .bar { height: 10px; background: rgba(0, 0, 0, 0.5); border-radius: 6px; overflow: hidden; margin-top: 4px; border: 2px solid var(--ink); }
.wbar i, .bbar i, #barBox .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--spore), #e3c6ff); border-radius: 4px; transition: width 0.25s ease; }
#bossBox { position: absolute; top: 74px; left: 50%; transform: translateX(-50%); width: min(380px, 70%); background: rgba(60, 10, 30, 0.88); border: 3px solid var(--ink); border-radius: 14px; padding: 6px 12px 8px; pointer-events: none; animation: dropIn 0.4s cubic-bezier(.2, 1.6, .4, 1); }
.btop { display: flex; gap: 6px; align-items: center; font-family: var(--font-d); font-size: 17px; }
.btop #bName { flex: 1; color: #ffd0d8; }
#bTime { color: var(--gold); }
#bTime.urgent { color: var(--red); animation: pulse 1.2s ease-in-out infinite; }
.bbar i { background: linear-gradient(90deg, #ff4d5e, #ff9f43); }
#barBox { position: absolute; left: 10px; bottom: 10px; display: flex; align-items: center; gap: 6px; background: rgba(20, 14, 38, 0.8); border: 3px solid var(--ink); border-radius: 12px; padding: 4px 10px; width: 170px; }
#barBox .bar { flex: 1; margin: 0; }
#comboBox { position: absolute; left: 50%; bottom: 10px; transform: translateX(-30%); width: 190px; background: rgba(20, 14, 38, 0.82); border: 3px solid var(--ink); border-radius: 12px; padding: 3px 10px 5px; text-align: center; pointer-events: none; transition: opacity 0.3s, transform 0.15s; opacity: 0.55; }
#comboBox #comboTxt { font-family: var(--font-d); font-size: 14px; letter-spacing: 0.5px; color: #e9d5ff; text-shadow: 0 2px 0 var(--ink); }
#comboBox .bar { height: 9px; background: rgba(0, 0, 0, 0.5); border-radius: 6px; overflow: hidden; margin-top: 2px; border: 2px solid var(--ink); }
#comboBox .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #c77dff, #e3c6ff); border-radius: 4px; transition: width 0.1s linear; }
#comboBox.on { opacity: 1; }
#comboBox.c2 .bar i { background: linear-gradient(90deg, #f59e0b, #fde047); }
#comboBox.c2 #comboTxt { color: #fde047; }
#comboBox.c3 .bar i { background: linear-gradient(90deg, #ff4d5e, #ff9f43, #fde047); }
#comboBox.c3 #comboTxt { color: #ffb347; }
#comboBox.c3 { box-shadow: 0 0 10px rgba(255, 120, 40, 0.6); }
#comboBox.fz { border-color: #ffb347; box-shadow: 0 0 18px #ff9f43, inset 0 0 10px rgba(255, 159, 67, 0.5); animation: pulseFz 0.9s ease-in-out infinite alternate; }
#comboBox.fz #comboTxt { color: #fff; font-size: 16px; }
#comboBox.fz .bar i { background: linear-gradient(90deg, #ff4d5e, #ff9f43, #fde047, #fff); }
#comboBox.st { border-color: #ffd23a; box-shadow: 0 0 16px #ffd23a; }
@keyframes pulseFz { from { transform: translateX(-30%) scale(1); } to { transform: translateX(-30%) scale(1.08); } }
#barBox .bar i { background: linear-gradient(90deg, #f59e0b, #fde047); }
#barBox.low .bar i { background: linear-gradient(90deg, #ff4d5e, #ff9f43); }
#barBox.low { animation: shakeX 0.8s ease-in-out infinite; }
@keyframes shakeX { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
.pill { position: absolute; right: 10px; bottom: 10px; background: rgba(20, 14, 38, 0.85); border: 3px solid var(--ink); border-radius: 999px; padding: 6px 12px; font-family: var(--font-d); font-size: 14px; transition: transform 0.1s; }
.pill.off { color: var(--gold); }
.pill:active { transform: scale(0.94); }
#banner { position: absolute; left: 0; right: 0; top: 38%; text-align: center; pointer-events: none; font-family: var(--font-d); font-size: clamp(26px, 5vw, 54px); color: #fff; text-shadow: 0 4px 0 var(--ink), 0 0 24px rgba(199, 125, 255, 0.8); -webkit-text-stroke: 2px var(--ink); opacity: 0; }
#banner small { display: block; font-size: max(16px, 0.42em); margin-top: 4px; color: var(--lime); -webkit-text-stroke: 1px var(--ink); }
#banner.show { animation: bannerIn 2.2s ease forwards; }
#banner.red { color: #ffd0d8; text-shadow: 0 4px 0 var(--ink), 0 0 24px rgba(255, 77, 94, 0.9); }
@keyframes bannerIn { 0% { opacity: 0; transform: scale(2.2); } 12% { opacity: 1; transform: scale(0.95); } 18% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-20px); } }
#toasts { position: absolute; top: 76px; right: 10px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; pointer-events: none; z-index: 4; }
.toast { background: rgba(20, 14, 38, 0.92); border: 2px solid var(--ink); border-left: 5px solid var(--spore); border-radius: 10px; padding: 7px 12px; font-size: 13px; font-weight: 600; max-width: 280px; animation: toastIn 0.3s cubic-bezier(.2, 1.4, .4, 1), toastOut 0.4s ease 3s forwards; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35); }
.toast.good { border-left-color: var(--lime); } .toast.bad { border-left-color: var(--red); } .toast.gold { border-left-color: var(--gold); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ---------- cards / rows / buttons ---------- */
.sec { font-family: var(--font-d); font-size: 15px; color: var(--muted); margin: 14px 2px 8px; display: flex; align-items: center; gap: 8px; letter-spacing: 0.04em; text-transform: uppercase; }
.sec:first-child { margin-top: 0; }
.sec::after { content: ''; flex: 1; height: 2px; background: var(--line); border-radius: 2px; }
.row { display: flex; align-items: center; gap: 10px; background: var(--card2); border: 2px solid var(--ink); border-radius: 14px; padding: 8px 10px; margin-bottom: 8px; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25); transition: transform 0.12s, background 0.2s; position: relative; }
.row:hover { background: #3b2e6a; }
.row .icon { width: 44px; height: 44px; flex: none; border-radius: 12px; background: rgba(0, 0, 0, 0.3); border: 2px solid var(--ink); display: grid; place-items: center; font-size: 24px; position: relative; overflow: hidden; }
.row .icon img { width: 100%; height: 100%; object-fit: cover; }
.row .info { flex: 1; min-width: 0; }
.row .t { font-family: var(--font-d); font-size: 16px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.row .t .lv { font-family: var(--font-b); font-size: 11px; font-weight: 800; background: rgba(0, 0, 0, 0.35); border-radius: 6px; padding: 1px 6px; color: var(--muted); }
.row .s { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.3; }
.row .s b { color: var(--lime); font-weight: 700; }
.row.dim { opacity: 0.55; }
.row.hl { box-shadow: 0 0 0 3px var(--gold), 0 3px 0 rgba(0, 0, 0, 0.25); }
.btn { position: relative; font-family: var(--font-d); font-size: 15px; color: var(--ink); background: linear-gradient(180deg, #c4f06a, #84cc16); border: 2px solid var(--ink); border-radius: 12px; padding: 7px 12px; min-width: 86px; box-shadow: 0 4px 0 var(--ink); transition: transform 0.08s, box-shadow 0.08s, filter 0.15s; display: inline-flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap; line-height: 1.1; }
.btn .ic { width: 16px; height: 16px; }
.btn:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 5px 0 var(--ink); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled, .btn.no { background: linear-gradient(180deg, #6b6290, #514873); color: #cfc8ea; cursor: default; }
.btn.purple { background: linear-gradient(180deg, #d4a5ff, #a855f7); }
.btn.gold { background: linear-gradient(180deg, #fde68a, #f59e0b); }
.btn.pink { background: linear-gradient(180deg, #ffb3d4, #ff5fa2); }
.btn.red { background: linear-gradient(180deg, #ff99a3, #ff4d5e); }
.btn.ghost { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.btn.small { font-size: 13px; padding: 5px 10px; min-width: 0; }
.btn.big { font-size: 24px; padding: 14px 34px; border-radius: 18px; box-shadow: 0 6px 0 var(--ink); }
.btn.max { background: linear-gradient(180deg, #fde68a, #fbbf24); }
.btn .cost { display: inline-flex; align-items: center; gap: 3px; }
.btn.ready { animation: ready 1.6s infinite; }
@keyframes ready { 0%, 100% { box-shadow: 0 4px 0 var(--ink), 0 0 0 rgba(163, 230, 53, 0); } 50% { box-shadow: 0 4px 0 var(--ink), 0 0 7px rgba(163, 230, 53, 0.28); } }
.btn .bsub { display: block; font-size: 10px; opacity: 0.8; }
.btn-col { display: flex; flex-direction: column; align-items: stretch; }
.buyamt { display: flex; gap: 4px; background: rgba(0, 0, 0, 0.3); border-radius: 10px; padding: 3px; border: 2px solid var(--ink); }
.buyamt button { font-family: var(--font-d); font-size: 13px; padding: 3px 10px; border-radius: 7px; color: var(--muted); }
.buyamt button.on { background: var(--spore); color: var(--ink); }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 6px; }
.stat { background: rgba(0, 0, 0, 0.28); border: 2px solid var(--ink); border-radius: 12px; padding: 6px 8px; }
.stat small { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.stat b { font-family: var(--font-d); font-weight: 400; font-size: 17px; }
.rar { font-family: var(--font-b); font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 6px; color: var(--ink); text-transform: uppercase; letter-spacing: 0.04em; }
.rar-C { background: #a3adb8; } .rar-U { background: #4cc35a; } .rar-R { background: #3a8cff; color: #fff; } .rar-E { background: #b04cff; color: #fff; } .rar-L { background: linear-gradient(90deg, #ffd23a, #ff9f43); }
.row.r-R .icon { box-shadow: 0 0 10px #3a8cff; } .row.r-E .icon { box-shadow: 0 0 12px #b04cff; } .row.r-L .icon { box-shadow: 0 0 14px #ffb020; }
.prog { height: 8px; background: rgba(0, 0, 0, 0.45); border-radius: 5px; overflow: hidden; margin-top: 5px; border: 1.5px solid var(--ink); }
.prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--lime), #ecfccb); border-radius: 4px; transition: width 0.3s; }
.note { font-size: 12px; color: var(--muted); background: rgba(0, 0, 0, 0.22); border-radius: 12px; padding: 8px 10px; margin-bottom: 8px; line-height: 1.4; border: 2px dashed var(--line); }
.note b { color: var(--text); }
.grid-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; }
.chip { position: relative; aspect-ratio: 1; border-radius: 12px; background: var(--card2); border: 2px solid var(--ink); display: grid; place-items: center; font-size: 24px; transition: transform 0.1s; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3); }
.chip:hover { transform: translateY(-2px); }
.chip .tier { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; }
.chip .clv { position: absolute; top: 2px; right: 4px; font-size: 10px; font-weight: 800; color: var(--muted); }
.chip.eq { box-shadow: 0 0 0 2px var(--lime), 0 3px 0 rgba(0, 0, 0, 0.3); }
.chip.eq::after { content: 'E'; position: absolute; top: 2px; left: 4px; font-size: 10px; font-weight: 900; color: var(--lime); }
.t1 { background: #9aa0a8; } .t2 { background: #4cc35a; } .t3 { background: #3a8cff; } .t4 { background: #b04cff; } .t5 { background: #ffb020; } .t6 { background: linear-gradient(90deg, #ff5fa2, #c77dff, #3ac8e8); }

/* talents */
.tree { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; }
.branch { display: flex; flex-direction: column; gap: 12px; position: relative; }
.branch h4 { margin: 0 0 2px; font-family: var(--font-d); font-weight: 400; font-size: 13px; text-align: center; color: var(--muted); }
.branch::before { content: ''; position: absolute; left: 50%; top: 26px; bottom: 30px; width: 4px; margin-left: -2px; background: var(--line); border-radius: 2px; }
.tnode { position: relative; z-index: 1; background: var(--card2); border: 2px solid var(--ink); border-radius: 12px; padding: 6px 4px; text-align: center; font-size: 11px; min-height: 92px; display: flex; flex-direction: column; align-items: center; gap: 2px; transition: transform 0.1s, box-shadow 0.2s; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3); }
.tnode:hover { transform: translateY(-2px); }
.tnode .tn { font-family: var(--font-d); font-size: 12.5px; line-height: 1.1; }
.tnode .tl { font-size: 10px; color: var(--muted); font-weight: 700; }
.tnode .td { font-size: 10px; color: var(--muted); line-height: 1.2; flex: 1; }
.tnode.locked { opacity: 0.4; }
.tnode.can { box-shadow: 0 0 0 2px var(--lime), 0 3px 0 rgba(0, 0, 0, 0.3); }
.tnode.maxed { background: linear-gradient(180deg, #4b3a7a, #33285a); }
.tnode .tc { font-family: var(--font-d); font-size: 12px; display: inline-flex; gap: 2px; align-items: center; }
.tnode .tc .ic { width: 13px; height: 13px; }

/* map */
.mapwrap { position: relative; background: radial-gradient(circle at 50% 40%, #3b2e6a, #241a45); border: 2px solid var(--ink); border-radius: 16px; overflow: hidden; margin-bottom: 10px; }
.mapwrap svg { display: block; width: 100%; height: auto; }
.mnode { cursor: pointer; }
.mnode circle.base { transition: r 0.2s; }
.mnode:hover circle.base { r: 15; }
.mnode text { font-family: var(--font-d); font-size: 11px; fill: #fff; paint-order: stroke; stroke: var(--ink); stroke-width: 3px; }
.pulse-ring { animation: ring 1.6s infinite; transform-origin: center; transform-box: fill-box; }
@keyframes ring { from { opacity: 0.9; transform: scale(0.8); } to { opacity: 0; transform: scale(2); } }

/* ---------- modal ---------- */
#modalRoot { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.mback { position: absolute; inset: 0; background: rgba(10, 6, 22, 0.66); backdrop-filter: blur(3px); pointer-events: auto; display: grid; place-items: center; padding: 16px; animation: fadeIn 0.2s ease; }
.mback.closing { animation: fadeOut 0.18s ease forwards; }
.mback.closing { pointer-events: none; } /* a closing backdrop must not swallow the next tap */
.modal { width: min(440px, 100%); max-height: calc(100dvh - 40px); overflow: auto; background: linear-gradient(180deg, #33285a, #261c46); border: 3px solid var(--ink); border-radius: 22px; padding: 20px; box-shadow: 0 8px 0 var(--ink), 0 0 60px rgba(168, 85, 247, 0.35); text-align: center; animation: popIn 0.35s cubic-bezier(.2, 1.5, .4, 1); position: relative; }
.mback.closing .modal { animation: popOut 0.18s ease forwards; }
.modal h2 { font-family: var(--font-d); font-weight: 400; font-size: 26px; margin: 4px 0 8px; text-shadow: 0 3px 0 var(--ink); }
.modal p { color: var(--muted); font-size: 14px; line-height: 1.45; margin: 6px 0 14px; }
.modal p b { color: var(--text); }
.modal .big-ico { font-size: 54px; line-height: 1; filter: drop-shadow(0 4px 0 var(--ink)); animation: floaty 2s ease-in-out infinite; }
.modal .mbtns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.modal .x { position: absolute; z-index: 3; top: 10px; right: 12px; width: 32px; height: 32px; border-radius: 10px; background: rgba(0, 0, 0, 0.3); font-size: 16px; }
.modal textarea { width: 100%; height: 90px; border-radius: 12px; border: 2px solid var(--ink); background: rgba(0, 0, 0, 0.35); color: var(--text); padding: 8px; font-family: ui-monospace, monospace; font-size: 11px; resize: none; user-select: text; -webkit-user-select: text; }
.setrow { display: flex; justify-content: space-between; align-items: center; padding: 10px 4px; border-bottom: 2px solid rgba(0, 0, 0, 0.25); font-weight: 600; }
.tog { width: 54px; height: 30px; border-radius: 15px; background: #514873; border: 2px solid var(--ink); position: relative; transition: background 0.2s; }
.tog::after { content: ''; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); transition: left 0.2s cubic-bezier(.2, 1.4, .4, 1); }
.tog.on { background: var(--lime); }
.tog.on::after { left: 26px; }
.reward { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-d); font-size: 26px; background: rgba(0, 0, 0, 0.3); border: 2px solid var(--ink); padding: 8px 18px; border-radius: 14px; margin: 4px; }
.reward .ic { width: 28px; height: 28px; }
.crate-anim { width: 120px; height: 120px; margin: 4px auto; position: relative; }
.crate-anim canvas { width: 120px; height: 120px; }
.crate-box { font-size: 86px; display: block; animation: crateShake 0.9s ease; }
@keyframes crateShake { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(-12deg) scale(1.05); } 30% { transform: rotate(12deg) scale(1.1); } 45% { transform: rotate(-14deg) scale(1.15); } 60% { transform: rotate(14deg) scale(1.2); } 80% { transform: scale(1.4); opacity: 0.6; } }
.reveal { animation: revealIn 0.6s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes revealIn { from { transform: scale(0) rotate(-20deg); opacity: 0; } }
.reveal-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px; border-radius: 18px; border: 3px solid var(--ink); background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 70%); position: relative; }
.reveal-card img { width: 120px; height: 120px; }
.reveal-card .rays { position: absolute; inset: -30px; background: conic-gradient(from 0deg, transparent 0 10deg, var(--rc) 10deg 20deg, transparent 20deg 40deg, var(--rc) 40deg 50deg, transparent 50deg 70deg, var(--rc) 70deg 80deg, transparent 80deg 100deg, var(--rc) 100deg 110deg, transparent 110deg 130deg, var(--rc) 130deg 140deg, transparent 140deg 160deg, var(--rc) 160deg 170deg, transparent 170deg 190deg, var(--rc) 190deg 200deg, transparent 200deg 220deg, var(--rc) 220deg 230deg, transparent 230deg 250deg, var(--rc) 250deg 260deg, transparent 260deg 280deg, var(--rc) 280deg 290deg, transparent 290deg 310deg, var(--rc) 310deg 320deg, transparent 320deg 340deg, var(--rc) 340deg 350deg, transparent 350deg); opacity: 0.25; border-radius: 50%; animation: spin 8s linear infinite; z-index: -1; -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%); mask: radial-gradient(circle, #000 30%, transparent 70%); }
.ad-fake { background: #000; border-radius: 14px; height: 160px; display: grid; place-items: center; font-family: var(--font-d); font-size: 20px; color: #fff; border: 3px solid var(--ink); margin-bottom: 10px; position: relative; overflow: hidden; }
.ad-fake .bar { position: absolute; left: 0; bottom: 0; height: 6px; background: var(--gold); width: 0; }

/* ---------- tooltip ---------- */
#tip { position: fixed; z-index: 80; pointer-events: none; background: #0e0a1c; border: 2px solid var(--spore); color: var(--text); font-size: 12px; padding: 6px 10px; border-radius: 10px; max-width: 260px; opacity: 0; transform: translateY(4px); transition: opacity 0.12s, transform 0.12s; line-height: 1.35; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5); }
#tip.show { opacity: 1; transform: none; }

/* ---------- tutorial ---------- */
#tut { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
#tutRing { position: absolute; border-radius: 16px; border: 4px solid var(--gold); box-shadow: 0 0 0 4000px rgba(10, 6, 22, 0.35), 0 0 20px var(--gold); transition: all 0.3s ease; animation: ringPulse 1.2s infinite; }
#tutRing.none { box-shadow: none; border-color: transparent; animation: none; }
@keyframes ringPulse { 50% { border-color: #fff; } }
#tutHand { position: absolute; width: 54px; height: 54px; transition: left 0.3s ease, top 0.3s ease; animation: tap 0.9s ease-in-out infinite; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.4)); }
#tutHand.hide { display: none; }
@keyframes tap { 50% { transform: translateY(10px) scale(0.92); } }
#tutBubble { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(460px, calc(100% - 20px)); display: flex; gap: 10px; align-items: center; background: #fffaf0; color: var(--ink); border: 3px solid var(--ink); border-radius: 18px; padding: 10px 12px; box-shadow: 0 6px 0 var(--ink); pointer-events: auto; animation: popIn 0.35s cubic-bezier(.2, 1.5, .4, 1); }
#tutBubble.top { bottom: auto; top: 70px; }
#tutBubble img { width: 64px; height: 64px; flex: none; border-radius: 14px; background: #ffd9a8; border: 3px solid var(--ink); }
#tutBubble b { font-family: var(--font-d); font-weight: 400; font-size: 16px; color: #7c3aed; }
#tutBubble p { margin: 2px 0 0; font-size: 14px; font-weight: 600; line-height: 1.35; }
#tutBubble .tb { flex: 1; }
#tutNext { margin-top: 6px; }

/* ---------- splash & intro ---------- */
#splash { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: radial-gradient(circle at 50% 40%, #4b2a86, #140e26 70%); text-align: center; padding: 20px; transition: opacity 0.4s; }
#splash.out { opacity: 0; pointer-events: none; }
#spBg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; filter: saturate(0.9); }
.sp-dim { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 42%, rgba(40, 20, 80, 0.35), rgba(20, 12, 40, 0.72) 62%, rgba(12, 8, 26, 0.92)); }
#splash > *:not(#spBg):not(.sp-dim) { position: relative; }
#splash .sp-glow { position: absolute; }
#splash.out .sp-logo { transform: scale(1.04); transition: transform 0.4s ease; }
.sp-glow { position: absolute; width: 520px; height: 520px; border-radius: 50%; background: radial-gradient(circle, rgba(199, 125, 255, 0.35), transparent 65%); animation: floaty 4s ease-in-out infinite; pointer-events: none; }
.sp-logo { position: relative; display: flex; flex-direction: column; align-items: center; }
.sp-crystal .ic { width: 70px; height: 70px; animation: floaty 2.4s ease-in-out infinite; filter: drop-shadow(0 0 20px #c77dff); }
#splash h1, #introTitle h1 { font-family: var(--font-d); font-weight: 400; font-size: clamp(32px, 8.4vw, 84px); margin: 6px 0 0; line-height: 0.95; max-width: 96vw; color: #fff; -webkit-text-stroke: 3px var(--ink); text-shadow: 0 6px 0 var(--ink), 0 0 40px rgba(199, 125, 255, 0.9); }
#splash h1 span, #introTitle h1 span { display: block; width: max-content; margin: 0.32em auto 0; padding: 0.12em 0.7em 0.08em; font-size: clamp(22px, 0.52em, 46px); letter-spacing: 0.32em; text-indent: 0.32em; line-height: 1; color: #1a0f2e; -webkit-text-stroke: 0; text-shadow: none; background: linear-gradient(180deg, #d9ff6b, #8fe02a); border: 3px solid var(--ink); border-radius: 999px; box-shadow: 0 4px 0 var(--ink), 0 0 18px rgba(163, 230, 53, 0.55); transform: rotate(-3deg); }
.sp-tag { max-width: 420px; color: #d8cff5; font-weight: 600; margin: 0; }
.sp-small { color: var(--muted); font-size: 12px; margin: 0; }
#intro { position: fixed; inset: 0; z-index: 70; background: #000; }
#introCv { width: 100%; height: 100%; display: block; }
#introCap { position: absolute; left: 50%; bottom: 11%; transform: translateX(-50%) translateY(10px); width: min(90%, 640px); text-align: center; font-family: var(--font-d); font-size: clamp(20px, 3.2vw, 32px); color: #fff; text-shadow: 0 3px 0 #000, 0 0 16px rgba(0, 0, 0, 0.8); opacity: 0; transition: opacity 0.4s, transform 0.4s; pointer-events: none; }
#introCap.show { opacity: 1; transform: translateX(-50%); }
#introTitle { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; opacity: 0; }
#introTitle.show { animation: titleIn 3.8s ease forwards; }
#introTitle p { font-family: var(--font-d); font-size: clamp(16px, 2.6vw, 24px); color: #ffe7a8; text-shadow: 0 3px 0 #000; }
@keyframes titleIn { 0% { opacity: 0; transform: scale(1.8); } 15% { opacity: 1; transform: scale(0.96); } 22% { transform: scale(1); } 85% { opacity: 1; } 100% { opacity: 0; } }
#introSkip { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 14px; background: rgba(255, 255, 255, 0.14); border: 2px solid rgba(255, 255, 255, 0.4); color: #fff; border-radius: 999px; padding: 8px 16px; font-family: var(--font-d); font-size: 15px; }
#introSkip:hover { background: rgba(255, 255, 255, 0.25); }

@keyframes pop { from { transform: scale(0); } }
@keyframes popIn { from { opacity: 0; transform: scale(0.7); } }
@keyframes popOut { to { opacity: 0; transform: scale(0.85); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes dropIn { from { opacity: 0; transform: translate(-50%, -30px); } }
@keyframes floaty { 50% { transform: translateY(-8px); } }
@keyframes pulse { 50% { opacity: 0.65; } }
@keyframes spin { to { transform: rotate(360deg); } }
#tutBubble.top { animation: popIn 0.35s cubic-bezier(.2, 1.5, .4, 1); }

/* ---------- portrait / small screens ---------- */
@media (orientation: portrait), (max-width: 760px) and (min-height: 501px) {
  :root { --hud-h: 50px; }
  #main { flex-direction: column; }
  #stage { flex: none; height: 43%; min-height: 250px; }
  #panel { width: auto; flex: 1; border-left: 0; border-top: 3px solid var(--ink); }
  #tabs { order: 2; border-bottom: 0; border-top: 3px solid var(--ink); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  #tabs button { border-radius: 12px; padding: 5px 1px; font-size: 11px; }
  #tabs button.on { box-shadow: inset 0 -3px 0 var(--spore); }
  .brand-txt { display: none; }
  .brand-logo { width: 26px; height: 26px; }
  .cur { font-size: 15px; padding: 3px 9px 3px 4px; min-width: 0; gap: 4px; }
  .cur .ico .ic { width: 20px; height: 20px; }
  .cur .sub { display: none; }
  .cur .sub.clickinc { display: block; font-size: 10px; }
  .cur .sub.clickinc:empty { display: none; }
  #hud { gap: 5px; padding: 0 6px; }
  .hbtn { height: 34px; min-width: 34px; padding: 0 6px; font-size: 16px; }
  #waveBox { top: 6px; width: min(300px, 70%); padding: 4px 10px 6px; }
  .wtop { font-size: 14px; }
  #bossBox { top: 56px; }
  #barBox { width: 140px; bottom: 6px; left: 6px; }
  #comboBox { width: 118px; bottom: 6px; left: 152px; transform: none; padding: 2px 6px 4px; }
  #comboBox #comboTxt { font-size: 12px; }
  #comboBox.fz #comboTxt { font-size: 13px; }
  @keyframes pulseFz { from { transform: scale(1); } to { transform: scale(1.06); } }
  .pill { bottom: 6px; right: 6px; font-size: 12px; padding: 4px 10px; }
  #toasts { top: auto; bottom: 46px; }
  #tabBody { padding: 10px; }
  .tree { gap: 4px; }
  .tnode { min-height: 98px; padding: 5px 2px; }
  .tnode .td { font-size: 9px; }
}
@media (max-width: 380px) { #curFrag { display: none !important; } }

/* ---------- milestone progress (cards) ---------- */
.ms { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 11px; color: var(--muted); }
.ms span b { color: #ffd23a; }
.msb { flex: 0 0 58px; height: 6px; border-radius: 4px; background: rgba(0, 0, 0, 0.4); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.msb i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffb347, #ffd23a); border-radius: 4px; transition: width 0.25s; }

/* ---------- in-scene "+" upgrade buttons ---------- */
#sceneBtns { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.sbtn { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; padding: 0; border: 3px solid #1e3a12; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #b6f57a, #4cc21f 60%, #2f8f12); color: #fff; font: 900 26px/1 var(--font-b, sans-serif);
  display: none; align-items: center; justify-content: center; pointer-events: auto; touch-action: manipulation;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), inset 0 -3px 0 rgba(0, 0, 0, 0.18), 0 3px 0 #1e3a12, 0 0 6px rgba(124, 255, 80, 0.22); transition: filter 0.15s, transform 0.12s; }
.sbtn b { display: block; margin-top: -3px; text-shadow: 0 2px 0 #1e3a12; -webkit-text-stroke: 1px #1e3a12; }
.sbtn.on { display: flex; animation: sbtnIn 0.35s cubic-bezier(.2, 1.6, .4, 1) both, sbtnPulse 2.2s ease-in-out 0.35s infinite; }
.sbtn:hover { filter: brightness(1.15); }
.sbtn:active { transform: scale(0.9); }
.sbtn.hit { animation: sbtnHit 0.25s ease, sbtnPulse 2.2s ease-in-out 0.25s infinite; }
@keyframes sbtnIn { from { transform: scale(0) rotate(-90deg); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes sbtnPulse { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-3px) scale(1.05); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), inset 0 -3px 0 rgba(0, 0, 0, 0.18), 0 3px 0 #1e3a12, 0 0 9px rgba(124, 255, 80, 0.32); } }
@keyframes sbtnHit { 0% { transform: scale(1.35); } 100% { transform: scale(1); } }
@media (max-width: 700px) { .sbtn { width: 30px; height: 30px; margin: -15px 0 0 -15px; font-size: 21px; border-width: 2.5px; } .sbtn::before { inset: -9px !important; } }

/* settings danger zone + reset confirm */
.danger { margin-top: 16px; padding-top: 12px; border-top: 2px dashed rgba(230, 57, 70, 0.55); }
.danger .setrow span small { display: block; font-size: 12px; opacity: 0.75; font-weight: 400; }
.resetm h2 { color: #ff5a67; }
.resetm .mbtns .btn.red[disabled] { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.4); }
/* modal stability: never scroll sideways, only scroll vertically when content truly needs it; animations are transform-only */
.modal { position: relative; overflow-x: hidden; overflow-y: auto; transform-origin: 50% 50%; will-change: transform; backface-visibility: hidden; }
.reveal-card { overflow: hidden; isolation: isolate; contain: paint; }
.reveal-card .rays { inset: auto; left: 50%; top: 50%; width: 160%; height: auto; aspect-ratio: 1; transform: translate(-50%, -50%); animation: raySpin 8s linear infinite; will-change: transform; pointer-events: none; }
@keyframes raySpin { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(360deg); } }
.reveal { animation: revealIn 0.55s cubic-bezier(.2, 1.3, .4, 1) both; transform-origin: 50% 50%; will-change: transform; }
@keyframes revealIn { from { transform: scale(0.3); opacity: 0; } }
.crate-anim { overflow: visible; contain: layout; }
.crate-box { transform-origin: 50% 60%; will-change: transform; }
/* survivor stars */
.stars { display: inline-flex; gap: 1px; vertical-align: middle; font-size: 12px; line-height: 1; }
.stars i { font-style: normal; color: rgba(255, 255, 255, 0.22); position: relative; }
.stars i.on { color: #ffd23a; text-shadow: 0 1px 0 #1e1633, 0 0 4px rgba(255, 210, 58, 0.6); }
.stars.big { font-size: 30px; gap: 4px; margin-top: 2px; }
.stars.big i { color: rgba(30, 22, 51, 0.35); -webkit-text-stroke: 1.5px #1e1633; }
.stars.big i.on { color: #ffd23a; }
.stars i.fill { animation: starFill 0.5s var(--d, 0.4s) cubic-bezier(.2, 1.8, .4, 1) both; }
.stars i.fill b { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; pointer-events: none; animation: starSpark 0.7s calc(var(--d, 0.4s) + 0.15s) ease-out both;
  box-shadow: 0 -22px 0 #fff6c2, 16px -16px 0 #ffd23a, 22px 0 0 #fff6c2, 16px 16px 0 #ffd23a, 0 22px 0 #fff6c2, -16px 16px 0 #ffd23a, -22px 0 0 #fff6c2, -16px -16px 0 #ffd23a; }
@keyframes starFill { 0% { color: rgba(30, 22, 51, 0.35); transform: scale(0.6); } 60% { color: #fff6c2; transform: scale(1.5); text-shadow: 0 0 16px #ffd23a; } 100% { color: #ffd23a; transform: scale(1); } }
@keyframes starSpark { 0% { opacity: 0; transform: scale(0.2); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(1.6); } }
.nextms { opacity: 0.7; font-size: 0.92em; }
@media (prefers-reduced-motion: reduce) { .stars i.fill { animation-duration: 0.01s; } .stars i.fill b { display: none; } }

/* ---------- armory / gear equip states ---------- */
.btn.equip { background: linear-gradient(180deg, #7cf08a, #16a34a); color: #062b12; letter-spacing: 0.5px; min-width: 96px; flex: none; }
.btn.equip.pulse { animation: eqPulse 1.1s ease-in-out infinite; }
@keyframes eqPulse { 0%, 100% { transform: scale(1); box-shadow: 0 4px 0 var(--ink), 0 0 0 rgba(74, 222, 128, 0); } 50% { transform: scale(1.05); box-shadow: 0 4px 0 var(--ink), 0 0 8px rgba(74, 222, 128, 0.3); } }
.eqbadge { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 96px; padding: 7px 10px; border-radius: 12px; border: 2px dashed #4ade80; color: #86efac; background: rgba(22, 163, 74, 0.16); font-family: var(--font-d); font-size: 14px; letter-spacing: 0.5px; white-space: nowrap; cursor: default; }
.row.eqrow { background: linear-gradient(90deg, rgba(34, 197, 94, 0.22), rgba(34, 197, 94, 0.06)); box-shadow: 0 0 0 2px #4ade80, 0 3px 0 rgba(0, 0, 0, 0.25); }
.reveal-card + h2 + p + .eqbadge { margin: 2px auto 6px; }
@media (max-width: 420px) { .btn.equip, .eqbadge { min-width: 84px; font-size: 13px; padding: 7px 8px; } }

/* ---------- nav tabs: per-tab accents, clear active / selected / locked states ---------- */
#tabs button { --ac: var(--spore); color: #ece6ff; background: color-mix(in srgb, var(--ac) 14%, transparent); box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--ac) 55%, transparent); cursor: pointer; }
#tabs button[data-tab="shop"] { --ac: #fbbf24; }
#tabs button[data-tab="hero"] { --ac: #ff7a59; }
#tabs button[data-tab="squad"] { --ac: #34d399; }
#tabs button[data-tab="map"] { --ac: #60a5fa; }
#tabs button[data-tab="tasks"] { --ac: #a3e635; }
#tabs button[data-tab="rebirth"] { --ac: #d08bff; }
#tabs button i { filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35)); }
#tabs button span { text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5); }
#tabs button:hover { color: #fff; background: color-mix(in srgb, var(--ac) 28%, transparent); }
#tabs button:active { transform: translateY(2px); background: color-mix(in srgb, var(--ac) 36%, transparent); }
#tabs button:focus-visible { outline: 3px solid var(--ac); outline-offset: -3px; }
#tabs button.on { background: var(--card); color: var(--ac); box-shadow: inset 0 4px 0 var(--ac), 0 -4px 12px color-mix(in srgb, var(--ac) 35%, transparent); }
#tabs button.on span { color: #fff; }
#tabs button.locked { opacity: 1; background: rgba(255, 255, 255, 0.03); box-shadow: none; color: #7d7699; cursor: not-allowed; }
#tabs button.locked i { filter: grayscale(1) brightness(0.7); opacity: 0.55; }
#tabs button.locked span { color: #7d7699; }
#tabs button.locked::after { content: '🔒'; position: absolute; top: 5px; left: 50%; margin-left: 4px; font-size: 13px; filter: drop-shadow(0 1px 0 #000); }
#tabs button.locked:hover, #tabs button.locked:active { background: rgba(255, 255, 255, 0.05); transform: none; }
#tabs .badge.dot { min-width: 12px; width: 12px; height: 12px; top: 5px; right: 12px; padding: 0; }
@media (prefers-reduced-motion: reduce) { .btn.equip.pulse { animation: none; box-shadow: 0 4px 0 var(--ink), 0 0 7px rgba(74, 222, 128, 0.3); } }
/* currency amounts: icon + number, inline */
.amt { display: inline-flex; align-items: center; gap: 2px; vertical-align: -0.2em; white-space: nowrap; }
.amt .ic { width: 1.15em; height: 1.15em; }
.row .icon > .ic { width: 30px; height: 30px; }
.row .icon.gemico > .ic { width: 34px; height: 34px; }
/* themed pointer feedback (cursor.js) */
.clickfx, .tapfx { position: fixed; z-index: 9999; pointer-events: none; width: 0; height: 0; }
.clickfx i { position: absolute; left: -2px; top: -2px; width: 4px; height: 4px; border-radius: 2px; background: #b6ff5a; box-shadow: 0 0 0 1px #14101f; animation: cfx 0.28s ease-out forwards; }
.clickfx i:nth-child(2n) { background: #fff6b0; }
.clickfx i:nth-child(1) { --a: 0deg; } .clickfx i:nth-child(2) { --a: 60deg; } .clickfx i:nth-child(3) { --a: 120deg; }
.clickfx i:nth-child(4) { --a: 180deg; } .clickfx i:nth-child(5) { --a: 240deg; } .clickfx i:nth-child(6) { --a: 300deg; }
@keyframes cfx { from { transform: rotate(var(--a)) translateX(6px) scale(1); opacity: 1; } to { transform: rotate(var(--a)) translateX(17px) scale(0.4); opacity: 0; } }
.tapfx b { position: absolute; left: -26px; top: -26px; width: 52px; height: 52px; border-radius: 50%; border: 4px solid #8dff3a; box-shadow: 0 0 0 2px #14101f, inset 0 0 0 2px #14101f, 0 0 14px #8dff3a; animation: tfx 0.55s ease-out forwards; }
.tapfx .ic { position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; filter: drop-shadow(0 0 6px #c77dff); animation: tfx2 0.55s ease-out forwards; }
@keyframes tfx { from { transform: scale(0.25); opacity: 1; } to { transform: scale(1.15); opacity: 0; } }
@keyframes tfx2 { 0% { transform: scale(0.4) rotate(-20deg); opacity: 1; } 40% { transform: scale(1.25) rotate(8deg); opacity: 1; } 100% { transform: translateY(-14px) scale(0.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .clickfx, .tapfx { display: none; } }
/* ---- Tasks tab ---- */
.sec .secn { font-family: var(--font-b); font-size: 12px; font-weight: 800; color: var(--gold); background: rgba(0,0,0,0.3); border-radius: 8px; padding: 1px 8px; letter-spacing: 0; order: 2; }
.achbar { height: 6px; border-radius: 4px; background: rgba(0,0,0,0.35); margin: -2px 2px 10px; overflow: hidden; }
.achbar i { display: block; height: 100%; background: linear-gradient(90deg, #ffb020, #ffd23a); border-radius: 4px; }
#tabBody .sub { font-size: 12px; font-weight: 800; color: var(--muted); margin: 8px 4px 6px; text-transform: uppercase; letter-spacing: 0.05em; }
#tabBody .sub.gold { color: #ffd23a; }
.row.readyrow { background: linear-gradient(90deg, rgba(255, 196, 40, 0.24), rgba(255, 196, 40, 0.07)); border-color: #b8860b; animation: goldGlow 2.6s ease-in-out infinite; }
@keyframes goldGlow { 0%, 100% { box-shadow: inset 0 0 0 2px #ffd23a, 0 0 8px 1px rgba(255, 210, 58, 0.35), 0 3px 0 rgba(0,0,0,0.25); } 50% { box-shadow: inset 0 0 0 2px #ffd23a, 0 0 18px 4px rgba(255, 210, 58, 0.6), 0 3px 0 rgba(0,0,0,0.25); } }
.btn.claimpulse { background: linear-gradient(#ffe066, #ffb020); color: #2a1a00; animation: claimPulse 1.4s ease-in-out infinite; }
@keyframes claimPulse { 0%, 100% { transform: scale(1); box-shadow: 0 4px 0 var(--ink), 0 0 0 rgba(255, 210, 58, 0); } 50% { transform: scale(1.05); box-shadow: 0 4px 0 var(--ink), 0 0 8px rgba(255, 210, 58, 0.32); } }
.row .rew { text-align: center; margin-bottom: 4px; white-space: nowrap; }
.row .rew .ic, .row .rew svg { width: 14px; height: 14px; vertical-align: -2px; }
.row.claimed .btn { opacity: 0.8; }
.donebadge { font-family: var(--font-b); font-size: 11px; font-weight: 800; color: #0d2a12; background: #4ade80; border-radius: 6px; padding: 1px 6px; }
.done-note { border-color: #4ade80; color: var(--text); }
.donehead { display: flex; align-items: center; gap: 8px; width: 100%; margin: 10px 0 8px; padding: 9px 12px; border-radius: 12px; border: 2px dashed var(--line); background: rgba(0,0,0,0.22); color: var(--muted); font: 800 13px var(--font-b); text-transform: uppercase; letter-spacing: 0.05em; text-align: left; }
.donehead:hover { color: var(--text); border-color: var(--muted); }
.donehead .car { display: inline-block; transition: transform 0.2s; }
.donehead.open .car { transform: rotate(90deg); }
.donelist { animation: fadeIn 0.25s ease-out; }
.row.got { opacity: 0.6; filter: grayscale(0.55); }
.row.got .icon { position: relative; overflow: visible; }
.row .chk { position: absolute; right: -6px; bottom: -6px; width: 20px; height: 20px; border-radius: 50%; background: #4ade80; color: #0d2a12; font: 900 13px/20px var(--font-b); text-align: center; border: 2px solid var(--ink); }
.rew.earned { color: #4ade80; font-size: 11px; }
.gemfly { position: fixed; left: 0; top: 0; width: 22px; height: 22px; z-index: 120; pointer-events: none; filter: drop-shadow(0 0 6px rgba(255, 120, 220, 0.8)); }
.gemfly svg, .gemfly .ic { width: 22px; height: 22px; }
@media (prefers-reduced-motion: reduce) { .row.readyrow, .btn.claimpulse { animation: none; } }

/* ---------- device: real viewport height, safe areas, no zoom/bounce ---------- */
html, body { position: fixed; inset: 0; width: 100%; height: var(--app-h, 100dvh); overscroll-behavior: none; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-touch-callout: none; }
#app, #splash, #intro, #modalRoot, #tut { bottom: auto; height: 100vh; height: 100dvh; height: var(--app-h, 100dvh); }
#app { padding-bottom: env(safe-area-inset-bottom); }
#splash { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.mback { padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
.modal { max-height: calc(var(--app-h, 100dvh) - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
#app, #app * { -webkit-user-select: none; user-select: none; }
textarea, input { -webkit-user-select: text; user-select: text; font-size: 16px; } /* 16px stops iOS focus-zoom */
/* touch tooltips: long-press any element with a tip */
@media (hover: none) { #tip { display: block; } #tip:not(.show) { visibility: hidden; } }
#tip.touch { max-width: min(300px, calc(100vw - 20px)); font-size: 13px; }
@media (orientation: portrait), (max-width: 760px) and (min-height: 501px) { #app { padding-bottom: 0; } }

/* ---------- touch devices: >=44px tap targets, >=12px text ---------- */
@media (pointer: coarse) {
  :root { --hud-h: 54px; }
  .hbtn { height: 44px; min-width: 44px; }
  .pill#btnFarm { min-height: 44px; display: inline-flex; align-items: center; }
  .btn { min-height: 44px; }
  .btn.small { min-height: 44px; padding: 6px 12px; }
  .buyamt button { min-height: 40px; min-width: 48px; position: relative; }
  .buyamt button::after { content: ''; position: absolute; inset: -4px 0; } /* 48px hit box */
  .modal .x { width: 44px; height: 44px; top: 6px; right: 8px; }
  .tog { width: 60px; height: 34px; border-radius: 17px; position: relative; }
  .tog::before { content: ''; position: absolute; inset: -6px -2px; }
  .tog::after { width: 26px; height: 26px; }
  .tog.on::after { left: 28px; }
  #tabs button { min-height: 48px; font-size: 12px; }
  #tabs .badge { font-size: 12px; }
  .row .t .lv { font-size: 12px; }
  .tnode .td { font-size: 12px; }
  #tabBody small, .modal small { font-size: 12px; }
}
@media (pointer: coarse) {
  .ms, .rar, .nextms { font-size: 12px !important; }
  .btn.small.ghost { min-width: 44px; }
  .sbtn::before { content: ''; position: absolute; inset: -8px; border-radius: 50%; } /* 46-48px hit circle around the 30-32px "+" */
}

/* ---------- phone landscape (short screens): side-by-side, compact chrome ---------- */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --hud-h: 50px; }
  .brand-txt { display: none; }
  .brand-logo { width: 26px; height: 26px; }
  #hud { gap: 6px; padding: 0 8px; }
  .cur { font-size: 15px; padding: 2px 9px 2px 4px; min-width: 0; }
  .cur .ico .ic { width: 20px; height: 20px; }
  .hbtn { height: 44px; min-width: 44px; }
  #panel { width: clamp(290px, 40vw, 380px); }
  #tabs { padding: 3px 3px 0; }
  #tabs button { min-height: 44px; padding: 3px 1px 4px; font-size: 12px; }
  #tabs button i { font-size: 17px; }
  #tabBody { padding: 8px; }
  #waveBox { top: 6px; width: min(280px, 60%); padding: 3px 10px 5px; }
  .wtop { font-size: 14px; }
  #bossBox { top: 52px; }
  #toasts { top: 52px; }
  #barBox { bottom: 6px; left: 6px; width: 150px; }
}
@media (pointer: coarse) { .cur .sub { font-size: 12px; } }
#introSkip { right: max(14px, env(safe-area-inset-right)); top: max(14px, env(safe-area-inset-top)); }
#introCap { bottom: calc(11% + env(safe-area-inset-bottom)); }
@media (pointer: coarse) { #introSkip { min-height: 44px; padding: 10px 18px; } }
/* HUD paints behind the notch / Dynamic Island instead of leaving a dark band */
#app { padding-top: 0; }
#hud { height: calc(var(--hud-h) + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); }
#tabBody { overflow-anchor: none; } /* claims collapse rows in place; keep the scroll position put */

/* ---------- power dock: hold-fire + x2 boosts (right edge of the stage, above Auto) ---------- */
#dock { position: absolute; right: calc(10px + env(safe-area-inset-right, 0px)); bottom: 52px; display: flex; flex-direction: column-reverse; gap: 8px; z-index: 2; pointer-events: auto; }
#dock.hidden { display: none; }
#dock.horiz { flex-direction: row-reverse; bottom: 48px; }
.dk { position: relative; width: 52px; height: 52px; border-radius: 50%; border: 3px solid var(--ink); background: rgba(20, 14, 38, 0.88); color: var(--text); padding: 0; display: grid; place-items: center; cursor: pointer; font-family: var(--font-d); box-shadow: 0 3px 0 var(--ink); touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.dk:active { transform: scale(0.94); }
.dk .ring { position: absolute; inset: -3px; width: calc(100% + 6px); height: calc(100% + 6px); transform: rotate(-90deg); pointer-events: none; }
.ring .trk { fill: none; stroke: rgba(255, 255, 255, 0.12); stroke-width: 3.5; }
.ring .arc { fill: none; stroke: #4cc9f0; stroke-width: 3.5; stroke-linecap: round; transition: stroke-dashoffset 0.25s linear; }
.dk .ic { font-size: 20px; line-height: 1; margin-top: -8px; }
.dk .ic .ic, .dk .ic svg { width: 20px; height: 20px; }
.dk .x2 { position: absolute; top: -6px; left: -6px; background: #ffd23a; color: #2a1a00; font-size: 11px; border: 2px solid var(--ink); border-radius: 8px; padding: 0 4px; line-height: 15px; }
.dk .lb { position: absolute; bottom: 5px; left: 0; right: 0; font-size: 11px; line-height: 1; text-align: center; letter-spacing: 0.02em; }
.dk .badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; border-radius: 9px; background: #e63946; color: #fff; font-size: 10px; line-height: 15px; border: 2px solid var(--ink); text-align: center; }
.dk .badge:empty { display: none; }
.dk.hold .arc { stroke: #ff9f43; }
.dk.hold.ready { animation: dkGlow 3s ease-in-out infinite; }
.dk.hold.ready .lb { color: #ffd23a; font-size: 10px; }
.dk.hold.on { background: rgba(120, 40, 10, 0.9); }
.dk.cool { background: rgba(58, 54, 76, 0.94); }
.dk.cool .arc { stroke: #8b8fa8; }
.dk.cool .ic { filter: grayscale(1); opacity: 0.55; }
.dk.boost.on { background: linear-gradient(180deg, #3d6b17, #24420c); }
.dk.boost.on .arc { stroke: #a3e635; }
.dk.boost.ready { animation: dkGlow 3.2s ease-in-out infinite; }
.dk.boost.ready .arc { stroke: #ffd23a; }
@keyframes dkGlow { 0%, 100% { box-shadow: 0 3px 0 var(--ink), 0 0 0 0 rgba(255, 210, 58, 0); } 50% { box-shadow: 0 3px 0 var(--ink), 0 0 9px rgba(255, 210, 58, 0.35); } }
#holdRing { position: absolute; left: -30px; top: -30px; width: 60px; height: 60px; pointer-events: none; opacity: 0; transition: opacity 0.2s; z-index: 2; display: grid; place-items: center; }
#holdRing.on { opacity: 1; }
#holdRing .ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.7)); }
#holdRing .arc { stroke: #ff9f43; stroke-width: 4.5; }
#holdRing .trk { stroke: rgba(20, 14, 38, 0.6); stroke-width: 5.5; }
#holdRing.low .arc { stroke: #ff5d5d; }
#holdRing b { font-family: var(--font-d); font-size: 13px; text-shadow: 0 2px 0 var(--ink); }
.cur.x2::after { content: 'x2'; position: absolute; top: -7px; right: -6px; background: #a3e635; color: #142006; font-family: var(--font-d); font-size: 10px; line-height: 14px; padding: 0 4px; border-radius: 7px; border: 2px solid var(--ink); }
.cur { position: relative; }
#adBusy { position: fixed; inset: 0; z-index: 60; display: none; place-items: center; align-content: center; gap: 10px; background: rgba(10, 6, 22, 0.75); color: var(--text); font-family: var(--font-d); }
#adBusy.on { display: grid; }
#adBusy .spin { width: 40px; height: 40px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, 0.2); border-top-color: #ffd23a; animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.adico { display: inline-grid; place-items: center; width: 1.25em; height: 1.25em; border-radius: 4px; background: #e63946; color: #fff; font-style: normal; font-size: 0.75em; vertical-align: 0.1em; margin-right: 2px; }
.boostm .okline, .okline { color: #a3e635; }
/* armory: watch tokens + level track */
.wbtns { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.btn.wad { background: linear-gradient(#4cc9f0, #2b8fb8); font-size: 13px; padding: 6px 8px; white-space: nowrap; }
.btn.wad.locked { filter: grayscale(0.8); opacity: 0.75; }
.pips { display: inline-flex; gap: 3px; margin-left: 5px; vertical-align: middle; }
.pips i { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--ink); background: rgba(255, 255, 255, 0.25); }
.pips i.on { background: #ffd23a; }
.wadnote { font-size: 11px; opacity: 0.85; margin-top: 2px; }
.wtrack { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; font-size: 11px; }
.wtrack .wbar { flex: 1 1 80px; min-width: 60px; height: 8px; border-radius: 4px; background: rgba(0, 0, 0, 0.35); border: 2px solid var(--ink); overflow: hidden; }
.wtrack .wbar i { display: block; height: 100%; background: linear-gradient(90deg, #ffd23a, #ff9f43); }
.wtrack .wpv { width: 48px; height: 30px; background: rgba(0, 0, 0, 0.25); border-radius: 6px; }
.wtrack.max span { color: #ffd23a; font-family: var(--font-d); }
/* skins */
.skingrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.skincard { background: rgba(0, 0, 0, 0.22); border: 2px solid var(--ink); border-radius: 12px; padding: 6px; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; }
.skincard.on { border-color: #a3e635; box-shadow: inset 0 0 0 2px rgba(163, 230, 53, 0.35); }
.skincard canvas { width: 96px; height: 106px; }
.skincard .t { font-family: var(--font-d); font-size: 14px; }
.skincard .perk { color: #a3e635; font-size: 12px; font-weight: 700; }
.skincard .perk.none { color: rgba(255, 255, 255, 0.5); }
.skincard .s { font-size: 11px; opacity: 0.75; flex: 1; }
.skincard .btn, .skincard .eqbadge { width: 100%; min-width: 0; }
.vipb { background: #ffd23a; color: #2a1a00; border-radius: 6px; padding: 0 4px; font-size: 10px; }
.vipl { text-align: left; margin: 6px 0 10px; padding-left: 20px; line-height: 1.5; }
.row.vip { border-color: #b8860b; }
@media (orientation: portrait), (max-width: 760px) and (min-height: 501px) {
  #dock { bottom: 40px; right: calc(6px + env(safe-area-inset-right, 0px)); gap: 6px; }
  #dock.horiz { bottom: 40px; }
  .dk { width: 44px; height: 44px; }
  .dk .ic { font-size: 17px; margin-top: -7px; }
  .dk .lb { bottom: 4px; font-size: 10px; }
}
/* ---------- Reduce flashing: no infinite pulses/glows, softer effects ---------- */
body.calm .btn.ready, body.calm .sbtn.on, body.calm .sbtn.hit, body.calm .btn.equip.pulse, body.calm .row.readyrow, body.calm .btn.claimpulse,
body.calm .reveal-card .rays, body.calm #tutHand, body.calm .modal .big-ico, body.calm .sp-crystal .ic, body.calm #bTime.urgent, body.calm #comboBox.fz,
body.calm #barBox.low, body.calm .dk.ready, body.calm .pulse-ring, body.calm .hbtn.boost.on { animation: none !important; }
body.calm .dk.ready { box-shadow: 0 3px 0 var(--ink), 0 0 6px rgba(255, 210, 58, 0.35); }
@media (prefers-reduced-motion: reduce) { .dk.ready { animation: none; } }
@media (orientation: portrait), (max-width: 760px) and (min-height: 501px) { #toasts { right: calc(58px + env(safe-area-inset-right, 0px)); left: 8px; } }

/* ---- visual polish pass: smoother cards, presses and panel transitions ---- */
.row { box-shadow: 0 3px 0 rgba(0, 0, 0, 0.22), 0 6px 14px rgba(8, 4, 20, 0.22); transition: transform 0.12s ease, background 0.2s ease, box-shadow 0.2s ease; }
.row.hl { box-shadow: 0 0 0 3px var(--gold), 0 3px 0 rgba(0, 0, 0, 0.25), 0 6px 14px rgba(8, 4, 20, 0.22); }
.row .icon { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.08), inset 0 -3px 6px rgba(0, 0, 0, 0.25); }
.btn { transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.15s ease; }
.btn::after { content: ''; position: absolute; left: 6px; right: 6px; top: 2px; height: 38%; border-radius: 10px 10px 6px 6px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0)); pointer-events: none; }
.btn:disabled::after, .btn.no::after, .btn.ghost::after { opacity: 0.35; }
.toast { box-shadow: 0 6px 16px rgba(8, 4, 20, 0.35); }
#tabBody.anim > * { animation: slideIn 0.26s cubic-bezier(.2, .8, .3, 1) both; }
@media (max-width: 700px) { #toasts > .toast:nth-last-child(n+3) { display: none; } .toast { font-size: 12px; padding: 6px 10px; max-width: 240px; } }

/* --- fill-inside-outline rule: every outlined control paints its fill only inside the dark border (no colour under/around the
   anti-aliased rounded border), glows are soft and low-alpha, gloss layers sit inside the padding box with matching radii --- */
.btn, .sbtn, .dk, .dk .x2, .dk .badge, #tabs .badge, .buyamt, .buyamt button, .chip, .skincard, .hbtn, .row .icon { background-clip: padding-box; }
.btn::after { left: 4px; right: 4px; top: 2px; border-radius: 9px 9px 5px 5px; }
.btn.big::after { border-radius: 15px 15px 8px 8px; }
.btn.small::after { left: 3px; right: 3px; top: 1px; border-radius: 7px 7px 4px 4px; }
.btn:active:not(:disabled) { box-shadow: 0 1px 0 var(--ink); }
#tabs button.on { box-shadow: inset 0 4px 0 var(--ac), 0 -3px 8px color-mix(in srgb, var(--ac) 22%, transparent); }

/* Free Supply Drop daily milestone */
.sdms { margin-top: 4px; }
.sdms-t { font-size: 12px; font-weight: 800; color: #c4f06a; }
.sdms-bar { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.sdms-track { flex: 1; max-width: 160px; height: 9px; border-radius: 6px; background: rgba(0, 0, 0, 0.45); border: 2px solid var(--ink); overflow: hidden; background-clip: padding-box; }
.sdms-track i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(180deg, #8ef0a0, #22c55e); transition: width 0.4s cubic-bezier(.2, .8, .3, 1); }
.sdms-n { font-family: var(--font-d); font-size: 12px; color: #fff; }
.sdms-ico { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 13px; background: radial-gradient(circle at 35% 30%, #a7f3b0, #22c55e 70%); border: 2px solid var(--ink); background-clip: padding-box; box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), 0 2px 0 var(--ink); }
.sdms.next .sdms-t { color: #ffd23a; animation: sdNext 2.4s ease-in-out infinite; }
.sdms.next .sdms-ico { animation: sdIco 2.4s ease-in-out infinite; }
.sdms-day { font-size: 11px; color: var(--muted); margin-top: 2px; }
@keyframes sdNext { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
@keyframes sdIco { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12) rotate(-6deg); } }
body.calm .sdms.next .sdms-t, body.calm .sdms.next .sdms-ico { animation: none !important; }
.gtag { font-family: var(--font-d); font-size: 17px; color: #1a0f2e; background: linear-gradient(180deg, #b8f5c2, #4ade80); border: 3px solid var(--ink); border-radius: 12px; padding: 4px 12px; margin: 0 auto 6px; display: inline-block; box-shadow: 0 3px 0 var(--ink); background-clip: padding-box; }
.reveal-card.guar .rays { opacity: 1; }

/* --- timers / cooldowns: always dark ink on a light pill (contrast ~16:1 against the pill, the pill itself outlined so it
   reads on any button state); the button greys out during cooldown but the timer keeps full contrast --- */
.tmr { display: inline-block; background: #f6f1ff; color: #1a0f2e !important; border: 2px solid #1a0f2e; border-radius: 8px; padding: 0 6px; font-family: var(--font-d); font-weight: 800; line-height: 1.3; text-shadow: none; -webkit-text-stroke: 0; background-clip: padding-box; white-space: nowrap; }
.tmr.on { background: #d9fbb4; }
.btn .tmr { font-size: 13px; }
.btn.btn:disabled, .btn.btn.no { background: linear-gradient(180deg, #6b6290, #514873); background-clip: padding-box; color: #e9e4ff; filter: none; }
.btn.btn:disabled::after { opacity: 0.35; }
.dk.cool .lb, .dk.on .lb { left: 50%; right: auto; bottom: 3px; transform: translateX(-50%); background: #f6f1ff; color: #1a0f2e; border: 2px solid #1a0f2e; border-radius: 7px; padding: 1px 4px; font-size: 11px; line-height: 1; text-shadow: none; white-space: nowrap; background-clip: padding-box; }
.dk.on .lb { background: #d9fbb4; }
.dk.hold.on .lb { background: #ffe2b8; }
#holdRing b { color: #fff; -webkit-text-stroke: 4px #1a0f2e; paint-order: stroke fill; text-shadow: 0 2px 0 #1a0f2e; font-size: 14px; }
@media (max-width: 760px) { .dk.cool .lb, .dk.on .lb { font-size: 10px; bottom: 2px; padding: 1px 3px; } }

/* pulsing buttons scale as one piece (fill + outline + highlight together); glows stay a soft blurred halo, never a spread ring */
.btn.ready, .btn.claimpulse, .btn.equip, .sbtn, .dk.ready, .xb.ready { transform-origin: 50% 50%; backface-visibility: hidden; }

/* ---------- extras: HUD icons, Lucky Meteor, Free Gems offer, wheel, check-in ---------- */
#xbar { position: absolute; left: 10px; top: 10px; display: flex; flex-direction: column; gap: 8px; z-index: 3; }
#xbar.hidden { display: none; }
#hud #xbar { position: static; flex-direction: row; gap: 8px; margin-left: 4px; }
#hud .xb { width: 38px; height: 38px; font-size: 19px; }
.xb { position: relative; width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--ink); background: linear-gradient(180deg, #4a3a7a, #2c2150); background-clip: padding-box; font-size: 22px; line-height: 1; cursor: pointer; box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.25), 0 3px 0 var(--ink); padding: 0; }
.xb.ready { background: linear-gradient(180deg, #ffe066, #f4a91a); background-clip: padding-box; animation: dkGlow 2.6s ease-in-out infinite; }
.xb .badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; border-radius: 9px; background: #e63946; background-clip: padding-box; border: 2px solid var(--ink); color: #fff; font: 12px/14px var(--font-d); }
.xb .badge:empty { display: none; }
body.calm .xb.ready { animation: none; box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.25), 0 3px 0 var(--ink), 0 0 6px rgba(255, 210, 58, 0.35); }
#xMeteor { position: absolute; left: 0; top: 0; width: 80px; height: 48px; border: 0; padding: 0; background: none; cursor: pointer; display: none; z-index: 4; filter: drop-shadow(0 0 8px rgba(255, 210, 58, 0.55)); }
#xMeteor svg { width: 100%; height: 100%; }
#xMeteor { touch-action: none; -webkit-tap-highlight-color: transparent; }
#xMeteor::before { content: ''; position: absolute; inset: -24px -26px -24px -10px; border-radius: 40px; } /* 116x96 invisible hitbox (ball + tail), moves with the meteor */
.xgem { position: absolute; right: 74px; top: 64px; display: none; align-items: center; gap: 6px; padding: 6px 12px 9px 8px; border-radius: 16px; border: 3px solid var(--ink); background: linear-gradient(180deg, #ff7ac6, #d43f8f); background-clip: padding-box; color: #fff; font-family: var(--font-d); font-size: 15px; cursor: pointer; z-index: 4; box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), 0 3px 0 var(--ink), 0 0 10px rgba(255, 122, 198, 0.35); overflow: hidden; transition: opacity 0.6s; }
.xgem.on { display: flex; animation: gemBob 3s ease-in-out infinite; }
.xgem.fade { opacity: 0.3; }
.xgem .gi svg { width: 22px; height: 22px; vertical-align: middle; }
.xgem b { -webkit-text-stroke: 3px #1a0f2e; paint-order: stroke fill; }
.xgem .gs { background: #f6f1ff; color: #1a0f2e; border: 2px solid #1a0f2e; border-radius: 8px; padding: 0 6px; font-size: 12px; background-clip: padding-box; }
.xgem .gt { position: absolute; left: 0; bottom: 0; height: 4px; background: #fff; opacity: 0.8; }
@keyframes gemBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
body.calm .xgem.on { animation: none; }
.wheelm #whCv { display: block; margin: 6px auto; width: min(300px, 70vw); height: auto; }
.whnote { text-align: center; }
.cisub { font-size: 13px; text-align: center; }
.cigrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 8px 0; }
.ciday { position: relative; border: 2px solid var(--ink); border-radius: 10px; background: rgba(255, 255, 255, 0.06); background-clip: padding-box; padding: 4px 2px; text-align: center; min-height: 74px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ciday b { font-family: var(--font-d); font-size: 11px; color: #e9e4ff; }
.ciday .ci-ico { font-size: 20px; }
.ciday small { font-size: 9.5px; line-height: 1.15; color: #e9e4ff; word-break: normal; overflow-wrap: break-word; }
.ciday small svg { width: 10px; height: 10px; vertical-align: -1px; }
.ciday.done { background: rgba(76, 195, 90, 0.18); opacity: 0.75; }
.ciday .ck { position: absolute; top: 2px; right: 4px; color: #4cc35a; font-style: normal; font-weight: 900; }
.ciday.today { background: linear-gradient(180deg, #ffe58a, #f4b62a); background-clip: padding-box; }
.ciday.today b, .ciday.today small { color: #1a0f2e; }
.ciday.big { background: linear-gradient(180deg, #7b4dd6, #4a2385); background-clip: padding-box; box-shadow: inset 0 0 0 2px #ffd23a; }
.cinote { text-align: center; font-size: 11px; opacity: 0.8; }
.wbq { text-align: center; font-family: var(--font-d); font-size: 18px; margin: 4px 0; }
.vipb.ci { background: #4cc35a; color: #1a0f2e; }
.skipb { margin-left: 6px; }
.skipb small { font-size: 10px; opacity: 0.9; }
@media (max-width: 760px) { #stage > #xbar { left: auto; right: 6px; top: 6px; gap: 5px; } #stage > #xbar .xb { width: 32px; height: 32px; font-size: 16px; border-width: 2.5px; } #stage > #xbar .badge { min-width: 15px; height: 15px; font-size: 10px; line-height: 11px; top: -5px; right: -5px; } .xgem { right: 62px; top: 56px; font-size: 13px; } .cigrid { gap: 4px; } .ciday { min-height: 66px; } .ciday small { font-size: 8.5px; } }

/* video-unlock skin card (Ninja Clan) */
.adsk { display: flex; flex-direction: column; gap: 6px; align-items: stretch; width: 100%; }
.adsk-p { display: flex; align-items: center; gap: 6px; justify-content: center; }
.adsk-bar { flex: 1; max-width: 90px; height: 8px; border-radius: 4px; background: rgba(0, 0, 0, 0.45); border: 2px solid var(--ink); background-clip: padding-box; overflow: hidden; display: block; }
.adsk-bar b { display: block; height: 100%; background: linear-gradient(90deg, #ffd23a, #ff9f1c); }
.vipb.ad { background: #9b1c2e; color: #fff; }
/* dismissible tip banners */
.note.tip { position: relative; padding-right: 44px; }
.note.tip .tipx { position: absolute; top: 4px; right: 4px; width: 34px; height: 34px; min-width: 34px; border-radius: 50%; border: 2px solid rgba(26,15,46,0.55);
  background: #fff7e6; color: #1a0f2e; font: 900 16px/1 system-ui, sans-serif; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3); touch-action: manipulation; }
.note.tip .tipx:hover, .note.tip .tipx:focus-visible { background: #ffe08a; outline: 2px solid #ffd23a; outline-offset: 1px; }
/* weapon unlock path: "Reach X Lv100 to unlock" + "Unlock now (X/3)" (dark ink on a light button for legibility) */
.btn.wad { background: linear-gradient(#9fe8ff, #4cc9f0); color: #1a0f2e; text-shadow: none; font-weight: 900; min-height: 36px; }
.btn.wad .tmr, .btn.wad b { color: #1a0f2e; }
.btn.wad.locked { filter: none; opacity: 1; background: linear-gradient(#e6e1ee, #c9c1d6); color: #1a0f2e; }
.wgate { margin-top: 4px; font-size: 12px; }
.wgate .wgt { color: #fff; }
.wgate .gbar { height: 10px; margin: 3px 0 2px; }
.wgate .gbar i { background: linear-gradient(90deg, #ffd23a, #ff9f43); }
.wgate .wgl { font-size: 11px; opacity: 0.9; }
.wgate.ok { color: #a3e635; }
.row.wlock .btn.gold { filter: grayscale(0.6); }
/* drawn item icons (replace emoji: Windows 10 has no glyph for the newer ones) */
.iimg { display: block; width: 86%; height: 86%; object-fit: contain; pointer-events: none; user-select: none; }
.row .icon img.iimg { width: 86%; height: 86%; object-fit: contain; }
.iimg.dimi { opacity: 0.45; filter: grayscale(0.6); }
.chip .iimg { width: 72%; height: 72%; }
.modal .big-ico .iimg { width: 72px; height: 72px; margin: 0 auto; }
.wtrack .wpv { width: 64px; height: 40px; background: rgba(255, 255, 255, 0.1); border: 2px solid var(--ink); border-radius: 8px; }
.wtrack .wpv { display: grid; place-items: center; width: 52px; height: 52px; flex: none; }
.wtrack .wpv .iimg { width: 92%; height: 92%; }
/* i18n: long localized titles/labels (de, ja, zh...) must not run under the close button or widen grids */
.modal h2 { padding: 0 40px; overflow-wrap: anywhere; }
html:lang(ja) .modal h2, html:lang(zh-Hans) .modal h2, html:lang(ko) .modal h2, html:lang(de) .modal h2 { font-size: 22px; }
.cigrid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.ciday { min-width: 0; }
.ciday small { overflow-wrap: anywhere; hyphens: auto; }

/* ad blocker detected (CrazyGames rule): video buttons look disabled; a tap shows the notice instead of an ad */
body.adblock button:has(> .adico) { filter: grayscale(1); opacity: 0.55; }
body.adblock .adico { background: #777; }
/* CrazyGames rewarded-ad rule: "continue without watching" must match the ad button (same size, font, colour).
   Only offers that carry the video icon are affected; free/no-SDK dialogs keep their usual ghost secondary button. */
.modal .mbtns:has(> .btn > .adico) > .btn { flex: 1 1 0; min-width: 0; max-width: 240px; }
.modal .mbtns:has(> .btn > .adico) > .btn.ghost { background: linear-gradient(180deg, #fde68a, #f59e0b); color: var(--ink); }
.modal .mbtns:has(> .btn > .adico) > .btn.ghost::after { opacity: 1; }
/* perf: the ready glow animates the opacity of a pre-drawn halo (compositor only) instead of box-shadow (a repaint per frame) */
.dk.hold.ready, .dk.boost.ready, .xb.ready { animation: none; }
.dk.hold.ready::before, .dk.boost.ready::before, .xb.ready::before { content: ''; position: absolute; inset: -3px; border-radius: inherit; box-shadow: 0 0 9px rgba(255, 210, 58, 0.35); opacity: 0; pointer-events: none; animation: haloPulse 3s ease-in-out infinite; will-change: opacity; }
@keyframes haloPulse { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }
body.calm .dk.hold.ready::before, body.calm .dk.boost.ready::before, body.calm .xb.ready::before { animation: none; opacity: 0.6; }

/* ---------- full-bleed phones: art/backgrounds run edge to edge, HUD + buttons stay inside the safe area ----------
   --st-l / --st-b / --st-r = how much of the screen inset the STAGE itself touches (0 on desktop, where env() is 0). */
:root { --sa-t: env(safe-area-inset-top, 0px); --sa-r: env(safe-area-inset-right, 0px); --sa-b: env(safe-area-inset-bottom, 0px); --sa-l: env(safe-area-inset-left, 0px);
  --st-l: var(--sa-l); --st-b: var(--sa-b); --st-r: 0px; }
#app { padding: 0 !important; }
#hud { padding-left: calc(10px + var(--sa-l)); padding-right: calc(10px + var(--sa-r)); }
#cv { left: var(--st-l); width: calc(100% - var(--st-l)); }
#sceneBtns { left: var(--st-l); }
#cvBleed { position: absolute; left: 0; top: 0; height: 100%; width: var(--st-l); display: block; pointer-events: none; }
#vig { z-index: 0; }
#waveBox, #bossBox { margin-left: calc(var(--st-l) / 2); }
#xbar { left: calc(10px + var(--st-l)); }
#barBox { left: calc(10px + var(--st-l)); bottom: calc(10px + var(--st-b)); }
#comboBox { bottom: calc(10px + var(--st-b)); margin-left: calc(var(--st-l) / 2); }
.pill { bottom: calc(10px + var(--st-b)); right: calc(10px + var(--st-r)); }
#dock { right: calc(10px + var(--st-r)); bottom: calc(52px + var(--st-b)); }
#dock.horiz { bottom: calc(48px + var(--st-b)); }
#panel { padding-right: var(--sa-r); padding-bottom: var(--sa-b); }
#tutBubble { bottom: calc(18px + var(--st-b)); }
@media (orientation: landscape) and (max-height: 500px) {
  #hud { padding-left: calc(8px + var(--sa-l)); padding-right: calc(8px + var(--sa-r)); }
  #barBox { left: calc(6px + var(--st-l)); bottom: calc(6px + var(--st-b)); }
  #comboBox { bottom: calc(6px + var(--st-b)); }
  .pill { bottom: calc(6px + var(--st-b)); right: 8px; }
  #dock { bottom: calc(44px + var(--st-b)); }
  #panel { width: calc(clamp(290px, 40vw, 380px) + var(--sa-r)); }
  .row { gap: 8px; padding: 5px 8px; margin-bottom: 6px; }
  .row .icon { width: 36px; height: 36px; font-size: 19px; }
  .row .icon > .ic { width: 24px; height: 24px; }
  .row .t { font-size: 14px; }
  .row .s { font-size: 11px; line-height: 1.25; }
  .row .ms, .nextms { font-size: 10px !important; }
  .row .msb { flex-basis: 40px; }
}
/* portrait phones: taller scene (~55% of the usable height), compact upgrade cards, boosts clear of the edge and each other */
@media (orientation: portrait), (max-width: 760px) and (min-height: 501px) {
  :root { --st-l: 0px; --st-b: 0px; --st-r: var(--sa-r); }
  #hud { padding-left: calc(6px + var(--sa-l)); padding-right: calc(6px + var(--sa-r)); }
  #stage { height: 56%; min-height: 250px; }
  #panel { padding-right: 0; padding-bottom: 0; }
  #tabs { padding-left: calc(4px + var(--sa-l)); padding-right: calc(4px + var(--sa-r)); }
  #barBox { left: calc(6px + var(--sa-l)); bottom: 6px; }
  #comboBox { bottom: 6px; margin-left: 0; }
  .pill { bottom: 6px; right: calc(8px + var(--sa-r)); }
  #dock { right: calc(12px + var(--sa-r)); bottom: 44px; gap: 12px; }
  #dock.horiz { bottom: 44px; }
  #toasts { right: calc(72px + var(--sa-r)); }
  #tabBody { padding: 8px; }
  .row { gap: 8px; padding: 5px 8px; margin-bottom: 6px; border-radius: 12px; }
  .row .icon { width: 36px; height: 36px; font-size: 19px; border-radius: 10px; }
  .row .icon > .ic { width: 24px; height: 24px; }
  .row .icon.gemico > .ic { width: 27px; height: 27px; }
  .row .t { font-size: 14px; gap: 4px; }
  .row .t .lv { font-size: 10px; }
  .row .s { font-size: 11px; line-height: 1.25; margin-top: 1px; }
  .row .s .dsc { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
  .row .ms { margin-top: 2px; gap: 5px; font-size: 10px !important; line-height: 1.2; }
  .row .msb { flex-basis: 40px; height: 5px; }
  .nextms { font-size: 10px !important; }
  .row .btn { min-height: 44px; padding-top: 4px; padding-bottom: 4px; }
}
.row .s .dsc { display: block; }
@media (orientation: portrait), (max-width: 760px) and (min-height: 501px) {
  .row .s .dsc { display: -webkit-box; }
}
/* portrait phones v2 (user: panel must be clearly smaller, no collapse): HUD+scene ~60% / panel incl. tab bar ~40% of the usable height,
   single-line title, 2-line description, 1-line effect/milestone, buttons stay >= 44px */
@media (orientation: portrait), (max-width: 760px) and (min-height: 501px) {
  #stage { flex: 1 1 auto; height: auto; min-height: 220px; }
  #panel { flex: none; height: calc(0.40 * (var(--app-h, 100dvh) - var(--sa-t) - var(--sa-b)) + var(--sa-b)); min-height: 230px; }
  #tabs { padding-top: 3px; }
  #tabs button { padding: 3px 1px; }
  #tabBody { padding: 6px 7px; }
  #tabBody .sec { margin: 8px 2px 4px; font-size: 12px; } #tabBody > .sec:first-child { margin-top: 2px; }
  .row { gap: 7px; padding: 4px 7px; margin-bottom: 5px; min-height: 52px; }
  .row .icon { width: 32px; height: 32px; font-size: 17px; border-radius: 9px; }
  .row .icon > .ic { width: 22px; height: 22px; }
  .row .icon.gemico > .ic { width: 24px; height: 24px; }
  .row .t { font-size: 13.5px; line-height: 1.15; flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
  .row .t .lv { font-size: 9.5px; padding: 0 5px; flex: none; }
  .row .s { font-size: 10.5px; line-height: 1.22; margin-top: 1px; }
  .row .s .dsc { -webkit-line-clamp: 2; line-clamp: 2; }
  .row .s .dsc + [data-u] { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .row .ms { margin-top: 1px; font-size: 9.5px !important; line-height: 1.15; white-space: nowrap; overflow: hidden; }
  .row .ms > span { overflow: hidden; text-overflow: ellipsis; }
  .nextms { font-size: 9.5px !important; }
  .row .btn { min-height: 44px; }
  #tabs button { padding: 2px 1px 3px; gap: 0; font-size: 10.5px; }
  #tabs button i { font-size: 17px; }
  .buyamt { padding: 2px; border-radius: 10px; }
  .buyamt button { padding: 2px 12px; min-height: 26px; font-size: 12px; }
  .buyamt button::after { inset: -9px 0; } /* keeps a 44px hit box */
  #tabs { padding-top: 2px; padding-bottom: calc(2px + var(--sa-b)); }
  #tabs button { min-height: 44px; }
  .row { padding-top: 3px; padding-bottom: 3px; margin-bottom: 4px; }
  .row .s { font-size: 11px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
  .row .s .dsc, .row .s .dsc + [data-u] { display: inline; white-space: normal; }
  .row .s .dsc + [data-u]:not(:empty)::before { content: ' · '; }
  .row .ms, .nextms { font-size: 10px !important; }
}
/* landscape phones v2: narrower side panel so the scene gets more width */
@media (orientation: landscape) and (max-height: 500px) {
  #panel { width: calc(clamp(250px, 33vw, 320px) + var(--sa-r)); }
  .row .t { flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
  #tabBody { padding: 6px 7px; }
  .row { gap: 6px; padding: 3px 6px; margin-bottom: 4px; }
  .row .icon { width: 30px; height: 30px; font-size: 16px; border-radius: 9px; }
  .row .icon > .ic { width: 20px; height: 20px; }
  .row .t { font-size: 13px; line-height: 1.15; }
  .row .t .lv { font-size: 9.5px; padding: 0 5px; flex: none; }
  .row .s { font-size: 10.5px; line-height: 1.22; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
  .row .s .dsc, .row .s .dsc + [data-u] { display: inline; }
  .row .s .dsc + [data-u]:not(:empty)::before { content: ' · '; }
  .row .ms { margin-top: 1px; gap: 4px; line-height: 1.15; white-space: nowrap; overflow: hidden; font-size: 9.5px !important; }
  .row .ms > span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .row .msb { flex-basis: 28px; }
  .row .btn { min-height: 44px; padding-left: 8px; padding-right: 8px; }
  .buyamt button { padding: 2px 10px; min-height: 26px; }
  .buyamt button::after { inset: -9px 0; }
}

/* ---------- round 9: touch ---------- */
button, [data-act] { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
/* ---------- round 9: power buttons (hold-fire, x2 Passive, x2 Click) + wheel/check-in as compact round icons in the HUD bar ---------- */
:root { --hi: 44px; --hg: 8px; }
#hud #dock { position: static; display: flex; flex-direction: row-reverse; gap: var(--hg); margin: 0 0 0 2px; z-index: auto; right: auto; bottom: auto; flex: none; }
#hud #dock.hidden { display: none; }
#hud #xbar { position: static; flex-direction: row; gap: var(--hg); margin: 0; flex: none; z-index: auto; }
#hud .dk, #hud .xb { width: var(--hi); height: var(--hi); flex: none; border-width: 3px; }
#hud .xb { font-size: calc(var(--hi) * 0.46); }
#hud .dk::after, #hud .xb::after { content: ''; position: absolute; top: -9px; bottom: -9px; left: calc(-3px - var(--hg) / 2); right: calc(-3px - var(--hg) / 2); border-radius: 12px; } /* invisible hit box: whole gap + taller than the icon */
#hud .dk .ic { margin-top: 0; font-size: calc(var(--hi) * 0.42); }
#hud .dk .ic .ic, #hud .dk .ic svg { width: calc(var(--hi) * 0.44); height: calc(var(--hi) * 0.44); }
#hud .dk .lb, #hud .dk.cool .lb, #hud .dk.on .lb, #hud .dk.hold.ready .lb { left: 50%; right: auto; bottom: -7px; transform: translateX(-50%); background: #f6f1ff; color: #1a0f2e; border: 2px solid #1a0f2e;
  border-radius: 7px; padding: 0 4px; font-size: 10px; line-height: 12px; text-shadow: none; white-space: nowrap; background-clip: padding-box; z-index: 1; }
#hud .dk.hold.ready .lb { background: #ffd23a; color: #2a1a00; }
#hud .dk.on .lb { background: #d9fbb4; }
#hud .dk.hold.on .lb { background: #ffe2b8; }
#hud .dk .lb:empty { display: none; }
#hud .dk .x2 { top: -6px; left: -7px; font-size: 9px; line-height: 12px; padding: 0 3px; border-radius: 6px; }
#hud .dk .badge { top: -6px; right: -7px; min-width: 15px; height: 15px; font-size: 9px; line-height: 11px; border-radius: 8px; }
#hud .xb .badge { top: -5px; right: -6px; min-width: 15px; height: 15px; font-size: 10px; line-height: 11px; }
#hud .dk .ring { inset: -3px; }
@media (pointer: coarse) { #hud { padding-top: calc(var(--sa-t) + 2px); } }
/* phone landscape */
@media (orientation: landscape) and (max-height: 500px) { :root { --hi: 38px; --hg: 8px; } #hud { gap: 8px; } }
/* phone portrait: 393px must hold crystals, gems, 3 power + 2 daily icons and settings; Sound moves into Settings (toggle there + M key) */
@media (orientation: portrait), (max-width: 760px) and (min-height: 501px) {
  :root { --hi: 34px; --hg: 6px; }
  #hud #xbar { margin-left: 1px; } /* dock-to-xbar gap = --hg so hit boxes split evenly */
  #hud { gap: 5px; }
  #hud .brand { display: none; }
  #hud .cur { padding: 2px 7px 2px 3px; gap: 3px; font-size: 14px; flex: none; }
  #hud .cur .ico .ic { width: 18px; height: 18px; }
  #hud .dk .lb, #hud .dk.cool .lb, #hud .dk.on .lb, #hud .dk.hold.ready .lb { font-size: 9px; line-height: 11px; padding: 0 3px; bottom: -6px; }
  #hud .xb .badge { min-width: 14px; height: 14px; font-size: 9px; line-height: 10px; }
}
@media (orientation: portrait) and (max-width: 440px), (max-width: 440px) and (min-height: 501px) {
  #btnSound { display: none; }
  #curSerum, #curFrag { display: none !important; } /* balances are shown in the Rebirth tab */
  #hud .cur { padding: 2px 5px 2px 2px; gap: 2px; font-size: 13px; flex: 0 1 auto; min-width: 0; letter-spacing: -0.2px; } /* late-game numbers (716ag / 100.0K) must not push the icons off-screen */
  #hud .cur .ico .ic { width: 16px; height: 16px; }
  #hud .cur .val { min-width: 0; overflow: hidden; white-space: nowrap; }
  #hud .spacer { min-width: 0; }
  #btnSettings { min-width: 38px; width: 38px; padding: 0; position: relative; }
  #btnSettings::after { content: ''; position: absolute; top: -5px; bottom: -5px; left: -4px; right: -9px; } /* 44+ px hit box, reaching the screen edge */
}
.sbtn::before { content: ''; position: absolute; inset: -8px; border-radius: 50%; } /* >= 46px hit circle around the "+" */
@media (orientation: portrait), (max-width: 760px) and (min-height: 501px) { #toasts { right: calc(8px + var(--sa-r)); } }
/* round 9: every tab fits the narrow phone panels in all 13 languages (titles wrap instead of clipping, compact milestone,
   x1/x10/MAX wraps under the heading when the heading is long, narrower price buttons so the text column is wider) */
@media (orientation: landscape) and (max-height: 500px), (orientation: portrait), (max-width: 760px) and (min-height: 501px) {
  .toolbar { flex-wrap: wrap; row-gap: 4px; }
  .toolbar > .sec { flex: 1 0 auto !important; min-width: 0; }
  .toolbar > .buyamt { margin-left: auto; }
  .row .t { white-space: normal; flex-wrap: wrap; overflow: visible; row-gap: 1px; overflow-wrap: break-word; }
  .row .t .rar { font-size: 9px !important; padding: 0 4px; letter-spacing: 0.02em; }
  .row .t .stars { font-size: 10px; }
  .row .ms { white-space: normal; overflow: visible; align-items: center; }
  .row .ms > span { white-space: normal; overflow: visible; text-overflow: clip; min-width: 0; overflow-wrap: anywhere; }
  .row .btn { min-width: 70px; padding-left: 6px; padding-right: 6px; }
  .row .btn-col { min-width: 0; }
  .row .btn-col .btn { min-width: 64px; }
  .stats { gap: 5px; }
  .stat { padding: 5px 6px; min-width: 0; }
  .stat small { font-size: 9px; letter-spacing: 0; overflow-wrap: break-word; hyphens: auto; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .buyamt button { min-width: 40px; padding: 2px 6px; }
  .buyamt button::after { inset: -9px -2px; } /* 44 x 44 hit box */
}
.row .s .ds { display: none; }
@media (orientation: landscape) and (max-height: 500px), (orientation: portrait), (max-width: 760px) and (min-height: 501px) {
  .row .s .dl { display: none; }
  .row .s .ds { display: inline; }
  /* only upgrade cards (description + live effect) are clamped to 2 lines; crates, offers, districts, squad stats, notes show in full */
  .row .s:not(:has(> .dsc)) { display: block; -webkit-line-clamp: none; line-clamp: none; overflow: visible; }
}
.row .s .arw { font-style: normal; opacity: .75; }
.row .s .dsc + [data-u]:has(> .arw)::before { content: ' ' !important; }
@media (orientation: landscape) and (max-height: 500px) {
  .row { gap: 4px; padding-left: 4px; padding-right: 4px; }
  .row .btn { min-width: 62px; padding-left: 4px; padding-right: 4px; }
}

/* Settings > Language picker */
.langsel { font: inherit; font-size: 14px; font-weight: 600; color: #1e1633; background: #fff3d6; border: 3px solid #1e1633; border-radius: 10px; padding: 4px 8px; max-width: 52%; cursor: pointer; }
.langsel:focus-visible { outline: 3px solid #ffd23a; outline-offset: 2px; }
/* Rival Squads (weekly offline leaderboard vs fictional AI squads) */
.rivm .rivsub { font-size: 12.5px; opacity: .9; margin: 4px 0 6px; }
.rivm .rivend { font-size: 13px; margin: 0 0 6px; }
.rivlist { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 3px; text-align: left; }
.rivrow { display: grid; grid-template-columns: 26px 26px minmax(0, 1fr) auto; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 10px; background: rgba(0, 0, 0, .22); font-size: 13.5px; }
.rivrow .rk { font-weight: 800; text-align: center; opacity: .85; }
.rivrow .em { font-size: 17px; text-align: center; }
.rivrow .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rivrow .sc { font-weight: 800; font-variant-numeric: tabular-nums; }
.rivrow.me { background: linear-gradient(90deg, rgba(255, 210, 58, .35), rgba(255, 210, 58, .12)); outline: 2px solid #ffd23a; }
.rivrow:nth-child(-n+3) .rk { color: #ffd23a; }
.rivm .rivrwh { margin: 4px 0; }
.rivtiers { display: flex; flex-direction: column; gap: 2px; font-size: 12px; text-align: left; }
.rivtier { padding: 2px 8px; border-radius: 8px; overflow-wrap: anywhere; }
.rivtier.cur { background: rgba(255, 210, 58, .2); }
.rivcard.locked .s { font-size: 12px; }
@media (max-height: 520px) { .rivrow { padding: 2px 8px; font-size: 12.5px; } .rivm .rivsub { font-size: 11.5px; } }
/* P7: Rebirth available -> red tab highlight (every run) */
#tabs button.rebready { --ac: var(--red); color: #fff; background: color-mix(in srgb, var(--red) 30%, transparent); box-shadow: inset 0 -3px 0 var(--red), 0 0 0 2px color-mix(in srgb, var(--red) 70%, transparent); animation: rebRed 2.2s ease-in-out infinite; }
#tabs button.rebready.on { box-shadow: inset 0 3px 0 var(--red), 0 0 0 2px color-mix(in srgb, var(--red) 70%, transparent); }
@keyframes rebRed { 0%, 100% { filter: none; } 50% { filter: drop-shadow(0 0 6px rgba(255, 77, 94, 0.75)); } }
.btn.purple.rebready { background: linear-gradient(180deg, #ff8a95, #e63946); color: #fff; }
body.calm #tabs button.rebready { animation: none; }
@media (prefers-reduced-motion: reduce) { #tabs button.rebready { animation: none; } }
/* P8: boost stack ladder */
.dk.boost .badge { padding: 0 3px; white-space: nowrap; font-family: var(--font-b); font-weight: 800; }
.dk.boost.full .badge { background: #2f9e44; }
.dk.boost.full .arc { stroke: #69db7c; }
.adbl { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 2px 0 10px; }
.adbl span { padding: 3px 8px; border-radius: 9px; border: 2px solid var(--ink); background: rgba(255, 255, 255, 0.08); color: var(--muted); font-family: var(--font-b); font-weight: 800; font-size: 13px; white-space: nowrap; }
.adbl span.done { background: #2f6b12; color: #d9fbb4; }
.adbl span.nx { background: #ffd23a; color: #2a1a00; }
/* P8: a running boost shows "+Xm"/MAX centred on top (the green ring + time label already say it is on), so the x2 chip makes room */
.dk.boost.on .x2 { display: none; }
.dk.boost.on .badge, #hud .dk.boost.on .badge { right: auto; left: 50%; transform: translateX(-50%); }
/* P10 (t376u): no working Guard/Scavenger = passive +0/s warning */
.note.warn { color: #ffd6d6; background: rgba(230, 57, 70, 0.22); border: 2px solid #e63946; font-weight: 700; overflow-wrap: anywhere; }
.note.warn b { color: #fff; }
.tipwarn { color: #ff8a8a; font-weight: 700; }

/* P15 hidden playtest log button (only with ?playtest=1) */
#ptLog{position:fixed;left:calc(env(safe-area-inset-left,0px) + 2px);top:50%;transform:translateY(-50%);z-index:9000;padding:3px 6px;font:600 10px/1 system-ui,sans-serif;color:#cfe;background:rgba(0,0,0,.45);border:1px solid rgba(255,255,255,.25);border-radius:6px;opacity:.6;touch-action:manipulation;cursor:pointer}
#ptLog.inStage{position:absolute;transform:none}
#ptLog:active{opacity:1}

/* P16: hold-fire button while x2 Auto-fire runs */
.dk.hold.x2on .ring .arc { stroke: #ffd23a; }
