:root {
  --bg: #0b0d10;
  --bg-elevated: #14181f;
  --surface: #1a1f29;
  --surface-hover: #232a36;
  --border: #2a3140;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --up: #22c55e;
  --up-bg: rgba(34, 197, 94, 0.12);
  --down: #ef4444;
  --down-bg: rgba(239, 68, 68, 0.12);
  --gold: #fbbf24;
  --tier-vintage: #f59e0b;
  --tier-modern: #06b6d4;
  --tier-current: #a78bfa;
  --max-w: 1200px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.2);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "ヒラギノ角ゴ ProN W3", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }

/* ===== Header ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 13, 16, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.02em;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--gold) 100%);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  color: #0b0d10;
}
.nav { display: flex; gap: 4px; }
.nav a {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.nav a:hover, .nav a.active { background: var(--surface); color: var(--text); }

/* ===== Layout ===== */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 24px;
}

section {
  margin-bottom: 56px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
  gap: 16px;
  flex-wrap: wrap;
}
.section-head h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.section-head .section-sub {
  color: var(--text-muted);
  font-size: 12px;
}

/* ===== Hero / Daily Index ===== */
.hero {
  background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-top: 16px;
  margin-bottom: 32px;
}
.hero-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 18px;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.hero-title {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.hero-value {
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.hero-change {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.hero-change.up { background: var(--up-bg); color: var(--up); }
.hero-change.down { background: var(--down-bg); color: var(--down); }

.tier-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 24px;
}
.tier-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.tier-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.tier-year {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0;
}
.tier-label.vintage { color: var(--tier-vintage); }
.tier-label.modern { color: var(--tier-modern); }
.tier-label.current { color: var(--tier-current); }
.tier-value {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}
.tier-change {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.tier-change.up { color: var(--up); }
.tier-change.down { color: var(--down); }

/* ===== Tabs ===== */
.tabs {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}
.tab {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent); color: white; }

/* ===== Chart ===== */
.chart-wrapper {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
}
.chart-controls {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.chart-canvas-wrapper {
  position: relative;
  height: 320px;
}

/* ===== Movers Grid (Latest Cards) ===== */
.movers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.mover-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  transition: border-color 0.15s, transform 0.15s;
}
.mover-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.mover-rank {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 6px;
}
.mover-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mover-set {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mover-tier {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.mover-tier.VINTAGE { background: rgba(245, 158, 11, 0.15); color: var(--tier-vintage); }
.mover-tier.MODERN { background: rgba(6, 182, 212, 0.15); color: var(--tier-modern); }
.mover-tier.CURRENT { background: rgba(167, 139, 250, 0.15); color: var(--tier-current); }
.mover-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.mover-price {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.mover-change {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.mover-change.up { color: var(--up); }
.mover-change.down { color: var(--down); }

/* ===== Pulse Stats ===== */
.pulse-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.pulse-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.pulse-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.pulse-stat-value {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pulse-stat-value.up { color: var(--up); }
.pulse-stat-value.down { color: var(--down); }

/* ===== Movers Table ===== */
.movers-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.mover-table {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.mover-table-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mover-table-title { font-size: 13px; font-weight: 600; }
.mover-table-title.up::before { content: "▲ "; color: var(--up); }
.mover-table-title.down::before { content: "▼ "; color: var(--down); }
.mover-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  padding: 10px 16px;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(42, 49, 64, 0.5);
  font-size: 13px;
}
.mover-row:last-child { border-bottom: 0; }
.mover-row .rank { color: var(--text-dim); font-size: 11px; font-weight: 700; }
.mover-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mover-row .change { font-weight: 600; font-variant-numeric: tabular-nums; }
.mover-row .change.up { color: var(--up); }
.mover-row .change.down { color: var(--down); }

/* ===== Constituents Table ===== */
.constituents {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.constituents-controls {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  color: var(--text);
  font-size: 13px;
  flex: 1;
  min-width: 180px;
  font-family: inherit;
}
.search-input:focus { outline: none; border-color: var(--accent); }
.search-input::placeholder { color: var(--text-dim); }

table.constituents-table { width: 100%; border-collapse: collapse; }
table.constituents-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
table.constituents-table th:hover { color: var(--text); }
table.constituents-table th.sort-asc::after { content: " ▲"; }
table.constituents-table th.sort-desc::after { content: " ▼"; }
table.constituents-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(42, 49, 64, 0.5);
  font-size: 13px;
  vertical-align: middle;
}
table.constituents-table tr:last-child td { border-bottom: 0; }
table.constituents-table tr:hover td { background: rgba(255, 255, 255, 0.02); }
.col-rank { width: 40px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.col-name { font-weight: 600; }
.col-set { color: var(--text-muted); font-size: 12px; }
.col-tier { width: 80px; }
.col-price { width: 110px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.col-change { width: 80px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.col-weight { width: 80px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.col-change.up { color: var(--up); }
.col-change.down { color: var(--down); }

.show-more {
  display: block;
  width: 100%;
  padding: 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  background: var(--surface);
  border-top: 1px solid var(--border);
  transition: color 0.15s, background 0.15s;
}
.show-more:hover { color: var(--text); background: var(--surface-hover); }

/* ===== Methodology ===== */
.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.method-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.method-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.method-card h3::before {
  content: "";
  width: 4px;
  height: 16px;
  background: var(--accent);
  border-radius: 2px;
}
.method-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ===== Footer ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  margin-top: 64px;
  font-size: 12px;
  color: var(--text-dim);
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.footer a:hover { color: var(--text); }

/* ===== Responsive ===== */
@media (max-width: 720px) {
  .container { padding: 16px; }
  .hero { padding: 20px; }
  .hero-value { font-size: 40px; }
  .tier-row { grid-template-columns: 1fr; }
  .pulse-stats { grid-template-columns: 1fr; }
  .movers-row { grid-template-columns: 1fr; }
  .nav { display: none; }
  .col-set, .col-weight { display: none; }
  table.constituents-table th, table.constituents-table td { padding: 10px 8px; }
}
