/* ============ Cosmos Astral — общий стиль сайта и лаунчера ============ */
:root {
  --bg: #0A0E1A;
  --bg2: #0F1528;
  --card: rgba(18, 26, 50, 0.72);
  --card2: rgba(26, 36, 68, 0.85);
  --line: rgba(30, 107, 255, 0.22);
  --line2: rgba(120, 160, 255, 0.12);
  --accent: #1E6BFF;
  --accent2: #4D8DFF;
  --glow: 0 0 24px rgba(30, 107, 255, 0.45);
  --text: #FFFFFF;
  --muted: #9AA8C7;
  --ok: #2FD58A;
  --warn: #FFB547;
  --bad: #FF5470;
  --r: 18px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --head: 'Unbounded', 'Manrope', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; }
body { background: radial-gradient(1200px 600px at 80% -10%, rgba(30,107,255,.18), transparent 60%),
                    radial-gradient(900px 500px at -10% 30%, rgba(110,60,255,.12), transparent 60%), var(--bg); }
#stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
a { color: var(--accent2); text-decoration: none; }
a:hover { color: #8FB4FF; }
h1, h2, h3 { font-family: var(--head); letter-spacing: .02em; margin: 0 0 .6em; }
h1 { font-size: clamp(28px, 5vw, 54px); line-height: 1.1; }
h2 { font-size: clamp(20px, 3vw, 28px); }
h3 { font-size: 17px; }
p { line-height: 1.6; color: #D6DEF2; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }
code, .mono { font-family: ui-monospace, Consolas, monospace; }

/* ---------- верхняя панель (сайт) ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; padding: 14px 28px;
  background: rgba(10, 14, 26, .72); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line2); }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-family: var(--head); font-size: 17px; white-space: nowrap; }
.brand img { width: 34px; height: 34px; filter: drop-shadow(0 0 10px rgba(30,107,255,.7)); }
.brand b { color: var(--accent2); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: var(--muted); padding: 9px 14px; border-radius: 12px; font-weight: 600; transition: .2s; }
.nav a:hover { color: #fff; background: rgba(30,107,255,.12); }
.nav a.active { color: #fff; background: rgba(30,107,255,.2); box-shadow: inset 0 0 0 1px var(--line); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.cur-select { background: var(--card); color: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; font: inherit; font-weight: 700; cursor: pointer; }
.burger { display: none; background: none; border: 0; width: 40px; height: 40px; cursor: pointer; flex-direction: column; justify-content: center; gap: 5px; padding: 8px; }
.burger span { display: block; height: 2px; background: #fff; border-radius: 2px; }
.userchip { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; color: #fff; }
.userchip .ava { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #7A4DFF); display: grid; place-items: center; font-weight: 800; font-size: 13px; }

/* ---------- лаунчер ---------- */
body.launcher { overflow: hidden; }
[hidden] { display: none !important; }
.titlebar { position: fixed; top: 0; left: 0; right: 0; height: 38px; z-index: 50; display: flex; align-items: center;
  background: rgba(6, 9, 18, .9); border-bottom: 1px solid var(--line2); }
.tb-drag { -webkit-app-region: drag; flex: 1; height: 100%; display: flex; align-items: center; gap: 8px; padding-left: 14px; font-family: var(--head); font-size: 12px; color: var(--muted); }
.tb-drag img { width: 18px; }
.tb-btn { -webkit-app-region: no-drag; width: 46px; height: 100%; border: 0; background: none; color: #cbd5f0; font-size: 14px; cursor: pointer; }
.tb-btn:hover { background: rgba(255,255,255,.08); }
.tb-close:hover { background: #E81123; color: #fff; }
body.launcher .topbar { display: none; }
.sidebar { position: fixed; top: 38px; bottom: 0; left: 0; width: 92px; z-index: 10; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 0;
  background: rgba(8, 12, 24, .8); border-right: 1px solid var(--line2); }
.sidebar a { width: 72px; padding: 12px 4px; border-radius: 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; transition: .2s; }
.sidebar a svg { width: 24px; height: 24px; }
.sidebar a:hover { color: #fff; background: rgba(30,107,255,.12); }
.sidebar a.active { color: #fff; background: rgba(30,107,255,.25); box-shadow: var(--glow); }
.sidebar .bottom { margin-top: auto; }
body.launcher .app { position: fixed; top: 38px; left: 92px; right: 0; bottom: 0; overflow-y: auto; padding: 26px 30px; max-width: none; }

/* ---------- основная область ---------- */
.app { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 32px 24px 80px; animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.section { margin: 44px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }

.card { background: var(--card); border: 1px solid var(--line2); border-radius: var(--r); padding: 22px; backdrop-filter: blur(10px);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s; }
.card.hover:hover { transform: translateY(-4px); border-color: var(--line); box-shadow: 0 14px 40px rgba(0,0,0,.35), var(--glow); }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border-radius: 14px; border: 1px solid var(--line);
  background: rgba(30,107,255,.12); color: #fff; font: inherit; font-weight: 700; cursor: pointer; transition: .2s; white-space: nowrap; }
.btn:hover { background: rgba(30,107,255,.25); color: #fff; }
.btn.primary { background: linear-gradient(135deg, #1E6BFF, #3F7CFF 60%, #6A5BFF); border-color: transparent; box-shadow: 0 6px 22px rgba(30,107,255,.45); }
.btn.primary:hover { filter: brightness(1.12); box-shadow: 0 8px 30px rgba(30,107,255,.65); }
.btn.danger { background: rgba(255,84,112,.14); border-color: rgba(255,84,112,.4); }
.btn.danger:hover { background: rgba(255,84,112,.28); }
.btn.ghost { background: transparent; border-color: var(--line2); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.lg { padding: 16px 28px; font-size: 17px; border-radius: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: grayscale(.5); }

input, select, textarea { width: 100%; background: rgba(8, 12, 26, .7); color: #fff; border: 1px solid var(--line2); border-radius: 12px; padding: 11px 13px; font: inherit; outline: none; transition: .2s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(30,107,255,.2); }
textarea { min-height: 90px; resize: vertical; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
input[type=range] { padding: 0; accent-color: var(--accent); }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; margin: 8px 0; }
.check input { width: 18px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; background: rgba(30,107,255,.18); color: #cfe0ff; }
.badge.ok { background: rgba(47,213,138,.16); color: var(--ok); }
.badge.warn { background: rgba(255,181,71,.16); color: var(--warn); }
.badge.bad { background: rgba(255,84,112,.16); color: var(--bad); }
.prefix { font-weight: 900; letter-spacing: .03em; }

/* ---------- главная ---------- */
.hero { display: grid; grid-template-columns: 1.2fr .8fr; gap: 30px; align-items: center; padding: 30px 0 10px; }
.hero h1 .glow { background: linear-gradient(90deg, #fff, #8FB4FF 50%, #1E6BFF); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-art { position: relative; aspect-ratio: 1; display: grid; place-items: center; }
.planet { width: 72%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #6FA0FF, #1E6BFF 35%, #0D2B7A 70%, #050A1C);
  box-shadow: 0 0 80px rgba(30,107,255,.6), inset -30px -30px 80px rgba(0,0,0,.6); animation: float 6s ease-in-out infinite; }
.ring { position: absolute; width: 100%; height: 30%; border-radius: 50%; border: 3px solid rgba(143,180,255,.55); transform: rotate(-18deg); box-shadow: 0 0 30px rgba(30,107,255,.4); animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { translate: 0 -12px; } }
.ipbox { display: inline-flex; align-items: center; gap: 12px; padding: 10px 10px 10px 18px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); font-family: ui-monospace, Consolas, monospace; font-size: 17px; }
.online { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 10px var(--bad); }
.dot.on { background: var(--ok); box-shadow: 0 0 10px var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.stat .v { font-family: var(--head); font-size: 26px; }
.stat .l { color: var(--muted); font-size: 13px; }

/* ---------- магазин ---------- */
.product { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; position: relative; overflow: hidden; }
.product::before { content: ''; position: absolute; inset: -40% -40% auto; height: 70%; background: radial-gradient(circle, var(--pc, #1E6BFF) 0%, transparent 65%); opacity: .18; pointer-events: none; }
.product .img { width: 116px; height: 116px; object-fit: contain; filter: drop-shadow(0 8px 22px rgba(0,0,0,.5)); transition: transform .3s; }
.product:hover .img { transform: scale(1.08) rotate(-3deg); }
.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }
.product .name { font-family: var(--head); font-size: 18px; font-weight: 800; }
.product .desc { font-size: 13px; color: var(--muted); min-height: 36px; }
.price { font-family: var(--head); font-size: 22px; }
.price s { font-size: 14px; color: var(--muted); margin-right: 6px; font-family: var(--font); }
.sale { position: absolute; top: 12px; right: 12px; background: var(--bad); color: #fff; font-weight: 900; font-size: 12px; padding: 4px 8px; border-radius: 8px; }
.case-list { width: 100%; text-align: left; font-size: 13px; margin: 6px 0 0; padding: 0; list-style: none; }
.case-list li { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed var(--line2); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs button { background: var(--card); border: 1px solid var(--line2); color: var(--muted); padding: 9px 15px; border-radius: 12px; font: inherit; font-weight: 700; cursor: pointer; transition: .2s; }
.tabs button.active, .tabs button:hover { color: #fff; border-color: var(--line); background: rgba(30,107,255,.2); }

/* ---------- новости ---------- */
.news-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.news-card .cover { aspect-ratio: 16/8; background: linear-gradient(135deg, #12204a, #0a0e1a); background-size: cover; background-position: center; }
.news-card .body { padding: 18px 20px 20px; }
.news-card .date { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.news-card p { white-space: pre-line; margin: 0; }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid var(--line2); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--line2); vertical-align: middle; }
th { color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; background: rgba(8,12,26,.6); }
tr:hover td { background: rgba(30,107,255,.05); }

/* ---------- модальные окна и уведомления ---------- */
.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(3, 5, 12, .72); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: fadein .2s; }
@keyframes fadein { from { opacity: 0; } }
.modal { width: min(520px, 100%); max-height: 92vh; overflow-y: auto; background: linear-gradient(180deg, #121a36, #0c1226); border: 1px solid var(--line); border-radius: 22px; padding: 26px; box-shadow: 0 30px 80px rgba(0,0,0,.6), var(--glow); animation: pop .25s ease; }
.modal.wide { width: min(860px, 100%); }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h3 { margin: 0; }
.x { background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { min-width: 240px; max-width: 380px; padding: 13px 16px; border-radius: 14px; background: #131c3a; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: pop .25s; }
.toast.err { border-color: rgba(255,84,112,.6); }
.toast.ok { border-color: rgba(47,213,138,.6); }
.code-big { font-family: var(--head); font-size: 38px; letter-spacing: .2em; text-align: center; padding: 14px; border-radius: 16px; background: rgba(30,107,255,.12); border: 1px dashed var(--line); margin: 14px 0; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255,255,255,.2); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.methods { display: grid; gap: 8px; }
.method { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line2); cursor: pointer; transition: .2s; }
.method:hover { border-color: var(--line); }
.method.sel { border-color: var(--accent); background: rgba(30,107,255,.14); box-shadow: var(--glow); }
.method input { width: auto; }
.summary { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: 14px; background: rgba(30,107,255,.1); margin: 14px 0; }
.warnbox { padding: 12px 14px; border-radius: 12px; background: rgba(255,181,71,.1); border: 1px solid rgba(255,181,71,.35); color: #FFE2B0; font-size: 14px; margin: 10px 0; }

/* ---------- кабинет / аккаунты ---------- */
.acc { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 16px; border: 1px solid var(--line2); background: rgba(8,12,26,.5); cursor: pointer; transition: .2s; }
.acc:hover { border-color: var(--line); }
.acc.sel { border-color: var(--accent); box-shadow: var(--glow); background: rgba(30,107,255,.12); }
.acc img { width: 46px; height: 46px; border-radius: 10px; image-rendering: pixelated; background: #10172e; }
.acc .nick { font-weight: 800; font-size: 16px; }

/* ---------- лаунчер: играть ---------- */
.play-wrap { display: grid; grid-template-columns: 1fr 340px; gap: 22px; min-height: calc(100vh - 100px); }
.play-hero { position: relative; border-radius: 24px; overflow: hidden; padding: 34px; display: flex; flex-direction: column; justify-content: flex-end;
  background: radial-gradient(600px 300px at 70% 20%, rgba(30,107,255,.35), transparent 70%), linear-gradient(160deg, #101a3c, #070b18); border: 1px solid var(--line2); min-height: 420px; }
.play-hero .planet { position: absolute; width: 280px; right: 40px; top: 40px; }
.playbtn { font-family: var(--head); font-size: 26px; letter-spacing: .12em; padding: 22px 60px; border-radius: 20px; }
.progress { height: 12px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: 18px; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, #1E6BFF, #7AA6FF); box-shadow: 0 0 16px #1E6BFF; transition: width .25s; }
.progress-text { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 8px; }
.side-col { display: flex; flex-direction: column; gap: 16px; }

/* ---------- админка ---------- */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; gap: 22px; }
.admin-menu { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 90px; align-self: start; }
body.launcher .admin-menu { top: 0; }
.admin-menu a { padding: 10px 14px; border-radius: 12px; color: var(--muted); font-weight: 700; }
.admin-menu a:hover { color: #fff; background: rgba(30,107,255,.1); }
.admin-menu a.active { color: #fff; background: rgba(30,107,255,.22); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 14px; font-size: 14px; }
.kv .k { color: var(--muted); }
.bars { display: flex; align-items: end; gap: 4px; height: 140px; padding-top: 10px; }
.bars div { flex: 1; background: linear-gradient(180deg, #4D8DFF, #1E6BFF); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bars div:hover::after { content: attr(data-t); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #000; padding: 4px 6px; border-radius: 6px; font-size: 11px; white-space: nowrap; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 14px; }
.case-item { display: grid; grid-template-columns: 1fr 90px 1.4fr 36px; gap: 8px; margin-bottom: 8px; align-items: start; }
.case-item textarea { min-height: 42px; }

/* ---------- адаптив ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { max-width: 280px; margin: 0 auto; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-menu { position: static; flex-direction: row; flex-wrap: wrap; }
  .play-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .topbar { padding: 12px 16px; gap: 10px; }
  .burger { display: flex; }
  .nav { position: fixed; top: 64px; left: 0; right: 0; flex-direction: column; padding: 12px; background: rgba(10,14,26,.97); border-bottom: 1px solid var(--line); display: none; }
  .nav.open { display: flex; }
  .brand span { display: none; }
  .app { padding: 20px 14px 70px; }
  .kv { grid-template-columns: 1fr; }
  .case-item { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
