/* ================= Шапка ================= */
#top {
  position: relative;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 8px 18px;
  background: linear-gradient(180deg, #2a2470 0%, #1b1650 100%);
  border-bottom: 4px solid var(--out);
  box-shadow: 0 4px 0 rgba(0,0,0,.35);
  z-index: 5;
}
.logo { display: flex; align-items: center; gap: 10px; min-width: 220px; }
#logo-ico { width: 64px; height: 64px; margin: -6px -4px -6px -6px; cursor: pointer; filter: drop-shadow(0 3px 0 rgba(0,0,0,.35)); }
@keyframes float { 50% { transform: translateY(-3px) rotate(-5deg); } }
.logo-t { font-family: 'Rubik', sans-serif; font-weight: 800; font-size: 28px; line-height: 1; color: var(--gold); letter-spacing: .5px; }
.logo-s { font-size: 12.5px; color: var(--muted); font-weight: 800; }

.res { display: flex; flex-direction: column; }
.res-main { display: flex; align-items: center; gap: 8px; font-size: 28px; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; line-height: 1.1; }
.res.credits.boosted .res-main { color: #fff3c4; animation: boost .7s ease-in-out infinite; }
@keyframes boost { 50% { transform: scale(1.05); } }
.res.dm .res-main { color: var(--dm); font-size: 23px; }
.res-sub { font-size: 12.5px; color: var(--muted); padding-left: 38px; cursor: help; font-weight: 800; }
.res-sub span { color: var(--text); font-weight: 900; }
.ico-sm { width: 30px; height: 30px; filter: drop-shadow(0 2px 0 rgba(0,0,0,.4)); }
.top-btns { margin-left: auto; display: flex; gap: 8px; }
.icon-btn {
  position: relative; width: 44px; height: 44px; border-radius: 50%; font-size: 19px;
  border: 3px solid var(--out);
  background: radial-gradient(circle at 38% 30%, #7a72e8, #3a3396 60%, #241f6a);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.3), 0 4px 0 #0a0720;
  transition: transform .08s;
}
.icon-btn:hover { filter: brightness(1.15); }
.icon-btn:active { transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255,255,255,.3), 0 1px 0 #0a0720; }
.icon-btn.off { filter: grayscale(1) brightness(.7); }
.icon-btn .dot {
  position: absolute; top: -2px; right: -2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--good); border: 2.5px solid var(--out); animation: pulse 1.2s infinite;
}

/* ================= Основная область ================= */
main { flex: 1; display: flex; min-height: 0; }
#space { position: relative; flex: 1; min-width: 0; overflow: hidden; }
#space-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 60%, rgba(5,3,20,.45) 100%); }

#planet-label { position: absolute; left: 18px; bottom: 14px; pointer-events: none; z-index: 2; }
#planet-name { font-family: 'Rubik', sans-serif; font-weight: 800; font-size: 30px; color: var(--gold); line-height: 1.1; }
#planet-type { font-size: 13.5px; color: var(--muted); font-weight: 800; text-shadow: 0 2px 0 var(--out); }

#hint {
  position: absolute; left: 50%; bottom: 62px; transform: translateX(-50%); z-index: 2;
  padding: 9px 20px; border-radius: 999px; font-size: 15px; font-weight: 900; color: var(--out);
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 50%, var(--gold-lo));
  border: 3px solid var(--out); box-shadow: 0 4px 0 var(--out);
  pointer-events: none; animation: bob 1.6s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateX(-50%) translateY(-4px); } }
@keyframes pulse { 50% { opacity: .55; } }

#boosts { position: absolute; top: 14px; left: 14px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; z-index: 2; }
.boost {
  padding: 7px 14px; border-radius: 14px; font-size: 13.5px; font-weight: 900; color: var(--out);
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo));
  border: 3px solid var(--out); box-shadow: 0 4px 0 var(--out);
}
.boost .bar { height: 7px; margin-top: 5px; background: rgba(26,16,51,.35); border-radius: 4px; overflow: hidden; }
.boost .bar i { display: block; height: 100%; background: var(--out); border-radius: 4px; }
.boost.raid { color: #fff; background: linear-gradient(180deg, #ff9aa6, #ff5a6e 55%, #c42840); animation: shake .5s ease-in-out infinite; }
.boost.raid .bar i { background: #fff; }
@keyframes shake { 25% { transform: rotate(-1deg); } 75% { transform: rotate(1deg); } }

#sector-mod {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 2; pointer-events: none;
  padding: 6px 16px; border-radius: 999px; font-size: 13px; font-weight: 800; white-space: nowrap; max-width: 46%; overflow: hidden; text-overflow: ellipsis;
  background: linear-gradient(180deg, #8a5cf0, #5e36c0); color: #fff; border: 3px solid var(--out); box-shadow: 0 4px 0 var(--out);
}
#sector-mod b { color: var(--gold-hi); }

/* трекер задания */
#tracker { position: absolute; right: 14px; bottom: 14px; width: 280px; z-index: 2; cursor: pointer; padding: 11px 14px; transition: transform .12s; }
#tracker:hover { transform: translateY(-3px); }
#tracker.done { background: linear-gradient(180deg, #4fd06b, #2a9a48); animation: bobY 1.2s ease-in-out infinite; }
@keyframes bobY { 50% { transform: translateY(-4px); } }
.tr-label { font-size: 11px; font-weight: 900; letter-spacing: 1.5px; color: var(--gold); }
#tracker.done .tr-label { color: #fff; }
.tr-title { font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 20px; line-height: 1.15; }
.tr-desc { font-size: 12.5px; color: var(--muted); }
#tracker.done .tr-desc { color: #e8ffe8; }
#tracker .progress { margin: 7px 0 5px; }
.tr-foot { font-size: 12px; color: var(--muted); }
#tracker.done .tr-foot { color: #fff; font-weight: 900; }

/* ИИ ОРИОН */
#comms {
  position: absolute; left: 14px; bottom: 80px; z-index: 3; width: min(400px, calc(100% - 28px));
  display: flex; gap: 12px; align-items: center; padding: 10px 14px; pointer-events: none;
  animation: commsIn .4s cubic-bezier(.2,1.5,.4,1);
}
#comms.out { animation: commsOut .4s forwards; }
@keyframes commsIn { from { transform: scale(.6) translateY(20px); opacity: 0; } }
@keyframes commsOut { to { transform: scale(.8) translateY(10px); opacity: 0; } }
#ai-face { width: 60px; height: 60px; flex-shrink: 0; }
.comms-body { min-width: 0; flex: 1; }
.ai-name { font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 16px; color: var(--accent); }
.ai-text { font-size: 14px; line-height: 1.4; min-height: 20px; }

/* уведомления */
#toasts { position: absolute; top: 14px; right: 14px; width: 340px; max-width: calc(100% - 28px); display: flex; flex-direction: column; gap: 10px; pointer-events: none; z-index: 3; }
.toast { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 13px; font-size: 14px; animation: toastIn .45s cubic-bezier(.2,1.6,.4,1); }
.toast > div { flex: 1; min-width: 0; line-height: 1.35; overflow-wrap: break-word; }
.toast small { color: var(--muted); }
.toast img { width: 40px; height: 40px; filter: drop-shadow(0 2px 0 rgba(0,0,0,.4)); }
.toast b { color: var(--gold); }
.toast.t-ach { background: linear-gradient(180deg, #5a4ab8, #3a2d8a); }
.toast.t-quest { background: linear-gradient(180deg, #3aa85a, #237a3e); }
.toast.t-quest b { color: #fff3a8; }
.toast.t-tech { background: linear-gradient(180deg, #4a68d8, #2c44a0); }
.toast.out { animation: toastOut .4s forwards; }
@keyframes toastIn { from { transform: scale(.5); opacity: 0; } }
@keyframes toastOut { to { transform: translateX(60px); opacity: 0; } }

/* тулбар: рисованные иконки строго по центру круглых кнопок */
.icon-btn { display: grid; place-items: center; padding: 0; }
.icon-btn img { width: 28px; height: 28px; display: block; pointer-events: none; filter: drop-shadow(0 1px 0 rgba(0,0,0,.35)); }
.set-row .vol { flex: 1; max-width: 200px; accent-color: var(--gold); cursor: pointer; }
.set-row .vol-v { width: 42px; text-align: right; color: var(--gold); font-weight: 900; }

/* всплывающее предложение рекламы за вознаграждение */
#ad-pop {
  position: absolute; right: 14px; bottom: 14px; z-index: 4; width: min(320px, calc(100% - 28px)); padding: 12px 14px 14px;
  border-radius: 18px; border: 3px solid var(--out); background: linear-gradient(180deg, #2c2680, #1e1a5c);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.15), 0 4px 0 #0a0720; animation: pop .3s; overflow: hidden;
}
#ad-pop.out { animation: adOut .25s forwards; }
@keyframes adOut { to { transform: translateY(20px); opacity: 0; } }
.ad-pop-t { font-size: 14px; font-weight: 800; margin: 0 22px 10px 0; color: #fff; }
.ad-pop-t b { color: var(--gold); }
#ad-pop .ad-btn { margin: 0; }
.ad-pop-x {
  position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--out);
  background: #3a3396; color: #fff; font-size: 12px; font-weight: 900; line-height: 1; display: grid; place-items: center;
}
.ad-pop-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(0,0,0,.35); }
.ad-pop-bar b { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #4fd06b, #a8ff8a); transition: width .1s linear; }
.ad-pop-t small { display: block; margin-top: 3px; font-size: 11.5px; font-weight: 700; color: var(--muted); }
