/* ================= Правая панель ================= */
#panel {
  width: 440px; display: flex; flex-direction: column;
  background:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.05) 0 2px, transparent 3px) 0 0 / 60px 60px,
    radial-gradient(circle at 70% 60%, rgba(255,255,255,.04) 0 1.5px, transparent 2.5px) 0 0 / 45px 45px,
    linear-gradient(180deg, #1d1852, #120e38);
  border-left: 4px solid var(--out);
}
#tabs { display: flex; padding: 10px 8px 8px; gap: 5px; background: rgba(0,0,0,.18); border-bottom: 3px solid var(--out); }
#tabs button {
  position: relative; flex: 1; padding: 6px 2px 5px; border-radius: 14px;
  border: 3px solid var(--out); background: linear-gradient(180deg, #3a3396, #282370);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.15), 0 3px 0 var(--out);
  display: flex; flex-direction: column; align-items: center; gap: 1px; transition: transform .08s;
}
#tabs button i { font-style: normal; font-size: 19px; line-height: 1.1; }
#tabs button span { font-size: 11.5px; font-weight: 900; color: var(--muted); }
#tabs button:hover { filter: brightness(1.15); }
#tabs button.active { background: linear-gradient(180deg, var(--gold-hi), var(--gold) 50%, var(--gold-lo)); transform: translateY(2px); box-shadow: inset 0 2px 0 rgba(255,255,255,.6), 0 1px 0 var(--out); }
#tabs button.active span { color: var(--out); }
.badge {
  position: absolute; top: -8px; right: -4px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px;
  font-size: 12px; font-weight: 900; line-height: 16px; background: #ff5a6e; color: #fff; border: 3px solid var(--out);
  animation: pop .3s;
}
#quest-badge { background: #3cc860; }
.tab-body { flex: 1; overflow-y: auto; padding: 12px; }
.tab-body::-webkit-scrollbar { width: 10px; }
.tab-body::-webkit-scrollbar-thumb { background: #3a3396; border: 2px solid var(--out); border-radius: 6px; }

.sub-title { margin: 18px 2px 8px; font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 20px; font-weight: 400; color: var(--gold); text-shadow: 0 2px 0 var(--out); }
.sub-title span { font-family: 'Nunito', sans-serif; font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); font-size: 13.5px; text-align: center; padding: 18px 8px; }

/* полосы прогресса */
.progress { height: 14px; border-radius: 8px; background: #120e33; border: 2.5px solid var(--out); overflow: hidden; margin: 8px 0; position: relative; }
.progress i {
  display: block; height: 100%; border-radius: 5px; transition: width .25s;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 50%, var(--gold-lo));
  box-shadow: inset 0 2px 0 rgba(255,255,255,.5);
}
.q-bar { height: 12px; margin: 6px 0 4px; }

/* доля производства */
.prod { margin-bottom: 12px; padding: 10px 12px; }
.prod-bar { display: flex; height: 14px; border-radius: 8px; overflow: hidden; background: #120e33; border: 2.5px solid var(--out); }
.prod-bar i { display: block; height: 100%; transition: width .5s; box-shadow: inset 0 2px 0 rgba(255,255,255,.35); }
.prod-total { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.buy-amt { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.buy-amt button {
  padding: 5px 12px; border-radius: 12px; font-weight: 900; font-size: 12.5px;
  border: 3px solid var(--out); background: linear-gradient(180deg, #3a3396, #282370); box-shadow: 0 3px 0 var(--out);
}
.buy-amt button.active { background: linear-gradient(180deg, var(--gold-hi), var(--gold) 50%, var(--gold-lo)); color: var(--out); transform: translateY(2px); box-shadow: 0 1px 0 var(--out); }

/* постройки */
.bld {
  --bc: var(--gold);
  position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 12px 13px; margin-bottom: 10px;
  cursor: pointer; overflow: hidden; transition: transform .1s, filter .15s;
}
.bld::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 7px; background: var(--bc); border-right: 3px solid var(--out); }
.bld:hover { filter: brightness(1.12); transform: translateY(-2px); }
.bld:active { transform: translateY(2px); box-shadow: inset 0 2px 0 rgba(255,255,255,.14), 0 1px 0 #0a0720; }
.bld.cant { cursor: default; }
.bld.cant:hover { filter: none; transform: none; }
.bld.cant .ico, .bld.cant .name { opacity: .55; }
.bld.locked { filter: brightness(.35) saturate(0); pointer-events: none; }
.bld .ico { width: 58px; height: 58px; flex-shrink: 0; margin-left: 4px; padding: 4px; }
.bld .info { flex: 1; min-width: 0; }
.bld .name { font-size: 16px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bld .cost { font-size: 14px; color: var(--gold); font-weight: 900; }
.bld.cant .cost { color: var(--bad); }
.bld .sub { font-size: 11.5px; color: var(--muted); font-weight: 800; }
.bld .right { text-align: right; }
.bld .count { font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 32px; line-height: 1; color: var(--text); paint-order: stroke fill; }
.bld .mile { font-size: 11px; color: var(--gold); margin-top: 3px; white-space: nowrap; font-weight: 900; }
.bld .afford { position: absolute; left: 10px; right: 0; bottom: 0; height: 6px; background: rgba(0,0,0,.3); }
.bld .afford i { display: block; height: 100%; background: var(--bc); transition: width .2s; }
.bld .flash { position: absolute; inset: 0; background: radial-gradient(circle at 40px 50%, rgba(255,240,170,.6), transparent 60%); opacity: 0; pointer-events: none; }
.bld .flash.go { animation: flash .45s; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
.turret-row .sub { color: #ff9aa8; }

/* технологии */
.btn-buyall { width: 100%; padding: 11px; margin-bottom: 12px; font-size: 15px; }
.upg { display: flex; gap: 12px; align-items: center; padding: 9px 12px; margin-bottom: 10px; cursor: pointer; transition: transform .1s, filter .15s; }
.upg:hover { filter: brightness(1.12); transform: translateY(-2px); }
.upg.cant { opacity: .55; cursor: default; }
.upg.cant:hover { filter: none; transform: none; }
.upg .ico-wrap { position: relative; flex-shrink: 0; }
.upg img { width: 52px; height: 52px; padding: 3px; }
.tier {
  position: absolute; right: -6px; bottom: -4px; font-size: 11px; font-weight: 900; padding: 0 6px; border-radius: 8px;
  background: var(--out); border: 2px solid currentColor;
}
.upg .name { font-size: 15px; font-weight: 900; }
.upg .desc { font-size: 12.5px; color: var(--good); }
.upg .cost { font-size: 13.5px; color: var(--gold); font-weight: 900; }
.upg.cant .cost { color: var(--bad); }
#upg-done, .ach-grid { display: flex; flex-wrap: wrap; gap: 7px; }
#upg-done img { width: 42px; height: 42px; padding: 3px; }

/* задания */
.q-head { display: flex; justify-content: space-between; align-items: baseline; margin: 4px 2px 10px; font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 21px; color: var(--gold); }
.q-count { font-family: 'Nunito', sans-serif; font-size: 12.5px; color: var(--muted); text-shadow: none; font-weight: 800; }
.quest { position: relative; display: flex; gap: 12px; align-items: center; padding: 11px 12px; margin-bottom: 10px; overflow: hidden; }
.quest.main { background: linear-gradient(180deg, #4a3ab0, #3a2d8a 30%, #2c2272); margin-bottom: 18px; }
.quest.done { background: linear-gradient(180deg, #4fd06b, #2f9e4c 30%, #237a3e); }
.quest.done .q-desc, .quest.done .q-foot { color: #e8ffe8; }
.q-ico img { width: 50px; height: 50px; padding: 3px; }
.q-body { flex: 1; min-width: 0; }
.q-title { font-size: 15px; font-weight: 900; }
.q-tag { font-size: 10px; font-weight: 900; letter-spacing: 1px; padding: 1px 7px; border-radius: 8px; margin-right: 6px; vertical-align: 2px; background: var(--gold); color: var(--out); border: 2px solid var(--out); }
.q-desc { font-size: 12.5px; color: var(--muted); }
.q-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.quest.done .q-bar i { background: linear-gradient(180deg, #fff, #d8ffe0); }
.rw-cr { color: var(--gold); font-weight: 900; }
.rw-dm { color: var(--dm); font-weight: 900; }
.rw-boost { color: #ffb070; font-weight: 900; }
.rw-exo { color: #6ff0d6; font-weight: 900; }
.rw-art { color: #ff9ad2; font-weight: 900; }
.quest.done .rw-cr, .quest.done .rw-dm, .quest.done .rw-boost, .quest.done .rw-exo, .quest.done .rw-art { color: #fff3a8; }
.q-actions { display: flex; flex-direction: column; gap: 6px; }
.q-claim { padding: 9px 14px; font-size: 14px; animation: wiggle 1.4s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 10% { transform: rotate(-4deg); } 20% { transform: rotate(4deg); } 30% { transform: rotate(0); } }
.q-skip { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--out); background: linear-gradient(180deg, #3a3396, #282370); box-shadow: 0 3px 0 var(--out); font-size: 17px; font-weight: 900; transition: .15s; }
.q-skip:hover:not(:disabled) { transform: rotate(90deg); filter: brightness(1.2); }
.q-skip:disabled { opacity: .35; }
.q-note { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 4px; }

/* варп */
.warp-card { padding: 16px; margin-bottom: 12px; background: linear-gradient(180deg, #5a3ab8, #3e2690 30%, #2a1a6a); }
.warp-card h3 { margin: 0 0 6px; font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 24px; color: var(--gold); }
.warp-card p { margin: 6px 0; font-size: 13.5px; color: #e4dcff; line-height: 1.45; }
.big-num { font-size: 36px; font-weight: 900; color: var(--dm); }
.btn-warp { width: 100%; padding: 13px; margin-top: 10px; font-family: 'Rubik', sans-serif; font-weight: 800; font-size: 24px; font-weight: 400; letter-spacing: 1px; }

/* таланты */
.tal-head h3 { margin: 6px 0 4px; font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 24px; color: var(--gold); }
.tal-head p { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.tal-tree { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tal-col { display: flex; flex-direction: column; align-items: center; padding: 10px 5px; }
.tal-br { font-size: 12px; font-weight: 900; color: var(--gold); margin-bottom: 8px; text-align: center; }
.tal { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; border: 0; background: none; transition: transform .1s; }
.tal img { width: 52px; height: 52px; padding: 4px; }
.tal-lv { font-size: 11px; font-weight: 900; color: var(--muted); padding: 0 7px; border-radius: 8px; background: var(--out); margin-top: -10px; position: relative; }
.tal-name { font-size: 11.5px; font-weight: 900; line-height: 1.15; text-align: center; }
.tal.has img { background: radial-gradient(circle at 38% 32%, #c8a0ff, #8a4ae0 50%, #4a2090); }
.tal.has .tal-lv { color: var(--dm); }
.tal.maxed img { background: radial-gradient(circle at 38% 32%, #fff3a8, var(--gold) 50%, var(--gold-lo)); }
.tal.maxed .tal-lv { color: var(--gold); }
.tal.can img { animation: glowPurple 1.4s ease-in-out infinite; }
.tal.can:hover { transform: scale(1.06); }
@keyframes glowPurple { 50% { box-shadow: 0 0 0 4px rgba(192,139,255,.55), 0 3px 0 #0a0720; } }
.tal.locked { opacity: .35; filter: grayscale(.9); }
.tal-link { width: 6px; height: 14px; background: #120e33; border-left: 2px solid var(--out); border-right: 2px solid var(--out); }
.tal-link.on { background: var(--dm); }

/* журнал */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-bottom: 12px; }
.kpi { padding: 9px 4px; text-align: center; }
.kpi b { display: block; font-size: 20px; font-weight: 900; color: var(--gold); }
.kpi span { font-size: 10.5px; color: var(--muted); line-height: 1.2; display: block; }
.chart-card { padding: 10px 10px 6px; margin-bottom: 12px; }
.chart-title { font-size: 14px; font-weight: 900; margin-bottom: 6px; }
.chart-title span { font-weight: 700; font-size: 11.5px; color: var(--muted); margin-left: 4px; }
.chart-card canvas { width: 100%; height: 120px; display: block; cursor: crosshair; }
.stats { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.stats td { padding: 6px 4px; border-bottom: 2px dashed rgba(179,169,230,.2); }
.stats td:last-child { text-align: right; font-weight: 900; color: var(--gold); }
.ach {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 21px;
  background: #1d1858; border: 3px solid var(--out); box-shadow: 0 3px 0 #0a0720; filter: grayscale(1) brightness(.45); transition: transform .15s;
}
.ach:hover { transform: scale(1.12) rotate(-6deg); }
.ach.on { filter: none; background: radial-gradient(circle at 38% 32%, #fff3a8, var(--gold) 55%, var(--gold-lo)); }

/* склад */
.exo-card { display: flex; gap: 12px; align-items: center; padding: 14px; margin-bottom: 4px; background: linear-gradient(180deg, #2fb89a, #1f8a74 30%, #176858); }
.exo-card img { width: 66px; height: 66px; padding: 4px; }
.exo-num { font-size: 24px; font-weight: 900; color: #b8fff0; }
.exo-sub { font-size: 13px; color: #fff3a8; font-weight: 900; }
.exo-note { font-size: 11.5px; color: #d8fff6; margin-top: 3px; line-height: 1.35; }
.mega { display: flex; gap: 12px; align-items: center; padding: 9px 12px; margin-bottom: 10px; }
.mega > img { width: 54px; height: 54px; padding: 3px; }
.mega.maxed { background: linear-gradient(180deg, #6a58c8, #4a3a9a 30%, #3a2d80); }
.mega-body { flex: 1; min-width: 0; }
.mega-name { font-size: 14.5px; font-weight: 900; }
.mega-desc { font-size: 12px; color: var(--muted); }
.mega-lv i { display: inline-block; width: 11px; height: 11px; margin-left: 2px; border-radius: 50%; background: #120e33; border: 2px solid var(--out); vertical-align: -1px; }
.mega-lv i.on { background: var(--gold); }
.mega-btn { display: flex; align-items: center; gap: 4px; padding: 8px 12px; font-size: 14px; white-space: nowrap; }
.mega-btn img { width: 20px; height: 20px; }
.mega.maxed .mega-btn { filter: none; background: linear-gradient(180deg, #8af0a0, #4fd06b 50%, #2a9a48); }
.art-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 9px; }
.art { aspect-ratio: 1; padding: 5px; transition: transform .15s; }
.art img { width: 100%; height: 100%; }
.art:hover { transform: scale(1.1) rotate(-6deg); }
.art.r1 { box-shadow: 0 0 0 3px #5ce1ff, 0 3px 0 #0a0720; }
.art.r2 { box-shadow: 0 0 0 3px #c58bff, 0 3px 0 #0a0720; }
.art.r3 { box-shadow: 0 0 0 3px var(--gold), 0 0 14px var(--gold), 0 3px 0 #0a0720; animation: bobY 1.6s ease-in-out infinite; }

/* ручка сворачивания панели: золотой язычок посередине края */
main { position: relative; }
#panel-toggle {
  position: absolute; z-index: 6; top: 50%; right: 440px; transform: translateY(-50%);
  width: 28px; height: 72px; padding: 0; cursor: pointer; border-radius: 14px 0 0 14px;
  border: 3px solid var(--out); border-right: 0; color: var(--out); font-size: 22px; font-weight: 900;
  background: linear-gradient(90deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo));
  box-shadow: inset 0 2px 0 rgba(255,255,255,.6), -3px 3px 0 rgba(10,7,32,.6);
  display: grid; place-items: center; transition: filter .15s;
}
#panel-toggle:hover { filter: brightness(1.12); }
#panel-toggle span { display: block; transition: transform .25s ease; }
body.panel-hidden #panel-toggle span { transform: rotate(180deg); }
#panel { animation: panelIn .28s ease-out; }
@keyframes panelIn { from { transform: translateX(24px); opacity: 0; } }
body.panel-hidden #panel { display: none; }
body.panel-hidden #panel-toggle { right: 0; }
@media (max-width: 860px) { #panel-toggle { display: none; } body.panel-hidden #panel { display: flex; } }

/* блок автокликов во вкладке «Флот» */
.ac-block { margin-top: 6px; }
.ac-row .sub { color: #9fe8ff; }

/* =================================================================
   Компоновка панели: вертикальная лента вкладок слева + просторный контент
   ================================================================= */
#panel { width: 500px; flex-direction: row; }
#tabs {
  flex-direction: column; width: 74px; flex-shrink: 0; gap: 8px; padding: 12px 8px;
  border-bottom: 0; border-right: 3px solid var(--out); background: rgba(0,0,0,.25); overflow-y: auto;
}
#tabs button { flex: none; height: 62px; padding: 6px 2px; gap: 3px; border-radius: 16px; }
#tabs button i { font-size: 22px; }
#tabs button span { font-size: 10.5px; line-height: 1; }
#tabs button.active { transform: none; box-shadow: inset 0 2px 0 rgba(255,255,255,.6), 0 3px 0 var(--out); }
.badge { top: -6px; right: -6px; }
.tab-body { padding: 14px 16px; }
#panel-toggle { right: 500px; }

/* шапка вкладки «Флот»: доля производства и количество покупки в одну строку */
#tab-fleet .prod { margin-bottom: 10px; padding: 9px 12px; }
.buy-amt { margin-bottom: 12px; }

/* лёгкие карточки построек */
.bld { padding: 8px 12px 11px; margin-bottom: 8px; gap: 12px; border-width: 2.5px; box-shadow: inset 0 2px 0 rgba(255,255,255,.1), 0 3px 0 #0a0720; }
.bld::before { width: 6px; }
.bld .ico { width: 48px; height: 48px; padding: 3px; margin-left: 2px; }
.bld .name { font-size: 15px; }
.bld .cost { font-size: 13.5px; }
.bld .count { font-size: 26px; }
.upg, .quest, .mega, .lab-card { border-width: 2.5px; box-shadow: inset 0 2px 0 rgba(255,255,255,.1), 0 3px 0 #0a0720; }
.upg img, .q-ico img, .mega > img, .lab-card > img { width: 46px; height: 46px; }
.sub-title { margin: 20px 2px 10px; }
@media (max-width: 860px) {
  #panel { width: 100%; flex-direction: column; }
  #tabs { flex-direction: row; width: auto; border-right: 0; border-bottom: 3px solid var(--out); padding: 8px; }
  #tabs button { flex: 1; height: 56px; }
}
