/* ═══════════ ASTRA WAR GUIDE — space theme, mobile-first ═══════════ */
:root {
  --bg: #0b1026;
  --bg-deep: #070b1c;
  --panel: #111936;
  --panel-2: #16204a;
  --line: #24305e;
  --text: #dbe4ff;
  --muted: #93a1c9;
  --accent: #6ea8ff;
  --accent-2: #8fd8ff;
  --glow: rgba(110, 168, 255, .35);
  --gold: #ffd166;
  --radius: 14px;
  --font-body: "Inter", system-ui, sans-serif;
  --font-head: "Unbounded", "Inter", sans-serif;
  --font-pixel: "Press Start 2P", monospace;
}

* { box-sizing: border-box; }

/* ── themed scrollbar ── */
html { scrollbar-width: thin; scrollbar-color: var(--accent) var(--bg-deep); }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--accent), var(--accent-2));
  border: 3px solid var(--bg-deep);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(var(--accent-2), var(--accent)); }
::-webkit-scrollbar-corner { background: var(--bg-deep); }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.65;
  overflow-x: hidden;
}

/* ── language switching ── */
html[data-lang="uk"] .en { display: none !important; }
html[data-lang="en"] .uk { display: none !important; }

/* ── topbar ── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: rgba(7, 11, 28, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; }
.brand-logo { width: 34px; height: auto; image-rendering: pixelated; }
.brand-text {
  font-family: var(--font-pixel);
  text-shadow: 0 2px 0 var(--accent);
  font-size: 12px; color: #fff;
  text-shadow: 0 3px 0 #274b8f;
  letter-spacing: 1px;
}
.lang-switch { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.lang-btn {
  border: 0; background: transparent; color: var(--muted);
  font: 600 12px var(--font-body); padding: 6px 10px; border-radius: 8px; cursor: pointer;
  transition: background .2s, color .2s;
}
.lang-btn.active { background: var(--accent); color: #08122e; }
.burger {
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
  width: 38px; height: 38px; padding: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.burger span { display: block; height: 2px; background: var(--accent-2); border-radius: 2px; transition: transform .25s, opacity .25s; }
.burger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ── TOC ── */
.toc {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 49;
  width: min(300px, 84vw);
  padding: 76px 18px 24px;
  background: var(--bg-deep);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  transform: translateX(-105%);
  transition: transform .3s ease;
}
.toc.open { transform: translateX(0); }
.toc-title { font-family: var(--font-head); font-size: 13px; color: var(--accent-2); text-transform: uppercase; letter-spacing: 2px; margin: 0 0 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc a {
  display: block; padding: 8px 10px; border-radius: 9px;
  color: var(--muted); text-decoration: none; font-size: 14px;
  transition: background .2s, color .2s;
}
.toc a:hover, .toc a.active { background: var(--panel-2); color: var(--text); }
.toc-backdrop {
  position: fixed; inset: 0; z-index: 48;
  background: rgba(4, 6, 16, .6);
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
.toc-backdrop.show { opacity: 1; pointer-events: auto; }

/* ── hero ── */
.hero {
  position: relative;
  min-height: 88svh;
  display: grid; place-items: center;
  padding: 96px 18px 64px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(7,11,28,.25) 0%, rgba(11,16,38,.65) 70%, var(--bg) 100%),
    url("../assets/img/nebula-teal.png") center / cover no-repeat;
  image-rendering: pixelated;
  overflow: hidden;
}
.hero-inner { position: relative; z-index: 2; max-width: 680px; }
.hero-logo {
  width: min(300px, 70vw);
  border-radius: 22px;
  image-rendering: pixelated;
  box-shadow: 0 0 60px var(--glow), 0 18px 50px rgba(0,0,0,.5);
  animation: heroFloat 7s ease-in-out infinite;
}
.hero-logo.hidden { display: none; }
.hero-ship {
  width: min(110px, 26vw);
  image-rendering: pixelated;
  filter: drop-shadow(0 10px 26px rgba(0,0,0,.55));
  animation: heroFloat 7s ease-in-out infinite;
}
.hero-title {
  font-family: var(--font-pixel);
  color: #fff;
  font-size: clamp(22px, 6vw, 44px);
  margin: 26px 0 8px;
  text-shadow: 0 5px 0 var(--accent), 0 10px 0 var(--line), 0 0 34px var(--glow);
  letter-spacing: 2px;
}
.hero-logo:not(.hidden) + .hero-title { font-size: clamp(16px, 3.4vw, 22px); opacity: .0; height: 0; margin: 0; overflow: hidden; }
.hero-sub { color: var(--accent-2); font-size: clamp(15px, 2.6vw, 19px); margin: 14px 0 30px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

.btn {
  display: inline-block; padding: 13px 24px; border-radius: 12px;
  font: 600 15px var(--font-body); text-decoration: none;
  transition: transform .2s, box-shadow .2s, background .2s;
}
.btn-sm { padding: 10px 18px; font-size: 14px; }
.btn-primary { background: var(--accent); color: #08122e; box-shadow: 0 0 24px var(--glow); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 0 38px var(--glow); }
.btn-ghost { border: 1px solid var(--line); color: var(--text); background: rgba(17,25,54,.5); }
.btn-ghost:hover { background: var(--panel-2); transform: translateY(-2px); }

.hero-planets { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.float-planet { position: absolute; image-rendering: pixelated; opacity: .9; filter: drop-shadow(0 6px 18px rgba(0,0,0,.45)); }
.float-planet.p1 { width: 84px; top: 12%; left: 6%; animation: drift 11s ease-in-out infinite; }
.float-planet.p2 { width: 56px; top: 22%; right: 8%; animation: drift 9s ease-in-out infinite reverse; }
.float-planet.p3 { width: 44px; bottom: 14%; left: 14%; animation: drift 13s ease-in-out infinite 1.2s; }

@keyframes heroFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes drift { 0%,100% { transform: translate(0,0); } 50% { transform: translate(10px,-16px); } }

/* twinkling stars */
.stars { position: absolute; inset: 0; pointer-events: none; }
.stars::before, .stars::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 28%, #fff 40%, transparent 55%),
    radial-gradient(1px 1px at 32% 68%, #cfe4ff 40%, transparent 55%),
    radial-gradient(2px 2px at 54% 18%, #fff 40%, transparent 55%),
    radial-gradient(1px 1px at 71% 47%, #bfe0ff 40%, transparent 55%),
    radial-gradient(1.5px 1.5px at 86% 76%, #fff 40%, transparent 55%),
    radial-gradient(1px 1px at 44% 86%, #d7e8ff 40%, transparent 55%),
    radial-gradient(1.5px 1.5px at 92% 12%, #fff 40%, transparent 55%);
  animation: twinkle 4.5s ease-in-out infinite;
}
.stars::after { transform: translate(28px, 42px) scale(1.35); animation-delay: 2.2s; opacity: .6; }
@keyframes twinkle { 0%,100% { opacity: .35; } 50% { opacity: .95; } }

/* ── content ── */
.content { max-width: 880px; margin: 0 auto; padding: 26px 18px 60px; }
section { margin: 0 0 26px; padding: 26px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
h2 {
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(19px, 4vw, 25px);
  margin: 0 0 14px; color: #fff;
  padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
h3 { font-family: var(--font-head); font-weight: 500; font-size: 15px; color: var(--accent-2); margin: 26px 0 8px; letter-spacing: .5px; }
p { margin: 10px 0; }
ul { margin: 10px 0; padding-left: 20px; }
li { margin: 7px 0; }
li > p { margin: 0; }
strong { color: #fff; }
em { color: var(--accent-2); font-style: normal; }
/* Inline content links — distinct gold + underline so they stand out from body text
   (buttons and whole-card links keep their own styles). */
section a:not(.btn):not(.mini-card-link) {
  color: var(--gold);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(255, 209, 102, .5);
  text-underline-offset: 2px;
  transition: color .15s, text-decoration-color .15s;
}
section a:not(.btn):not(.mini-card-link):hover {
  color: #ffe08a;
  text-decoration-color: var(--gold);
}
section a:not(.btn):not(.mini-card-link) em { color: inherit; }
code {
  background: var(--bg-deep); border: 1px solid var(--line);
  border-radius: 7px; padding: 2px 8px;
  color: var(--gold); font-size: .9em; white-space: nowrap;
}
.hint { color: var(--muted); font-size: 14.5px; border-left: 3px solid var(--accent); padding-left: 12px; }

/* standalone formula line — a wider cousin of inline `code`, scrollable so a long
   expression never pushes the page sideways on a narrow screen */
.formula { overflow-x: auto; margin: 10px 0 14px; padding: 10px 14px; background: var(--bg-deep); border: 1px solid var(--line); border-radius: 10px; }
.formula code { background: none; border: 0; padding: 0; color: var(--gold); font-size: 15px; white-space: nowrap; }
.warn { color: #ffc2c2; font-size: 15.5px; border-left: 4px solid #ff5d5d; background: rgba(255,93,93,.09); padding: 12px 16px; border-radius: 10px; margin: 14px 0; }
.warn strong { color: #ff8f8f; }

/* faq */
.faq-item { border-bottom: 1px solid var(--line); padding: 16px 0; }
.faq-item:last-child { border-bottom: 0; padding-bottom: 0; }
.faq-item .q { margin: 0 0 7px; font-family: var(--font-head); font-weight: 500; font-size: 15.5px; color: var(--accent-2); }
.faq-item .q::before { content: "❓ "; }
.faq-item p:not(.q) { margin: 5px 0 0; font-size: 14.5px; color: var(--muted); }

/* steps */
.steps { counter-reset: step; list-style: none; margin: 14px 0; padding: 0; }
.steps > li { counter-increment: step; position: relative; padding: 0 0 18px 52px; }
.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 36px; height: 36px; display: grid; place-items: center;
  background: var(--panel-2); border: 1px solid var(--accent);
  border-radius: 50%; color: var(--accent-2);
  font: 700 15px var(--font-head);
  box-shadow: 0 0 14px rgba(110,168,255,.25);
}
.steps > li:not(:last-child)::after {
  content: ""; position: absolute; left: 17px; top: 40px; bottom: 2px;
  width: 2px; background: linear-gradient(var(--line), transparent);
}
.steps > li > p { margin: 6px 0 0; }

/* cards */
.card-grid { display: grid; gap: 12px; grid-template-columns: 1fr; margin-top: 16px; }
.mini-card {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; transition: transform .25s, border-color .25s, box-shadow .25s;
}
.mini-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 8px 26px rgba(0,0,0,.35); }
a.mini-card-link { text-decoration: none; color: inherit; cursor: pointer; display: block; }
a.mini-card-link:hover { border-color: var(--accent-2); }
.mini-card > span { font-size: 26px; display: block; margin-bottom: 6px; }
.mini-card p { margin: 4px 0 0; font-size: 14.5px; }

/* The Extras cards differ wildly in height — «Рейтинги» is several times taller than the
   others — and a grid aligns every card in a row to the tallest one, leaving a hole beside
   it. Multi-column packing lets each column fill on its own, so the short cards stack up
   next to the tall one. Scoped to #extras: the other card grids hold same-sized cards,
   where a grid's row alignment is what we want. */
@media (min-width: 620px) {
  #extras .card-grid { display: block; columns: 2; column-gap: 12px; }
  #extras .mini-card { break-inside: avoid; margin-bottom: 12px; }
  #extras .mini-card:last-child { margin-bottom: 0; }
}

/* tables */
.table-wrap { overflow-x: auto; margin: 14px 0; border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; min-width: 380px; font-size: 14.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
thead th { background: var(--panel-2); color: var(--accent-2); font-family: var(--font-head); font-weight: 500; font-size: 12.5px; letter-spacing: .6px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(110,168,255,.06); }
table.cmd td:first-child, table.cmd td:nth-child(2) { white-space: nowrap; }
table.cmd code { white-space: normal; }
/* На телефоні контейнер вужчий за 380px, і остання колонка ховалась за краєм — а це саме
   та колонка, заради якої таблицю й читають. Таблиці команд лишаються широкими: там
   колонки нерозривні за задумом. */
@media (max-width: 560px) {
  table:not(.cmd) { min-width: 0; font-size: 13.5px; }
  table:not(.cmd) th, table:not(.cmd) td { padding: 9px 8px; }
}
.tier { font-weight: 600; vertical-align: middle; }
.t-base { color: #9be49b; } .t-adv { color: var(--accent-2); } .t-leg { color: var(--gold); }

/* ship grid */
.ship-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin: 16px 0; }
.ship-grid figure, .obj-strip figure, .def-strip figure { margin: 0; text-align: center; }
.ship-grid img, .obj-strip img, .def-strip img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 12px; border: 1px solid var(--line);
  transition: transform .25s, border-color .25s;
}
.ship-grid figure:hover img, .obj-strip figure:hover img { transform: scale(1.05) rotate(-1deg); border-color: var(--accent); }
figcaption { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.35; }

.obj-strip, .def-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; margin: 16px 0; }

/* split layout */
/* Текст ОМИВАЄ картинку, а не стоїть із нею у двох колонках.
   Колонки лишали під картинкою порожню дірку на пів екрана — її видно було
   на кожній довгій секції. Тому картинка float'иться вправо, і текст тече під нею.
   У розмітці <img> іде ПЕРШИМ (float тягне за собою лише те, що після нього),
   а на вузькому екрані column-reverse повертає звичний порядок: спершу текст. */
.split { display: flex; flex-direction: column-reverse; gap: 16px; }
.section-img { width: 100%; border-radius: 12px; border: 1px solid var(--line); }

/* ── collapsible cheat sheets (raid page) ──
   Long reference tables that are useless while reading and priceless mid-raid:
   folded away by default so the page still scans in one pass. */
.sheet {
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg-deep); margin: 14px 0; overflow: hidden;
}
.sheet > summary {
  cursor: pointer; list-style: none; user-select: none;
  padding: 14px 16px 14px 40px; position: relative;
  font-family: var(--font-head); font-weight: 500; font-size: 15px; color: #fff;
  transition: background .15s, color .15s;
}
.sheet > summary::-webkit-details-marker { display: none; }
.sheet > summary::before {
  content: "▸"; position: absolute; left: 16px; top: 50%;
  transform: translateY(-50%); color: var(--accent);
  transition: transform .2s ease;
}
.sheet[open] > summary::before { transform: translateY(-50%) rotate(90deg); }
.sheet[open] > summary { border-bottom: 1px solid var(--line); }
.sheet > summary:hover { background: var(--panel-2); color: var(--accent-2); }
.sheet > summary em { color: var(--muted); font-size: 13px; }
.sheet > *:not(summary) { padding-left: 16px; padding-right: 16px; }
.sheet > .table-wrap { padding-top: 4px; padding-bottom: 4px; }
.sheet > p:last-child { padding-bottom: 14px; }

/* the console screenshot on the raid page */
/* ── наочні приклади (анімації) ──
   Не .obj-strip: там плитки одного ряду, а тут три ВИПАДКИ поспіль, і кожен потребує
   не назви, а пояснення на рядок-два. Тому картки ширші, підпис лівий, а не центрований. */
.demo-strip { display: grid; gap: 16px; grid-template-columns: 1fr; margin: 18px 0; }
.demo-strip figure { margin: 0; }
.demo-strip img {
  display: block; width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 12px; border: 1px solid var(--line); background: var(--bg-deep);
}
.demo-strip figcaption { margin-top: 8px; font-size: 13.5px; color: var(--muted); text-align: left; line-height: 1.45; }
.demo-strip figcaption b { display: block; color: var(--text); font-size: 14px; margin-bottom: 2px; }
.demo-strip figcaption .step { color: var(--accent-2); font-family: var(--font-head); font-size: 12px; margin-right: 6px; }
@media (min-width: 760px) { .demo-strip { grid-template-columns: repeat(3, 1fr); } }

.console-shot { margin: 18px 0 4px; text-align: center; }
.console-shot img { max-width: 340px; width: 100%; border-radius: 12px; border: 1px solid var(--line); }

/* reveal animation */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* footer */
.footer {
  position: relative; text-align: center;
  margin-top: 30px; padding: 54px 18px 64px;
  background:
    linear-gradient(0deg, rgba(7,11,28,.3), var(--bg) 90%),
    url("../assets/img/nebula-purple.png") center / cover no-repeat;
  image-rendering: pixelated;
  border-top: 1px solid var(--line);
  overflow: hidden;
}
.footer p { position: relative; font-family: var(--font-head); font-size: 16px; color: #fff; margin-bottom: 18px; }
.footer .btn { position: relative; }

/* ── desktop ── */
@media (min-width: 1080px) {
  .burger, .toc-backdrop { display: none; }
  .toc { transform: none; width: 264px; padding-top: 84px; }
  .topbar { padding-left: 22px; }
  .content, .hero-inner { margin-left: auto; margin-right: auto; }
  .content { max-width: 860px; padding-left: 300px; padding-right: 36px; max-width: 1160px; }
  .hero, .footer { padding-left: 264px; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .split { display: flow-root; gap: 0; }
  .split > .section-img { float: right; width: 38%; max-width: 360px; margin: 4px 0 18px 24px; }
  .split .table-wrap, .split .sheet, .split .card-grid { clear: right; }
  section { padding: 32px 30px; }
}
@media (min-width: 620px) and (max-width: 1079px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .split { display: flow-root; gap: 0; }
  .split > .section-img { float: right; width: 38%; max-width: 360px; margin: 4px 0 18px 24px; }
  .split .table-wrap, .split .sheet, .split .card-grid { clear: right; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-logo, .hero-ship, .float-planet, .stars::before, .stars::after { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
