:root {
  --bg: #080b18; --panel: rgba(17, 23, 43, .9); --panel-light: #18213b;
  --line: #293453; --text: #edf3ff; --muted: #91a0bf; --cyan: #58e6e9;
  --purple: #ad8bff; --gold: #ffd166; --danger: #ff7188; --green: #68e0ae;
  --planet-a: #667085; --planet-b: #252c3d;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100vh; color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 12% 18%, rgba(88,230,233,.09), transparent 25%), radial-gradient(circle at 85% 15%, rgba(173,139,255,.11), transparent 28%), radial-gradient(circle at 50% 110%, #182044, transparent 45%), var(--bg);
  overflow-x: hidden;
}
body::before, body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background-image: radial-gradient(circle, #fff 0 1px, transparent 1.4px), radial-gradient(circle, #9bdfff 0 1px, transparent 1.4px);
  background-position: 0 0, 43px 67px; background-size: 137px 149px, 211px 223px; opacity: .28;
}
body::after { transform: rotate(25deg) scale(1.3); opacity: .12; }
button, select { font: inherit; }
button:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.app { width: min(1440px, 100%); margin: auto; padding: 24px; }
header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.brand { display: flex; align-items: center; gap: 13px; }
.logo { width: 44px; height: 44px; border: 1px solid var(--cyan); border-radius: 50%; position: relative; box-shadow: 0 0 24px rgba(88,230,233,.25); flex: 0 0 auto; }
.logo::before { content: ""; position: absolute; inset: 9px; border: 2px solid var(--cyan); border-radius: 50%; }
.logo::after { content: ""; position: absolute; width: 54px; height: 13px; border: 1px solid var(--purple); border-radius: 50%; left: -6px; top: 14px; transform: rotate(-25deg); }
h1 { font-size: 1.35rem; letter-spacing: .12em; margin: 0; text-transform: uppercase; }
.subtitle { color: var(--muted); font-size: .78rem; letter-spacing: .08em; margin-top: 3px; }
.header-stats { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.stat-chip { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; min-width: 118px; }
.stat-chip span { display: block; color: var(--muted); font-size: .67rem; text-transform: uppercase; letter-spacing: .07em; }
.stat-chip strong { color: var(--cyan); font-size: 1.02rem; }
.stat-chip.energy strong { color: var(--gold); }
.layout { display: grid; grid-template-columns: minmax(300px, .82fr) minmax(500px, 1.55fr); gap: 20px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 16px 50px rgba(0,0,0,.18); }
.mine-panel { padding: 24px; display: flex; flex-direction: column; min-height: 650px; position: sticky; top: 20px; align-self: start; }
.sector-label { color: var(--purple); text-transform: uppercase; letter-spacing: .15em; font-size: .72rem; }
#locationName { margin: 5px 0 0; font-size: 1.5rem; }
.location-desc { color: var(--muted); font-size: .88rem; min-height: 40px; }
.mine-zone { position: relative; flex: 1; min-height: 310px; display: grid; place-items: center; }
.orbit { position: absolute; width: 270px; height: 270px; border: 1px solid rgba(88,230,233,.14); border-radius: 50%; animation: spin 24s linear infinite; }
.orbit::after { content: ""; width: 8px; height: 8px; background: var(--cyan); border-radius: 50%; position: absolute; top: 32px; left: 30px; box-shadow: 0 0 14px var(--cyan); }
.orbit.two { width: 220px; height: 220px; animation-direction: reverse; animation-duration: 16s; transform: rotate(70deg); }
@keyframes spin { to { transform: rotate(360deg); } }
#asteroid {
  width: 175px; height: 175px; border: 0; border-radius: 46% 54% 58% 42% / 52% 43% 57% 48%;
  cursor: pointer; position: relative; z-index: 2; color: white;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.24) 0 4%, transparent 5%), radial-gradient(circle at 66% 64%, rgba(0,0,0,.25) 0 10%, transparent 11%), radial-gradient(circle at 60% 25%, rgba(0,0,0,.19) 0 7%, transparent 8%), radial-gradient(circle at 32% 70%, rgba(0,0,0,.2) 0 12%, transparent 13%), linear-gradient(135deg, var(--planet-a), var(--planet-b));
  box-shadow: inset -20px -20px 35px rgba(0,0,0,.38), inset 8px 8px 20px rgba(255,255,255,.1), 0 0 55px rgba(88,230,233,.16);
  transition: transform .09s, filter .2s; animation: float 5s ease-in-out infinite;
}
#asteroid:hover { filter: brightness(1.16); }
#asteroid:active, #asteroid.pressed { transform: scale(.93); }
#asteroid::after { content: "EXTRAIRE"; position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: .75rem; letter-spacing: .13em; text-shadow: 0 2px 5px #000; }
@keyframes float { 50% { translate: 0 -8px; rotate: 2deg; } }
.escort { position: absolute; width: 13px; height: 7px; background: var(--cyan); clip-path: polygon(0 0, 100% 50%, 0 100%, 25% 50%); z-index: 1; filter: drop-shadow(0 0 5px var(--cyan)); animation: escort 9s linear infinite; }
.escort.two { animation-duration: 13s; animation-delay: -4s; background: var(--purple); }
.escort.three { animation-duration: 18s; animation-delay: -9s; }
@keyframes escort { from { transform: rotate(0deg) translateX(135px); } to { transform: rotate(360deg) translateX(135px); } }
.float-number { position: absolute; z-index: 8; pointer-events: none; color: var(--gold); font-weight: 800; animation: rise .85s ease-out forwards; text-shadow: 0 2px 5px #000; }
@keyframes rise { to { transform: translateY(-80px) scale(1.15); opacity: 0; } }
#spaceEvent { position: absolute; z-index: 9; right: 3%; top: 12%; max-width: 145px; padding: 10px 12px; border: 1px solid var(--gold); border-radius: 10px; background: #28233c; color: var(--gold); cursor: pointer; font-size: .75rem; font-weight: 700; box-shadow: 0 0 25px rgba(255,209,102,.25); animation: eventPulse 1.2s ease-in-out infinite; }
#spaceEvent span { display: block; color: var(--text); font-size: .66rem; font-weight: 400; margin-top: 4px; }
@keyframes eventPulse { 50% { transform: scale(1.05); box-shadow: 0 0 35px rgba(255,209,102,.4); } }
.click-info { text-align: center; color: var(--muted); font-size: .85rem; }
.click-info strong { color: var(--gold); }
#buffStatus { text-align: center; color: var(--green); min-height: 22px; font-size: .76rem; margin-top: 8px; }
.progress-wrap { margin-top: 16px; }
.progress-label { display: flex; justify-content: space-between; gap: 10px; font-size: .76rem; color: var(--muted); margin-bottom: 7px; }
.progress { height: 6px; background: #0b1020; border-radius: 10px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--purple), var(--cyan)); transition: width .3s; }
.command-panel { min-height: 650px; overflow: hidden; }
.tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 10px; overflow-x: auto; }
.tab { color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; padding: 18px 12px 14px; cursor: pointer; white-space: nowrap; font-size: .81rem; }
.tab.active { color: var(--cyan); border-color: var(--cyan); }
.tab-content { display: none; padding: 20px; }
.tab-content.active { display: block; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.section-head h3 { margin: 0; font-size: 1rem; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: .78rem; }
.buy-modes { display: flex; background: #0b1020; border-radius: 8px; padding: 3px; flex-wrap: wrap; }
.buy-mode { border: 0; color: var(--muted); background: transparent; border-radius: 6px; padding: 5px 8px; cursor: pointer; font-size: .72rem; }
.buy-mode.active { background: var(--panel-light); color: var(--cyan); }
.energy-banner { display: flex; justify-content: space-between; gap: 10px; border: 1px solid #49452d; background: rgba(255,209,102,.05); border-radius: 9px; padding: 10px 12px; margin-bottom: 12px; font-size: .76rem; color: var(--muted); }
.energy-banner strong { color: var(--gold); }
.energy-banner.warning { border-color: var(--danger); }
.card-list { display: grid; gap: 10px; }
.shop-card { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px; border: 1px solid var(--line); background: rgba(24,33,59,.45); padding: 12px; border-radius: 11px; }
.card-icon { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid #3a496d; border-radius: 9px; color: var(--cyan); font-weight: 800; font-size: .7rem; background: #11182b; text-align: center; }
.card-icon.energy-icon { color: var(--gold); border-color: #625c35; }
.card-title { font-size: .9rem; font-weight: 700; }
.card-desc { color: var(--muted); font-size: .74rem; margin-top: 3px; line-height: 1.45; }
.card-yield { color: var(--green); font-size: .71rem; margin-top: 4px; }
.owned { color: var(--purple); margin-left: 6px; }
.buy-btn { min-width: 118px; border: 1px solid #39747c; border-radius: 8px; color: var(--cyan); background: rgba(88,230,233,.07); padding: 9px 10px; cursor: pointer; font-size: .75rem; font-weight: 700; }
.buy-btn:hover:not(:disabled) { background: rgba(88,230,233,.16); transform: translateY(-1px); }
.buy-btn:disabled { opacity: .38; cursor: not-allowed; border-color: var(--line); color: var(--muted); }
.buy-btn .cost { display: block; font-size: .68rem; margin-top: 3px; color: var(--gold); line-height: 1.4; }
.empty { padding: 25px 15px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 10px; font-size: .85rem; }
.planet-card.current { border-color: var(--cyan); }
.planet-swatch { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--a), var(--b)); box-shadow: inset -7px -6px 10px rgba(0,0,0,.35); }
.planet-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.small-btn { min-width: 105px; }
.locked-note { color: var(--muted); font-size: .7rem; max-width: 145px; text-align: right; line-height: 1.45; }
.spec-select { color: var(--text); background: #11182b; border: 1px solid var(--line); border-radius: 7px; padding: 6px; font-size: .7rem; max-width: 150px; }
.subsection { margin-top: 25px; padding-top: 20px; border-top: 1px solid var(--line); }
.expedition-active { padding: 15px; border: 1px solid #493b72; border-radius: 10px; margin-bottom: 12px; }
.expedition-head { display: flex; justify-content: space-between; font-size: .82rem; margin-bottom: 9px; }
.prestige-box { text-align: center; padding: 24px 18px; border: 1px solid #493b72; border-radius: 13px; background: radial-gradient(circle at 50% 0, rgba(173,139,255,.15), transparent 70%); }
.core-symbol { width: 68px; height: 68px; margin: 0 auto 16px; border: 2px solid var(--purple); transform: rotate(45deg); display: grid; place-items: center; box-shadow: 0 0 35px rgba(173,139,255,.2); }
.core-symbol::after { content: ""; width: 28px; height: 28px; background: var(--purple); box-shadow: 0 0 25px var(--purple); }
.prestige-box h3 { margin: 0 0 10px; }
.prestige-box p { color: var(--muted); font-size: .82rem; line-height: 1.55; }
.prestige-gain { color: var(--purple); font-size: 1.65rem; font-weight: 800; margin: 15px 0; }
.prestige-btn { border: 1px solid var(--purple); color: #e3d8ff; background: rgba(173,139,255,.12); padding: 11px 20px; border-radius: 9px; cursor: pointer; font-weight: 700; }
.prestige-btn:hover:not(:disabled) { background: rgba(173,139,255,.22); }
.prestige-btn:disabled { opacity: .35; cursor: not-allowed; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 15px; text-align: left; }
.stats-grid div { background: rgba(0,0,0,.15); padding: 10px; border-radius: 8px; }
.stats-grid span { display: block; color: var(--muted); font-size: .7rem; }
.stats-grid strong { font-size: .9rem; }
.branch-title { color: var(--purple); text-transform: uppercase; letter-spacing: .1em; margin: 20px 0 9px; }
.perk-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.perk-card { border: 1px solid var(--line); border-radius: 9px; padding: 11px; background: rgba(24,33,59,.4); }
.perk-card.maxed { border-color: #446d60; }
.perk-card .buy-btn { width: 100%; margin-top: 9px; min-width: 0; }
.galaxy-hero { text-align: center; padding: 22px; border: 1px solid #365d72; border-radius: 12px; background: radial-gradient(circle at 50% 0, rgba(88,230,233,.13), transparent 70%); }
.galaxy-hero h3 { margin: 0 0 8px; }
.galaxy-hero p { color: var(--muted); font-size: .8rem; line-height: 1.55; }
.artifact-list { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin: 13px 0; }
.artifact { border: 1px solid var(--purple); color: #ddd0ff; border-radius: 20px; padding: 5px 10px; font-size: .7rem; }
.challenge-card.active { border-color: var(--gold); }
.challenge-card.completed { border-color: var(--green); }
.achievement { opacity: .62; }
.achievement.unlocked { opacity: 1; border-color: #426f61; }
.achievement.unlocked .card-icon { color: var(--green); border-color: #426f61; }
.notification { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .75rem; color: var(--muted); }
.notification strong { display: block; color: var(--text); font-weight: 500; }
.notification time { display: block; margin-top: 3px; }
footer { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-top: 18px; color: var(--muted); font-size: .7rem; flex-wrap: wrap; }
.save-actions, .settings, .account-actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.text-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; font-size: .7rem; text-decoration: underline; }
.text-btn:hover { color: var(--text); }
.danger:hover { color: var(--danger); }
#cloudStatus { max-width: 260px; }
#toast { position: fixed; left: 50%; bottom: 25px; transform: translate(-50%,20px); max-width: min(90vw,600px); text-align: center; background: #1c2945; border: 1px solid var(--cyan); padding: 12px 20px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .25s; z-index: 40; font-size: .82rem; box-shadow: 0 8px 30px #0008; }
#toast.show { opacity: 1; transform: translate(-50%,0); }
#offlineModal { display: none; position: fixed; inset: 0; background: rgba(3,5,12,.8); z-index: 50; place-items: center; padding: 20px; }
#offlineModal.show { display: grid; }
.modal { max-width: 420px; padding: 28px; text-align: center; }
.modal h2 { margin-top: 0; }
.modal p { color: var(--muted); line-height: 1.6; }
.modal strong { color: var(--gold); }
#celebration { position: fixed; inset: 0; pointer-events: none; z-index: 35; opacity: 0; background: radial-gradient(circle, rgba(88,230,233,.18), transparent 60%); }
#celebration.play { animation: celebrate .8s ease-out; }
@keyframes celebrate { 30% { opacity: 1; } to { opacity: 0; } }
body[data-planet="ice"] { --planet-a: #b9f3ff; --planet-b: #347caa; }
body[data-planet="volcanic"] { --planet-a: #ffb14a; --planet-b: #8f2538; }
body[data-planet="gas"] { --planet-a: #e5b5ff; --planet-b: #68418f; }
body[data-planet="ocean"] { --planet-a: #52f2c5; --planet-b: #1454a0; }
body.reduced-motion *, body.reduced-motion *::before, body.reduced-motion *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (max-width: 950px) {
  .app { padding: 14px; } header { align-items: flex-start; }
  .layout { grid-template-columns: 1fr; } .mine-panel { position: relative; top: 0; min-height: 550px; }
  .command-panel { min-height: 500px; } .header-stats .stat-chip:first-child { display: none; }
}
@media (max-width: 560px) {
  h1 { font-size: 1.02rem; } .subtitle { display: none; } .logo { width: 36px; height: 36px; }
  .logo::after { width: 45px; left: -5px; top: 11px; } .stat-chip { min-width: 101px; padding: 8px; }
  .header-stats { gap: 6px; } .shop-card { grid-template-columns: 38px 1fr; }
  .shop-card > :last-child { grid-column: 1 / -1; justify-self: stretch; }
  .buy-btn { width: 100%; } .locked-note { max-width: none; text-align: center; }
  .planet-actions { width: 100%; align-items: center; } .spec-select { max-width: none; width: 100%; }
  .mine-panel { padding: 18px; } .tab { padding: 15px 10px 12px; } .tab-content { padding: 14px; }
  .perk-grid { grid-template-columns: 1fr; } footer { flex-direction: column; }
  #spaceEvent { right: 0; top: 4%; }
}
