:root {
  color-scheme: dark;
  --bg: #06080f;
  --bg2: #0d1228;
  --panel: #0f1530cc;
  --border: #2a3566;
  --accent: #6ee7ff;
  --accent2: #b388ff;
  --gem: #ff79c6;
  --gold: #ffd166;
  --danger: #ff5577;
  --text: #e6edf3;
  --dim: #8a97b8;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: radial-gradient(ellipse at top, #1a2050 0%, var(--bg) 60%); color: var(--text); font-family: ui-sans-serif, system-ui, "Segoe UI", sans-serif; overflow: hidden; }
body { display: flex; flex-direction: column; height: 100vh; }

#stars { position: fixed; inset: 0; pointer-events: none; background-image:
  radial-gradient(1px 1px at 10% 20%, #fff8, transparent),
  radial-gradient(1px 1px at 30% 60%, #fff6, transparent),
  radial-gradient(1px 1px at 50% 30%, #fffa, transparent),
  radial-gradient(2px 2px at 70% 80%, #fff5, transparent),
  radial-gradient(1px 1px at 85% 15%, #fff7, transparent),
  radial-gradient(1px 1px at 20% 85%, #fff8, transparent),
  radial-gradient(1px 1px at 60% 50%, #fff5, transparent),
  radial-gradient(1px 1px at 90% 70%, #fff7, transparent);
  background-size: 800px 800px; animation: drift 120s linear infinite; opacity: .6; }
@keyframes drift { to { background-position: 800px 800px; } }

header {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px;
  padding: 12px 22px; background: linear-gradient(180deg, #0a0f25, #0a0f2500);
  border-bottom: 1px solid var(--border); z-index: 10;
}
.brand { font-size: 18px; letter-spacing: 2px; color: var(--accent); text-shadow: 0 0 12px var(--accent); }
.brand b { color: #fff; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 6px 14px; min-width: 110px; text-align: center; }
.stat .lbl { display: block; font-size: 10px; letter-spacing: 1.5px; color: var(--dim); text-transform: uppercase; }
.stat .val { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat.gems .val { color: var(--gem); text-shadow: 0 0 8px var(--gem); }
.who { display: flex; gap: 8px; align-items: center; }
#name { background: #0008; color: #fff; border: 1px solid var(--border); padding: 8px 12px; border-radius: 8px; font: inherit; width: 140px; }

main {
  flex: 1; display: grid;
  grid-template-columns: 1.1fr 1.4fr .9fr;
  gap: 14px; padding: 14px; min-height: 0;
}
@media (max-width: 1100px) { main { grid-template-columns: 1fr; overflow-y: auto; } html, body { overflow: auto; } }

section, aside { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px; overflow: hidden; display: flex; flex-direction: column; }

/* asteroide */
#core-panel { align-items: center; justify-content: center; position: relative; }
#asteroid-wrap { position: relative; width: 280px; height: 280px; display: flex; align-items: center; justify-content: center; }
#asteroid { position: relative; width: 200px; height: 200px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform .08s; user-select: none; }
#asteroid:active { transform: scale(.93); }
#asteroid .core {
  font-size: 130px; line-height: 1;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 24px var(--accent)) drop-shadow(0 0 40px var(--accent2));
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { filter: drop-shadow(0 0 36px var(--accent)) drop-shadow(0 0 60px var(--accent2)); } }
.ring { position: absolute; border: 1px solid var(--accent); border-radius: 50%; opacity: .25; }
.r1 { width: 240px; height: 240px; animation: spin 18s linear infinite; border-style: dashed; }
.r2 { width: 280px; height: 280px; animation: spin 30s linear infinite reverse; border-color: var(--accent2); border-style: dotted; }
.r3 { width: 200px; height: 200px; animation: spin 10s linear infinite; border-color: #fff; opacity: .12; }
@keyframes spin { to { transform: rotate(360deg); } }

#click-fx { position: absolute; inset: 0; pointer-events: none; }
.float-num { position: absolute; font-weight: 800; color: var(--accent); text-shadow: 0 0 8px var(--accent); pointer-events: none; animation: floatup .9s ease-out forwards; font-size: 18px; }
@keyframes floatup { to { transform: translate(-50%, -80px); opacity: 0; } }
.click-hint { margin-top: 14px; color: var(--dim); font-size: 13px; }

#prestige-box { margin-top: 18px; text-align: center; border: 1px dashed var(--gem); border-radius: 12px; padding: 12px 16px; background: #ff79c612; max-width: 320px; }
#prestige-box h3 { margin: 0 0 6px; color: var(--gem); letter-spacing: 2px; }
#prestige-box p { margin: 0 0 10px; font-size: 13px; color: #ddd; }
.hidden { display: none !important; }
.dim { color: var(--dim); }
.small { font-size: 11px; }

/* tienda */
.tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-shrink: 0; }
.tab { flex: 1; background: #0009; color: var(--dim); border: 1px solid var(--border); padding: 8px; border-radius: 8px; cursor: pointer; font: inherit; letter-spacing: 1px; font-size: 12px; }
.tab.active { background: var(--accent); color: #001; font-weight: 800; border-color: var(--accent); }
.tab-pane { display: none; flex: 1; overflow-y: auto; padding-right: 4px; }
.tab-pane.active { display: block; }

.item { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; background: #0a0f24; transition: border-color .15s, transform .08s; }
.item:hover { border-color: var(--accent); }
.item.locked { opacity: .35; pointer-events: none; }
.item .icon { font-size: 28px; text-align: center; }
.item .info { min-width: 0; }
.item .name { font-weight: 700; font-size: 14px; }
.item .desc { font-size: 11px; color: var(--dim); }
.item .meta { font-size: 11px; color: var(--accent); margin-top: 2px; }
.item .buy { background: var(--accent); color: #001; border: 0; border-radius: 8px; padding: 8px 12px; font-weight: 800; cursor: pointer; font: inherit; min-width: 110px; }
.item .buy:disabled { background: #2a3566; color: var(--dim); cursor: not-allowed; }
.item .buy .cost { display: block; font-size: 11px; opacity: .8; font-weight: 600; }

.achievement { display: flex; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; background: #0a0f24; }
.achievement.done { border-color: var(--gold); background: #ffd16614; }
.achievement .ic { font-size: 24px; opacity: .4; }
.achievement.done .ic { opacity: 1; }
.achievement .t { font-weight: 700; font-size: 13px; }
.achievement .d { font-size: 11px; color: var(--dim); }

/* leaderboard */
#leader h3 { margin: 0 0 10px; color: var(--gold); letter-spacing: 2px; font-size: 14px; }
#board { padding: 0; margin: 0; list-style: none; flex: 1; overflow-y: auto; }
#board li { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; padding: 8px 6px; border-bottom: 1px dashed #ffffff14; font-size: 13px; align-items: center; }
#board li .rank { color: var(--dim); text-align: right; font-variant-numeric: tabular-nums; }
#board li .g { color: var(--gem); font-weight: 700; font-variant-numeric: tabular-nums; }
#board li.me { background: #ffd16612; border-radius: 6px; }
#board li.me .nm { color: var(--gold); font-weight: 800; }

.btn { background: var(--accent); color: #001; border: 0; border-radius: 8px; padding: 8px 16px; font: inherit; font-weight: 800; cursor: pointer; letter-spacing: 1px; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.danger { background: var(--danger); color: #fff; }
.btn:hover { filter: brightness(1.1); }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px); background: #000d; border: 1px solid var(--accent); color: var(--accent); padding: 10px 18px; border-radius: 999px; font-weight: 700; transition: transform .3s; pointer-events: none; z-index: 100; }
#toast.show { transform: translateX(-50%) translateY(0); }
