/* ============================================================
   CRAZY DL — main.css
   Custom props, glassmorphism, animations, scrollbar
   ============================================================ */

:root {
  --bg: #0a0a0f;
  --surface: #111118;
  --border: rgba(255, 255, 255, 0.07);
  --primary: #8b5cf6;
  --primary-soft: rgba(139, 92, 246, 0.15);
  --secondary: #ce1126;
  --gold: #f59e0b;
  --green-cm: #007a5e;
  --text: #f8fafc;
  --muted: #64748b;
  --success: #22c55e;
  --error: #ef4444;
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
}

html[data-theme="light"] {
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: rgba(15, 23, 42, 0.08);
  --primary: #7c3aed;
  --primary-soft: rgba(124, 58, 237, 0.1);
  --text: #0f172a;
  --muted: #64748b;
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(15, 23, 42, 0.08);
  --shadow: 0 20px 60px -20px rgba(15, 23, 42, 0.15);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  overflow-x: hidden;
}

.font-display { font-family: 'Sora', 'Inter', sans-serif; }
.font-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary), #6d28d9);
  border-radius: 8px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: #a78bfa; }
* { scrollbar-width: thin; scrollbar-color: var(--primary) var(--bg); }

::selection { background: var(--primary); color: #fff; }

/* ---------- Glassmorphism ---------- */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}
.card:hover { border-color: rgba(139, 92, 246, 0.35); }

/* ---------- Cameroon mesh background (subliminal) ---------- */
.cm-mesh {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.5;
  background:
    radial-gradient(38% 32% at 12% 18%, rgba(0, 122, 94, 0.12), transparent 70%),
    radial-gradient(40% 36% at 88% 12%, rgba(206, 17, 38, 0.09), transparent 70%),
    radial-gradient(45% 40% at 50% 92%, rgba(245, 158, 11, 0.09), transparent 70%),
    radial-gradient(55% 45% at 50% 35%, rgba(139, 92, 246, 0.12), transparent 70%);
  animation: meshFlow 18s ease-in-out infinite alternate;
}
html[data-theme="light"] .cm-mesh { opacity: 0.35; }

@keyframes meshFlow {
  0%   { transform: translate3d(0, 0, 0) scale(1); filter: hue-rotate(0deg); }
  50%  { transform: translate3d(-2%, 2%, 0) scale(1.06); }
  100% { transform: translate3d(2%, -2%, 0) scale(1.03); filter: hue-rotate(-12deg); }
}

/* ---------- Signal wave (hero) ---------- */
.signal-wave path {
  stroke-dasharray: 12 9;
  animation: waveDash 5s linear infinite;
}
.signal-wave .w2 { animation-duration: 7s; animation-direction: reverse; }
.signal-wave .w3 { animation-duration: 9s; }
@keyframes waveDash { to { stroke-dashoffset: -210; } }

/* ---------- Entrance animations ---------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.in { opacity: 1; transform: translateY(0); }

.stagger > * {
  opacity: 0;
  transform: translateY(16px);
  animation: riseIn 0.7s ease forwards;
}
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.15s; }
.stagger > *:nth-child(3) { animation-delay: 0.25s; }
.stagger > *:nth-child(4) { animation-delay: 0.35s; }
.stagger > *:nth-child(5) { animation-delay: 0.45s; }
.stagger > *:nth-child(6) { animation-delay: 0.55s; }
@keyframes riseIn { to { opacity: 1; transform: translateY(0); } }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  background: rgba(5, 5, 10, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-box {
  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
}
.modal-overlay.open .modal-box { transform: scale(1); opacity: 1; }

/* ---------- Buttons ---------- */
.btn-primary {
  background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 50%, #6d28d9 100%);
  color: #fff;
  font-weight: 600;
  border-radius: 0.9rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  box-shadow: 0 8px 24px -8px rgba(139, 92, 246, 0.55);
  position: relative;
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-primary.pulse::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  border: 2px solid var(--primary);
  animation: pulseRing 0.8s ease-out forwards;
  pointer-events: none;
}
@keyframes pulseRing {
  0%   { opacity: 0.9; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.35); }
}

.btn-ghost {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 0.9rem;
  color: var(--text);
  transition: background 0.25s ease, border-color 0.25s ease;
}
.btn-ghost:hover { background: var(--primary-soft); border-color: rgba(139, 92, 246, 0.4); }

/* ---------- Inputs ---------- */
.input-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  color: var(--text);
  border-radius: 1rem;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.input-glass::placeholder { color: var(--muted); }
.input-glass:focus {
  outline: none;
  border-color: rgba(139, 92, 246, 0.6);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

/* ---------- Pills / badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text);
  white-space: nowrap;
}
.pill i { color: var(--primary); }

/* ---------- Output card animation ---------- */
.output-enter {
  animation: outputUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes outputUp {
  from { opacity: 0; transform: translateY(28px); filter: blur(8px); }
  to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* ---------- Toast ---------- */
#toast-zone {
  position: fixed; bottom: 1.25rem; left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex; flex-direction: column; gap: 0.5rem;
  width: min(92vw, 26rem);
}
.toast {
  display: flex; align-items: flex-start; gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-radius: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.875rem;
  animation: toastIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.toast.out { animation: toastOut 0.3s ease forwards; }
.toast.success { border-color: rgba(34, 197, 94, 0.4); }
.toast.error { border-color: rgba(239, 68, 68, 0.4); }
.toast.warn { border-color: rgba(245, 158, 11, 0.4); }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

/* ---------- Offline banner ---------- */
#net-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 150;
  background: linear-gradient(90deg, #b91c1c, #ef4444);
  color: #fff; text-align: center;
  font-size: 0.8rem; padding: 0.4rem 1rem;
  transform: translateY(-110%);
  transition: transform 0.35s ease;
}
#net-banner.show { transform: translateY(0); }

/* ---------- 1XBET banner glow ---------- */
.xbet-banner {
  position: relative;
  border-radius: 1.25rem;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(17, 17, 24, 0.9) 45%);
  border: 1px solid rgba(245, 158, 11, 0.25);
}
html[data-theme="light"] .xbet-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(255, 255, 255, 0.9) 45%);
}
.xbet-banner::before {
  content: "";
  position: absolute; inset: -2px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(110deg, transparent 20%, rgba(245, 158, 11, 0.8), transparent 80%);
  background-size: 250% 100%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: borderGlow 4s linear infinite;
  pointer-events: none;
}
@keyframes borderGlow { to { background-position: -250% 0; } }

/* ---------- Accordion ---------- */
details.acc summary { list-style: none; cursor: pointer; }
details.acc summary::-webkit-details-marker { display: none; }
details.acc summary .chev { transition: transform 0.3s ease; }
details.acc[open] summary .chev { transform: rotate(180deg); }

/* ---------- Carousel ---------- */
.carousel {
  display: flex; overflow-x: auto;
  scroll-snap-type: x mandatory;
  gap: 0.5rem;
  border-radius: 1rem;
}
.carousel > * { scroll-snap-align: center; flex: 0 0 100%; }

/* ---------- Spinner dots ---------- */
.dot-live {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: livePulse 2s infinite;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ---------- Quality pills ---------- */
.q-pill input { position: absolute; opacity: 0; }
.q-pill span {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.q-pill input:checked + span {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.q-pill input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Focus rings ---------- */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Gradient text ---------- */
.grad-text {
  background: linear-gradient(135deg, #a78bfa, #8b5cf6 50%, #6d28d9);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.grad-gold {
  background: linear-gradient(135deg, #fde68a, #f59e0b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Header blur ---------- */
.header-glass {
  background: rgba(10, 10, 15, 0.65);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.3s ease;
}
html[data-theme="light"] .header-glass { background: rgba(248, 250, 252, 0.7); }

/* ---------- Lite mode (slow connection) ---------- */
html.lite .cm-mesh,
html.lite .signal-wave { display: none; }
html.lite * { animation-duration: 0.001s !important; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
    scroll-behavior: auto !important;
  }
  .reveal, .stagger > * { opacity: 1 !important; transform: none !important; }
}
