@font-face {
  font-family: 'Fredoka';
  src: url(fonts/fredoka.woff2) format('woff2');
  font-weight: 300 700;
  font-display: swap;
}
:root {
  --u: 1;
  --navy: #0a2a44;
  --panel: rgba(7, 30, 52, 0.9);
  --panel2: rgba(12, 48, 78, 0.92);
  --aqua: #5fe0e6;
  --gold: #ffd75e;
  --coral: #ff7b6b;
  --text: #f2fbff;
  --dim: #9fc3d6;
  --fs: calc(var(--u) * 15px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden; background: #0b3a52;
  position: fixed; inset: 0;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-text-size-adjust: 100%;
  font-family: 'Fredoka', ui-rounded, 'Segoe UI', system-ui, sans-serif;
  color: var(--text);
  font-size: var(--fs);
}
canvas#game { position: absolute; left: 0; top: 0; display: block; touch-action: none; }
#ui, #modals { position: absolute; inset: 0; pointer-events: none; }
#modals > .modal { pointer-events: auto; }
.screens { pointer-events: auto; }
.hud { position: absolute; inset: 0; pointer-events: none; }
.hud > .hud-top, .hud > .hud-bar { pointer-events: auto; }
button { font-family: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; touch-action: manipulation; }
button:focus { outline: none; }
body.pad button:focus { outline: 3px solid #fff; outline-offset: 2px; }
.ic { width: 1.25em; height: 1.25em; display: inline-block; vertical-align: middle; flex: none; }
.hidden { display: none !important; }

/* ---------------- loading */
#loading { position: absolute; inset: 0; background: radial-gradient(circle at 50% 40%, #1a6f8a, #072438); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 50; transition: opacity .5s; }
#loading.done { opacity: 0; pointer-events: none; }
.ld-logo { font-size: 44px; font-weight: 700; letter-spacing: 1px; color: #fff; text-shadow: 0 3px 0 #0a4a63, 0 0 30px rgba(120,240,255,.5); }
.ld-bub { display: flex; gap: 10px; margin-top: 18px; }
.ld-bub i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #bff6ff; animation: ldb 1s infinite ease-in-out; }
.ld-bub i:nth-child(2) { animation-delay: .15s; } .ld-bub i:nth-child(3) { animation-delay: .3s; }
@keyframes ldb { 0%, 100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(-10px); opacity: 1; } }

/* ---------------- HUD top */
.hud-top {
  position: absolute; display: flex; align-items: center; gap: calc(var(--u) * 6px);
  padding: 0 calc(var(--u) * 8px);
  background: linear-gradient(rgba(4,22,40,.85), rgba(4,22,40,.55));
  border-bottom: 1px solid rgba(160, 230, 255, 0.15);
}
.hud-top .spacer { flex: 1; }
.stat {
  display: flex; align-items: center; gap: 4px;
  background: rgba(0,0,0,.28); border-radius: 999px;
  padding: calc(var(--u) * 3px) calc(var(--u) * 10px) calc(var(--u) * 3px) calc(var(--u) * 5px);
  font-weight: 600; font-size: calc(var(--u) * 17px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
  white-space: nowrap;
}
.stat .ic { width: calc(var(--u) * 22px); height: calc(var(--u) * 22px); }
.stat b { font-weight: 700; display: inline-block; min-width: 1.2em; }
.stat.gold b { color: #ffe680; }
.stat.wave b { color: #bff6ff; }
.bump { animation: bump .25s ease-out; }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.3); } 100% { transform: scale(1); } }
.stat.deny { animation: deny .4s; }
@keyframes deny { 0%, 100% { transform: translateX(0); background: rgba(0,0,0,.28); } 20%, 60% { transform: translateX(-4px); background: rgba(200,40,40,.6); } 40%, 80% { transform: translateX(4px); } }
.hbtn {
  height: max(40px, calc(var(--u) * 36px)); min-width: max(42px, calc(var(--u) * 40px)); border-radius: 12px;
  display: flex; align-items: center; justify-content: center; gap: 2px;
  background: linear-gradient(#2b7e9c, #1b5a76); box-shadow: 0 3px 0 #0d3a52, inset 0 1px 0 rgba(255,255,255,.25);
  font-weight: 700; font-size: calc(var(--u) * 14px); padding: 0 8px;
}
.hbtn .ic { width: calc(var(--u) * 20px); height: calc(var(--u) * 20px); }
.hbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 #0d3a52; }
.hbtn.on { background: linear-gradient(#ffcf4d, #ff9f1c); color: #4a2400; box-shadow: 0 3px 0 #9a5200, inset 0 1px 0 rgba(255,255,255,.5); }
.land .stat { font-size: calc(var(--u) * 15px); padding-top: 2px; padding-bottom: 2px; }
.land .stat .ic { width: calc(var(--u) * 19px); height: calc(var(--u) * 19px); }

/* ---------------- control bar */
.hud-bar {
  position: absolute; display: flex; align-items: center; justify-content: center;
  gap: calc(var(--u) * 10px); padding: calc(var(--u) * 8px);
  background: linear-gradient(rgba(4,22,40,.55), rgba(4,22,40,.9));
  border-top: 1px solid rgba(160, 230, 255, 0.15);
}
.hud-bar.side { flex-direction: column; justify-content: flex-end; border-top: 0; border-left: 1px solid rgba(160,230,255,.15); background: linear-gradient(90deg, rgba(4,22,40,.6), rgba(4,22,40,.9)); padding-bottom: calc(var(--u) * 12px); }
.abil {
  position: relative; width: calc(var(--u) * 58px); height: calc(var(--u) * 58px); flex: none;
  border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-direction: column;
  background: radial-gradient(circle at 40% 30%, #4fa6c4, #1d5f7a 70%); box-shadow: 0 4px 0 #0d3a52, inset 0 2px 0 rgba(255,255,255,.3);
  color: #fff; overflow: hidden;
}
.abil .ic { width: 52%; height: 52%; margin-top: -6%; }
.abil .aname { position: absolute; bottom: 5%; font-size: calc(var(--u) * 9.5px); font-weight: 600; opacity: .9; }
.abil::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(rgba(0,10,20,.68) calc(var(--cd, 0) * 360deg), transparent 0); pointer-events: none; }
.abil .cdring { position: absolute; z-index: 2; font-weight: 700; font-size: calc(var(--u) * 18px); text-shadow: 0 2px 2px #000; }
.abil.ready { animation: ready 2.2s infinite; }
@keyframes ready { 0%, 100% { box-shadow: 0 4px 0 #0d3a52, inset 0 2px 0 rgba(255,255,255,.3), 0 0 0 0 rgba(120,240,255,0); } 50% { box-shadow: 0 4px 0 #0d3a52, inset 0 2px 0 rgba(255,255,255,.3), 0 0 14px 3px rgba(120,240,255,.6); } }
.abil.aim { background: radial-gradient(circle at 40% 30%, #ffe07a, #ff9f1c 70%); color: #4a2400; }
.abil:active { transform: translateY(2px); }
.wavebtn {
  position: relative; flex: 1; max-width: calc(var(--u) * 230px); height: calc(var(--u) * 58px);
  border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(#5fd38a, #2e9d5b); box-shadow: 0 4px 0 #155f33, inset 0 2px 0 rgba(255,255,255,.35);
  font-weight: 700; color: #fff; text-shadow: 0 2px 0 rgba(0,60,20,.5); overflow: hidden; padding: 0 8px;
}
.hud-bar.side .wavebtn { flex: none; width: 100%; height: calc(var(--u) * 86px); padding: 0 4px; }
.hud-bar.side .wavebtn .wmain { font-size: calc(var(--u) * 16px); gap: 3px; }
.hud-bar.side .wavebtn.start .wmain { font-size: calc(var(--u) * 18px); }
.hud-bar.side .wavebtn .wmain .ic { width: calc(var(--u) * 14px); height: calc(var(--u) * 14px); }
.land .info { font-size: calc(var(--u) * 11.5px); padding: 6px 8px; }
.land .info .ih img { width: calc(var(--u) * 32px); height: calc(var(--u) * 32px); }
.land .info .in { font-size: calc(var(--u) * 14px); }
.land .info .id { font-size: calc(var(--u) * 11px); }
.land .info .sr { font-size: calc(var(--u) * 11px); }
.land .info .stats { grid-template-columns: 1fr; margin-top: 3px; }
.land .info .tags { display: none; }
.wavebtn .wmain { display: flex; align-items: center; gap: 6px; font-size: calc(var(--u) * 19px); line-height: 1.1; position: relative; z-index: 1; }
.wavebtn .wmain .ic { width: calc(var(--u) * 20px); height: calc(var(--u) * 20px); }
.wavebtn .ws { font-size: calc(var(--u) * 12px); font-weight: 600; opacity: .95; display: flex; align-items: center; gap: 2px; position: relative; z-index: 1; }
.wavebtn .ws .ic { width: 1.1em; height: 1.1em; }
.wavebtn .wp { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 1px; z-index: 1; }
.hud-bar.side .wavebtn .wp { position: static; transform: none; flex-direction: row; margin-top: 2px; }
.wavebtn .pv { display: flex; align-items: center; font-size: calc(var(--u) * 10px); font-weight: 700; background: rgba(0,0,0,.22); border-radius: 8px; padding: 0 4px 0 0; }
.wavebtn .pv img { width: calc(var(--u) * 18px); height: calc(var(--u) * 18px); }
.wavebtn .pv.boss { background: rgba(200,20,40,.6); }
.wavebtn .wtimer { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--t, 0) * 100%); background: rgba(255,255,255,.18); }
.wavebtn.start { background: linear-gradient(#ffcf4d, #ff9f1c); box-shadow: 0 4px 0 #9a5200, inset 0 2px 0 rgba(255,255,255,.5); color: #4a2400; text-shadow: none; }
.wavebtn.start .wmain { font-size: calc(var(--u) * 22px); }
.wavebtn.off { background: linear-gradient(#3e6b80, #2a4f62); box-shadow: 0 4px 0 #15303e; color: #cfe6f0; text-shadow: none; }
.wavebtn.off .wmain .ic { display: none; }
.wavebtn:not(.off):active { transform: translateY(2px); }
.wavebtn.hint, .wavebtn.start { animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* ---------------- ring */
.hud .ring { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.hud .ring > .ropt { pointer-events: auto; }
.rdot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: #9ff3ff; box-shadow: 0 0 10px #9ff3ff; pointer-events: none; }
.ropt {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, rgba(255,255,255,.95), rgba(200,235,250,.9) 60%, rgba(150,200,225,.9));
  box-shadow: 0 4px 10px rgba(0,20,40,.5), inset 0 -3px 0 rgba(0,40,70,.25), 0 0 0 2px rgba(255,255,255,.8);
  display: flex; align-items: center; justify-content: center;
  animation: ropt .18s ease-out backwards;
  color: #0b3a52;
}
@keyframes ropt { from { transform: scale(.3); opacity: 0; } }
.ropt img { width: 92%; height: 92%; margin-top: -10%; pointer-events: none; }
.ropt .ri { display: flex; margin-top: -12%; }
.ropt .ri .ic { width: calc(var(--u) * 26px); height: calc(var(--u) * 26px); }
.ropt.k-sell .ri .ic { width: calc(var(--u) * 28px); height: calc(var(--u) * 28px); }
.ropt.k-upgrade { background: radial-gradient(circle at 40% 30%, #c8ffd8, #6fdc94 60%, #3fae68); color: #0d4a24; }
.ropt .rl {
  position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%);
  background: #0b2a44; color: #fff; border-radius: 999px; padding: 1px 7px;
  font-size: calc(var(--u) * 12px); font-weight: 700; white-space: nowrap; box-shadow: 0 2px 0 rgba(0,0,0,.35);
}
.ropt .rl.cost { color: #ffe680; }
.ropt.poor img { filter: grayscale(.85) brightness(.85); }
.ropt.poor .rl { color: #ff8a8a; }
.ropt.dis { opacity: .55; }
.ropt .rcheck { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; background: #2e9d5b; color: #fff; display: none; align-items: center; justify-content: center; box-shadow: 0 2px 4px rgba(0,0,0,.4); }
.ropt .rcheck .ic { width: 16px; height: 16px; }
.ropt.armed { box-shadow: 0 0 0 4px #ffe680, 0 0 18px 4px rgba(255,230,120,.8); transform: scale(1.08); }
.ropt.armed .rcheck { display: flex; }
.ropt.armed.poor .rcheck { background: #b33; }
@media (hover: hover) and (pointer: fine) { .ropt:hover { transform: scale(1.08); box-shadow: 0 0 0 3px #ffe680, 0 6px 14px rgba(0,20,40,.5); } }

/* ---------------- info card */
.info {
  position: absolute; z-index: 6; pointer-events: none !important;
  background: var(--panel); border-radius: 14px; padding: calc(var(--u) * 8px) calc(var(--u) * 10px);
  box-shadow: 0 6px 20px rgba(0,0,0,.45), inset 0 0 0 1px rgba(160,230,255,.2);
  font-size: calc(var(--u) * 13px);
  animation: fadein .15s;
}
@keyframes fadein { from { opacity: 0; } }
.ih { display: flex; align-items: center; gap: 8px; }
.ih img { width: calc(var(--u) * 46px); height: calc(var(--u) * 46px); flex: none; }
.ih > div:nth-child(2) { flex: 1; min-width: 0; }
.in { font-weight: 700; font-size: calc(var(--u) * 16px); display: flex; align-items: center; gap: 6px; }
.in .lv { font-size: calc(var(--u) * 11px); font-weight: 600; background: rgba(95,224,230,.2); color: #9ff3ff; border-radius: 6px; padding: 0 5px; }
.id { color: var(--dim); font-size: calc(var(--u) * 12.5px); line-height: 1.25; }
.icost { font-weight: 700; color: #ffe680; font-size: calc(var(--u) * 16px); display: flex; align-items: center; gap: 3px; flex: none; }
.icost.poor { color: #ff8a8a; }
.icost.sellv { color: #9dff9d; }
.icost.hp { color: #ff9aa8; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 12px; margin-top: 6px; }
.sr { display: flex; justify-content: space-between; gap: 6px; font-size: calc(var(--u) * 12.5px); }
.sk { color: var(--dim); }
.sv { font-weight: 600; text-align: right; }
.sv em { color: #8dff9d; font-style: normal; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; justify-content: center; }
.tags span { font-size: calc(var(--u) * 11px); background: rgba(95,224,230,.15); color: #bff6ff; border-radius: 6px; padding: 1px 6px; }
.tstats { color: var(--dim); font-size: calc(var(--u) * 11.5px); margin-top: 4px; text-align: center; }

/* ---------------- boss bar & banners */
.bossbar { position: absolute; z-index: 4; pointer-events: none !important; text-align: center; }
.bossbar .bname { font-weight: 700; font-size: calc(var(--u) * 13px); color: #ffb3b3; text-shadow: 0 2px 0 #000; }
.bbar { height: calc(var(--u) * 10px); background: rgba(0,0,0,.6); border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 2px rgba(255,120,120,.5); }
.bbar i { display: block; height: 100%; width: 100%; background: linear-gradient(#ff6b6b, #c92a2a); transition: width .2s; }
.banners { position: absolute; z-index: 7; pointer-events: none !important; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.banner { text-align: center; animation: bannerIn .35s cubic-bezier(.2,1.4,.5,1); transition: opacity .4s, transform .4s; }
.banner.out { opacity: 0; transform: translateY(-20px); }
@keyframes bannerIn { from { transform: scale(.4); opacity: 0; } }
.banner .bt { font-weight: 700; font-size: calc(var(--u) * 30px); color: #fff; text-shadow: 0 3px 0 #0b3a52, 0 0 18px rgba(120,240,255,.6); -webkit-text-stroke: 1px rgba(11,58,82,.5); }
.banner .bs { font-weight: 600; font-size: calc(var(--u) * 15px); color: #ffe680; text-shadow: 0 2px 0 #0b3a52; }
.banner.boss .bt { color: #ff8a8a; font-size: calc(var(--u) * 34px); text-shadow: 0 3px 0 #4a0d0d, 0 0 20px rgba(255,80,80,.7); }
.banner.final .bt { color: #ffe680; }
.banner.tip .bt { font-size: calc(var(--u) * 20px); }

/* ---------------- tutorial */
.tut {
  position: absolute; z-index: 8; display: flex; align-items: center; gap: 10px;
  background: linear-gradient(#fffdf2, #fff3cf); color: #3a2a10; border-radius: 16px; padding: 10px 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,.4), 0 0 0 3px #ffd75e; font-weight: 500; font-size: calc(var(--u) * 15px); line-height: 1.25;
  pointer-events: none !important; animation: bannerIn .35s cubic-bezier(.2,1.4,.5,1);
}
.tut.neri { transition: opacity .4s, transform .4s; }
.tut.neri.out { opacity: 0; transform: translateY(-12px); }
.tutface { flex: none; width: calc(var(--u) * 52px); height: calc(var(--u) * 52px); border-radius: 50%; background: radial-gradient(circle at 50% 40%, #8fe3f0, #2a9fc0); box-shadow: inset 0 0 0 3px #ffd75e; animation: wiggle 2.4s infinite ease-in-out; }
@keyframes wiggle { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }

/* ---------------- modals & cards */
.modal { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(2,14,26,.55); z-index: 20; padding: 12px; animation: fadein .2s; }
.modal.out { opacity: 0; transition: opacity .2s; }
.mbox { width: min(calc(var(--u) * 400px), 100%); max-height: 100%; display: flex; flex-direction: column; animation: pop .3s cubic-bezier(.2,1.3,.5,1); }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }
.card {
  background: linear-gradient(#134a6e, #0b2f4b); border-radius: 22px; padding: calc(var(--u) * 16px);
  box-shadow: 0 10px 30px rgba(0,0,0,.5), inset 0 0 0 2px rgba(160,230,255,.25), inset 0 2px 0 rgba(255,255,255,.15);
  text-align: center; overflow-y: auto; max-height: calc(100vh - 110px);
}
.ctag { display: inline-block; font-weight: 700; font-size: calc(var(--u) * 12px); letter-spacing: .5px; text-transform: uppercase; color: #0b3a52; background: var(--aqua); border-radius: 999px; padding: 2px 10px; }
.enemycard.boss .ctag { background: #ff7b7b; color: #3a0a0a; }
.ctitle { font-weight: 700; font-size: calc(var(--u) * 26px); margin: 6px 0 2px; text-shadow: 0 2px 0 rgba(0,0,0,.3); }
.cdesc { color: #cfe8f3; font-size: calc(var(--u) * 15px); line-height: 1.3; margin: 4px 0; }
.cport { width: calc(var(--u) * 120px); height: calc(var(--u) * 120px); display: block; margin: 4px auto 0; filter: drop-shadow(0 6px 8px rgba(0,0,0,.4)); animation: float 3s infinite ease-in-out; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.ctip { margin-top: 10px; background: rgba(95,224,230,.14); border-radius: 12px; padding: 8px 10px; font-size: calc(var(--u) * 14px); color: #bff6ff; }
.bigicon { width: calc(var(--u) * 80px); height: calc(var(--u) * 80px); margin: 8px auto; color: #bff6ff; }
.bigicon .ic { width: 100%; height: 100%; }
.modlist { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.mod { background: rgba(0,0,0,.25); border-radius: 10px; padding: 6px 10px; font-size: calc(var(--u) * 14px); }
.mbtns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.btn {
  min-height: calc(var(--u) * 46px); padding: 0 calc(var(--u) * 18px); border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 700; font-size: calc(var(--u) * 17px); color: #fff;
  background: linear-gradient(#2f8fb0, #1d6383); box-shadow: 0 4px 0 #0d3a52, inset 0 2px 0 rgba(255,255,255,.25);
  text-shadow: 0 1px 0 rgba(0,0,0,.3);
}
.btn .ic { width: 1.2em; height: 1.2em; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #0d3a52; }
.btn.primary { background: linear-gradient(#ffcf4d, #ff9f1c); color: #4a2400; box-shadow: 0 4px 0 #9a5200, inset 0 2px 0 rgba(255,255,255,.5); text-shadow: none; }
.btn.primary:active { box-shadow: 0 1px 0 #9a5200; }
.btn.ghost { background: rgba(255,255,255,.1); box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.btn.danger { background: linear-gradient(#e05252, #a52a2a); box-shadow: 0 4px 0 #5a1010; }
.btn.small { min-height: calc(var(--u) * 38px); font-size: calc(var(--u) * 14px); }
.btn.big { min-height: calc(var(--u) * 64px); font-size: calc(var(--u) * 26px); padding: 0 calc(var(--u) * 40px); border-radius: 22px; }
.btn.round { width: calc(var(--u) * 46px); padding: 0; border-radius: 50%; }
.btn.rewind { background: linear-gradient(#a78bfa, #6d4fd6); box-shadow: 0 4px 0 #3b2585, inset 0 2px 0 rgba(255,255,255,.3); }
.btn.heroic-btn { background: linear-gradient(#ff8c42, #d9480f); box-shadow: 0 4px 0 #7a2600; }
.toggles { display: flex; gap: 10px; justify-content: center; margin: 12px 0 4px; flex-wrap: wrap; }
.toggle { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 14px; background: rgba(0,0,0,.25); font-weight: 600; font-size: calc(var(--u) * 15px); }
.toggle i { width: 36px; height: 20px; border-radius: 10px; background: #3a5566; position: relative; transition: background .2s; }
.toggle i::after { content: ''; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .2s; }
.toggle.on i { background: #2e9d5b; }
.toggle.on i::after { left: 18px; }
.keys { margin-top: 10px; font-size: calc(var(--u) * 12.5px); color: var(--dim); line-height: 1.5; }
.keys b { color: #fff; }
.keys .kh { font-weight: 700; color: #bff6ff; margin-top: 6px; }
.credits { margin-top: 10px; font-size: calc(var(--u) * 11px); color: #7fa6ba; }
@media (hover: none) { .keys { display: none; } }

/* boons */
.boonrow { display: flex; gap: 8px; margin-top: 10px; }
.boon { flex: 1; background: linear-gradient(#1f6d93, #154e6c); border-radius: 16px; padding: 10px 6px; box-shadow: 0 4px 0 #0b2f44, inset 0 0 0 2px rgba(160,230,255,.25); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.boon:active { transform: translateY(3px); }
.boon .bi { width: 40px; height: 40px; color: #ffe680; }
.boon .bi .ic { width: 100%; height: 100%; }
.boon .bn { font-weight: 700; font-size: calc(var(--u) * 14px); }
.boon .bd { font-size: calc(var(--u) * 12px); color: #cfe8f3; line-height: 1.2; }

/* results */
.result .rtitle { font-weight: 700; font-size: calc(var(--u) * 32px); text-shadow: 0 3px 0 rgba(0,0,0,.35); }
.result.win .rtitle { color: #ffe680; }
.result.lose .rtitle { color: #ffb3b3; }
.rsub { color: var(--dim); }
.rstars { display: flex; justify-content: center; gap: 6px; margin: 10px 0 4px; }
.rstar { width: calc(var(--u) * 62px); height: calc(var(--u) * 62px); animation: starIn .5s cubic-bezier(.2,1.6,.5,1) backwards; }
.rstar:nth-child(2) { transform: translateY(-10px); }
.rstar .ic { width: 100%; height: 100%; }
.rstar.lit .ic { filter: drop-shadow(0 0 10px rgba(255,200,100,.8)); }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); opacity: 0; } }
.rgain { font-weight: 600; color: #ffe680; display: flex; align-items: center; justify-content: center; gap: 4px; }
.rhint { color: var(--dim); font-size: calc(var(--u) * 13px); }
.rstats { display: flex; flex-direction: column; gap: 3px; margin: 10px auto 0; max-width: 260px; }
.rs { display: flex; justify-content: space-between; font-size: calc(var(--u) * 14px); color: var(--dim); }
.rs b { color: #fff; }
.rnews { margin-top: 10px; background: rgba(95,224,230,.14); border-radius: 12px; padding: 8px; font-weight: 600; color: #bff6ff; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rnt2 { display: flex; align-items: center; gap: 6px; color: #ffe680; }
.rnt2 img { width: 40px; height: 40px; }
.rtip { margin-top: 10px; display: flex; align-items: center; gap: 8px; text-align: left; background: rgba(0,0,0,.25); border-radius: 12px; padding: 8px 10px; font-size: calc(var(--u) * 14px); color: #e2f3fa; }
.rtip img { width: 44px; height: 44px; flex: none; }
.rtip .ti { color: #9ff3ff; }
.rbig { margin: 10px 0; display: flex; flex-direction: column; }
.rbig span { color: var(--dim); }
.rbig b { font-size: calc(var(--u) * 48px); color: #ffe680; line-height: 1; }

/* ---------------- menu screens */
.screens { position: absolute; inset: 0; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
.screen.title { align-items: center; justify-content: center; gap: calc(var(--u) * 18px); padding: 20px; }
.logo { text-align: center; position: relative; animation: float 4s infinite ease-in-out; }
.mascot { position: absolute; width: calc(var(--u) * 110px); height: calc(var(--u) * 110px); left: calc(var(--u) * -60px); top: calc(var(--u) * -78px); transform: rotate(-8deg); animation: wiggle 3s infinite ease-in-out; filter: drop-shadow(0 6px 6px rgba(0,0,0,.35)); }
.logo-main {
  font-weight: 700; font-size: calc(var(--u) * 64px); line-height: 1; letter-spacing: 1px;
  background: linear-gradient(#fffbe6 10%, #ffd75e 45%, #ff9f43 90%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 #0b3a52) drop-shadow(0 0 24px rgba(120,240,255,.45));
}
.logo-sub { font-weight: 600; font-size: calc(var(--u) * 18px); color: #bff6ff; margin-top: 6px; text-shadow: 0 2px 0 #0b3a52; }
.logo-bubbles i { position: absolute; border-radius: 50%; border: 2px solid rgba(220,250,255,.7); animation: rise 4s infinite ease-in; }
.logo-bubbles i:nth-child(1) { width: 14px; height: 14px; left: -8%; top: 30%; }
.logo-bubbles i:nth-child(2) { width: 9px; height: 9px; left: 104%; top: 10%; animation-delay: 1s; }
.logo-bubbles i:nth-child(3) { width: 11px; height: 11px; left: 96%; top: 60%; animation-delay: 2s; }
.logo-bubbles i:nth-child(4) { width: 7px; height: 7px; left: 2%; top: 0%; animation-delay: 3s; }
.logo-bubbles i:nth-child(5) { width: 10px; height: 10px; left: 50%; top: -20%; animation-delay: 1.6s; }
@keyframes rise { 0% { transform: translateY(20px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(-60px); opacity: 0; } }
.title-btns { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.btn.resume { flex-direction: column; gap: 0; min-height: calc(var(--u) * 60px); padding: 4px 22px 4px 48px; background: linear-gradient(#5fd38a, #2e9d5b); box-shadow: 0 4px 0 #155f33, inset 0 2px 0 rgba(255,255,255,.35); position: relative; }
.btn.resume .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); }
.btn.resume .rt { font-size: calc(var(--u) * 19px); }
.btn.resume .rs2 { font-size: calc(var(--u) * 12px); font-weight: 600; opacity: .95; }
.btn.dailyready { background: linear-gradient(#4fc3e8, #1f7fae); box-shadow: 0 4px 0 #0d3a52, inset 0 2px 0 rgba(255,255,255,.3); animation: glow 1.8s infinite; }
.gift { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; background: linear-gradient(#fffdf2, #fff3cf); color: #3a2a10; border-radius: 14px; padding: 8px 14px; box-shadow: 0 6px 18px rgba(0,0,0,.4), 0 0 0 3px #ffd75e; font-size: calc(var(--u) * 14px); animation: bannerIn .4s cubic-bezier(.2,1.4,.5,1); transition: opacity .5s; white-space: nowrap; max-width: 92vw; }
.gift .ic { width: 28px; height: 28px; }
.gift.out { opacity: 0; }
.title-stats { color: #cfe8f3; font-weight: 600; display: flex; align-items: center; gap: 6px; text-shadow: 0 2px 0 rgba(0,0,0,.4); }
.corner { position: absolute; top: 12px; right: 12px; }
.warn { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; font-size: 12px; color: #ffd0a0; }

.mhead { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: linear-gradient(rgba(4,22,40,.9), rgba(4,22,40,.6)); }
.mtitle { flex: 1; font-weight: 700; font-size: calc(var(--u) * 24px); text-shadow: 0 2px 0 rgba(0,0,0,.4); }
.starbtn { gap: 4px; padding: 0 12px; font-size: calc(var(--u) * 16px); }
.starbtn .ic { width: 1.5em; height: 1.5em; }
.starbtn span { font-size: calc(var(--u) * 13px); }
.starbtn.glow { animation: glow 1.6s infinite; }
@keyframes glow { 0%, 100% { box-shadow: 0 4px 0 #0d3a52, 0 0 0 0 rgba(255,215,94,0); } 50% { box-shadow: 0 4px 0 #0d3a52, 0 0 16px 4px rgba(255,215,94,.7); } }
.starcount { display: flex; align-items: center; gap: 4px; font-weight: 700; font-size: calc(var(--u) * 20px); color: #ffe680; }
.starcount .ic { width: 1.4em; height: 1.4em; }
.mscroll { flex: 1; overflow-y: auto; overflow-x: hidden; touch-action: pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.mpath { position: relative; width: min(calc(var(--u) * 470px), 100%); margin: 0 auto; }
.mtrail { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.mtrail polyline { fill: none; stroke: rgba(242,224,168,.55); stroke-width: 7px; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; stroke-dasharray: 2 12; }
.lnode {
  position: absolute; width: calc(var(--u) * 64px); height: calc(var(--u) * 64px); margin-left: calc(var(--u) * -32px); margin-top: calc(var(--u) * -32px);
  border-radius: 50%; background: radial-gradient(circle at 40% 30%, #ffe9a8, #f2b84b 60%, #c7801d); box-shadow: 0 5px 0 #7a4a0a, 0 0 0 3px rgba(255,255,255,.7), 0 8px 16px rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center; color: #4a2400;
}
.lnode.done { background: radial-gradient(circle at 40% 30%, #c8fff0, #5fe0c6 60%, #2a9d8f); box-shadow: 0 5px 0 #1a5e56, 0 0 0 3px rgba(255,255,255,.7), 0 8px 16px rgba(0,0,0,.35); color: #0b3a30; }
.lnode.locked { background: radial-gradient(circle at 40% 30%, #6f8a99, #44606f); box-shadow: 0 5px 0 #233844, 0 0 0 3px rgba(255,255,255,.25); color: #c9d9e2; }
.lnode.current { animation: nodepulse 1.4s infinite; }
@keyframes nodepulse { 0%, 100% { box-shadow: 0 5px 0 #7a4a0a, 0 0 0 3px rgba(255,255,255,.8), 0 0 0 0 rgba(255,215,94,.7); } 50% { box-shadow: 0 5px 0 #7a4a0a, 0 0 0 3px rgba(255,255,255,.8), 0 0 0 12px rgba(255,215,94,0); } }
.lnode:active { transform: translateY(3px); }
.lnum { font-weight: 700; font-size: calc(var(--u) * 26px); }
.lnum .ic { width: 26px; height: 26px; }
.lstars { position: absolute; bottom: calc(var(--u) * -14px); display: flex; gap: 0; }
.lstars .ic { width: calc(var(--u) * 18px); height: calc(var(--u) * 18px); }
.lstars .hero .ic { width: calc(var(--u) * 16px); height: calc(var(--u) * 16px); }
.lname.left { left: auto; right: calc(100% + 8px); }
.lname { position: absolute; top: 50%; transform: translateY(-50%); left: calc(100% + 8px); white-space: nowrap; font-weight: 700; font-size: calc(var(--u) * 14px); color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.5), 0 0 6px rgba(0,0,0,.6); }
.mfoot { display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(rgba(4,22,40,.6), rgba(4,22,40,.92)); justify-content: center; }
.btn.mode { flex: 1; max-width: calc(var(--u) * 230px); flex-direction: column; gap: 0; min-height: calc(var(--u) * 58px); padding: 4px 8px; position: relative; }
.btn.mode .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: calc(var(--u) * 24px); height: calc(var(--u) * 24px); }
.btn.mode .mt { font-size: calc(var(--u) * 17px); }
.btn.mode .ms { font-size: calc(var(--u) * 11.5px); font-weight: 600; opacity: .9; }
.btn.mode.locked { filter: grayscale(.7) brightness(.8); }
.btn.mode.glow { animation: glow 1.6s infinite; }
.levelcard .pstars, .dailycard .pstars { display: flex; justify-content: center; gap: 2px; margin: 4px 0; }
.pstars .ic { width: 34px; height: 34px; }
.lrow { display: flex; align-items: center; gap: 8px; margin-top: 8px; background: rgba(0,0,0,.2); border-radius: 12px; padding: 4px 8px; }
.lk { font-size: calc(var(--u) * 12px); color: var(--dim); width: 64px; text-align: left; flex: none; }
.imgs { display: flex; flex-wrap: wrap; gap: 2px; }
.imgs img { width: calc(var(--u) * 38px); height: calc(var(--u) * 38px); }
.lmeta { margin-top: 8px; color: var(--dim); font-size: calc(var(--u) * 13px); display: flex; align-items: center; justify-content: center; gap: 4px; }
.lmeta.dim { opacity: .75; margin-top: 2px; }
.heroic { margin-top: 8px; font-size: calc(var(--u) * 13px); color: #ffc9a0; display: flex; align-items: center; justify-content: center; gap: 4px; }
.heroic.done { color: #ffe680; }
.elist { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; max-height: 50vh; overflow-y: auto; touch-action: pan-y; }
.erow { display: flex; justify-content: space-between; align-items: center; background: rgba(0,0,0,.25); border-radius: 12px; padding: 10px 12px; font-weight: 600; }
.erow:active { background: rgba(95,224,230,.2); }
.eb { color: #ffe680; font-size: calc(var(--u) * 13px); }

/* upgrades */
.uscroll { flex: 1; overflow-y: auto; touch-action: pan-y; padding: 8px 10px 20px; -webkit-overflow-scrolling: touch; }
.unote { text-align: center; color: #cfe8f3; font-size: calc(var(--u) * 13px); margin: 4px auto 10px; max-width: 460px; }
.ugrid { display: flex; flex-direction: column; gap: 8px; max-width: calc(var(--u) * 500px); margin: 0 auto; }
.urow { display: flex; align-items: center; gap: 8px; background: rgba(4,22,40,.75); border-radius: 16px; padding: 6px 8px; box-shadow: inset 0 0 0 1px rgba(160,230,255,.15); }
.urow.hiddenrow { opacity: .45; }
.uhead { flex: 1; display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: calc(var(--u) * 14px); min-width: 0; }
.uhead img { width: 40px; height: 40px; flex: none; }
.uhead .uic { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; color: #bff6ff; flex: none; }
.uhead .uic .ic { width: 30px; height: 30px; }
.unode { width: calc(var(--u) * 54px); height: calc(var(--u) * 54px); border-radius: 14px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; background: linear-gradient(#2b6e8c, #1c4f69); box-shadow: 0 3px 0 #0d3047; }
.unode .ut { font-weight: 700; font-size: calc(var(--u) * 13px); color: #bff6ff; }
.unode .uc { font-weight: 700; font-size: calc(var(--u) * 13px); display: flex; align-items: center; gap: 1px; color: #ffe680; }
.unode .uc .ic { width: 1.2em; height: 1.2em; }
.unode.owned { background: linear-gradient(#5fd38a, #2e9d5b); box-shadow: 0 3px 0 #155f33; }
.unode.owned .uc, .unode.owned .ut { color: #fff; }
.unode.can { background: linear-gradient(#ffcf4d, #ff9f1c); box-shadow: 0 3px 0 #9a5200; animation: glow 1.6s infinite; }
.unode.can .ut, .unode.can .uc { color: #4a2400; }
.unode.dim { opacity: .5; }

/* landscape phones: compact */
@media (max-height: 420px) {
  .card { padding: 10px 12px; max-height: calc(100vh - 80px); }
  .ctitle { font-size: 20px; margin: 2px 0; }
  .cport { width: 72px; height: 72px; }
  .mbtns { margin-top: 6px; }
  .btn { min-height: 40px; font-size: 15px; }
  .logo-main { font-size: 46px; }
  .screen.title { gap: 10px; }
  .rstar { width: 44px; height: 44px; }
  .mhead { padding: 6px 10px; }
  .mtitle { font-size: 20px; }
}

/* trophies */
.trobtn { position: relative; }
.trobtn .tn { position: absolute; right: -4px; bottom: -4px; background: #ffd75e; color: #4a2400; border-radius: 999px; font-size: 11px; min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.tlist { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; max-height: 55vh; overflow-y: auto; touch-action: pan-y; text-align: left; }
.trow { display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,.25); border-radius: 12px; padding: 7px 10px; opacity: .75; }
.trow.done { opacity: 1; background: rgba(255,215,94,.15); box-shadow: inset 0 0 0 1px rgba(255,215,94,.4); }
.trow .ti { width: 30px; height: 30px; flex: none; color: #9fc3d6; display: flex; }
.trow.done .ti { color: #ffd75e; }
.trow .ti .ic { width: 100%; height: 100%; }
.trow .tt { flex: 1; display: flex; flex-direction: column; font-size: calc(var(--u) * 12.5px); color: #cfe8f3; line-height: 1.2; }
.trow .tt b { font-size: calc(var(--u) * 14.5px); color: #fff; }
.trow .tp { font-weight: 700; color: #ffe680; font-size: calc(var(--u) * 13px); white-space: nowrap; }
.trophytoast { position: absolute; z-index: 30; left: 50%; top: 70px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; background: linear-gradient(#fffdf2, #fff3cf); color: #3a2a10; border-radius: 14px; padding: 8px 14px; box-shadow: 0 6px 18px rgba(0,0,0,.4), 0 0 0 3px #ffd75e; font-size: calc(var(--u) * 13px); line-height: 1.25; animation: bannerIn .4s cubic-bezier(.2,1.4,.5,1); transition: opacity .5s; max-width: 92vw; pointer-events: none; }
.trophytoast .tti { width: 34px; height: 34px; color: #c98b00; flex: none; display: flex; }
.trophytoast .tti .ic { width: 100%; height: 100%; }
.trophytoast em { font-style: normal; color: #c25e00; font-weight: 600; }
.trophytoast.out { opacity: 0; }
.rtroph { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.rtr { display: flex; align-items: center; justify-content: center; gap: 6px; color: #ffe680; font-size: calc(var(--u) * 13.5px); }
.rtr .ic { width: 22px; height: 22px; }

/* guide */
.gtabs { display: flex; gap: 6px; justify-content: center; margin-top: 6px; }
.gtab { padding: 6px 16px; border-radius: 999px; background: rgba(0,0,0,.25); font-weight: 700; font-size: calc(var(--u) * 14px); color: #cfe8f3; }
.gtab.on { background: var(--aqua); color: #0b3a52; }
.trow.gr { align-items: flex-start; background: rgba(0,0,0,.22); box-shadow: none; }
.trow.gr.boss { box-shadow: inset 0 0 0 1px rgba(255,120,120,.4); }
.gimg { width: 52px; height: 52px; flex: none; }
.gsp { margin-top: 3px; color: #bff6ff; font-size: calc(var(--u) * 12px); }
.gsp b { color: #ffe680; font-size: inherit; }
@media (max-width: 420px) { .starbtn span { display: none; } .mtitle { font-size: calc(var(--u) * 20px); } }
