:root {
  --bg: #07070f;
  --surface: #0f0f1a;
  --surface-2: #16162a;
  --border: rgba(255,255,255,0.07);
  --border-hi: rgba(167,139,250,0.3);
  --primary: #a78bfa;
  --primary-glow: rgba(167,139,250,0.4);
  --accent: #10b981;
  --cyan: #06b6d4;
  --danger: #ef4444;
  --warning: #f59e0b;
  --text: #eeeef2;
  --muted: #8888aa;
}

* { box-sizing: border-box; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---------- aurora background ---------- */
.aurora {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  overflow: hidden;
}
.aurora::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(rgba(167,139,250,0.035) 1px, transparent 1px) 0 0/48px 48px,
    linear-gradient(90deg, rgba(167,139,250,0.035) 1px, transparent 1px) 0 0/48px 48px;
  mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
}
.aurora::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 0%, rgba(7,7,15,0.75) 90%);
}
.aurora .blob {
  position: absolute;
  width: 560px;
  height: 560px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  mix-blend-mode: screen;
  animation: blob-drift 22s ease-in-out infinite;
  will-change: transform;
}
.aurora .blob.b1 { background: #a78bfa; top: -160px; left: -120px; animation-delay: 0s; }
.aurora .blob.b2 { background: #06b6d4; top: 20%;   right: -180px; animation-delay: -6s; }
.aurora .blob.b3 { background: #10b981; bottom: -200px; left: 20%; animation-delay: -12s; opacity: 0.4; }
.aurora .blob.b4 { background: #7c3aed; top: 55%; left: 40%; width: 420px; height: 420px; animation-delay: -18s; opacity: 0.3; }

@keyframes blob-drift {
  0%, 100% { transform: translate(0,0) scale(1); }
  25% { transform: translate(60px,-40px) scale(1.05); }
  50% { transform: translate(-40px,60px) scale(0.95); }
  75% { transform: translate(30px,30px) scale(1.02); }
}

/* parallax applied via JS sets --mx --my on body */
body {
  --mx: 0;
  --my: 0;
}
.aurora .blob.b1 { transform: translate(calc(var(--mx) *  14px), calc(var(--my) *  14px)); }
.aurora .blob.b2 { transform: translate(calc(var(--mx) * -18px), calc(var(--my) *  10px)); }
.aurora .blob.b3 { transform: translate(calc(var(--mx) *  10px), calc(var(--my) * -12px)); }
.aurora .blob.b4 { transform: translate(calc(var(--mx) * -8px),  calc(var(--my) *  16px)); }

/* ---------- typography ---------- */
.font-display { font-family: 'Space Grotesk', sans-serif; font-weight: 700; letter-spacing: -0.02em; }
.font-mono    { font-family: 'JetBrains Mono', monospace; }

.cyber-text {
  background: linear-gradient(90deg, #a78bfa 0%, #06b6d4 50%, #10b981 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- glass & borders ---------- */
.glass {
  background: linear-gradient(180deg, rgba(15,15,26,0.72), rgba(10,10,18,0.72));
  border: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.glow-border {
  box-shadow:
    0 0 0 1px var(--border-hi),
    0 24px 70px -20px var(--primary-glow),
    inset 0 1px 0 rgba(255,255,255,0.03);
}

/* ---------- buttons ---------- */
.btn-primary {
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.02em;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px -8px var(--primary-glow);
  filter: brightness(1.06);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* beam-sweep animation across primary button */
.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg,
    transparent 0%, transparent 40%,
    rgba(255,255,255,0.28) 50%,
    transparent 60%, transparent 100%);
  transform: translateX(-100%);
  animation: beam-sweep 2.8s cubic-bezier(.6,0,.4,1) infinite;
  pointer-events: none;
}
@keyframes beam-sweep {
  0%   { transform: translateX(-100%); }
  60%  { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}

.btn-accent {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  letter-spacing: 0.02em;
}
.btn-accent:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px -8px rgba(16,185,129,0.4);
}

/* ---------- inputs ---------- */
.input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(167,139,250,0.18);
}

/* ---------- chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(167,139,250,0.1);
  border: 1px solid rgba(167,139,250,0.25);
  border-radius: 999px;
  font-size: 12px;
  color: var(--primary);
  font-family: 'JetBrains Mono', monospace;
}

/* ---------- ticker ---------- */
.ticker {
  overflow: hidden;
  white-space: nowrap;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(15,15,26,0.5);
  backdrop-filter: blur(10px);
}
.ticker-inner {
  display: inline-flex;
  gap: 48px;
  padding: 10px 0;
  animation: ticker-scroll 40s linear infinite;
}
@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.spin { animation: spin 1s linear infinite; }
@keyframes spin {
  from { transform: rotate(0); }
  to   { transform: rotate(360deg); }
}

.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(16,185,129,0.7);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(16,185,129,0.7); }
  70%  { box-shadow: 0 0 0 10px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

.swap-flip {
  transition: transform 0.3s;
}
.swap-flip:hover { transform: rotate(180deg); }

.grid-lines {
  background-image:
    linear-gradient(rgba(167,139,250,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(167,139,250,0.05) 1px, transparent 1px);
  background-size: 40px 40px;
}

.shimmer {
  background: linear-gradient(90deg,
    var(--surface-2) 0%,
    var(--surface) 50%,
    var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- status badges ---------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 500;
}
.status-AwaitingDeposit { background: rgba(245,158,11,0.12); color: var(--warning); border:1px solid rgba(245,158,11,0.3); }
.status-Confirming       { background: rgba(6,182,212,0.12);  color: var(--cyan);    border:1px solid rgba(6,182,212,0.3); }
.status-Exchanging       { background: rgba(167,139,250,0.12); color: var(--primary); border:1px solid rgba(167,139,250,0.3); }
.status-Sent             { background: rgba(167,139,250,0.12); color: var(--primary); border:1px solid rgba(167,139,250,0.3); }
.status-Completed        { background: rgba(16,185,129,0.12); color: var(--accent);  border:1px solid rgba(16,185,129,0.3); }
.status-Expired,
.status-Failed           { background: rgba(239,68,68,0.12);  color: var(--danger);  border:1px solid rgba(239,68,68,0.3); }
.status-Created,
.status-NEW              { background: rgba(161,161,170,0.12); color: var(--muted); border:1px solid rgba(161,161,170,0.2); }

.scrollbar-hide::-webkit-scrollbar { display: none; }

.ccy-logo {
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  object-fit: contain;
  flex-shrink: 0;
}

/* ---------- coin icon (real logo + colored gradient fallback) ---------- */
.coin-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: white;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  line-height: 1;
}
.coin-icon::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.18), transparent 60%);
  pointer-events: none;
  z-index: 1;
}
.coin-icon .coin-txt {
  position: relative;
  z-index: 1;
}
.coin-icon .coin-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: white;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.15s;
}
.coin-icon.has-img .coin-img { opacity: 1; }
.coin-icon.has-img::after { display: none; }
.coin-icon.sz-6  { width: 22px; height: 22px; font-size: 8px; }
.coin-icon.sz-8  { width: 30px; height: 30px; font-size: 10px; }
.coin-icon.sz-10 { width: 40px; height: 40px; font-size: 11px; }
.coin-icon.sz-12 { width: 48px; height: 48px; font-size: 13px; }

/* ---------- 3d tilt ---------- */
.tilt-wrap { perspective: 1000px; }
.tilt {
  transition: transform 0.25s cubic-bezier(.2,.8,.2,1);
  transform-style: preserve-3d;
  will-change: transform;
}

/* ---------- circular countdown ring ---------- */
.ring-wrap {
  position: relative;
  width: 120px; height: 120px;
}
.ring-bg, .ring-fg {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
}
.ring-bg { stroke: rgba(255,255,255,0.06); }
.ring-fg {
  stroke: url(#ringGrad);
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 0.6s ease;
  filter: drop-shadow(0 0 8px rgba(167,139,250,0.5));
}
.ring-wrap .ring-txt {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* ---------- rate confidence bar ---------- */
.confidence {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  overflow: hidden;
}
.confidence .fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 85%;
  border-radius: 999px;
  background: linear-gradient(90deg, #10b981, #a78bfa, #06b6d4);
  background-size: 200% 100%;
  animation: confidence-flow 3s linear infinite;
}
@keyframes confidence-flow {
  0%   { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

/* ---------- confetti ---------- */
.confetti-piece {
  position: fixed;
  top: -20px;
  width: 10px; height: 14px;
  pointer-events: none;
  z-index: 9998;
  will-change: transform, opacity;
  animation: confetti-fall 2.4s cubic-bezier(.2,.8,.3,1) forwards;
}
@keyframes confetti-fall {
  0%   { transform: translate3d(0, -20px, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate3d(var(--dx, 0px), 100vh, 0) rotate(720deg); opacity: 0; }
}

/* ---------- slide-in page transition ---------- */
@keyframes slide-in {
  0%   { opacity: 0; transform: translateY(16px); }
  100% { opacity: 1; transform: translateY(0); }
}
.slide-in {
  animation: slide-in 0.35s cubic-bezier(.2,.8,.2,1) both;
}

/* ---------- tables ---------- */
table.table {
  width: 100%;
  border-collapse: collapse;
}
table.table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
table.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
table.table tr:hover td {
  background: rgba(167,139,250,0.05);
  cursor: pointer;
}

/* ---------- sparkline ---------- */
.spark {
  display: block;
  width: 100%;
  height: 40px;
}

/* ---------- live rate panel / pair cell ---------- */
.pair-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
}
.pair-cell .col { flex: 1; min-width: 0; }
.pair-cell .price {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--text);
}
.pair-cell .sym {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---------- rolling number ---------- */
.roll {
  display: inline-block;
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1);
}
