/* Сайт гри (battlearena.online/site/). Окремо від застосунку: без React і без збірки —
   сторінки мусять відкриватися миттєво з реклами й пошуку. Токени ті самі, що в
   frontend/src/index.css, щоб сайт і гра виглядали одним світом. */

:root {
  --bg: #0E0C11;
  --bg-section: #141219;
  --bg-card: #19161F;
  --bg-elevated: #221E29;
  --line: rgba(255, 255, 255, 0.08);
  --text: #F2EFF6;
  --muted: #A59FB0;
  --best: #FF6B00;      /* Bestborn — як --color-primary-500 у грі */
  --best-soft: rgba(255, 107, 0, 0.14);
  --mech: #1FBFCE;      /* Mechanborn — бірюзовий primary раси */
  --mech-soft: rgba(31, 191, 206, 0.14);
  --gold: #D9A441;      /* золото «LEGENDS» з логотипу */
  --radius: 16px;
  --max: 1120px;
  --font-title: "Unbounded", "Noto Sans", system-ui, sans-serif;
  --font-body: "Onest", "Noto Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--font-body);
  overflow-x: hidden;
}
/* Мови без латиниці: Unbounded/Onest не мають гліфів — одразу Noto */
html[lang="hi"], html[lang="ar"], html[lang="fa"], html[lang="he"], html[lang="ja"], html[lang="ko"] {
  --font-title: "Noto Sans", system-ui, sans-serif;
  --font-body: "Noto Sans", system-ui, sans-serif;
}
img { max-width: 100%; height: auto; display: block; }
/* Атрибут hidden мусить перемагати display з класів (flex/grid у блоках розіграшів) */
[hidden] { display: none !important; }
a { color: var(--mech); }
a:hover { color: #6fe3ee; }

.wrap { max-width: var(--max); margin: 0 auto; padding-inline: 16px; }

/* ---------- Шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(14, 12, 17, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; gap: 12px; height: 64px; }
.top-logo img { height: 48px; width: auto; }
.top-nav { display: flex; gap: 20px; margin-inline-start: 16px; }
.top-nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
.top-nav a:hover { color: var(--text); }
.top-end { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }
.lang {
  appearance: none; background: var(--bg-card); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  height: 40px; padding-inline: 12px; font: 500 14px var(--font-body); cursor: pointer;
}

/* ---------- Кнопки (як .price-btn/Button у грі: пласка заливка, без світіння) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 24px; border-radius: 14px; border: 0;
  font: 700 16px var(--font-body); text-decoration: none; cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-play { background: var(--best); color: #1a0b00; }
.btn-play:hover { background: #ff8226; color: #1a0b00; }
.btn-ghost { background: var(--bg-elevated); color: var(--text); }
.btn-ghost:hover { background: #2B2634; color: var(--text); }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 14px; border-radius: 12px; }
.btn svg { width: 20px; height: 20px; flex: none; }

/* ---------- Перший екран ---------- */
.hero { position: relative; overflow: hidden; isolation: isolate; }
.hero-art { position: absolute; inset: 0; z-index: -1; display: grid; grid-template-columns: 1fr 1fr; }
.hero-art img { width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.hero-art img:first-child { mask-image: linear-gradient(to right, #000 30%, transparent 95%); -webkit-mask-image: linear-gradient(to right, #000 30%, transparent 95%); }
.hero-art img:last-child { mask-image: linear-gradient(to left, #000 30%, transparent 95%); -webkit-mask-image: linear-gradient(to left, #000 30%, transparent 95%); }
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(14,12,17,.15), rgba(14,12,17,.85) 70%),
    linear-gradient(to bottom, transparent 60%, var(--bg));
}
.hero .wrap { text-align: center; padding-block: 48px 72px; }
.hero-logo { width: min(520px, 92vw); margin: 0 auto; }
.hero h1 {
  font: 800 clamp(22px, 4vw, 34px)/1.25 var(--font-title);
  margin: 8px auto 12px; max-width: 760px;
}
.hero p.lead { color: var(--muted); font-size: 18px; max-width: 620px; margin: 0 auto 28px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-note { margin-top: 14px; color: var(--muted); font-size: 14px; }

/* ---------- Секції ---------- */
section.block { padding-block: 64px; }
section.block.alt { background: var(--bg-section); }
.kicker { color: var(--gold); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: 13px; margin: 0 0 8px; }
h2 { font: 800 clamp(22px, 3.2vw, 32px)/1.25 var(--font-title); margin: 0 0 12px; }
.sub { color: var(--muted); max-width: 680px; margin: 0 0 32px; }
.center { text-align: center; }
.center .sub { margin-inline: auto; }

/* Трейлер: кадр 16:9 тримає місце ще до завантаження обкладинки — сторінка не «стрибає» */
.trailer-frame {
  position: relative; max-width: 880px; margin: 20px auto 0; aspect-ratio: 16 / 9;
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #000;
}
.trailer-play { all: unset; position: absolute; inset: 0; cursor: pointer; display: block; }
.trailer-play img, .trailer-video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; }
.trailer-btn {
  position: absolute; inset-inline-start: 50%; top: 50%; translate: -50% -50%;
  width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center;
  background: rgb(14 12 17 / .72); color: var(--gold); border: 2px solid var(--gold); transition: transform .15s;
}
[dir="rtl"] .trailer-btn { translate: 50% -50%; }
.trailer-btn svg { width: 34px; height: 34px; margin-inline-start: 4px; }
.trailer-play:hover .trailer-btn, .trailer-play:focus-visible .trailer-btn { transform: scale(1.08); }
.trailer-play:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }

/* Раси */
.races { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.race {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--line);
}
.race img { width: 100%; aspect-ratio: 16 / 11; object-fit: cover; object-position: 50% 30%; }
.race-body { padding: 20px 22px 24px; }
.race h3 { font: 800 22px var(--font-title); margin: 0 0 6px; }
.race p { margin: 0; color: var(--muted); }
.race.best { box-shadow: inset 0 -3px 0 var(--best); }
.race.best h3 { color: var(--best); }
.race.mech { box-shadow: inset 0 -3px 0 var(--mech); }
.race.mech h3 { color: var(--mech); }

/* Шлях героя */
.ranks-tabs { display: inline-flex; gap: 6px; padding: 4px; background: var(--bg-card); border-radius: 14px; margin-bottom: 24px; }
.ranks-tabs button {
  min-height: 44px; padding: 0 18px; border: 0; border-radius: 10px; cursor: pointer;
  background: transparent; color: var(--muted); font: 600 15px var(--font-body);
}
.ranks-tabs button[aria-pressed="true"] { background: var(--bg-elevated); color: var(--text); }
.ranks { display: grid; grid-template-columns: repeat(8, 1fr); gap: 12px; }
.rank { text-align: center; }
.rank img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-card); }
.rank span { display: block; margin-top: 8px; font-weight: 600; font-size: 14px; }
.rank small { color: var(--muted); font-size: 12px; }

/* Можливості */
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.feature {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; gap: 10px;
}
.feature img { width: 72px; height: 72px; object-fit: contain; }
.feature h3 { margin: 0; font: 700 17px var(--font-body); }
.feature p { margin: 0; color: var(--muted); font-size: 15px; }

/* Розіграші (редизайн 08.10): найближчий розіграш — героєм з табло-відліком і головним
   призом, решта — рядками; стрічка «щойно виграли» і цифри, що кличуть грати.
   Числа з'являються лише після відповіді сервера — нулів-заглушок немає */
.dz { position: relative; overflow: hidden; background:
  radial-gradient(ellipse 60% 50% at 20% 0%, rgba(255,107,0,.16), transparent 70%),
  radial-gradient(ellipse 50% 45% at 90% 100%, rgba(31,191,206,.12), transparent 70%),
  var(--bg-section); }
.dz-head { text-align: center; max-width: 720px; margin: 0 auto 32px; }
.dz-head .sub { margin: 0 auto 12px; }
.live-badge { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; font-weight: 600; color: #2ECC71; }
.live-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: #2ECC71; animation: live-pulse 1.6s ease-in-out infinite; }
@keyframes live-pulse { 50% { opacity: .3; } }

.dz-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 20px; align-items: stretch; }
.dz-grid.no-hero { grid-template-columns: 1fr; }

/* Герой: рамка-градієнт кольорами двох рас, легке світіння, яке «дихає» */
.dz-hero {
  position: relative; display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: center;
  padding: 28px; border-radius: 22px; isolation: isolate; overflow: hidden;
  background: linear-gradient(160deg, #1d1823, #141219);
}
.dz-hero::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; border-radius: inherit; padding: 1.5px;
  background: linear-gradient(135deg, var(--best), var(--gold) 45%, var(--mech));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.dz-hero::after {
  content: ""; position: absolute; inset: -30%; z-index: -1;
  background: radial-gradient(circle at 30% 40%, rgba(255,140,0,.22), transparent 55%);
  animation: dz-breathe 4s ease-in-out infinite;
}
@keyframes dz-breathe { 50% { opacity: .45; transform: scale(1.05); } }
.dz-hero-art img { width: 200px; height: 200px; object-fit: contain; filter: drop-shadow(0 18px 30px rgba(255,140,0,.35)); animation: dz-float 5s ease-in-out infinite; }
@keyframes dz-float { 50% { transform: translateY(-8px); } }
.dz-label { margin: 0 0 10px; color: var(--gold); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: 13px; }
.dz-timer { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 18px; direction: ltr; }
.dz-timer .seg { display: grid; justify-items: center; gap: 4px; }
.dz-timer .seg b {
  min-width: 74px; padding: 10px 8px; border-radius: 14px; text-align: center;
  font: 800 44px/1 var(--font-title); font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #2a2432, #1a1620); border: 1px solid rgba(255,255,255,.08);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.4);
}
.dz-timer .seg i { font-style: normal; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.dz-timer .colon { font: 800 36px/64px var(--font-title); color: var(--muted); }
.dz-timer.is-soon .seg b { color: #ffb15c; border-color: rgba(255,107,0,.5); }
.dz-prize { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.dz-prize > span { color: var(--muted); font-weight: 600; }
.dz-prize b {
  font: 800 40px/1 var(--font-title); font-variant-numeric: tabular-nums;
  background: linear-gradient(90deg, #ffd27a, var(--gold) 50%, #ff9a3c); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.dz-prize b small { font: 700 16px var(--font-body); -webkit-text-fill-color: var(--gold); }
.dz-filling { margin: 0 0 10px; font: 700 18px var(--font-body); color: #ffb15c; }
.dz-facts { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.dz-facts b { color: var(--text); font-variant-numeric: tabular-nums; }
.dz-cta { min-height: 54px; font-size: 17px; padding: 0 28px; box-shadow: 0 10px 30px rgba(255,107,0,.35); }

/* Решта розіграшів */
.dz-list { display: grid; gap: 12px; align-content: stretch; }
.dz-row {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center;
  padding: 14px 16px; border-radius: 16px; background: rgba(25,22,31,.85); border: 1px solid var(--line);
  transition: border-color .2s, transform .2s;
}
.dz-row:hover { border-color: rgba(217,164,65,.45); transform: translateY(-2px); }
.dz-row img { width: 56px; height: 56px; object-fit: contain; }
.dz-row-name b { display: block; font-size: 16px; }
.dz-row-name small { color: var(--muted); font-size: 13px; }
.dz-row-live { text-align: end; display: grid; gap: 2px; }
.dz-row-prize { font: 800 18px var(--font-title); color: var(--gold); font-variant-numeric: tabular-nums; }
.dz-row-prize small { font: 600 11px var(--font-body); color: var(--muted); }
.dz-row time { font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; }
.dz-row-label { color: var(--muted); font-size: 11px; }
/* Місця й фонд — під назвою й сумою, щоб у маленькому рядку було те саме, що у великому вікні */
.dz-row-facts { grid-column: 2 / -1; display: flex; gap: 6px 16px; flex-wrap: wrap; margin: -6px 0 0; color: var(--muted); font-size: 13px; }
.dz-row-facts b { color: var(--text); font-variant-numeric: tabular-nums; }
.dz-row.is-featured { display: none; }

/* Стрічка «щойно виграли»: нескінченна прокрутка, на reduced motion — нерухома */
.dz-ticker { display: flex; align-items: center; gap: 14px; margin-top: 24px; padding: 12px 16px; border-radius: 14px; background: rgba(25,22,31,.7); border: 1px solid var(--line); }
.dz-ticker-label { flex: none; font-weight: 700; color: #2ECC71; font-size: 14px; }
.dz-ticker-window { overflow: hidden; flex: 1; mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.dz-track { display: flex; gap: 28px; width: max-content; animation: dz-scroll var(--dz-dur, 40s) linear infinite; }
.dz-ticker:hover .dz-track { animation-play-state: paused; }
.dz-win { white-space: nowrap; font-size: 14px; color: var(--muted); }
.dz-win b { color: var(--gold); font-variant-numeric: tabular-nums; }
@keyframes dz-scroll { to { transform: translateX(-50%); } }
[dir="rtl"] .dz-track { animation-direction: reverse; }

/* Цифри, що кличуть грати */
.dz-stats { display: grid; grid-template-columns: 1fr 1fr 1.6fr; gap: 16px; margin-top: 20px; }
.dz-stat { padding: 18px 20px; border-radius: 16px; background: rgba(25,22,31,.85); border: 1px solid var(--line); display: grid; gap: 4px; align-content: start; }
.dz-stat b { font: 800 26px/1.15 var(--font-title); font-variant-numeric: tabular-nums; }
.dz-stat > span { color: var(--muted); font-size: 14px; }
.dz-early { border-color: rgba(46,204,113,.35); background: linear-gradient(135deg, rgba(46,204,113,.10), rgba(25,22,31,.85) 60%); }
.dz-early b { color: #2ECC71; }

.dz-foot { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-top: 28px; }
.dz-foot .checks { margin: 0; flex: 1 1 520px; }

@media (max-width: 900px) {
  .dz-grid { grid-template-columns: 1fr; }
  .dz-stats { grid-template-columns: 1fr 1fr; }
  .dz-early { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .dz-hero { grid-template-columns: 1fr; text-align: center; padding: 22px 16px; }
  .dz-hero-art img { width: 120px; height: 120px; margin: 0 auto; }
  .dz-timer { justify-content: center; }
  .dz-timer .seg b { min-width: 64px; font-size: 34px; }
  .dz-timer .colon { line-height: 54px; font-size: 28px; }
  .dz-prize, .dz-facts { justify-content: center; }
  .dz-prize b { font-size: 34px; }
  .dz-cta { width: 100%; }
  .dz-stats { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .live-badge .dot, .dz-hero::after, .dz-hero-art img { animation: none; }
  .dz-track { animation: none; flex-wrap: wrap; width: auto; }
}

.checks { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 14px; }
.checks li { display: flex; gap: 12px; align-items: flex-start; }
.checks li::before {
  content: ""; flex: none; width: 22px; height: 22px; margin-top: 2px; border-radius: 50%;
  background: var(--gold) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230E0C11' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center/14px no-repeat;
}

/* Фінальний заклик */
.final { text-align: center; }
.final img { width: 140px; margin: 0 auto 12px; }
.final .sub { margin-inline: auto; }

/* ---------- Підвал ---------- */
footer.foot { border-top: 1px solid var(--line); padding-block: 32px 40px; color: var(--muted); font-size: 14px; }
.foot .wrap { display: grid; gap: 16px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.foot-links a { color: var(--text); text-decoration: none; }
.foot-links a:hover { color: var(--mech); }
.foot p { margin: 0; }
.foot-contacts { display: grid; gap: 4px; }
.foot-contacts a { color: var(--text); }
.foot-social { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.foot-social[hidden] { display: none; }
.foot-social-row { display: flex; flex-wrap: wrap; gap: 10px; }
.foot-social-row a { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); }
.foot-social-row img { width: 24px; height: 24px; display: block; }

/* ---------- Юридичні сторінки ---------- */
.doc { padding-block: 40px 64px; }
.doc .wrap { max-width: 820px; }
.doc h1 { font: 800 clamp(24px, 4vw, 34px)/1.25 var(--font-title); margin: 0 0 6px; }
.doc .updated { color: var(--muted); margin: 0 0 32px; font-size: 14px; }
.doc h2 { font: 700 20px/1.35 var(--font-body); margin: 36px 0 10px; }
.doc h3 { font: 700 17px var(--font-body); margin: 22px 0 8px; }
.doc p, .doc li { color: #D9D4E0; }
.doc ul { padding-inline-start: 22px; }
.doc li { margin-bottom: 6px; }
.doc .callout {
  background: var(--bg-card); border: 1px solid var(--line); border-inline-start: 3px solid var(--gold);
  border-radius: 12px; padding: 14px 18px; margin: 20px 0; font-weight: 600;
}
.doc table { width: 100%; border-collapse: collapse; margin: 12px 0 20px; font-size: 15px; }
.doc th, .doc td { text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { color: var(--muted); font-weight: 600; }
.table-scroll { overflow-x: auto; }

/* Форма безкоштовної участі (AMOE) */
.amoe { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin: 16px 0 8px; }
.amoe label { display: block; font-weight: 600; margin: 0 0 6px; }
.amoe input {
  width: 100%; height: 48px; padding: 0 14px; margin-bottom: 14px;
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 12px;
  font: 400 16px var(--font-body);
}
.amoe input:focus { outline: 2px solid var(--mech); outline-offset: 1px; }
.amoe .check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin-bottom: 16px; }
.amoe .check input { width: 20px; height: 20px; margin: 3px 0 0; flex: none; }
.amoe-msg { margin: 14px 0 0; font-weight: 600; min-height: 1.6em; }
.amoe-msg.ok { color: #2ECC71; }
.amoe-msg.err { color: #FF6B6B; }

/* ---------- Телефон ---------- */
@media (max-width: 900px) {
  .features { grid-template-columns: repeat(2, 1fr); }
  .ranks { grid-template-columns: repeat(4, 1fr); }
  .top-nav { display: none; }
}
@media (max-width: 560px) {
  .races { grid-template-columns: 1fr; }
  .top-logo img { height: 40px; }
  .top-end .btn-play { display: none; }
  .hero .wrap { padding-block: 28px 56px; }
  .hero p.lead { font-size: 16px; }
  section.block { padding-block: 48px; }
  .feature { padding: 16px; }
  .feature img { width: 56px; height: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
}

/* Перевірка розіграшу (/verify/) */
.vf { margin-top: 32px; }
.vf-list { display: grid; gap: 10px; }
.vf-row { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.vf-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.vf-out:empty { display: none; }
.vf-out { margin-top: 10px; font-size: 14px; }
.vf-checks { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; overflow-wrap: anywhere; }
.vf-verdict { margin: 0; font-weight: 700; }
.vf-verdict.is-ok { color: #4ade80; }
.vf-verdict.is-bad, .vf-checks .is-bad { color: #f87171; }
.vf-note { color: var(--muted); }
