/* ============================================================
   LIVE STUDIO — Design System "Aurora"
   Premium dark theme · glass panels · neon gradients
   ============================================================ */

:root {
  /* palette */
  --bg-0: #07060f;
  --bg-1: #0d0b1c;
  --bg-2: #141126;
  --bg-3: #1c1834;
  --glass: rgba(255, 255, 255, 0.055);
  --glass-strong: rgba(255, 255, 255, 0.09);
  --stroke: rgba(255, 255, 255, 0.09);
  --stroke-strong: rgba(255, 255, 255, 0.16);

  --text-hi: #f4f2ff;
  --text-mid: #b9b4d6;
  --text-low: #756f96;

  --pink: #ff2e88;
  --pink-soft: #ff5d8f;
  --violet: #8b5cf6;
  --blue: #38bdf8;
  --gold: #ffc933;
  --green: #34d399;
  --red: #f43f5e;

  --grad-brand: linear-gradient(135deg, #ff2e88 0%, #8b5cf6 55%, #38bdf8 100%);
  --grad-gold: linear-gradient(135deg, #ffdd66 0%, #ffa733 60%, #ff7b33 100%);
  --grad-live: linear-gradient(135deg, #ff2e63, #ff2e88);

  --shadow-1: 0 8px 32px rgba(0, 0, 0, 0.45);
  --shadow-glow-pink: 0 0 24px rgba(255, 46, 136, 0.4);
  --shadow-glow-violet: 0 0 28px rgba(139, 92, 246, 0.35);

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;

  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', 'Segoe UI', system-ui, sans-serif;

  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: var(--bg-0);
  color: var(--text-hi);
  font-family: var(--font);
  font-size: 16px;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(139, 92, 246, 0.16), transparent 60%),
    radial-gradient(1000px 600px at -10% 20%, rgba(255, 46, 136, 0.12), transparent 55%),
    radial-gradient(900px 700px at 50% 110%, rgba(56, 189, 248, 0.10), transparent 60%),
    var(--bg-0);
  background-attachment: fixed;
}

::selection { background: rgba(255, 46, 136, 0.35); }

/* scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ---------- typography ---------- */
h1, h2, h3, .display { font-family: var(--font-display); letter-spacing: -0.025em; }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.micro { font-size: 10.5px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-low); }

/* ---------- stroke icons ---------- */
.ic { display: inline-flex; width: 1.2em; height: 1.2em; flex-shrink: 0; vertical-align: -0.22em; }
.ic svg { width: 100%; height: 100%; }
.muted { color: var(--text-mid); }
.tiny { font-size: 12px; color: var(--text-low); }

.grad-text {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.gold-text {
  background: var(--grad-gold);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ---------- glass panels ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: var(--shadow-1);
}
.glass-strong {
  background: var(--glass-strong);
  border: 1px solid var(--stroke-strong);
  border-radius: var(--r-lg);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  box-shadow: var(--shadow-1);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px;
  border-radius: 12px;
  font-weight: 600; font-size: 14.5px;
  letter-spacing: 0.01em;
  transition: transform 0.18s var(--ease-pop), box-shadow 0.25s, filter 0.2s, opacity 0.2s, background 0.2s;
  user-select: none;
  position: relative;
  overflow: hidden;
}
.btn:active { transform: scale(0.95); }
.btn:disabled { opacity: 0.45; pointer-events: none; }

.btn-primary {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: 0 4px 20px rgba(255, 46, 136, 0.35);
}
.btn-primary:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 8px 30px rgba(255, 46, 136, 0.5); }

.btn-gold {
  background: var(--grad-gold);
  color: #402800;
  box-shadow: 0 4px 20px rgba(255, 201, 51, 0.35);
}
.btn-gold:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 8px 30px rgba(255, 201, 51, 0.5); }

.btn-ghost {
  background: var(--glass);
  border: 1px solid var(--stroke);
  color: var(--text-hi);
}
.btn-ghost:hover { background: var(--glass-strong); border-color: var(--stroke-strong); transform: translateY(-1px); }

.btn-danger { background: linear-gradient(135deg, #f43f5e, #e11d48); color: #fff; }
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(244, 63, 94, 0.4); }

/* premium solid button (dashboards) */
.btn-solid {
  background: linear-gradient(180deg, #ffffff, #e8e6f2);
  color: #16121f;
  box-shadow: 0 1px 0 rgba(255,255,255,0.35) inset, 0 8px 22px rgba(0,0,0,0.4);
}
.btn-solid:hover { transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255,255,255,0.4) inset, 0 12px 28px rgba(0,0,0,0.5); }
.btn-quiet {
  background: transparent;
  border: 1px solid var(--stroke);
  color: var(--text-mid);
}
.btn-quiet:hover { color: var(--text-hi); border-color: var(--stroke-strong); background: rgba(255,255,255,0.04); }

.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn-lg { padding: 16px 32px; font-size: 17px; border-radius: 18px; }
.btn-round { width: 46px; height: 46px; padding: 0; border-radius: 50%; font-size: 20px; }

/* shine sweep on primary buttons */
.btn-primary::after, .btn-gold::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.35) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.6s;
}
.btn-primary:hover::after, .btn-gold:hover::after { transform: translateX(120%); }

/* ---------- inputs ---------- */
.field {
  width: 100%;
  padding: 13px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid var(--stroke);
  color: var(--text-hi);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field::placeholder { color: var(--text-low); }
.field:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
  background: rgba(255,255,255,0.08);
}
label.lbl { display: block; font-size: 13px; font-weight: 600; color: var(--text-mid); margin: 0 0 6px 4px; }

/* ---------- badges & chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px; font-weight: 700;
}
.badge-live {
  background: var(--grad-live);
  color: #fff;
  box-shadow: 0 0 14px rgba(255, 46, 99, 0.6);
  animation: livePulse 1.6s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 10px rgba(255,46,99,0.5); }
  50% { box-shadow: 0 0 22px rgba(255,46,99,0.9); }
}
.badge-live::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: #fff; animation: blink 1.2s infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 99px;
  background: var(--glass);
  border: 1px solid var(--stroke);
  font-size: 13px; font-weight: 600;
}

/* level badges */
.lvl {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 18px; padding: 0 6px;
  border-radius: 6px;
  font-size: 10.5px; font-weight: 800; color: #fff;
  vertical-align: middle;
}
.lvl-0  { background: linear-gradient(135deg, #64748b, #475569); }
.lvl-1  { background: linear-gradient(135deg, #38bdf8, #2563eb); }
.lvl-2  { background: linear-gradient(135deg, #34d399, #059669); }
.lvl-3  { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.lvl-4  { background: linear-gradient(135deg, #fb923c, #ea580c); }
.lvl-5  { background: linear-gradient(135deg, #ffd700, #b8860b); box-shadow: 0 0 8px rgba(255,215,0,0.5); }

/* ---------- avatars ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 50%;
  font-size: 20px;
  background: var(--bg-3);
  border: 2px solid var(--stroke-strong);
  flex-shrink: 0;
}
.avatar-ring {
  border: 2px solid transparent;
  background:
    linear-gradient(var(--bg-2), var(--bg-2)) padding-box,
    var(--grad-brand) border-box;
}
.avatar-lg { width: 72px; height: 72px; font-size: 34px; }
.avatar-sm { width: 30px; height: 30px; font-size: 14px; border-width: 1.5px; }

/* ---------- modal ---------- */
.modal-veil {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(5, 4, 12, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
.modal-veil.open { opacity: 1; pointer-events: auto; }
.modal {
  width: 100%; max-width: 440px;
  max-height: 88vh; overflow-y: auto;
  padding: 26px;
  transform: translateY(24px) scale(0.96);
  transition: transform 0.32s var(--ease-pop);
}
.modal-veil.open .modal { transform: translateY(0) scale(1); }
.modal h2 { font-size: 21px; margin-bottom: 4px; }

/* bottom sheet on phones */
@media (max-width: 640px) {
  .modal-veil { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100%;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    transform: translateY(100%);
    padding-bottom: max(26px, env(safe-area-inset-bottom));
  }
  .modal-veil.open .modal { transform: translateY(0); }
}

/* ---------- toast ---------- */
#toastWrap {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 500; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: min(92vw, 420px);
}
.toast {
  padding: 12px 20px;
  border-radius: 14px;
  background: rgba(20, 17, 38, 0.92);
  border: 1px solid var(--stroke-strong);
  backdrop-filter: blur(16px);
  font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow-1);
  animation: toastIn 0.35s var(--ease-pop);
  display: flex; align-items: center; gap: 8px;
  max-width: 100%;
}
.toast.err { border-color: rgba(244, 63, 94, 0.5); }
.toast.ok { border-color: rgba(52, 211, 153, 0.5); }
.toast.out { animation: toastOut 0.3s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-12px) scale(0.94); } }

/* ---------- generic animations ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: scale(1); } }
@keyframes floatY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }

.anim-fadeUp { animation: fadeUp 0.55s var(--ease-smooth) backwards; }
.anim-pop { animation: popIn 0.4s var(--ease-pop) backwards; }

.spinner {
  width: 22px; height: 22px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--pink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* skeleton shimmer for loading cards */
.skeleton {
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 50%, var(--bg-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--r-md);
}

/* coin icon */
.coin {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.15em; height: 1.15em; border-radius: 50%;
  background: var(--grad-gold);
  color: #5a3a00; font-size: 0.72em; font-weight: 900;
  box-shadow: 0 1px 4px rgba(255, 167, 51, 0.5), inset 0 -1px 2px rgba(0,0,0,0.2);
  vertical-align: -0.15em;
}
.coin::before { content: '¢'; content: 'C'; }

.diamond { font-style: normal; }
.diamond::before { content: '💎'; font-size: 0.9em; }

/* utility */
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.center { display: flex; align-items: center; justify-content: center; }
.hide { display: none !important; }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
