/* ========================================
   9999 Gold Price — Design System
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* Core palette */
  --gold-50:  #FFF9E6;
  --gold-100: #FFF0B3;
  --gold-200: #FFE680;
  --gold-300: #FFDB4D;
  --gold-400: #FFD11A;
  --gold-500: #D4AF37;
  --gold-600: #B8972E;
  --gold-700: #9C7F25;
  --gold-800: #80671C;

  --bg-primary:   #0B0E14;
  --bg-secondary: #111621;
  --bg-card:      #161C2A;
  --bg-card-hover:#1C2438;

  --text-primary:   #F0F0F5;
  --text-secondary: #8B92A5;
  --text-muted:     #5A6178;

  --border-color: rgba(212, 175, 55, 0.12);
  --border-glow:  rgba(212, 175, 55, 0.25);

  --green: #00E676;
  --red:   #FF5252;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Radius */
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0,0,0,0.3), 0 0 60px rgba(212,175,55,0.04);
  --shadow-glow: 0 0 40px rgba(212,175,55,0.15), 0 0 80px rgba(212,175,55,0.06);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- Ambient Background ---- */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient-bg::before {
  content: '';
  position: absolute;
  top: -30%;
  left: -10%;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212,175,55,0.06) 0%, transparent 70%);
  animation: float-orb 20s ease-in-out infinite;
}

.ambient-bg::after {
  content: '';
  position: absolute;
  bottom: -20%;
  right: -15%;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212,175,55,0.04) 0%, transparent 65%);
  animation: float-orb 25s ease-in-out infinite reverse;
}

@keyframes float-orb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(30px, -40px) scale(1.05); }
  66%      { transform: translate(-20px, 20px) scale(0.95); }
}

/* ---- Layout Container ---- */
.container {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ---- Header ---- */
.header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.header__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-lg);
  background: linear-gradient(135deg, var(--gold-500), var(--gold-300));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(212,175,55,0.25);
}

.header__icon svg {
  width: 28px;
  height: 28px;
  fill: var(--bg-primary);
}

.header__title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.header__subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

/* ---- Main Price Card ---- */
.price-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-xl);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.4s ease, border-color 0.4s ease;
}

.price-card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
}

.price-card__label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.price-card__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

.price-card__name {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--gold-400);
  letter-spacing: 0.01em;
}

.price-card__symbol {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
}

/* ---- Price Grid ---- */
.price-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.price-block {
  text-align: center;
  padding: 0.75rem 0.5rem;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.02);
  border: 1px solid transparent;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.price-block:hover {
  background: rgba(255,255,255,0.04);
  border-color: var(--border-color);
}

.price-block__label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-sm);
}

.price-block__value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.1;
  color: var(--text-primary);
  transition: color 0.3s ease;
  letter-spacing: -0.02em;
}

.price-block__unit {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* Price flash animations */
.price-up {
  color: var(--green) !important;
}

.price-down {
  color: var(--red) !important;
}

/* ---- Detail Stats Row ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-color);
}

.stat {
  text-align: center;
}

.stat__label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.stat__value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-secondary);
}

/* ---- Card Footer ---- */
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-color);
}

.card-footer__time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card-footer__time span {
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}

.card-footer__src {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.6;
}

/* ---- Badge (涨跌标签) ---- */
.price-card__badge {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
}

.badge--up {
  color: var(--green);
  background: rgba(0, 230, 118, 0.1);
  border: 1px solid rgba(0, 230, 118, 0.2);
}

.badge--down {
  color: var(--red);
  background: rgba(255, 82, 82, 0.1);
  border: 1px solid rgba(255, 82, 82, 0.2);
}

/* 基差主视觉区块 */
.basis-hero {
  text-align: center;
  padding: var(--space-lg);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  margin-bottom: var(--space-lg);
}

.basis-hero__label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-xs);
}

.basis-hero__value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 3.5rem;
  line-height: 1;
  transition: color 0.3s ease;
}

#basisExpand { color: #ff5252; }
#basisShrink { color: #00e676; }

/* ---- Price Grid (弱化版) ---- */
.price-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.price-block {
  text-align: center;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.01);
}

.price-block__label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.price-block__value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.price-block__unit {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ---- Skeleton Loading ---- */
.skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(255,255,255,0.05);
  border-radius: 6px;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
  animation: shimmer 1.5s infinite;
}

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

.skeleton-price {
  width: 100px;
  height: 24px;
  margin: 0 auto;
}

.skeleton-stat {
  width: 80px;
  height: 20px;
  margin: 0 auto;
}

/* ---- Error State ---- */
.error-msg {
  text-align: center;
  color: var(--red);
  font-size: 0.85rem;
  padding: var(--space-md);
  background: rgba(255,82,82,0.08);
  border: 1px solid rgba(255,82,82,0.2);
  border-radius: var(--radius-md);
  margin-top: var(--space-md);
  display: none;
}

.error-msg.visible {
  display: block;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .container {
    padding: var(--space-lg) var(--space-sm);
  }

  .price-card {
    padding: var(--space-xl) var(--space-md);
    border-radius: var(--radius-lg);
  }

  .price-block__value {
    font-size: 1.8rem;
  }

  .header__title {
    font-size: 1.4rem;
  }

  .stats-row {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
  }

  .stat__value {
    font-size: 0.85rem;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
