:root {
  --bg: #070A18;
  --panel: rgba(18, 22, 46, 0.92);
  --panel-solid: #12162E;
  --card: #1a1f40;
  --card-hi: #222a55;
  --border: rgba(168, 255, 244, 0.10);
  --text: #E9ECFF;
  --muted: #8a90b8;
  --friend: #3FF2E0;
  --energy: #7DFF8A;
  --stardust: #FFD34A;
  --enemy: #FF3D7F;
  --void: #9B5CFF;
  --common: #E9ECFF;
  --rare: #4AA8FF;
  --epic: #B06CFF;
  --legendary: #FFD34A;
  --fusion: #3FF2E0;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Fredoka", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
  touch-action: manipulation;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; cursor: pointer; }

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  padding-top: env(safe-area-inset-top);
}

/* ---------- HUD ---------- */
#hud {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--panel-solid);
  border-bottom: 1px solid var(--border);
}
.hud-item { flex: 1; display: flex; flex-direction: column; align-items: center; }
.label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 500; }
.val { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.energy { color: var(--energy); }
.stardust { color: var(--stardust); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--border); font-size: 13px;
}

/* ---------- Stage ---------- */
#stage { position: relative; flex: 1; min-height: 240px; overflow: hidden; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#wave-bar { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: rgba(255,255,255,.05); }
#wave-fill { height: 100%; width: 0; background: var(--friend); box-shadow: 0 0 8px var(--friend); }
#speed-btn { position: absolute; top: 12px; right: 12px; }
#orbit-info { position: absolute; top: 12px; left: 12px; pointer-events: none; }

#toast {
  position: absolute; top: 88px; left: 50%; transform: translateX(-50%);
  padding: 8px 14px; border-radius: 999px; white-space: nowrap;
  background: rgba(18,22,46,.9); border: 1px solid var(--border);
  font-size: 14px; font-weight: 600; opacity: 0; transition: opacity .25s; pointer-events: none;
}
#toast.show { opacity: 1; }

#pulse-btn {
  --p: 1;
  position: absolute; right: 12px; bottom: 40px; width: 64px; height: 64px; border-radius: 50%;
  border: 0; padding: 4px;
  background: conic-gradient(var(--friend) calc(var(--p) * 360deg), rgba(255,255,255,.08) 0);
}
#pulse-btn span {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
  border-radius: 50%; background: var(--panel-solid); font-size: 11px; font-weight: 700; letter-spacing: .06em;
  color: var(--muted);
}
#pulse-btn.ready { box-shadow: 0 0 18px rgba(63,242,224,.55); }
#pulse-btn.ready span { color: var(--friend); }

#hp-wrap {
  position: absolute; left: 12px; right: 12px; bottom: 10px; height: 18px;
  background: rgba(0,0,0,.5); border-radius: 9px; overflow: hidden; border: 1px solid var(--border);
}
#hp-fill {
  height: 100%; width: 100%; transition: width .1s;
  background: linear-gradient(90deg, color-mix(in srgb, var(--skin, #3FF2E0) 55%, #000), var(--skin, #3FF2E0));
}
#hp-fill.low { background: linear-gradient(90deg, #FF3D7F, #FF5A4E); }
#hp-text {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; text-shadow: 0 1px 2px #000; font-variant-numeric: tabular-nums;
}

/* ---------- Panel ---------- */
#panel {
  height: 41%;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  background: var(--panel-solid);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabs { display: flex; }
.tab {
  flex: 1; padding: 9px 4px; background: none; border: 0;
  border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; font-size: 15px;
}
.tab.active { color: var(--text); border-bottom-color: var(--friend); }
/* "Something here is affordable" dot on upgrade tabs and mission tabs */
.tab, .seg-btn { position: relative; }
.tab.dot::after, .seg-btn.dot::after {
  content: ''; position: absolute; top: 7px; right: calc(50% - 46px); width: 7px; height: 7px; border-radius: 50%;
  background: var(--energy); box-shadow: 0 0 6px var(--energy);
}
.seg-btn.dot::after { background: var(--enemy); box-shadow: 0 0 6px var(--enemy); right: 10px; top: 50%; margin-top: -4px; }

#buy-mode { display: flex; align-items: center; gap: 6px; padding: 8px 12px 0; }
#buy-mode .label { margin-right: 2px; }
#mut-strip {
  margin-left: auto; display: flex; align-items: center; gap: 2px; font-size: 16px; overflow: hidden; max-width: 42%; cursor: pointer;
  -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent);
}
#mut-strip sub { font-size: 9px; font-weight: 700; color: var(--muted); margin: 0 2px 0 -5px; align-self: flex-end; }
.chip {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: rgba(18,22,46,.85); font-size: 13px; font-weight: 600;
}
.chip.active { background: var(--friend); color: #04201d; border-color: var(--friend); }
.chip.ghost { font-variant-numeric: tabular-nums; }

#upgrades {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  padding: 10px 12px 12px; align-content: start;
}
.card {
  background: var(--card); border: 1px solid transparent; border-radius: 14px;
  padding: 8px 10px; text-align: left; display: flex; flex-direction: column; gap: 1px;
  transition: transform .06s, background .15s;
}
.card:active { transform: scale(.97); }
.card .top { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; }
.card .name { font-weight: 600; font-size: 14px; }
.card .lvl { font-size: 11px; color: var(--muted); white-space: nowrap; }
.card .bottom { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; margin-top: 2px; }
.card .value { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.card .value b { color: var(--text); font-weight: 600; }
.card .cost { font-size: 15px; font-weight: 700; color: var(--energy); font-variant-numeric: tabular-nums; white-space: nowrap; flex: none; }
.card.afford { border-color: rgba(125,255,138,.35); background: var(--card-hi); }
.card.cant { opacity: .55; }
.card.cant .cost { color: var(--muted); }
.card.maxed .cost { color: var(--stardust); }
.card.hidden { display: none; }

/* ---------- Overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(4,6,16,.8);
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
}
.overlay.hidden { display: none; }
/* Low graphics: skip the costly background blur */
.gfx-low .overlay { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(4,6,16,.9); }
.modal {
  width: 100%; max-width: 360px; max-height: 92dvh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 20px; padding: 22px 20px; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.modal.wide { max-width: 440px; }
.modal h2 { margin: 0 0 10px; font-weight: 600; }
#menu-planet {
  width: 150px; height: 150px; display: block; margin: -6px auto 0;
  -webkit-mask-image: radial-gradient(circle, #000 55%, transparent 70%);
  mask-image: radial-gradient(circle, #000 55%, transparent 70%);
}
.muted { color: var(--muted); margin: 6px 0 14px; }
.stats-row { display: flex; justify-content: space-around; margin: 14px 0; }
.stats-row div { display: flex; flex-direction: column; gap: 2px; }
.stats-row b { font-size: 22px; }

.btn {
  display: block; width: 100%; margin-top: 10px; padding: 14px;
  border-radius: 14px; border: 1px solid var(--border); background: var(--card); font-weight: 600; font-size: 17px;
}
.btn.primary { background: var(--friend); color: #04201d; border-color: var(--friend); box-shadow: 0 0 20px rgba(63,242,224,.35); }
.btn.danger { background: #2a1426; color: var(--enemy); }
.btn.small { width: auto; display: inline-block; padding: 10px 20px; font-size: 15px; }
.btn:disabled { opacity: .4; }

/* ---------- Draft ---------- */
.draft-wrap { width: 100%; max-width: 480px; text-align: center; }
.draft-wrap h2 { margin: 0; font-size: 26px; font-weight: 600; }
#draft-cards { display: flex; gap: 10px; justify-content: center; margin: 14px 0 8px; }
.mcard {
  --c: var(--common);
  flex: 1; max-width: 150px; min-height: 210px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 8px 12px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(34,42,85,.95), rgba(18,22,46,.95));
  border: 2px solid var(--c);
  box-shadow: 0 0 18px color-mix(in srgb, var(--c) 45%, transparent), inset 0 0 22px color-mix(in srgb, var(--c) 15%, transparent);
  animation: dealIn .35s ease-out backwards;
}
.mcard:nth-child(2) { animation-delay: .08s; }
.mcard:nth-child(3) { animation-delay: .16s; }
.mcard:active { transform: scale(.96); }
.mcard .rarity { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--c); }
.mcard .micon { font-size: 40px; line-height: 1.2; margin: 6px 0 2px; filter: drop-shadow(0 0 8px color-mix(in srgb, var(--c) 60%, transparent)); }
.mcard .mname { font-weight: 700; font-size: 15px; line-height: 1.15; }
.mcard .mdesc { font-size: 12px; color: #c4c8e6; line-height: 1.3; }
.mcard .mcount { font-size: 11px; color: var(--muted); margin-top: auto; }
.mcard.rare { --c: var(--rare); }
.mcard.epic { --c: var(--epic); }
.mcard.legendary { --c: var(--legendary); }
.mcard.fusion {
  --c: var(--fusion);
  background: linear-gradient(180deg, rgba(20,60,72,.95), rgba(40,22,60,.95));
  animation: dealIn .35s ease-out backwards, fuseGlow 1.6s ease-in-out .4s infinite alternate;
}
/* The fusion card is dealt last; its two parent icons fly in from the sides and slam together */
.mcard.fusion { animation-delay: .35s, 1.4s; }
.mcard.fusion .fuse-ico img:first-child { animation: fuseL .65s cubic-bezier(.6,0,.9,.4) .35s backwards; }
.mcard.fusion .fuse-ico img:last-child { animation: fuseR .65s cubic-bezier(.6,0,.9,.4) .35s backwards; }
@keyframes fuseL { from { transform: translateX(-120%) rotate(-25deg) scale(.7); } }
@keyframes fuseR { from { transform: translateX(120%) rotate(25deg) scale(.7); } }
.mcard.fusion { position: relative; overflow: hidden; flex: 1.2; max-width: 168px; z-index: 1; }
.mcard.fusion .mname { font-size: 16px; }
.mcard.fusion::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 35%, #fff 0%, color-mix(in srgb, var(--legendary) 70%, transparent) 30%, transparent 70%);
  animation: fuseFlash .7s ease-out 1s;
}
@keyframes fuseFlash { 0% { opacity: 1; } 100% { opacity: 0; } }
.mcard.fusion .micon { animation: fuseSlam .35s ease-out 1s; }
@keyframes fuseSlam { 0% { transform: scale(1.35); } 60% { transform: scale(.92); } }
#draft-title.fuse { background: linear-gradient(90deg, var(--fusion), var(--legendary)); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 700; }
/* Fusion hints on normal cards */
.fuse-tag { font-size: 11px; line-height: 1.25; color: color-mix(in srgb, var(--fusion) 70%, #c4c8e6); }
.fuse-tag.hot { font-weight: 700; color: var(--fusion); text-shadow: 0 0 8px color-mix(in srgb, var(--fusion) 60%, transparent); }
.mcard.fuse-hot { animation: dealIn .35s ease-out backwards, hotPulse 1.1s ease-in-out .4s infinite alternate; }
.mcard.fuse-hot { position: relative; border-color: var(--fusion); }
.mcard.fuse-hot::before {
  content: '⚗️'; position: absolute; top: -10px; right: -6px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-size: 14px; background: #0f2a33; border: 2px solid var(--fusion);
  box-shadow: 0 0 10px var(--fusion);
}
@keyframes hotPulse { to { box-shadow: 0 0 26px color-mix(in srgb, var(--fusion) 70%, transparent), inset 0 0 18px color-mix(in srgb, var(--fusion) 25%, transparent); } }
#mut-strip .fuse-ico { filter: drop-shadow(0 0 4px var(--fusion)); }
.mcard.fusion .rarity { background: linear-gradient(90deg, var(--fusion), var(--legendary)); -webkit-background-clip: text; background-clip: text; color: transparent; }
@keyframes fuseGlow { to { box-shadow: 0 0 30px color-mix(in srgb, var(--legendary) 55%, transparent), inset 0 0 26px color-mix(in srgb, var(--fusion) 25%, transparent); border-color: var(--legendary); } }
/* Fusion icon: the two parents overlapped */
.fuse-ico { display: inline-flex; align-items: center; vertical-align: middle; }
.fuse-ico img + img { margin-left: -35%; }
.mcard .micon .fuse-ico img { width: 56px; height: 56px; }
.bst-head { margin: 10px 0 0; font-size: 16px; }
.bst-note { margin: 0 0 2px; }
.beast.fusion .bico { grid-row: span 2; align-self: center; justify-self: center; }
.beast.fusion .bico img { width: 36px; height: 36px; }
.beast.fusion.locked .bico img { filter: brightness(0) drop-shadow(0 0 5px rgba(63,242,224,.6)); }
@keyframes dealIn { from { opacity: 0; transform: translateY(30px) scale(.9); } }

.mut-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 4px 0 8px; }
.mut-list .mut-pill { padding: 4px 10px; border-radius: 999px; font-size: 12px; background: var(--card); border: 1px solid var(--c, var(--border)); }
.mut-list .mut-pill.sel { background: color-mix(in srgb, var(--c) 25%, var(--card)); }
.mut-list .mut-desc { flex-basis: 100%; margin: 2px 0 0; min-height: 16px; color: #c4c8e6; }

/* Screens that pop up mid-action ignore taps for a moment (see show()) */
.overlay.guard * { pointer-events: none !important; }

/* Long screens: the Back/Done button stays on screen instead of sitting at the very bottom */
.modal > .btn:last-child:not(.danger) { position: sticky; bottom: 0; z-index: 2; box-shadow: 0 -10px 16px 4px var(--panel-solid); }
.modal > .btn.primary:last-child { box-shadow: 0 -10px 16px 4px var(--panel-solid), 0 0 20px rgba(63,242,224,.35); }
.modal > .btn:last-child:not(.primary):not(.danger) { background: var(--card-hi); }

/* ---------- Observatory ---------- */
#obs-list { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.obs-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: 14px; padding: 10px 12px; border: 1px solid var(--border);
}
.obs-item .icon { font-size: 22px; width: 28px; text-align: center; }
.obs-item .info { flex: 1; min-width: 0; }
.obs-item .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.obs-item .name .lvl { margin-left: 6px; font-size: 12px; color: var(--muted); }
.obs-item .desc { font-size: 12px; color: var(--muted); }
.obs-item .desc.next { color: var(--energy); }
.obs-item button {
  min-width: 76px; padding: 8px 10px; border-radius: 12px; border: 0;
  background: var(--card-hi); color: var(--stardust); font-weight: 700;
}
.obs-item button:disabled { opacity: .45; }

/* ---------- Menu ---------- */
#menu {
  background:
    radial-gradient(circle at 50% 45%, rgba(4,6,16,.7), rgba(4,6,16,.94) 75%),
    url("assets/ui_menu_bg.png") center / cover no-repeat,
    #070A18;
}
.menu-modal { background: rgba(18,22,46,.72); }
#menu-logo {
  display: block; width: 88%; max-width: 300px; margin: -4px auto -10px;
  filter: drop-shadow(0 0 10px rgba(120,160,255,.65)) drop-shadow(0 0 22px rgba(63,242,224,.35));
}
.tagline { margin-top: 0; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; font-size: 15px; padding: 13px 6px; }
.link-btn {
  margin-top: 12px; background: none; border: 0; color: var(--muted);
  font-size: 14px; text-decoration: underline; text-underline-offset: 3px;
}
.hero-img {
  display: block; width: 150px; margin: -6px auto 6px; border-radius: 14px;
  -webkit-mask-image: radial-gradient(ellipse, #000 55%, transparent 72%);
  mask-image: radial-gradient(ellipse, #000 55%, transparent 72%);
}

/* ---------- Observatory ---------- */
.obs-head { display: flex; align-items: center; gap: 12px; text-align: left; margin-bottom: 10px; }
.obs-head > img {
  width: 64px; height: 64px; border-radius: 14px; object-fit: cover;
  -webkit-mask-image: radial-gradient(circle, #000 55%, transparent 72%);
  mask-image: radial-gradient(circle, #000 55%, transparent 72%);
}
.obs-head h2 { margin: 0; }
.obs-head .muted { margin: 2px 0 0; }
.seg { display: flex; background: var(--card); border-radius: 12px; padding: 3px; margin-bottom: 10px; }
.seg-btn { flex: 1; padding: 8px; border: 0; border-radius: 10px; background: none; color: var(--muted); font-weight: 600; }
.seg-btn.active { background: var(--card-hi); color: var(--text); }
.hidden { display: none !important; }

#skin-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.skin {
  --glow: #3FF2E0;
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 8px 10px; border-radius: 16px; background: var(--card); border: 1px solid var(--border);
  text-align: center;
}
.skin.equipped { border-color: var(--glow); box-shadow: 0 0 16px color-mix(in srgb, var(--glow) 40%, transparent), inset 0 0 20px color-mix(in srgb, var(--glow) 12%, transparent); }
.skin > img {
  width: 76px; height: 76px; object-fit: contain;
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--glow) 70%, transparent));
  animation: spin 40s linear infinite;
}
.skin.locked > img { filter: grayscale(1) brightness(.35); animation: none; }
.skin .lock { position: absolute; top: 34px; font-size: 22px; }
.skin .sname { font-weight: 700; font-size: 15px; }
.skin .perk { font-size: 11.5px; color: #c4c8e6; line-height: 1.25; min-height: 29px; }
.skin .drawback { font-size: 11px; color: var(--enemy); min-height: 14px; }
.skin button {
  margin-top: 4px; width: 100%; padding: 8px; border-radius: 10px; border: 0;
  background: var(--card-hi); font-weight: 700; font-size: 13px;
}
.skin button.buy { color: var(--stardust); }
.skin button.equip { background: var(--friend); color: #04201d; }
.skin button:disabled { opacity: .5; }
.skin.equipped button { background: none; color: var(--glow); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Icons ---------- */
.cur { height: 1em; width: auto; vertical-align: -0.14em; margin-right: 2px; filter: drop-shadow(0 0 3px rgba(0,0,0,.6)); }
.val .cur { height: .9em; }
.upg-ico { width: 22px; height: 22px; vertical-align: -6px; margin: -3px 5px -3px -2px; }
.card .name { display: inline-flex; align-items: center; }
.mcard .micon img { width: 72px; height: 72px; display: block; }
.mcard .micon { filter: drop-shadow(0 0 10px color-mix(in srgb, var(--c) 45%, transparent)); }
#mut-strip img { width: 22px; height: 22px; }
.mut-pill img { width: 18px; height: 18px; vertical-align: -4px; }
#toast img { width: 22px; height: 22px; vertical-align: -6px; }
.obs-item .icon img { width: 30px; height: 30px; display: block; margin: 0 auto; }

/* ---------- Welcome back ---------- */
.welcome-planet { position: relative; width: 140px; height: 140px; margin: -4px auto 4px; }
.welcome-planet img {
  position: absolute; inset: 28px; width: 84px; height: 84px; object-fit: contain;
  filter: drop-shadow(0 0 14px color-mix(in srgb, var(--skin, #3FF2E0) 70%, transparent));
  animation: spin 30s linear infinite;
}
.welcome-orbit {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px dashed rgba(63,242,224,.35);
  animation: spin 6s linear infinite;
}
.welcome-orbit::before, .welcome-orbit::after {
  content: ""; position: absolute; width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle, #FFF6C8, #FFD34A 60%, transparent 70%);
  box-shadow: 0 0 10px #FFD34A;
}
.welcome-orbit::before { top: -6px; left: calc(50% - 6px); }
.welcome-orbit::after { bottom: 12px; right: 4px; width: 8px; height: 8px; }
.welcome-amount {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 44px; font-weight: 700; color: var(--stardust);
  text-shadow: 0 0 18px rgba(255,211,74,.45); font-variant-numeric: tabular-nums;
}
.welcome-amount .cur { height: 40px; }
.welcome-rate { font-size: 13px; color: var(--muted); margin: 4px 0 6px; }
.welcome-full { font-size: 13px; color: var(--stardust); margin: 4px 0 6px; }

/* ---------- Rewarded ad button & stand-in ad ---------- */
.btn.gold {
  background: linear-gradient(180deg, #FFE27A, #F5B82E); color: #3a2400; border-color: #FFD34A;
  box-shadow: 0 0 22px rgba(255,211,74,.45);
  animation: goldPulse 1.8s ease-in-out infinite;
}
.btn.gold:disabled { animation: none; }
.ad-tag {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  padding: 2px 6px; margin-right: 6px; border-radius: 6px; background: rgba(58,36,0,.18); vertical-align: 2px;
}
@keyframes goldPulse { 50% { box-shadow: 0 0 34px rgba(255,211,74,.75); transform: scale(1.02); } }
.welcome-amount.doubled { animation: popIn .5s ease-out; }
@keyframes popIn { 40% { transform: scale(1.25); } }

.ad-mock {
  position: fixed; inset: 0; z-index: 50; background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px;
}
.ad-label { position: absolute; top: calc(12px + env(safe-area-inset-top)); left: 14px; font-size: 12px; color: #888; letter-spacing: .1em; text-transform: uppercase; }
.ad-box { text-align: center; max-width: 320px; color: #ccc; }
.ad-title { font-size: 22px; font-weight: 700; color: #fff; }
.ad-count {
  margin: 18px auto 0; width: 72px; height: 72px; border-radius: 50%;
  border: 3px solid #444; display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: #fff;
}
.ad-close {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 12px;
  padding: 8px 14px; border-radius: 999px; border: 1px solid #555; background: #111; color: #ddd; font-size: 13px;
}
.ad-close:disabled { opacity: .6; }

/* ---------- Menu buttons & badges ---------- */
.btn-row.three .btn {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 13px; padding: 10px 4px;
}
.btn-row.three .bi { font-size: 20px; line-height: 1; }
.btn-row .btn { position: relative; }
.claim-badge {
  position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 11px; background: var(--enemy); color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 0 10px rgba(255,61,127,.6);
  animation: badgePop 1.6s ease-in-out infinite;
}
@keyframes badgePop { 50% { transform: scale(1.12); } }

/* ---------- Missions & achievements ---------- */
.small { font-size: 12px; }
#missions-list { display: flex; flex-direction: column; gap: 8px; text-align: left; }
#missions-list > .muted { margin: 0 0 2px; text-align: center; }
.mission, .chest, .achv {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
}
.mission.ready, .chest.ready, .achv.done { border-color: rgba(255,211,74,.6); box-shadow: 0 0 14px rgba(255,211,74,.18); }
.mission.claimed, .chest.claimed, .achv.claimed { opacity: .55; }
.minfo { flex: 1; min-width: 0; }
.mtext { font-weight: 600; font-size: 14px; }
.chest-ico { font-size: 28px; }
.achv > img { width: 40px; height: 40px; object-fit: contain; flex: none; }
.achv.locked > img { filter: grayscale(.85) brightness(.6); }
.mission button, .chest button, .achv button {
  min-width: 68px; padding: 8px 10px; border-radius: 12px; border: 0; flex: none;
  background: linear-gradient(180deg, #FFE27A, #F5B82E); color: #3a2400; font-weight: 700;
}
.mission button:disabled, .chest button:disabled, .achv button:disabled { background: var(--card-hi); color: var(--muted); }
.pbar { position: relative; height: 14px; margin-top: 5px; border-radius: 7px; background: rgba(0,0,0,.4); overflow: hidden; }
.pbar > div { height: 100%; background: linear-gradient(90deg, #1fb5a8, var(--friend)); }
.pbar span {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; text-shadow: 0 1px 2px #000; font-variant-numeric: tabular-nums;
}

/* ---------- Home base (lobby) ---------- */
#menu.lobby {
  flex-direction: column; justify-content: space-between; align-items: stretch; gap: 6px;
  padding: calc(10px + env(safe-area-inset-top)) 16px calc(12px + env(safe-area-inset-bottom));
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
#menu.lobby.hidden { display: none; }
.lobby > * { width: 100%; max-width: 440px; margin-left: auto; margin-right: auto; }
.lobby-top { display: flex; justify-content: space-between; }
.lobby-chip {
  display: flex; flex-direction: column; padding: 6px 12px; border-radius: 14px;
  background: rgba(18,22,46,.7); border: 1px solid var(--border);
}
.lobby-chip.right { align-items: flex-end; }
.lobby-chip b { font-size: 20px; }
#menu.lobby #menu-logo { width: 56%; max-width: 240px; max-height: 13vh; object-fit: contain; margin: -4px auto -12px; }
.lobby-center { position: relative; display: flex; flex-direction: column; align-items: center; flex: 1; min-height: 0; justify-content: center; }
#menu-planet {
  width: min(64vw, 26vh, 300px); height: min(64vw, 26vh, 300px); margin: 0 auto; display: block; cursor: pointer;
  -webkit-mask-image: radial-gradient(circle, #000 58%, transparent 71%);
  mask-image: radial-gradient(circle, #000 58%, transparent 71%);
}
.lobby-planet-name { display: flex; flex-direction: column; align-items: center; margin-top: -6px; }
#lobby-planet-name { font-size: 20px; font-weight: 700; color: var(--skin, var(--friend)); text-shadow: 0 0 12px color-mix(in srgb, var(--skin, #3FF2E0) 50%, transparent); }
#lobby-perk { font-size: 12px; margin: 0; }
.lobby-daily {
  margin-top: 4px; padding: 5px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: rgba(18,22,46,.75); border: 1px solid var(--border);
}
.lobby-daily.ready { border-color: var(--stardust); color: var(--stardust); box-shadow: 0 0 12px rgba(255,211,74,.3); }
.lobby-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-radius: 16px; border: 1px solid var(--border); background: rgba(26,31,64,.85);
  font-weight: 600; font-size: 15px; text-align: left;
}
.tile img { width: 38px; height: 38px; object-fit: contain; border-radius: 10px; flex: none; }
.tile:active { transform: scale(.97); }
.play-big { font-size: 22px; letter-spacing: .12em; padding: 16px; margin-top: 2px; }
.lobby .sound-row { margin-top: 6px; }

/* ---------- Bestiary ---------- */
.wave-pick { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; }
.wave-pick input { flex: 1; accent-color: var(--friend); }
.wave-pick b { min-width: 28px; font-size: 18px; color: var(--friend); }
#bst-list { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.beast {
  display: grid; grid-template-columns: 56px 1fr; gap: 4px 12px; padding: 10px 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
}
.beast > img { width: 56px; height: 56px; object-fit: contain; grid-row: span 2; align-self: center; }
.beast.locked > img { filter: brightness(0) drop-shadow(0 0 6px rgba(155,92,255,.6)); }
.beast .bname { font-weight: 700; font-size: 15px; display: flex; justify-content: space-between; gap: 6px; }
.beast .bname .bchance { color: var(--friend); font-variant-numeric: tabular-nums; }
.beast .bname .bchance.off { color: var(--muted); font-weight: 500; font-size: 12px; }
.beast .bdesc { font-size: 12px; color: #c4c8e6; }
.beast .bstats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 4px; }
.beast .bstats div { background: rgba(0,0,0,.25); border-radius: 8px; padding: 4px 6px; text-align: center; }
.beast .bstats span { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.beast .bstats b { font-size: 13px; font-variant-numeric: tabular-nums; }
.beast .bcap { grid-column: 1 / -1; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.beast .bcap img { width: 20px; height: 20px; }
.beast.boss { border-color: rgba(255,61,127,.35); }

/* ---------- In-run juice ---------- */
#boss-bar {
  position: absolute; top: 48px; left: 50%; transform: translateX(-50%); width: min(78%, 340px);
  text-align: center; pointer-events: none; z-index: 2;
}
.boss-name { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #FF8AA8; text-shadow: 0 0 10px #FF3D7F; }
.boss-track { height: 10px; margin-top: 3px; border-radius: 5px; background: rgba(0,0,0,.6); border: 1px solid rgba(255,61,127,.5); overflow: hidden; }
#boss-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #FF3D7F, #FF8A2A); transition: width .15s; }

#banner {
  position: absolute; left: 0; right: 0; top: 43%; text-align: center; pointer-events: none; z-index: 3;
  font-size: 34px; font-weight: 700; letter-spacing: .08em; color: #fff; opacity: 0;
  text-shadow: 0 0 18px rgba(63,242,224,.8), 0 2px 4px #000;
}
#banner small { display: block; font-size: 13px; letter-spacing: .08em; color: var(--friend); white-space: nowrap; margin-bottom: 2px; }
#banner small b { font-weight: 700; }
#banner small b.e { color: var(--energy); }
#banner small b.s { color: var(--stardust); }
#banner small .cur { height: 1.05em; margin: 0 1px; }
#banner.boss { color: #FFD0DC; text-shadow: 0 0 22px #FF3D7F, 0 2px 4px #000; }
#banner.boss small { color: #FF8AA8; }
#banner.show { animation: bannerIn 1.6s ease-out forwards; }
@keyframes bannerIn {
  0% { opacity: 0; transform: scale(1.6); }
  15% { opacity: 1; transform: scale(1); }
  75% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(.95) translateY(-10px); }
}

#combo {
  position: absolute; top: 130px; right: 14px; text-align: right; pointer-events: none; z-index: 2;
  transform-origin: right center;
}
#combo b { display: block; font-size: 28px; line-height: 1; color: #fff; text-shadow: 0 0 12px var(--stardust), 0 2px 3px #000; }
#combo span { font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--stardust); }
#combo.bump { animation: comboBump .18s ease-out; }
#combo.hot b { color: #FFE27A; text-shadow: 0 0 18px #FF8A2A, 0 2px 3px #000; }
@keyframes comboBump { 50% { transform: scale(1.25); } }

#flash { position: absolute; inset: 0; pointer-events: none; z-index: 4; opacity: 0; background: #fff; }
#flash.go { animation: flashOut .5s ease-out; }
@keyframes flashOut { 0% { opacity: .75; } 100% { opacity: 0; } }

#danger {
  position: absolute; inset: 0; pointer-events: none; z-index: 1; opacity: 0; transition: opacity .3s;
  box-shadow: inset 0 0 60px 10px rgba(255,61,127,.7);
}
#danger.on { animation: dangerPulse 1s ease-in-out infinite; }
@keyframes dangerPulse { 0%, 100% { opacity: .35; } 50% { opacity: .9; } }

/* ---------- Galaxy ---------- */
.lobby-galaxy { text-align: center; font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; margin-top: 2px; text-shadow: 0 0 10px currentColor; }
.tile.wide { grid-column: 1 / -1; }
.tile span small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
.galaxy-tile.ready { border-color: var(--stardust); box-shadow: 0 0 18px rgba(255,211,74,.35); animation: goldPulse 1.8s ease-in-out infinite; }
.galaxy-tile.ready small { color: var(--stardust); }
.dm { color: #C9A8FF; text-shadow: 0 0 8px #9B5CFF; margin-right: 2px; }
.gal-head { --gt: #3FF2E0; text-align: center; padding: 6px 0 4px; }
.gal-num { font-size: 12px; font-weight: 700; letter-spacing: .2em; color: var(--muted); }
.gal-name { font-size: 26px; font-weight: 700; color: var(--gt); text-shadow: 0 0 16px color-mix(in srgb, var(--gt) 60%, transparent); }
.gal-stats { display: flex; justify-content: space-around; margin: 10px 0 6px; }
.gal-stats div { display: flex; flex-direction: column; }
.gal-stats b { font-size: 20px; }
.nova-box { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 12px; margin: 8px 0 4px; text-align: center; }
.nova-box.ready { border-color: rgba(255,211,74,.6); box-shadow: 0 0 18px rgba(255,211,74,.2); }
.nova-title { font-weight: 700; font-size: 17px; }
.nova-box p { margin: 6px 0; color: #c4c8e6; }
.nova-box .btn { margin-top: 6px; }
.cons-title { margin: 14px 0 8px; text-align: left; font-size: 17px; }
.node {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin-bottom: 7px; text-align: left;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
}
.node > img { width: 36px; height: 36px; object-fit: contain; flex: none; }
.node.unlock { border-style: dashed; }
.node.owned { border-color: rgba(155,92,255,.5); }
.node.done { opacity: .6; }
.node .ndesc { color: #c4c8e6; }
.node .ndesc .next { color: var(--energy); }
.node button {
  min-width: 64px; padding: 8px 10px; border-radius: 12px; border: 0; flex: none; font-weight: 700;
  background: linear-gradient(180deg, #C9A8FF, #8B5CF6); color: #1a0b33;
}
.node button:disabled { background: var(--card-hi); color: var(--muted); }
#nova-flash { position: fixed; inset: 0; pointer-events: none; opacity: 0; z-index: 60;
  background: radial-gradient(circle, #fff 0%, #FFD34A 35%, #9B5CFF 70%, transparent 100%); }
#nova-flash.go { animation: novaFlash 1.4s ease-out; }
@keyframes novaFlash { 0% { opacity: 0; transform: scale(.2); } 20% { opacity: 1; transform: scale(1.2); } 100% { opacity: 0; transform: scale(2); } }
#draft-cards.four { flex-wrap: wrap; }
#draft-cards.four .mcard { flex: 0 0 calc(50% - 6px); min-height: 170px; }
#draft-cards.four .micon img { width: 56px; height: 56px; }

/* ---------- Settings: graphics & save ---------- */
.set-row { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px; text-align: left; }
.set-row > span { flex: 0 0 92px; font-weight: 600; font-size: 15px; }
.seg.mini { flex: 1; margin: 0; }
.seg.mini .seg-btn { padding: 6px; font-size: 13px; }
#gfx-note { margin: 2px 0 8px; }
.save-box { margin-top: 12px; padding: 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--border); text-align: left; }
.save-title { font-weight: 700; }
.save-box .btn { font-size: 14px; padding: 10px 6px; }
.save-box .link-btn { margin-top: 8px; }
#save-input {
  width: 100%; margin-top: 8px; padding: 8px; border-radius: 10px; border: 1px solid var(--border);
  background: rgba(0,0,0,.35); color: var(--text); font: 12px/1.3 ui-monospace, monospace; resize: vertical;
  -webkit-user-select: text; user-select: text;
}
#save-msg.ok { color: var(--energy); }
#save-msg.err { color: var(--enemy); }
.install-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 14px;
  background: rgba(63,242,224,.12); border: 1px solid rgba(63,242,224,.4); font-size: 13px;
}
.install-banner > span { flex: 1; min-width: 160px; }
.install-ios { flex-basis: 100%; color: var(--muted); }

/* ---------- Daily Challenge ---------- */
.challenge-tile { border-color: rgba(255,211,74,.35); }
.ch-mods { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; text-align: left; }
.ch-mod { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--border); }
.ch-mod.boon { border-color: rgba(125,255,138,.45); }
.ch-mod.curse { border-color: rgba(255,61,127,.45); }
.ch-mod.mixed { border-color: rgba(176,108,255,.45); }
.ch-icon { font-size: 24px; width: 30px; text-align: center; }
.ch-mod .small { color: #c4c8e6; }
.ch-best { margin: 8px 0; }
.ch-tiers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 4px; }
.ch-tier { display: flex; flex-direction: column; gap: 2px; padding: 6px 4px; border-radius: 10px; background: var(--card); font-size: 12px; }
.ch-tier b { font-size: 13px; color: var(--stardust); }
.ch-tier.done { opacity: .55; }
.ch-tier.done b { color: var(--energy); }
.go-challenge { margin: -4px 0 8px; padding: 8px; border-radius: 12px; background: rgba(255,211,74,.08); border: 1px solid rgba(255,211,74,.35); font-size: 14px; }
.ch-gain { color: var(--stardust); margin-top: 2px; }

/* ---------- Elites in the Bestiary ---------- */
.beast.elites { border-color: rgba(255,211,74,.45); grid-template-columns: 1fr; }
.etraits { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 6px; }
.etraits div { background: rgba(0,0,0,.25); border-radius: 8px; padding: 5px 7px; font-size: 12px; }
.etraits b { display: block; color: var(--stardust); }
.etraits span { color: #c4c8e6; }

/* ---------- Coach hints ---------- */
#coach {
  --arrow: 50%;
  position: fixed; z-index: 80; padding: 10px 14px; border-radius: 14px; pointer-events: none;
  background: #FFE27A; color: #2b1b00; font-weight: 600; font-size: 14px; line-height: 1.3;
  box-shadow: 0 6px 24px rgba(0,0,0,.45), 0 0 18px rgba(255,211,74,.5);
  animation: coachIn .35s ease-out;
}
#coach.hidden { display: none; }
#coach::after {
  content: ''; position: absolute; left: calc(var(--arrow) - 8px); width: 0; height: 0;
  border: 8px solid transparent;
}
#coach.below::after { top: -16px; border-bottom-color: #FFE27A; }
#coach.above::after { bottom: -16px; border-top-color: #FFE27A; }
@keyframes coachIn { from { opacity: 0; transform: translateY(6px) scale(.96); } }
.coach-target { position: relative; z-index: 79; box-shadow: 0 0 0 3px #FFE27A, 0 0 22px rgba(255,211,74,.7) !important; }

/* ---------- Run summary ---------- */
.go-summary { margin: 2px 0 6px; }
.sum-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sum-chip {
  position: relative; display: flex; flex-direction: column; gap: 1px; padding: 6px 4px 7px;
  border-radius: 10px; background: var(--card); border: 1px solid var(--border);
}
.sum-chip span { font-size: 11px; color: var(--muted); }
.sum-chip b { font-size: 16px; font-variant-numeric: tabular-nums; }
.sum-chip.record { border-color: var(--stardust); box-shadow: 0 0 12px rgba(255,211,74,.3); }
.sum-chip.record b { color: var(--stardust); }
.sum-chip i {
  position: absolute; top: -7px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  font-style: normal; font-size: 8px; font-weight: 700; letter-spacing: .08em;
  padding: 1px 5px; border-radius: 6px; background: var(--stardust); color: #3a2400;
}
.dmg-bar { display: flex; height: 10px; margin: 10px 0 4px; border-radius: 5px; overflow: hidden; background: rgba(0,0,0,.4); }
.dmg-bar div { height: 100%; }
.dmg-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; font-size: 11px; color: #c4c8e6; }
.dmg-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: 0; }
.sum-muts { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; margin-top: 8px; }
.sum-muts img { width: 26px; height: 26px; }
.sum-muts sub { font-size: 9px; color: var(--muted); margin: 0 3px 0 -4px; }
#gameover .hero-img { width: 110px; margin-bottom: 0; }
#gameover .stats-row { margin: 8px 0 14px; }
#gameover .stats-row > div { position: relative; }
#gameover .stats-row > div.record b { color: var(--stardust); }
#gameover .stats-row > div.record::after {
  content: 'NEW RECORD'; position: absolute; left: 50%; bottom: -11px; transform: translateX(-50%); white-space: nowrap;
  font-size: 8px; font-weight: 700; letter-spacing: .08em; padding: 1px 5px; border-radius: 6px;
  background: var(--stardust); color: #3a2400;
}

/* ---------- Store ---------- */
.lobby-top { align-items: center; }
.lobby-store {
  padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: linear-gradient(180deg, rgba(255,226,122,.22), rgba(245,184,46,.12));
  border: 1px solid rgba(255,211,74,.55); color: var(--stardust); box-shadow: 0 0 12px rgba(255,211,74,.2);
}
#store-body { display: flex; flex-direction: column; gap: 10px; text-align: left; }
#store-body > .muted { margin: 0; text-align: center; }
.product {
  --glow: #3FF2E0;
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px;
  background: var(--card); border: 1px solid color-mix(in srgb, var(--glow) 45%, transparent);
  box-shadow: 0 0 16px color-mix(in srgb, var(--glow) 15%, transparent);
}
.product > img { width: 64px; height: 64px; object-fit: contain; flex: none;
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--glow) 60%, transparent)); animation: spin 40s linear infinite; }
.product .pemoji { width: 64px; height: 64px; flex: none; display: flex; align-items: center; justify-content: center;
  font-size: 34px; border-radius: 16px; background: rgba(0,0,0,.25); }
.product .pname { font-weight: 700; font-size: 16px; }
.product .pdesc { color: #c4c8e6; line-height: 1.3; margin-top: 2px; }
.product .pdesc b { color: var(--text); }
.product button {
  min-width: 74px; padding: 10px; border-radius: 12px; border: 0; flex: none; font-weight: 700; font-size: 15px;
  background: var(--friend); color: #04201d;
}
.product button:disabled { background: var(--card-hi); color: var(--muted); font-size: 13px; }
.product.owned { opacity: .75; }

/* Stand-in purchase sheet (test mode) */
.buy-sheet-wrap { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; }
.buy-sheet {
  width: 100%; max-width: 440px; padding: 18px 20px calc(18px + env(safe-area-inset-bottom)); text-align: center;
  background: #f4f5fa; color: #1b1d2a; border-radius: 20px 20px 0 0; animation: sheetUp .25s ease-out;
}
.buy-sheet .muted { color: #5c6078; }
.buy-sheet .link-btn { color: #5c6078; }
.buy-sheet-tag { font-size: 11px; font-weight: 700; letter-spacing: .12em; color: #c0392b; }
.buy-sheet-name { font-size: 20px; font-weight: 700; margin-top: 4px; }
.buy-sheet-price { font-size: 26px; font-weight: 700; color: #1a7f5a; }
@keyframes sheetUp { from { transform: translateY(100%); } }

/* Second Wind */
.revive-modal { max-width: 320px; }
.revive-ring {
  --p: 1;
  width: 92px; height: 92px; margin: 0 auto 10px; border-radius: 50%; padding: 6px;
  background: conic-gradient(var(--stardust) calc(var(--p) * 360deg), rgba(255,255,255,.08) 0);
  box-shadow: 0 0 24px rgba(255,211,74,.35);
}
.revive-ring span {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; border-radius: 50%;
  background: var(--panel-solid); font-size: 36px; font-weight: 700; color: var(--stardust); font-variant-numeric: tabular-nums;
}
.btn.slim { padding: 10px; font-size: 15px; }
#go-stardust.pop { display: inline-block; animation: popIn .5s ease-out; }

.go-nova {
  display: block; width: 100%; margin: 8px 0 0; padding: 9px 10px; border-radius: 12px; font-size: 14px;
  background: rgba(255,211,74,.1); border: 1px solid rgba(255,211,74,.55); color: var(--stardust);
  box-shadow: 0 0 14px rgba(255,211,74,.2);
}
.go-nova small { display: block; font-size: 11px; color: #c4c8e6; margin-top: 1px; }
.go-nova.hidden { display: none; }

/* ---------- Volume sliders ---------- */
.vol-row { display: flex; align-items: center; gap: 10px; margin: 12px 0; text-align: left; }
.vol-row span { flex: 0 0 82px; font-weight: 600; font-size: 15px; }
.vol-row input { flex: 1; accent-color: var(--friend); height: 28px; }
.vol-row .vol-val { flex: 0 0 40px; text-align: right; font-variant-numeric: tabular-nums; color: var(--friend); }

/* ---------- Sound toggles ---------- */
.sound-row { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.snd-toggle.off { opacity: .45; text-decoration: line-through; }

/* ---------- How to play ---------- */
.howto-step { display: flex; align-items: center; gap: 12px; text-align: left; margin: 10px 0; }
.howto-step b { font-size: 16px; }
.howto-step p { margin: 2px 0 0; font-size: 13px; color: #c4c8e6; line-height: 1.3; }
.howto-art { flex: 0 0 92px; width: 92px; height: 72px; display: flex; align-items: center; justify-content: center; gap: 2px; }
.howto-art img { width: 36px; height: 36px; object-fit: contain; }
.howto-art img.round { width: 80px; height: 72px; object-fit: cover; border-radius: 12px; }
.capture-art span { color: var(--friend); font-size: 18px; }
.mini-cards i { display: block; width: 22px; height: 32px; border-radius: 5px; border: 2px solid; background: var(--card); margin: 0 1px; }
.mini-cards .c1 { border-color: var(--common); transform: rotate(-8deg); }
.mini-cards .c2 { border-color: var(--epic); transform: translateY(-4px); box-shadow: 0 0 10px var(--epic); }
.mini-cards .c3 { border-color: var(--legendary); transform: rotate(8deg); }
.dark-power { font-size: 13px; color: #c4c8e6; margin-top: 4px; }
.dark-power b { color: #C9A8FF; }

/* Lobby planet fills whatever height is left, so nothing overlaps on short phones */
.lobby-center { min-height: 0; overflow: hidden; }
#menu.lobby #menu-planet {
  flex: 1 1 0; min-height: 70px; max-height: 300px; max-width: 72vw;
  width: auto; height: auto; aspect-ratio: 1 / 1;
}
.lobby-planet-name, .lobby-daily { flex: none; }
@media (max-height: 700px) { #lobby-perk { display: none; } }
