#c { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; }
.hide { display: none !important; }

#top { position: fixed; top: calc(env(safe-area-inset-top) + 10px); left: 10px; right: 10px; display: flex; gap: 8px;
  align-items: center; z-index: 10; pointer-events: none; }
#top > * { pointer-events: auto; }
.pill { background: rgba(20, 14, 40, .62); padding: 8px 14px; border-radius: 999px; font-weight: 800; font-size: 15px;
  backdrop-filter: blur(4px); box-shadow: 0 3px 0 rgba(0,0,0,.25); white-space: nowrap; }
.pill.coins { margin-left: auto; display: flex; align-items: center; gap: 6px; min-width: 90px; justify-content: center; }
.pill.coins.bump { animation: bump .25s; }
@keyframes bump { 50% { transform: scale(1.15); } }
.iconbtn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(20,14,40,.62); font-size: 20px;
  cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,.25); }

#progress { position: fixed; top: calc(env(safe-area-inset-top) + 64px); left: 50%; transform: translateX(-50%);
  width: min(70vw, 360px); height: 12px; background: rgba(20,14,40,.5); border-radius: 99px; z-index: 10; }
#progFill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #22d3ee, #4ade80); }
#progEnd { position: absolute; right: -10px; top: -9px; font-size: 22px; }
#bossBar { position: fixed; top: calc(env(safe-area-inset-top) + 86px); left: 50%; transform: translateX(-50%);
  width: min(76vw, 380px); z-index: 10; text-align: center; font-weight: 900; text-shadow: 0 2px 0 #000; }
#bossBar div { height: 14px; background: rgba(0,0,0,.5); border-radius: 99px; overflow: hidden; border: 2px solid #fff; }
#bossBar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #a855f7, #ec4899); transition: width .1s; }

#menu { position: fixed; inset: 0; display: flex; flex-direction: column; z-index: 5; pointer-events: none; }
#menu > * { pointer-events: auto; }
#title { text-align: center; margin-top: calc(env(safe-area-inset-top) + 66px); pointer-events: none !important; }
.logo { font-weight: 900; font-size: 46px; line-height: .9; letter-spacing: 2px; color: #fff;
  text-shadow: 0 4px 0 #1e3a8a, 0 8px 18px rgba(0,0,0,.35); transform: rotate(-3deg); }
.logo span { color: var(--accent); text-shadow: 0 4px 0 #9a5b00, 0 8px 18px rgba(0,0,0,.35); font-size: 52px; }
#regionName { margin-top: 10px; font-weight: 800; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.4); }
#banners { font-size: 13px; color: #fff; text-shadow: 0 1px 0 #000; margin-top: 2px; }
#startHint { margin: auto auto 10px; text-align: center; font-weight: 900; font-size: 22px; color: #fff;
  text-shadow: 0 3px 0 rgba(0,0,0,.45); pointer-events: none !important; }
#startHint small { display: block; font-size: 13px; font-weight: 700; margin-top: 4px; opacity: .95; }
.hand { font-size: 40px; animation: swipe 1.4s ease-in-out infinite; }
@keyframes swipe { 0%, 100% { transform: translateX(-40px) rotate(-10deg); } 50% { transform: translateX(40px) rotate(10deg); } }

#shop { background: linear-gradient(180deg, rgba(27,21,48,0), rgba(27,21,48,.92) 22px); padding: 22px 10px calc(env(safe-area-inset-bottom) + 10px); }
#idleRow { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 13px;
  color: var(--muted); padding: 0 4px 6px; min-height: 44px; }
.btn.small { padding: 8px 12px; font-size: 14px; }
#ascendBtn { background: linear-gradient(180deg, #c084fc, #7c3aed); color: #fff; animation: glow 1.6s infinite; }
@keyframes glow { 50% { filter: brightness(1.3); } }
#cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-width: 640px; margin: 0 auto; }
.card { background: var(--panel); border-radius: 14px; padding: 8px 4px 6px; text-align: center; display: flex; flex-direction: column;
  align-items: center; gap: 2px; box-shadow: 0 4px 0 rgba(0,0,0,.35); cursor: pointer; border: 0; color: var(--ink); font: inherit;
  min-height: 118px; transition: transform .06s; }
.card:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.35); }
.card .ic { font-size: 24px; }
.card .nm { font-weight: 800; font-size: 11.5px; }
.card .lv { font-size: 10px; color: var(--muted); }
.card .ds { font-size: 9.5px; color: #d9d2f2; min-height: 24px; line-height: 1.2; padding: 0 2px; }
.card .cost { margin-top: auto; background: var(--accent); color: var(--accent-ink); border-radius: 8px; font-weight: 900;
  font-size: 12px; padding: 4px 6px; width: 92%; }
.card.off .cost { background: #4b4270; color: #a59cc8; }
.card.flash { animation: cardflash .35s; }
@keyframes cardflash { 0% { background: #fff6; transform: scale(1.06); } }
@media (max-width: 380px) { .card .ds { font-size: 9px; } .card .nm { font-size: 10.5px; } }

#labels { position: fixed; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.clabel { position: absolute; left: 0; top: 0; padding: 3px 10px; border-radius: 10px; font-weight: 900; font-size: 18px;
  color: #fff; background: #2563eb; box-shadow: 0 3px 0 #1e3a8a; white-space: nowrap; will-change: transform; }
.clabel.enemy { background: #9333ea; box-shadow: 0 3px 0 #581c87; font-size: 15px; }

#pops { position: fixed; inset: 0; pointer-events: none; z-index: 20; overflow: hidden; }
.pop { position: absolute; font-weight: 900; font-size: 30px; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.5);
  animation: popup .9s ease-out forwards; white-space: nowrap; transform: translate(-50%, -50%); }
.pop.good { color: #5eead4; } .pop.bad { color: #fb7185; } .pop.gold { color: #fde047; }
@keyframes popup { 0% { opacity: 0; scale: .4; } 15% { opacity: 1; scale: 1.25; } 30% { scale: 1; } 100% { opacity: 0; translate: 0 -70px; } }
.coinfly { position: absolute; font-size: 22px; transition: transform .6s cubic-bezier(.5,-0.3,.7,1), opacity .6s; }

#steerHint { position: fixed; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 70px); text-align: center; font-weight: 800;
  color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.5); z-index: 6; pointer-events: none; }
.teal { color: #5eead4; }

#modal { position: fixed; inset: 0; background: rgba(10,6,24,.55); display: flex; align-items: center; justify-content: center; z-index: 30; padding: 16px; }
#modalBody { width: min(100%, 360px); text-align: center; animation: modalin .3s cubic-bezier(.3,1.6,.6,1); }
@keyframes modalin { from { transform: scale(.6); opacity: 0; } }
#modalBody h2 { margin: 4px 0 6px; font-size: 30px; }
#modalBody h2.win { color: var(--accent); text-shadow: 0 3px 0 #9a5b00; }
#modalBody h2.lose { color: var(--bad); }
#modalBody p { color: var(--muted); margin: 6px 0; }
#modalBody .big { font-size: 38px; font-weight: 900; color: #fde047; margin: 6px 0; }
#modalBody .row { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
#modalBody .row .btn { flex: 1; }
.setrow { display: flex; justify-content: space-between; align-items: center; margin: 8px 0; font-weight: 700; }
.stats { font-size: 13px; color: var(--muted); text-align: left; margin-top: 10px; line-height: 1.6; }
@media (orientation: landscape) and (max-height: 820px) {
  #title { margin-top: calc(env(safe-area-inset-top) + 12px); }
  .logo { font-size: 32px; } .logo span { font-size: 36px; }
  #regionName { margin-top: 4px; }
  #startHint { margin-bottom: 4px; }
  .card { min-height: 104px; }
}
