/* ═══════════════════════════════════════════════════════════════
   XENOR DIGITAL V2 — BEAST LEVEL LUXURY CRYPTO DASHBOARD
   Deep Space Gold Premium Theme
═══════════════════════════════════════════════════════════════ */

:root {
  --bg-deep:        #010108;
  --bg-mid:         #080818;
  --bg-card:        rgba(255,255,255,0.035);
  --bg-card-hover:  rgba(255,255,255,0.06);
  --bg-input:       rgba(255,255,255,0.05);

  --gold:       #F59E0B;
  --gold-light: #FCD34D;
  --gold-dim:   rgba(245,158,11,0.12);
  --gold-glow:  rgba(245,158,11,0.25);

  --cyan:       #06B6D4;
  --cyan-light: #67E8F9;
  --cyan-dim:   rgba(6,182,212,0.12);
  --cyan-glow:  rgba(6,182,212,0.25);

  --purple:       #7C3AED;
  --purple-light: #A78BFA;
  --purple-dim:   rgba(124,58,237,0.12);
  --purple-glow:  rgba(124,58,237,0.3);

  --green:  #10B981;
  --red:    #EF4444;
  --pink:   #EC4899;

  --text-primary:   #F1F5F9;
  --text-secondary: rgba(241,245,249,0.6);
  --text-muted:     rgba(241,245,249,0.3);

  --border:        rgba(255,255,255,0.07);
  --border-bright: rgba(255,255,255,0.15);
  --border-gold:   rgba(245,158,11,0.25);
  --border-cyan:   rgba(6,182,212,0.25);
  --border-purple: rgba(124,58,237,0.25);

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 30px;

  --font-display: 'Outfit', sans-serif;
  --font-body:    'Space Grotesk', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 0.25s var(--ease-in-out);
  --transition-slow: 0.5s var(--ease-out);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── Background System ──────────────────────────────────────── */
.space-stage {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.space-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(124,58,237,0.15) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 90%, rgba(6,182,212,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 50% 30% at 50% 50%, rgba(245,158,11,0.06) 0%, transparent 70%);
  animation: bgPulse 12s ease-in-out infinite alternate;
}

@keyframes bgPulse {
  0%   { opacity: 0.7; }
  50%  { opacity: 1; }
  100% { opacity: 0.8; }
}

.space-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Animated mesh grid */
.space-stage::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(124,58,237,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,58,237,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 80% at center, black 40%, transparent 100%);
}

.ambient-orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(100px);
  animation: orbFloat 20s ease-in-out infinite;
}

.orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(124,58,237,0.35), rgba(124,58,237,0.05) 60%, transparent);
  top: -200px; left: -200px;
  animation-delay: 0s;
}

.orb-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(6,182,212,0.25), rgba(6,182,212,0.05) 60%, transparent);
  bottom: -150px; right: -150px;
  animation-delay: -7s;
}

.orb-3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(245,158,11,0.15), rgba(245,158,11,0.03) 60%, transparent);
  top: 40%; left: 40%;
  transform: translate(-50%, -50%);
  animation-delay: -14s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25%  { transform: translate(30px, -20px) scale(1.05); }
  50%  { transform: translate(-20px, 30px) scale(0.95); }
  75%  { transform: translate(20px, 20px) scale(1.02); }
}

/* ── App Shell ─────────────────────────────────────────────── */
.app-shell { position: relative; z-index: 1; min-height: 100vh; }

/* ── Header ─────────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(1,1,8,0.8);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 68px;
}

.app-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(124,58,237,0.5) 30%,
    rgba(6,182,212,0.5) 70%,
    transparent 100%
  );
}

.header-grid {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
}

/* Brand */
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.brand-mark {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--purple) 0%, var(--cyan) 100%);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 800; font-size: 17px; color: white;
  box-shadow: 0 0 20px rgba(124,58,237,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
  position: relative;
  overflow: hidden;
}

.brand-mark::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
}

.brand-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
  background: linear-gradient(135deg, var(--text-primary) 40%, var(--purple-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-subtitle { font-size: 11px; color: var(--text-muted); font-weight: 400; letter-spacing: 0.02em; }

.header-center { display: flex; align-items: center; gap: 8px; flex: 1; justify-content: center; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ── Chips ─────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 15px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap; cursor: default;
  transition: var(--transition);
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
  backdrop-filter: blur(8px);
}

.chip:hover { border-color: var(--border-bright); color: var(--text-primary); }
.chip button { background: none; border: none; cursor: pointer; color: inherit; }

.chip .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.chip.info .dot   { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); animation: dotPulse 2s ease infinite; }
.chip.success .dot { background: var(--green); box-shadow: 0 0 8px var(--green); animation: dotPulse 2s ease infinite; }
.chip.error .dot  { background: var(--red); box-shadow: 0 0 8px var(--red); }

@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.8); }
}

/* ── Speed Income Animations ─────────────────────────────────── */
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 12px rgba(124,58,237,0.2), inset 0 0 8px rgba(124,58,237,0.1); }
  50%      { box-shadow: 0 0 24px rgba(124,58,237,0.4), inset 0 0 12px rgba(124,58,237,0.2); }
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.4); opacity: 0.6; }
}

@keyframes slideInScale {
  0%   { transform: scale(0.8) translateY(-10px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes slideInRight {
  0%   { transform: translateX(-20px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 24px; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; transition: var(--transition);
  text-decoration: none; white-space: nowrap; line-height: 1;
  position: relative; overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.2s;
}

.btn:hover::after { opacity: 1; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--purple) 0%, #5B21B6 50%, var(--cyan) 100%);
  background-size: 200% 100%;
  color: white;
  box-shadow: 0 4px 20px rgba(124,58,237,0.35), inset 0 1px 0 rgba(255,255,255,0.15);
  transition: background-position 0.4s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover:not(:disabled) {
  background-position: right center;
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(124,58,237,0.45), inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn-outline {
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--purple);
  color: var(--text-primary);
  background: var(--purple-dim);
  box-shadow: 0 0 16px rgba(124,58,237,0.2);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold) 0%, #D97706 100%);
  color: #1a1200; font-weight: 700;
  box-shadow: 0 4px 20px rgba(245,158,11,0.35);
}

.btn-gold:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(245,158,11,0.45);
}

.btn-sm { padding: 7px 16px; font-size: 12.5px; }

/* ── Glass Cards ─────────────────────────────────────────────── */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  transition: var(--transition);
  overflow: hidden;
  position: relative;
}

.glass-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, transparent 50%);
  pointer-events: none;
}

.glass-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-bright);
  transform: translateY(-1px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

/* ── Stat Cards ─────────────────────────────────────────────── */
.stat-card { padding: 22px; }

.stat-card.gold {
  border-color: var(--border-gold);
  background: linear-gradient(135deg, var(--gold-dim) 0%, rgba(245,158,11,0.04) 100%);
}

.stat-card.gold:hover {
  box-shadow: 0 0 40px var(--gold-glow), 0 8px 32px rgba(0,0,0,0.4);
  border-color: rgba(245,158,11,0.4);
}

.stat-card.cyan {
  border-color: var(--border-cyan);
  background: linear-gradient(135deg, var(--cyan-dim) 0%, rgba(6,182,212,0.04) 100%);
}

.stat-card.cyan:hover {
  box-shadow: 0 0 40px var(--cyan-glow), 0 8px 32px rgba(0,0,0,0.4);
  border-color: rgba(6,182,212,0.4);
}

.stat-card .label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.stat-card .value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 8px;
  word-break: break-all;
  background: linear-gradient(135deg, var(--text-primary) 60%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card.gold .value {
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card.cyan .value {
  background: linear-gradient(135deg, var(--cyan-light) 0%, var(--cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card .meta { font-size: 12px; color: var(--text-muted); }

/* ── Bento Grid ─────────────────────────────────────────────── */
.bento-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px; }
.col-2  { grid-column: span 2; }
.col-3  { grid-column: span 3; }
.col-4  { grid-column: span 4; }
.col-6  { grid-column: span 6; }
.col-8  { grid-column: span 8; }
.col-12 { grid-column: span 12; }

/* ── Tab Bar ─────────────────────────────────────────────────── */
.tab-bar {
  display: flex; gap: 2px; padding: 20px 28px 0;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  max-width: 1440px; margin: 0 auto;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab-btn {
  position: relative; padding: 10px 22px;
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  color: #111827; background: transparent; border: none;
  cursor: pointer; border-radius: var(--radius-sm);
  transition: var(--transition); white-space: nowrap; flex-shrink: 0;
  letter-spacing: 0.01em;
  animation: neonRGB 3s infinite;
}

.tab-btn:hover { color: #111827; background: rgba(255,255,255,0.04); }

.tab-btn.active {
  color: #111827;
  background: rgba(255,255,255,0.06);
  font-weight: 600;
}

@keyframes neonRGB {
  0%   { color: #ff0080; text-shadow: 0 0 10px #ff0080; }
  25%  { color: #00ff80; text-shadow: 0 0 10px #00ff80; }
  50%  { color: #0080ff; text-shadow: 0 0 10px #0080ff; }
  75%  { color: #ff8000; text-shadow: 0 0 10px #ff8000; }
  100% { color: #ff0080; text-shadow: 0 0 10px #ff0080; }
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 15%; right: 15%;
  height: 2px;
  background: linear-gradient(90deg, var(--purple), var(--cyan));
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(124,58,237,0.6);
}

.tab-line { display: none; }

/* ── Panel Wrap ─────────────────────────────────────────────── */
.panel-wrap { padding: 16px 28px 40px; max-width: 1440px; margin: 0 auto; }

.tab-panel {
  display: none;
  animation: panelIn 0.35s var(--ease-out);
}

.tab-panel.active { display: block; }

@keyframes panelIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Top Strip ─────────────────────────────────────────────── */
.top-strip {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px; margin: 16px auto 0; max-width: 1440px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700; margin-bottom: 4px;
  background: linear-gradient(135deg, var(--text-primary) 50%, var(--purple-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-subtitle { font-size: 13px; color: var(--text-muted); }

.tab-panel h3.section-title {
  font-size: 15px; padding: 16px 22px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  -webkit-text-fill-color: var(--text-primary);
  background: none;
  background-clip: unset;
}

/* ── Wallet Cards ─────────────────────────────────────────────── */
.wallets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }

.wallet-card { display: flex; align-items: center; gap: 16px; padding: 20px; }

.wallet-icon {
  font-size: 26px; flex-shrink: 0; width: 50px; height: 50px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.wallet-info { flex: 1; min-width: 0; }

.wallet-title {
  font-size: 11px; color: var(--text-muted); font-weight: 600;
  margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.07em;
}

.wallet-balance {
  font-family: var(--font-display); font-size: 20px; font-weight: 700; line-height: 1.2;
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

.transfer-all-btn { width: 100%; padding: 14px; font-size: 15px; border-radius: var(--radius-md); margin-bottom: 16px; }

/* ── Inputs ─────────────────────────────────────────────────── */
.input {
  width: 100%; padding: 12px 16px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-family: var(--font-body); font-size: 14px; outline: none;
  transition: var(--transition); backdrop-filter: blur(8px);
}
.input:focus { border-color: var(--purple); background: rgba(124,58,237,0.07); box-shadow: 0 0 0 3px rgba(124,58,237,0.12); }
.input::placeholder { color: var(--text-muted); }

/* ── Notification ─────────────────────────────────────────────── */
.notification-wrap { position: relative; }
.notification-btn {
  position: relative; background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 13px; color: var(--text-secondary);
  cursor: pointer; font-size: 16px; transition: var(--transition); backdrop-filter: blur(8px);
}
.notification-btn:hover { border-color: var(--border-bright); color: var(--text-primary); }
.notification-count {
  position: absolute; top: -5px; right: -5px;
  background: linear-gradient(135deg, var(--red), #DC2626);
  color: white; font-size: 9px; font-weight: 800;
  width: 17px; height: 17px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 8px rgba(239,68,68,0.5);
}
.notification-panel {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 340px; max-height: 400px; overflow-y: auto; z-index: 200; display: none; padding: 12px;
  background: rgba(8,8,24,0.95); border: 1px solid var(--border);
  border-radius: var(--radius-md); backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.notification-panel.open { display: block; }

/* ── Theme + Menu ─────────────────────────────────────────────── */
.theme-toggle, .menu-toggle-btn {
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 13px; color: var(--text-secondary);
  cursor: pointer; font-size: 16px; transition: var(--transition); backdrop-filter: blur(8px);
}
.theme-toggle:hover, .menu-toggle-btn:hover { border-color: var(--border-bright); color: var(--text-primary); }
.menu-toggle-btn { display: none; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  backdrop-filter: blur(12px); z-index: 500;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: 0.3s ease;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal {
  background: rgba(8,8,24,0.97); border: 1px solid var(--border-purple);
  border-radius: var(--radius-xl); padding: 36px;
  width: min(500px, 92vw);
  box-shadow: 0 30px 80px rgba(0,0,0,0.7), 0 0 40px rgba(124,58,237,0.15);
  animation: modalIn 0.35s var(--ease-out);
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-title {
  font-family: var(--font-display); font-size: 24px; font-weight: 700; margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text-primary), var(--purple-light));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.modal-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 28px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Center Screen ─────────────────────────────────────────── */
.center-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 60vh; margin: 32px 28px; padding: 56px; text-align: center;
}

/* ── Warning Banner ─────────────────────────────────────────── */
.warning-banner {
  background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.25);
  color: var(--red); padding: 12px 28px; font-size: 13.5px; font-weight: 500; text-align: center;
}

/* ── Toast ─────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 28px; right: 28px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast {
  background: rgba(8,8,24,0.97); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px 20px; font-size: 14px;
  color: var(--text-primary); box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: toastIn 0.3s var(--ease-out); display: flex; align-items: center; gap: 10px;
  backdrop-filter: blur(20px);
}
.toast.success { border-color: rgba(16,185,129,0.4); box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 20px rgba(16,185,129,0.1); }
.toast.error   { border-color: rgba(239,68,68,0.4); box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 20px rgba(239,68,68,0.1); }
.toast.info    { border-color: rgba(6,182,212,0.4); box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 20px rgba(6,182,212,0.1); }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px) scale(0.95); } to { opacity: 1; transform: translateX(0) scale(1); } }

/* ── Skeleton Loading ─────────────────────────────────────────── */
.tab-panel.loading .value,
.tab-panel.loading .wallet-balance {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.04) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.8s ease infinite;
  border-radius: 8px; color: transparent !important;
  min-width: 80px; display: inline-block; min-height: 30px;
  -webkit-text-fill-color: transparent;
}
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* ── Animations ─────────────────────────────────────────────── */
.fade-in { animation: panelIn 0.35s var(--ease-out); }
.hidden { display: none !important; }

.loading-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Progress ─────────────────────────────────────────────── */
.progress-bar { height: 3px; background: rgba(255,255,255,0.06); border-radius: 4px; overflow: hidden; margin-top: 10px; }
.progress-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--purple), var(--cyan));
  box-shadow: 0 0 8px rgba(6,182,212,0.4);
  transition: width 0.8s var(--ease-out);
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }
::selection { background: rgba(124,58,237,0.35); color: white; }

/* ── Drawer ─────────────────────────────────────────────────── */
.drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.65); z-index: 400; display: none; backdrop-filter: blur(4px); }
.drawer-overlay.open { display: block; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(320px, 85vw);
  background: rgba(8,8,24,0.98); border-left: 1px solid var(--border-purple);
  z-index: 401; padding: 28px; transform: translateX(100%);
  transition: transform 0.35s var(--ease-out); overflow-y: auto;
  backdrop-filter: blur(20px);
}
.drawer.open { transform: translateX(0); }

/* ── Glow text helper ─────────────────────────────────────── */
.text-gold {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.text-cyan {
  background: linear-gradient(135deg, var(--cyan-light), var(--cyan));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.text-purple {
  background: linear-gradient(135deg, var(--purple-light), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .col-3 { grid-column: span 4; }
  .col-4 { grid-column: span 6; }
}

@media (max-width: 768px) {
  .app-header { padding: 0 16px; }
  /* allow header items to wrap instead of overflowing */
  .header-grid { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .brand { flex: 0 0 auto; }
  .header-center { display: none; }
  .header-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex-shrink: 1; }
  .header-actions .btn, .header-actions .theme-toggle, .header-actions .notification-btn { padding: 8px 12px; font-size: 13px; }
  .menu-toggle-btn { display: flex; }
  .tab-bar { padding: 12px 16px 0; }
  .tab-bar { display: flex; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .tab-btn { padding: 9px 14px; font-size: 13px; flex-shrink: 0; }
  .panel-wrap { padding: 12px 16px 28px; }
  .top-strip { margin: 12px 16px 0; padding: 16px; }
  /* make card grids single-column on small screens for full-width cards */
  .bento-grid { grid-template-columns: 1fr !important; gap: 10px; }
  .col-2,.col-3,.col-4 { grid-column: span 1; }
  .col-6,.col-8,.col-12 { grid-column: span 1; }
  .wallets-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 14px; }
  .stat-card .value { font-size: 20px; }

  /* reduce animations and heavy effects on mobile to avoid flicker */
  .space-stage::before, .ambient-orb, .space-stage canvas, .orb-1, .orb-2, .orb-3 { display: none !important; animation: none !important; }
  .card, .glass-card, .panel, .tab-bar, .tab-btn, .carousel-track { animation: none !important; transition: none !important; transform: none !important; opacity: 1 !important; }
  .tab-panel.loading .value, .tab-panel.loading .wallet-balance, .tab-panel.loading .value::before { animation: none !important; }
  body { font-size: 14px; }
  h1 { font-size: 22px; }
  h2 { font-size: 18px; }
  h3 { font-size: 16px; }
}

@media (max-width: 480px) {
  .bento-grid { grid-template-columns: 1fr; gap: 8px; }
  .col-2,.col-3,.col-4,.col-6,.col-8,.col-12 { grid-column: span 1; }
  .stat-card { padding: 14px; }
  .stat-card .value { font-size: 20px; }
  .wallets-grid { grid-template-columns: 1fr; }
  .btn { padding: 11px 20px; font-size: 13px; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }
  .header-center { display: none; }
}

/* ── V1 Style Components ────────────────────────────────── */
.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.kv-card {
  padding: 14px 16px;
}

.kv-card .k {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.kv-card .v {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  word-break: break-all;
}

.hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-form .input { flex: 1; }

.table-wrap { overflow-x: auto; margin-top: 10px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 13px;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

.accordion-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.accordion-header {
  width: 100%; padding: 16px 20px;
  background: transparent; border: none;
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-body); font-size: 15px; font-weight: 600;
  color: var(--text-primary); cursor: pointer;
  transition: var(--transition);
}

.accordion-header:hover { background: rgba(255,255,255,0.03); }

.accordion-content {
  max-height: 0; overflow: hidden;
  transition: max-height 0.3s var(--ease-out);
}

.accordion-content.open { max-height: 2000px; }
.accordion-content-inner { padding: 0 20px 16px; }

.carousel { overflow: hidden; margin: 12px 0; }
.carousel-track { display: flex; gap: 10px; transition: transform 0.3s var(--ease-out); }
.carousel-controls { display: flex; gap: 8px; margin-top: 10px; }

.mobile-bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(1,1,8,0.95); backdrop-filter: blur(20px);
  border-top: 1px solid var(--border); z-index: 200;
  padding: 8px 0 env(safe-area-inset-bottom);
  justify-content: space-around;
}

.mobile-bottom-nav .tab-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 12px; font-size: 11px; color: var(--text-muted);
  border-radius: var(--radius-xs);
}

.mobile-bottom-nav .tab-btn .icon { font-size: 18px; }
.mobile-bottom-nav .tab-btn.active { color: var(--purple-light); }

.mobile-drawer-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: none;
}
.mobile-drawer-overlay.open { display: block; }

.mobile-drawer {
  position: absolute; top: 0; right: 0;
  width: min(300px, 85vw); height: 100vh;
  padding: 24px; overflow-y: auto;
  background: rgba(8,8,24,0.98);
  border-left: 1px solid var(--border);
}

.mobile-drawer-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}

.mobile-drawer-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 22px; cursor: pointer; padding: 4px;
}

.mobile-drawer-nav { display: flex; flex-direction: column; gap: 4px; }
.mobile-drawer-nav .tab-btn { justify-content: flex-start; padding: 12px 16px; }

@media (max-width: 480px) {
  .mobile-bottom-nav { display: flex; }
  body { padding-bottom: 70px; }
  .kv-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Queue Specific ─────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-card {
  padding: 20px;
}

.form-card h4 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.form-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.slot-item {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition);
}

.slot-item.active {
  background: var(--purple-dim);
  border-color: var(--border-purple);
  color: var(--purple-light);
  box-shadow: 0 0 12px rgba(124,58,237,0.2);
}

.slot-item.filled {
  background: var(--cyan-dim);
  border-color: var(--border-cyan);
  color: var(--cyan-light);
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.progress-ring {
  width: 68px;
  height: 68px;
  flex-shrink: 0;
}

.progress-ring .bg {
  fill: none;
  stroke: rgba(255,255,255,0.07);
  stroke-width: 5;
}

.progress-ring .fg {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 188.5;
  stroke-dashoffset: 188.5;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 0.8s var(--ease-out);
}

.small-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.mini-queue-stat {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}

.mini-queue-stat .label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.mini-queue-stat .value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
  .slot-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── Queue Ring Animations ──────────────────────────────── */
.progress-ring .fg {
  stroke: url(#ringGrad);
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(124, 58, 237, 0.8))
          drop-shadow(0 0 12px rgba(6, 182, 212, 0.5));
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  animation: ringPulse 2s ease-in-out infinite;
}

@keyframes ringPulse {
  0%, 100% {
    filter: drop-shadow(0 0 6px rgba(124, 58, 237, 0.8))
            drop-shadow(0 0 12px rgba(6, 182, 212, 0.5));
  }
  50% {
    filter: drop-shadow(0 0 12px rgba(124, 58, 237, 1))
            drop-shadow(0 0 24px rgba(6, 182, 212, 0.8))
            drop-shadow(0 0 36px rgba(245, 158, 11, 0.4));
  }
}

.progress-ring .bg {
  stroke: rgba(255,255,255,0.05);
}

.slot-item.active {
  background: linear-gradient(135deg, rgba(124,58,237,0.3), rgba(6,182,212,0.2));
  border-color: var(--border-cyan) !important;
  box-shadow: 0 0 12px rgba(6,182,212,0.4), 0 0 24px rgba(124,58,237,0.2);
  animation: slotPulse 1.5s ease-in-out infinite;
}

.slot-item.filled {
  background: linear-gradient(135deg, rgba(16,185,129,0.2), rgba(6,182,212,0.1));
  border-color: rgba(16,185,129,0.4) !important;
  box-shadow: 0 0 8px rgba(16,185,129,0.3);
}

.slot-item.pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes slotPulse {
  0%, 100% {
    box-shadow: 0 0 12px rgba(6,182,212,0.4), 0 0 24px rgba(124,58,237,0.2);
  }
  50% {
    box-shadow: 0 0 20px rgba(6,182,212,0.7), 0 0 40px rgba(124,58,237,0.4);
  }
}

#r1-queue-position,
#r2-queue-position {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, #7C3AED, #06B6D4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px rgba(124,58,237,0.5));
}

/* ── Queue Specific ─────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-card {
  padding: 20px;
}

.form-card h4 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.form-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.slot-item {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition);
}

.slot-item.active {
  background: var(--purple-dim);
  border-color: var(--border-purple);
  color: var(--purple-light);
  box-shadow: 0 0 12px rgba(124,58,237,0.2);
}

.slot-item.filled {
  background: var(--cyan-dim);
  border-color: var(--border-cyan);
  color: var(--cyan-light);
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.progress-ring {
  width: 68px;
  height: 68px;
  flex-shrink: 0;
}

.progress-ring .bg {
  fill: none;
  stroke: rgba(255,255,255,0.07);
  stroke-width: 5;
}

.progress-ring .fg {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 188.5;
  stroke-dashoffset: 188.5;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 0.8s var(--ease-out);
}

.small-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.mini-queue-stat {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}

.mini-queue-stat .label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.mini-queue-stat .value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
  .slot-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── CRAYON/CUTE THEME OVERRIDE (Improved) ────────────────────── */
:root {
  --text-primary: #3D2B1F;
  --text-secondary: #5C4B3F;
  --text-muted: #8B7B6F;
  --bg-primary: #F8FF82; /* lime yellow */
  --bg-secondary: #FFFEF7; /* cream for cards */
  --crayon-pink: #EF476F;
  --crayon-blue: #118AB2;
  --crayon-green: #06D6A0;
  --crayon-yellow: #FFD166;
  --crayon-purple: #9B59B6;
  --crayon-red: #FF6B6B;
  --crayon-orange: #FF9F43;
}

body {
  background: linear-gradient(135deg, #F8FF82, #FFFDD0, #FFE4E1, #E0F7FA, #E8D5F5);
  background-size: 500% 500%;
  animation: bgBreathing 30s ease infinite;
  color: var(--text-primary);
  font-family: 'Patrick Hand', cursive, system-ui;
  font-size: 16px;
}

body::before { display: none !important; }

.glass-card, .card, .panel, [class*="card"], .wallet-card, .form-card {
  background: var(--bg-secondary);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 3px solid;
  border-radius: 8px;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.08), 6px 6px 12px rgba(0,0,0,0.06);
  transform: rotate(-0.5deg);
  position: relative;
}

.glass-card:nth-child(1), .card:nth-child(1), .panel:nth-child(1), .wallet-card:nth-child(1) { border-color: var(--crayon-pink); }
.glass-card:nth-child(2), .card:nth-child(2), .panel:nth-child(2), .wallet-card:nth-child(2) { border-color: var(--crayon-blue); }
.glass-card:nth-child(3), .card:nth-child(3), .panel:nth-child(3), .wallet-card:nth-child(3) { border-color: var(--crayon-green); }
.glass-card:nth-child(4), .card:nth-child(4), .panel:nth-child(4), .wallet-card:nth-child(4) { border-color: var(--crayon-purple); }
.glass-card:nth-child(5), .card:nth-child(5), .panel:nth-child(5), .wallet-card:nth-child(5) { border-color: var(--crayon-orange); }

.glass-card:hover, .card:hover, .panel:hover, [class*="card"]:hover {
  transform: rotate(-0.5deg) translateY(-2px);
  box-shadow: 4px 4px 0 rgba(0,0,0,0.1), 8px 8px 16px rgba(0,0,0,0.08);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.app-header {
  background: var(--bg-secondary);
  border-bottom: 3px solid var(--crayon-pink);
  box-shadow: 2px 2px 4px rgba(0,0,0,0.04);
}

.btn-primary {
  background: var(--crayon-pink);
  border: 3px solid #D63C5A;
  color: white;
  font-family: 'Patrick Hand', cursive;
  font-weight: 700;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.2);
  transform: rotate(0.3deg);
}

.btn-primary:hover {
  transform: rotate(0.3deg) translateY(-2px);
  box-shadow: 4px 4px 0 rgba(0,0,0,0.25);
}

.tab-btn.active {
  background: var(--crayon-pink) !important;
  border: 3px solid #D63C5A !important;
  color: white !important;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.15);
}

.brand-title {
  background: linear-gradient(45deg, var(--crayon-blue), var(--crayon-pink), var(--crayon-purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-family: 'Patrick Hand', cursive;
  font-weight: 700;
}

.wallet-balance, .stat-card .value { color: var(--crayon-blue); font-weight: 700; }

.slot-item.filled { border: 3px solid var(--crayon-green) !important; box-shadow: 2px 2px 0 rgba(6,214,160,0.2); }

.slot-item.active { border: 3px solid var(--crayon-purple) !important; background: rgba(155,89,182,0.08); }

.header-doodles, .doodle-layer, .flower-divider { display: block !important; opacity: 1 !important; }

.playful-footer { display: flex !important; opacity: 1 !important; }

/* Typography tweaks */
h1,h2,h3,h4,h5,h6, .section-title, .modal-title { font-weight: 700; }
h1 { font-size: 32px; }
h2 { font-size: 26px; }
h3 { font-size: 22px; }

.card-value, .balance, .wallet-balance, .stat-card .value, .kv-card .v {
  font-size: 24px !important;
  font-weight: 700 !important;
  color: var(--crayon-blue) !important;
}

.tab-btn { font-size: 16px !important; font-weight: 700 !important; }

.label, .description, .section-subtitle, .small-note { font-size: 14px !important; font-weight: 500 !important; }

* { font-family: 'Patrick Hand', cursive, system-ui, -apple-system, 'Segoe UI', Roboto, Arial; }

/* ── Card text sizing tweaks (Queue + Slots + Stats) ─────────── */
.slot-item, .slot-grid span, [class*="slot"] {
  font-size: 18px !important;
  font-weight: 700 !important;
}

.slot-item .amount, .slot-value {
  font-size: 20px !important;
  font-weight: 700 !important;
}

.queue-position, [id*="position"] {
  font-size: 36px !important;
  font-weight: 800 !important;
}

.card h3, .card-title, .panel-title {
  font-size: 22px !important;
  font-weight: 800 !important;
}

.card p, .card .desc, .hint, [class*="hint"], [class*="desc"] {
  font-size: 15px !important;
  font-weight: 600 !important;
}

.stat-label, [class*="stat"] {
  font-size: 16px !important;
  font-weight: 600 !important;
}

/* ── Rainbow text animation (smooth buttery transitions) ───── */
@keyframes rainbowText {
  0%   { color: #E85B5B; }
  15%  { color: #F5A623; }
  30%  { color: #F5D547; }
  45%  { color: #5BC86E; }
  60%  { color: #5B8FE8; }
  75%  { color: #9B6FD4; }
  90%  { color: #F5A3C7; }
  100% { color: #E85B5B; }
}

@keyframes textRainbow {
  0%   { color: #D94F4F; }
  16%  { color: #E8922E; }
  33%  { color: #4BAE5F; }
  50%  { color: #3B8FD4; }
  66%  { color: #8B5FD4; }
  83%  { color: #D94F8B; }
  100% { color: #D94F4F; }
}

@keyframes bgBreathing {
  0%   { background-position: 0% 50%; }
  25%  { background-position: 50% 0%; }
  50%  { background-position: 100% 50%; }
  75%  { background-position: 50% 100%; }
  100% { background-position: 0% 50%; }
}

/* ── Dark Theme: Midnight Garden ───────────────────────────── */
[data-theme="dark"] {
  background: linear-gradient(135deg, #0D1B2A, #1B2838, #162030, #1A1A2E, #0D1B2A) !important;
  background-size: 500% 500% !important;
  animation: darkBreathing 30s ease infinite !important;
  color: #E0E8F0 !important;
}

@keyframes darkBreathing {
  0%   { background-position: 0% 50%; }
  25%  { background-position: 50% 0%; }
  50%  { background-position: 100% 50%; }
  75%  { background-position: 50% 100%; }
  100% { background-position: 0% 50%; }
}

[data-theme="dark"] .card {
  background: rgba(15, 25, 45, 0.85);
  border: 2px solid rgba(100, 180, 255, 0.15);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255,255,255,0.05);
}

[data-theme="dark"] .card:hover {
  border-color: rgba(100, 180, 255, 0.3);
  box-shadow: 0 8px 30px rgba(50, 100, 200, 0.2);
}

[data-theme="dark"] .text-secondary { color: #8BA4C0; }
[data-theme="dark"] .text-tertiary { color: #5A7A9A; }

[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3,
[data-theme="dark"] .card-title {
  animation: darkTextRainbow 10s ease-in-out infinite;
}

@keyframes darkTextRainbow {
  0%   { color: #64FFDA; }
  20%  { color: #7C83FF; }
  40%  { color: #FF6B9D; }
  60%  { color: #FFC764; }
  80%  { color: #64D2FF; }
  100% { color: #64FFDA; }
}

[data-theme="dark"] .card-value, [data-theme="dark"] .balance {
  animation: darkValueGlow 8s ease-in-out infinite;
  text-shadow: 0 0 8px currentColor;
}

@keyframes darkValueGlow {
  0%   { color: #4FFFB0; }
  33%  { color: #64B5FF; }
  66%  { color: #FF8AE2; }
  100% { color: #4FFFB0; }
}

[data-theme="dark"] button, [data-theme="dark"] .btn {
  background: linear-gradient(135deg, #4FFFB0, #7C83FF);
  color: #0D1B2A;
  border: none;
  font-weight: 700;
}

[data-theme="dark"] .tab-btn.active {
  background: rgba(100, 255, 218, 0.15);
  border-color: #64FFDA;
  color: #64FFDA;
}

[data-theme="dark"] .card {
  animation: darkBorderAurora 20s ease-in-out infinite;
}

@keyframes darkBorderAurora {
  0%   { border-color: rgba(100, 255, 218, 0.2); }
  25%  { border-color: rgba(124, 131, 255, 0.2); }
  50%  { border-color: rgba(255, 107, 157, 0.2); }
  75%  { border-color: rgba(255, 199, 100, 0.2); }
  100% { border-color: rgba(100, 255, 218, 0.2); }
}

[data-theme="dark"] ::-webkit-scrollbar-track { background: #0D1B2A; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #2A3F5A; }

/* Force dark backgrounds/colors for all major components */
[data-theme="dark"] .card,
[data-theme="dark"] .panel,
[data-theme="dark"] [class*="card"],
[data-theme="dark"] .wallet-card,
[data-theme="dark"] .slot-item,
[data-theme="dark"] .stat-box,
[data-theme="dark"] table,
[data-theme="dark"] .history-section,
[data-theme="dark"] .referral-section,
[data-theme="dark"] input,
[data-theme="dark"] .modal,
[data-theme="dark"] .popup {
  background: rgba(15, 25, 45, 0.85) !important;
  color: #E0E8F0 !important;
  border-color: rgba(100, 180, 255, 0.15) !important;
}

[data-theme="dark"] .card-label,
[data-theme="dark"] .stat-label,
[data-theme="dark"] .desc,
[data-theme="dark"] .hint,
[data-theme="dark"] small {
  color: #8BA4C0 !important;
}

/* Ensure general text readability in dark mode */
[data-theme="dark"] body,
[data-theme="dark"] p,
[data-theme="dark"] span,
[data-theme="dark"] td,
[data-theme="dark"] th,
[data-theme="dark"] li,
[data-theme="dark"] label,
[data-theme="dark"] .card-value {
  color: #E0E8F0 !important;
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3 {
  color: #FFFFFF !important;
}

@keyframes borderRainbow {
  0%   { border-color: #F5A3C7; }
  25%  { border-color: #5B8FE8; }
  50%  { border-color: #5BC86E; }
  75%  { border-color: #F5A623; }
  100% { border-color: #F5A3C7; }
}

@keyframes btnPulse {
  0%   { background: #E85B5B; }
  33%  { background: #5B8FE8; }
  66%  { background: #9B6FD4; }
  100% { background: #E85B5B; }
}

.card-value, .balance-value, .slot-value, .queue-position, [class*="amount"],
h3, .card-title, .panel-title {
  animation: rainbowText 6s ease-in-out infinite;
  -webkit-animation: rainbowText 6s ease-in-out infinite;
}

/* Staggered delays for variety */
.card:nth-child(2) .card-value { animation-delay: 1s; }
.card:nth-child(3) .card-value { animation-delay: 2s; }
.card:nth-child(4) .card-value { animation-delay: 3s; }

/* ── Rainbow gradient animation for logos and accents ─────── */
@keyframes rainbowGradient {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.logo-text, .brand-name {
  background: linear-gradient(90deg, #E85B5B, #F5A623, #F5D547, #5BC86E, #5B8FE8, #9B6FD4, #F5A3C7, #E85B5B);
  background-size: 400% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rainbowGradient 8s linear infinite;
}

/* Active tab: rainbow border and subtle gradient animation */
.tab-btn.active {
  border: 3px solid;
  border-image: linear-gradient(90deg, #E85B5B, #F5A623, #5BC86E, #5B8FE8, #9B6FD4) 1;
  animation: rainbowGradient 4s linear infinite;
}

/* ── All text animations: diverse speeds and delays ────────── */
/* Headings — fast cycle (8s) */
h1, h2, h3, .card-title, .panel-title, .brand-name {
  animation: textRainbow 8s ease-in-out infinite !important;
  color: inherit;
}

/* Values/numbers — medium cycle (12s) with delay */
.card-value, .balance, [class*="amount"], .queue-position {
  animation: textRainbow 12s ease-in-out infinite !important;
  animation-delay: 2s !important;
  color: inherit;
}

/* Body text — slow cycle (20s) with delay */
p, span, .desc, .hint, label, td {
  animation: textRainbow 20s ease-in-out infinite !important;
  animation-delay: 4s !important;
  color: inherit;
}

/* Tab buttons — each different delay */
.tab-btn:nth-child(1) { animation: textRainbow 10s infinite; animation-delay: 0s; }
.tab-btn:nth-child(2) { animation: textRainbow 10s infinite; animation-delay: 1s; }
.tab-btn:nth-child(3) { animation: textRainbow 10s infinite; animation-delay: 2s; }
.tab-btn:nth-child(4) { animation: textRainbow 10s infinite; animation-delay: 3s; }
.tab-btn:nth-child(5) { animation: textRainbow 10s infinite; animation-delay: 4s; }
.tab-btn:nth-child(6) { animation: textRainbow 10s infinite; animation-delay: 5s; }
.tab-btn:nth-child(7) { animation: textRainbow 10s infinite; animation-delay: 6s; }
.tab-btn:nth-child(8) { animation: textRainbow 10s infinite; animation-delay: 7s; }

/* ── Card borders — rainbow cycle with staggered delays ───── */
.card, .panel, [class*="card"] {
  animation: borderRainbow 15s ease-in-out infinite;
  border: 3px solid;
}

.card:nth-child(1) { animation-delay: 0s; }
.card:nth-child(2) { animation-delay: 2s; }
.card:nth-child(3) { animation-delay: 4s; }
.card:nth-child(4) { animation-delay: 6s; }

/* ── Buttons — color pulse ────────────────────────────────── */
button, .btn, [class*="btn"] {
  animation: btnPulse 10s ease-in-out infinite;
  color: white;
}

/* ── Smooth buttery transitions across UI */
*:where(:not(svg):not(canvas)) {
  transition: all 0.5s ease;
}

/* Keep existing transition values for elements that rely on them */
.btn, .tab-btn, .glass-card, .card, .panel, .chip, .toast, .modal, .drawer { transition: all 0.5s ease; }

/* Ensure animations run across all tabs/pages */
html, body, .app-shell { -webkit-font-smoothing: antialiased; }

/* ====== Tab color & active-only highlight ====== */
/* Base tab text color: dark (#1a1a2e). Remove animation from inactive tabs.
   Active tab receives a subtle highlighted background and stronger weight. */
.tab-bar .tab-btn,
.mobile-drawer-nav .tab-btn,
.mobile-bottom-nav .tab-btn {
  color: #1a1a2e !important;
  animation: none !important;
  text-shadow: none !important;
}

.tab-bar .tab-btn.active,
.mobile-drawer-nav .tab-btn.active,
.mobile-bottom-nav .tab-btn.active {
  color: #1a1a2e !important;
  background: rgba(26,26,46,0.06);
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(26,26,46,0.06);
}

/* ensure mobile bottom nav follows same inactive/active coloring */
.mobile-bottom-nav .tab-btn { color: #1a1a2e !important; }
.mobile-bottom-nav .tab-btn.active { color: #1a1a2e !important; background: rgba(26,26,46,0.06); }

/* ── Welcome Animations (Entry Effects) ─────────────────────── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.card { 
  animation: slideUp 0.6s ease forwards;
  opacity: 0;
}
.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.4s; }
.card:nth-child(5) { animation-delay: 0.5s; }
.card:nth-child(6) { animation-delay: 0.6s; }
.card:nth-child(7) { animation-delay: 0.7s; }
.card:nth-child(8) { animation-delay: 0.8s; }

.tab-bar { animation: slideDown 0.5s ease; }

header { animation: fadeIn 0.8s ease; }

/* ── Confetti Animation ──────────────────────────────────────── */
@keyframes confettiFall {
  0% { top: -20px; opacity: 1; transform: rotate(0deg); }
  100% { top: 110vh; opacity: 0; transform: rotate(720deg); }
}

/* ── Greeting Section Rainbow Animation ────────────────────── */
#greeting-text {
  animation: textRainbow 8s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════════════════════
   ANNOUNCEMENT POPUP MODAL
═══════════════════════════════════════════════════════════════ */

#announcement-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  backdrop-filter: blur(4px);
}

.announcement-modal-center {
  background: #FFFEF7;
  border: 3px solid #F5A3C7;
  border-radius: 20px;
  padding: 30px 40px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  position: relative;
  animation: popIn 0.4s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .announcement-modal-center {
  background: rgba(15, 25, 45, 0.95);
  border-color: rgba(100, 180, 255, 0.3);
  color: #E0E8F0;
}

.announcement-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.announcement-modal-center h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 12px 0 16px;
  color: #F5A3C7;
}

[data-theme="dark"] .announcement-modal-center h2 {
  color: #7DD3FC;
}

.announcement-modal-center p {
  font-size: 15px;
  line-height: 1.6;
  color: #333;
}

[data-theme="dark"] .announcement-modal-center p {
  color: #E0E8F0;
}

.announcement-close {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #999;
  padding: 4px 8px;
  transition: color 0.2s;
}

.announcement-close:hover {
  color: #F5A3C7;
}

[data-theme="dark"] .announcement-close:hover {
  color: #7DD3FC;
}

@keyframes popIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ═══════════════════════════════════════════════════════════════
   TEAM EXPLORER STYLING
═══════════════════════════════════════════════════════════════ */

#team-explorer-results {
  border-radius: 12px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.team-result-card {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid #9B6FD4;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

[data-theme="dark"] .team-result-card {
  border-color: #7DD3FC;
}

.team-result-card h4 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #E85B5B;
}

[data-theme="dark"] .team-result-card h4 {
  color: #7DD3FC;
}

.team-result-card p {
  margin: 4px 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.leg-card {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 12px !important;
  font-size: 13px;
  transition: all 0.3s;
}

.leg-card:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

[data-theme="dark"] .leg-card {
  background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .leg-card:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* ── Ultra Mobile — Butter-smooth, relaxed animations for small screens */
@media (max-width: 420px) {
  html, body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
  body { font-size: 14px; line-height: 1.45; }
  .app-header { height: auto; padding: 10px 12px; }
  .header-grid { gap: 8px; align-items: center; }
  .brand-title { font-size: 16px; }
  .brand-subtitle { display: none; }
  .menu-toggle-btn { order: 3; }
  .header-actions { order: 2; }

  /* Scrollable, snap-aligned tabs for smooth horizontal nav */
  .tab-bar { gap: 6px; padding: 8px 12px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
  .tab-bar .tab-btn { scroll-snap-align: center; min-width: 96px; padding: 10px 12px; border-radius: 12px; }
  .tab-bar::-webkit-scrollbar { display: none; }

  /* Make cards, grids and lists full-width on small screens */
  .bento-grid, .wallets-grid, .kv-grid { grid-template-columns: 1fr !important; }
  .wallet-card, .glass-card, .card { border-radius: 12px; padding: 12px; margin: 0; width: 100%; }

  /* Touch-friendly controls */
  .btn { padding: 10px 14px; font-size: 15px; border-radius: 12px; }
  .btn, .tab-btn, .chip { -webkit-tap-highlight-color: rgba(0,0,0,0); touch-action: manipulation; }
  .mobile-bottom-nav .tab-btn { padding: 8px 10px; font-size: 12px; }

  /* Carousel smooth snap */
  .carousel-track { gap: 8px; scroll-snap-type: x mandatory; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .carousel-track > * { scroll-snap-align: start; min-width: 80%; }

  .progress-ring { width: 56px; height: 56px; }
  .queue-position, [id*="position"] { font-size: 28px !important; }

  /* Keep transitions buttery but focused on transform/opacity only */
  *:where(:not(svg):not(canvas)) { transition: transform 240ms cubic-bezier(.16,1,.3,1), opacity 240ms ease !important; }

  /* GPU hints for smoother animations */
  .card, .glass-card, .tab-btn, .btn { will-change: transform, opacity; backface-visibility: hidden; transform: translateZ(0); }

  /* Reduce visual noise on small devices */
  .card, .glass-card { box-shadow: none !important; }
}

/* Respect user reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Extremely small phones tweaks */
@media (max-width: 360px) {
  .tab-bar .tab-btn { min-width: 86px; padding: 8px 10px; font-size: 13px; }
  .brand-mark { width: 36px; height: 36px; font-size: 15px; }
  .brand-title { font-size: 15px; }
  .header-actions .btn, .header-actions .theme-toggle { padding: 8px; font-size: 13px; }
  body { font-size: 13px; }
}

/* Optional hint for app JS: reduce frequent refresh/flicker when this class is present */
@media (max-width: 420px) {
  body.mobile-light-mode .loading-spinner, body.mobile-light-mode .history-spinner { display: none !important; }
}
