/* =========================================================================
 *  Buzzik · Design System v2
 *  Strict black + gold + functional state colors only.
 * ========================================================================= */

:root {
  color-scheme: light;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);

  /* B&W LIGHT MODE: белый фон, чёрный текст. */
  --bg:           #FFFFFF;
  --bg-soft:      #F7F7F7;
  --surface:      #F2F2F2;
  --surface-2:    #EAEAEA;
  --line:         #D5D5D5;
  --line-strong:  #B0B0B0;
  --ink:          #0A0A0A;
  --ink-2:        #4A4A4A;
  --mute:         #888888;
  --mute-strong:  #B0B0B0;

  /* --gold* теперь = чёрный/тёмные оттенки (имя оставлено для совместимости).
     В тёмной теме это была "контраст-кнопка" (золотой акцент),
     в B&W LIGHT это — чёрный акцент на белом. */
  --gold:         #0A0A0A;
  --gold-bright:  #000000;
  --gold-warm:    #1A1A1A;
  --gold-deep:    #4A4A4A;

  --ok:           #22A560;
  --err:          #D43A52;
  --warn:         #D17A0E;

  /* Spacing rhythm */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-2xl: 28px;
}

html, body, #root {
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

body {
  /* Чисто-белый фон, без облаков */
  background: var(--bg);
  overscroll-behavior-y: contain;
  -webkit-tap-highlight-color: transparent;
  font-feature-settings: 'ss01' 1, 'cv11' 1;
  color: var(--ink);
}

* { -webkit-user-select: none; user-select: none; }
input, textarea { -webkit-user-select: text; user-select: text; }

::-webkit-scrollbar { width: 0; height: 0; }
::-webkit-scrollbar-thumb { display: none; }

/* Tabular numerics — used everywhere money/odds shown */
.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'ss01' 1;
  letter-spacing: -0.005em;
}

/* Display headlines */
.display {
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
}
.display-xl { font-size: 44px; }
.display-lg { font-size: 34px; }

/* Brand wordmark */
.wordmark {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-variant-caps: all-small-caps;
}

/* =========================================================================
 *  CARDS
 * ========================================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  position: relative;
  isolation: isolate;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  /* B&W LIGHT: subtle тень сверху для глубины */
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.04) 0%, transparent 50%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

.card-elev { background: var(--surface-2); }
.card-tight { border-radius: var(--r-md); }
.card-hero {
  /* B&W LIGHT: чистая белая подложка с мягкой тенью */
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  overflow: hidden;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* =========================================================================
 *  BUTTONS
 * ========================================================================= */
.btn-primary {
  /* B&W LIGHT: чёрная кнопка с белым текстом — на белом фоне приложения */
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  letter-spacing: -0.01em;
  border: 1px solid var(--ink);
  border-radius: var(--r-md);
  position: relative;
  transition: transform 0.08s ease, filter 0.15s ease;
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.15) inset,
    0 8px 24px -10px rgba(0, 0, 0, 0.35);
}
.btn-primary:active { transform: scale(0.985); }
.btn-primary:disabled {
  opacity: 0.4;
  filter: grayscale(0.6);
  cursor: not-allowed;
}

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--r-md);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.btn-ghost:hover { border-color: var(--line-strong); }
.btn-ghost:active { transform: scale(0.985); }
.btn-ghost:disabled { opacity: 0.4; }

.btn-secondary {
  /* B&W secondary: контур-кнопка с белой обводкой */
  background: transparent;
  border: 1px solid var(--ink);
  color: var(--ink);
  border-radius: var(--r-md);
  font-weight: 600;
}

/* =========================================================================
 *  PILLS / CHIPS
 * ========================================================================= */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  color: var(--ink-2);
  letter-spacing: 0.01em;
}
.chip.gold {
  /* Сохраняем gold только для денежных лейблов */
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.3);
  color: var(--gold);
}
.chip.brand {
  /* B&W brand: монохромный белый акцент */
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.2);
  color: var(--ink);
}
.chip.dim {
  background: transparent;
  border-color: var(--line);
  color: var(--mute);
}

/* Bigger pill — for filters */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2);
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.pill.active {
  /* B&W: белый пилл вместо золотого */
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  font-weight: 600;
}
.pill.muted {
  opacity: 0.5;
}
.pill.subtle {
  background: transparent;
  border-color: var(--line);
}
.pill.subtle.active {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.6);
  color: var(--ink);
}

/* =========================================================================
 *  ODDS BUTTON — central data-display component
 * ========================================================================= */
.odds-btn {
  position: relative;
  border-radius: var(--r-md);
  /* Активный «оранжевый» CTA-вид — ясно, что кликабельно. */
  background: linear-gradient(180deg, rgba(255, 159, 28, 0.10) 0%, rgba(255, 159, 28, 0.04) 100%);
  border: 1px solid rgba(255, 159, 28, 0.35);
  transition: transform 0.08s ease, border-color 0.15s, background 0.15s, box-shadow 0.15s;
  text-align: center;
  color: var(--ink);
}
.odds-btn .odds-val { color: var(--warn); transition: color 0.15s; }
.odds-btn:hover {
  border-color: rgba(255, 159, 28, 0.7);
  background: linear-gradient(180deg, rgba(255, 159, 28, 0.16) 0%, rgba(255, 159, 28, 0.06) 100%);
}
.odds-btn:active { transform: scale(0.97); }
.odds-btn.selected {
  /* B&W selected: белый рамка */
  border-color: var(--ink);
  background: rgba(0, 0, 0, 0.06);
  box-shadow:
    0 0 0 1px var(--ink) inset,
    0 0 24px -8px rgba(0, 0, 0, 0.4);
}
.odds-btn.selected .odds-val { color: var(--ink); }
.odds-btn.empty {
  opacity: 0.7;
  /* пустой пул: оставляем оранжевый «зовущий» вид — "поставь первым" */
  background: rgba(255, 159, 28, 0.05);
  border-color: rgba(255, 159, 28, 0.25);
}

/* Inputs */
.input {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px 14px;
  color: var(--ink);
  caret-color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-size: 18px;
  font-weight: 500;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--surface);
  box-shadow: 0 0 0 2px rgba(10, 10, 10, 0.08);
}
.input::placeholder { color: var(--mute); }

/* Global caret/border baseline для всех input/textarea — Telegram iOS WebView
   иногда сбрасывает caret-color на белый, делая курсор невидимым на светлом
   фоне. Жёстко прибиваем чёрный caret и форсим читаемый border на focus. */
input, textarea, select {
  caret-color: var(--ink);
  -webkit-text-fill-color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--ink) !important;
  box-shadow: 0 0 0 2px rgba(10, 10, 10, 0.08);
}

/* =========================================================================
 *  LOGO MARK — минималистичная жёлтая пчела с «BZ»
 * ========================================================================= */
.logo-mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  /* B&W: белая подсветка вместо золотой */
  filter: drop-shadow(0 0 12px rgba(0, 0, 0, 0.35));
}

/* Team monogram avatar */
.team-av {
  width: 40px; height: 40px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  flex-shrink: 0;
}

/* =========================================================================
 *  Bottom sheet
 * ========================================================================= */
.sheet {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-soft) 100%);
  border-top: 1px solid var(--line);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  box-shadow: 0 -30px 80px -20px rgba(0, 0, 0, 0.8);
}

/* Tab bar */
.tabbar {
  /* B&W LIGHT: белый полупрозрачный таббар */
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
}

/* Live indicator (B&W) */
.live-dot {
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--ink);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.15);
  animation: pulse-dot 1.6s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.12); }
  50%      { box-shadow: 0 0 0 7px rgba(0, 0, 0, 0.04); }
}

/* Hairlines */
.hr-line {
  height: 1px;
  background: var(--line);
}
.hr-gold {
  /* B&W: переименовали смысл — это просто акцент-линия, теперь белая */
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.6) 50%, transparent);
  opacity: 0.5;
}

/* Pool bar — progression (B&W) */
.pool-bar {
  height: 3px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.pool-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--ink-2), var(--ink));
  transition: width 0.3s ease;
}

/* =========================================================================
 *  CRASH multiplier — the hero element
 * ========================================================================= */
.crash-mul {
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1;
  font-size: 96px;
  color: var(--ink);
  text-shadow: 0 0 80px rgba(0, 0, 0, 0.12);
  transition: color 0.2s ease, text-shadow 0.3s ease, transform 0.2s ease;
  display: inline-block;
}
.crash-mul.flying {
  /* B&W: яркий белый вместо золотого */
  color: var(--ink);
  text-shadow:
    0 0 30px rgba(0, 0, 0, 0.35),
    0 0 80px rgba(0, 0, 0, 0.2),
    0 0 140px rgba(0, 0, 0, 0.1);
}
.crash-mul.crashed {
  color: var(--err);
  text-shadow: 0 0 60px rgba(255, 61, 88, 0.4);
}
.crash-mul .x {
  font-size: 0.55em;
  color: inherit;
  opacity: 0.7;
  margin-left: 0.05em;
}

/* Animations */
@keyframes fadein {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-fadein { animation: fadein 0.3s ease-out both; }

@keyframes slideup {
  from { transform: translateY(18px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.animate-slideup { animation: slideup 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both; }

@keyframes pulse-slow {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}
.animate-pulse-slow { animation: pulse-slow 2.4s ease-in-out infinite; }

/* Subtle marquee for winners feed */
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.marquee-track { animation: marquee 30s linear infinite; }

/* =========================================================================
 *  PENALTY SHOOTOUT — анимация удара
 * ========================================================================= */
.pen-grid {
  position: relative;
}

/* Мяч летит от удара (низ-центр) к выбранной клетке (--tx, --ty в %) */
.pen-ball {
  position: absolute;
  width: 36px;
  height: 36px;
  font-size: 30px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  pointer-events: none;
  /* Стартовая точка: ниже сетки, по центру */
  left: 50%;
  top: 100%;
  transform: translate(-50%, -50%);
  /* Финальные значения подставляются inline через CSS-переменные */
  animation: pen-shoot 0.85s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
}

@keyframes pen-shoot {
  0% {
    left: 50%;
    top: 110%;
    transform: translate(-50%, -50%) rotate(0deg) scale(0.4);
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  100% {
    left: var(--tx);
    top: var(--ty);
    transform: translate(-50%, -50%) rotate(540deg) scale(1);
    opacity: 1;
  }
}

/* Гол-эффект: вспышка зелёным внутри клетки */
@keyframes pen-goal-flash {
  0%   { background: rgba(34, 226, 122, 0.2); box-shadow: 0 0 0 2px var(--ok) inset; }
  60%  { background: rgba(34, 226, 122, 0.5); box-shadow: 0 0 24px 4px rgba(34, 226, 122, 0.6), 0 0 0 2px var(--ok) inset; }
  100% { background: rgba(34, 226, 122, 0.25); box-shadow: 0 0 12px 2px rgba(34, 226, 122, 0.4), 0 0 0 2px var(--ok) inset; }
}
.pen-goal-flash {
  animation: pen-goal-flash 0.45s ease-out 0.78s both;
}

/* Save-эффект: лёгкий красный пульс */
@keyframes pen-save-flash {
  0%   { background: rgba(255, 61, 88, 0.2); box-shadow: 0 0 0 2px var(--err) inset; }
  100% { background: rgba(255, 61, 88, 0.35); box-shadow: 0 0 18px 3px rgba(255, 61, 88, 0.5), 0 0 0 2px var(--err) inset; }
}
.pen-save-flash {
  animation: pen-save-flash 0.4s ease-out 0.78s both;
}

/* «Сетка ворот» сзади */
.pen-cell {
  position: relative;
  overflow: hidden;
}
.pen-cell::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 8px, rgba(0, 0, 0, 0.04) 8px 9px),
    repeating-linear-gradient(0deg,  transparent 0 8px, rgba(0, 0, 0, 0.04) 8px 9px);
  pointer-events: none;
}

/* Lottie-оверлей поверх клетки. Появляется в момент удара (0.85с задержка) */
.pen-lottie-overlay {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 25;
  opacity: 0;
  animation: pen-lottie-fadein 0.2s ease-out 0.78s forwards;
}
@keyframes pen-lottie-fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Стрелка-маркер выбора пользователя — крупная и яркая, остаётся видимой даже во время reveal */
.pen-pick-marker {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gold-bright);
  color: var(--bg);
  font-size: 11px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
  box-shadow: 0 0 0 2px var(--bg), 0 0 12px rgba(0, 0, 0, 0.5);
}

/* B&W inset glow utility */
.glow-gold-inset {
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.25) inset,
    0 0 30px -10px rgba(0, 0, 0, 0.25);
}

/* Subtle dotted grid pattern for hero backgrounds (B&W) */
.dots {
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
  background-size: 16px 16px;
}
