:root {
  --bg-deepest: #0a0e17;
  --bg-dark: #0e1422;
  --bg-card: #131c2e;
  --bg-card-hover: #1a2540;
  --bg-elevated: #1c2942;
  --border-color: #1f2a44;
  --border-light: #2a3855;

  --text-primary: #ffffff;
  --text-secondary: #b7bed4;
  --text-tertiary: #6b7390;
  --text-muted: #4a5170;

  --gold-primary: #f0b90b;
  --gold-bright: #ffd84d;
  --gold-deep: #c89000;

  --green-up: #0ecb81;
  --green-up-bg: rgba(14, 203, 129, 0.12);
  --red-down: #f6465d;
  --red-down-bg: rgba(246, 70, 93, 0.12);
  --blue-info: #4a8cff;
  --purple-accent: #a855f7;

  --gradient-gold: linear-gradient(135deg, #f0b90b 0%, #ffd84d 50%, #c89000 100%);
  --gradient-dark: linear-gradient(180deg, #0e1422 0%, #0a0e17 100%);
  --gradient-card: linear-gradient(145deg, #131c2e 0%, #0e1422 100%);

  --shadow-glow-gold: 0 0 24px rgba(240, 185, 11, 0.3);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-elevated: 0 8px 32px rgba(0, 0, 0, 0.6);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --tabbar-height: 64px;
  --status-bar-height: 0px;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  background: var(--bg-deepest);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  background: var(--gradient-dark);
  background-attachment: fixed;
}

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

button {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
}

a { color: inherit; text-decoration: none; }
img { vertical-align: middle; max-width: 100%; }

.app-container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg-deepest);
  position: relative;
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.5);
}

.page-content {
  padding-bottom: calc(var(--tabbar-height) + var(--safe-area-bottom) + 16px);
  min-height: 100vh;
}

/* ============ Tabbar ============ */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--tabbar-height) + var(--safe-area-bottom));
  background: rgba(14, 20, 34, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  padding-top: 10px;
  z-index: 1000;
}

.tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  transition: all 0.25s var(--ease-out);
  position: relative;
}

.tabbar-item.active {
  color: var(--gold-primary);
}

.tabbar-item.active::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: var(--gradient-gold);
  border-radius: 0 0 4px 4px;
  box-shadow: var(--shadow-glow-gold);
}

.tabbar-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s var(--ease-spring);
}

.tabbar-item.active .tabbar-icon {
  transform: scale(1.15) translateY(-1px);
}

.tabbar-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* ============ Animations ============ */
@keyframes priceUp {
  0% { background: transparent; }
  50% { background: var(--green-up-bg); }
  100% { background: transparent; }
}

@keyframes priceDown {
  0% { background: transparent; }
  50% { background: var(--red-down-bg); }
  100% { background: transparent; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 16px rgba(240, 185, 11, 0.3); }
  50% { box-shadow: 0 0 32px rgba(240, 185, 11, 0.6); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes tickerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

.fade-in-up { animation: fadeInUp 0.5s var(--ease-out) both; }
.slide-in-right { animation: slideInRight 0.4s var(--ease-out) both; }
.scale-in { animation: scaleIn 0.3s var(--ease-spring) both; }

.price-up { animation: priceUp 0.8s var(--ease-out); }
.price-down { animation: priceDown 0.8s var(--ease-out); }

/* ============ Utility ============ */
.text-green { color: var(--green-up); }
.text-red { color: var(--red-down); }
.text-gold { color: var(--gold-primary); }
.text-muted { color: var(--text-tertiary); }
.text-secondary { color: var(--text-secondary); }

.bg-green { background: var(--green-up); }
.bg-red { background: var(--red-down); }
.bg-gold { background: var(--gradient-gold); }

.font-mono {
  font-family: "SF Mono", "Roboto Mono", "Menlo", monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--green-up);
  border-radius: 50%;
  animation: livePulse 2s ease-in-out infinite;
  box-shadow: 0 0 8px var(--green-up);
}

.card {
  background: var(--gradient-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.btn-gold {
  background: var(--gradient-gold);
  color: #1a1404;
  font-weight: 700;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(240, 185, 11, 0.3);
  transition: all 0.2s var(--ease-out);
}

.btn-gold:active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(240, 185, 11, 0.4);
}

.glass {
  background: rgba(19, 28, 46, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.divider {
  height: 1px;
  background: var(--border-color);
  margin: 16px 0;
}

.shimmer-bg {
  background: linear-gradient(90deg, var(--bg-card) 0%, var(--bg-card-hover) 50%, var(--bg-card) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.fade-in-up:nth-child(1) { animation-delay: 0.05s; }
.fade-in-up:nth-child(2) { animation-delay: 0.1s; }
.fade-in-up:nth-child(3) { animation-delay: 0.15s; }
.fade-in-up:nth-child(4) { animation-delay: 0.2s; }
.fade-in-up:nth-child(5) { animation-delay: 0.25s; }
.fade-in-up:nth-child(6) { animation-delay: 0.3s; }
.fade-in-up:nth-child(7) { animation-delay: 0.35s; }
.fade-in-up:nth-child(8) { animation-delay: 0.4s; }
