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

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0a0a0f;
  --bg-card: rgba(0, 0, 0, 0.05);
  --bg-card-hover: rgba(0, 0, 0, 0.15);
  --accent: #ff4500;
  --accent-light: #ff6b35;
  --accent-glow: rgba(255, 69, 0, 0.3);
  --text-primary: #f0f0f0;
  --text-secondary: rgba(255, 255, 255, 0.55);
  --text-muted: rgba(255, 255, 255, 0.35);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 69, 0, 0.3);
  --grade-9: #f59e0b;
  --grade-95: #ef4444;
  --grade-10: #ff6b35;
  --glass-bg: rgba(15, 15, 25, 0.6);
  --glass-border: rgba(255, 255, 255, 0.06);
}

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

/* Background image with dark overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('/images/charizard-bg.png') center center / cover no-repeat;
  opacity: 0.5;
  z-index: 0;
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    180deg,
    rgba(10, 10, 15, 0.1) 0%,
    rgba(10, 10, 15, 0.4) 50%,
    rgba(10, 10, 15, 0.75) 100%
  );
  z-index: 0;
  pointer-events: none;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 48px;
  min-height: 100vh;
}

/* ─── Header ─── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.header h1 span {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.last-updated {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 6px 14px;
  border-radius: 100px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  white-space: nowrap;
}

/* ─── Card Grid ─── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.25s ease;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px var(--accent-glow);
}

.card.active {
  border-color: var(--accent);
  box-shadow: 0 0 24px var(--accent-glow), 0 8px 32px rgba(0, 0, 0, 0.3);
}

.card-image-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.card-image-wrap img {
  width: 72px;
  height: auto;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: transform 0.25s ease;
}

.card:hover .card-image-wrap img {
  transform: scale(1.05);
}

.card-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
  text-align: center;
  line-height: 1.3;
  min-height: 2.1em;
}

.card-prices {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
}

.price-row .grade {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.price-row .price {
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.price-row.g9 .price { color: var(--grade-9); }
.price-row.g95 .price { color: var(--grade-95); }
.price-row.g10 .price { color: var(--grade-10); }

/* Sparkline in card */
.card-sparkline {
  margin-top: 10px;
  height: 40px;
  border-radius: 6px;
  overflow: hidden;
}

.card-sparkline canvas {
  width: 100% !important;
  height: 40px !important;
  display: block;
}

/* ─── Detail Panel ─── */
.detail-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}

.detail-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.detail-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.range-btns {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 3px;
}

.range-btn {
  padding: 6px 16px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.range-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.range-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(255, 69, 0, 0.3);
}

.detail-legend {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-dot.g9 { background: var(--grade-9); }
.legend-dot.g95 { background: var(--grade-95); }
.legend-dot.g10 { background: var(--grade-10); }

.detail-chart {
  height: 320px;
  position: relative;
}

.detail-chart canvas {
  width: 100% !important;
  height: 100% !important;
}

.detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 320px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ─── Responsive ─── */
@media (max-width: 1100px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .page {
    padding: 20px 16px 32px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 24px;
  }

  .header h1 {
    font-size: 1.4rem;
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .card {
    padding: 12px;
  }

  .card-image-wrap img {
    width: 56px;
  }

  .card-name {
    font-size: 0.7rem;
  }

  .detail-panel {
    padding: 20px 16px;
    border-radius: 16px;
  }

  .detail-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .detail-chart {
    height: 240px;
  }
}

@media (max-width: 480px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .card {
    padding: 10px;
    border-radius: 12px;
  }

  .card-image-wrap img {
    width: 48px;
  }

  .price-row .grade {
    font-size: 0.6rem;
  }

  .price-row .price {
    font-size: 0.7rem;
  }

  .detail-chart {
    height: 200px;
  }
}
