/* VCP Dashboard · 深黑金主題（手機優先） */
:root {
  --bg: #0a0b0f;
  --bg-elev: #11131a;
  --bg-card: #161823;
  --gold: #c9a84c;
  --gold-soft: #d4b86a;
  --gold-dim: #8a7333;
  --green: #4ea970;
  --blue: #5b8fd6;
  --red: #d6695b;
  --orange: #d69b5b;
  --magenta: #b56fb5;
  --tw: #e74c3c;
  --text: #e8e6dd;
  --text-dim: #9a978c;
  --line: #2a2c38;
  --line-soft: rgba(201, 168, 76, 0.18);
}

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

body {
  font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
  background-image:
    linear-gradient(rgba(201, 168, 76, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201, 168, 76, 0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* ===== Header ===== */
.header {
  border: 1px solid var(--line-soft);
  background: linear-gradient(135deg, #11131a 0%, #1a1c28 100%);
  padding: 28px 28px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.header::before {
  content: '';
  position: absolute;
  top: -1px; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.header-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.header h1 {
  font-family: 'Noto Serif TC', serif;
  font-weight: 900;
  font-size: 28px;
  line-height: 1.25;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}
.header h1 .gold { color: var(--gold); }
.header-meta {
  display: flex;
  gap: 16px 24px;
  flex-wrap: wrap;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
}
.header-meta b { color: var(--gold); font-weight: 600; }

/* ===== Stats row ===== */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 20px 0 32px;
}
.stat {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  padding: 18px 16px;
  text-align: center;
}
.stat-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  font-weight: 600;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 12px;
  color: var(--text-dim);
}

/* ===== Section ===== */
.section { margin: 32px 0; }
.section-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.section-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--gold-dim);
  letter-spacing: 0.2em;
}
.section h2 {
  font-family: 'Noto Serif TC', serif;
  font-weight: 900;
  font-size: 22px;
  color: var(--gold);
}
.section .grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  font-family: 'Noto Serif TC', serif;
  font-weight: 900;
  font-size: 16px;
  border-radius: 4px;
}
.grade-A .grade-badge { background: var(--green); color: #0a0b0f; }
.grade-B .grade-badge { background: var(--blue); color: #fff; }
.grade-C .grade-badge { background: var(--orange); color: #0a0b0f; }
.grade-D .grade-badge { background: var(--red); color: #fff; }
.grade-WATCH .grade-badge { background: var(--magenta); color: #fff; width: auto; padding: 0 8px; font-size: 11px; letter-spacing: 0.1em; }
.grade-TIER0 .grade-badge { background: var(--tw); color: #fff; width: auto; padding: 0 8px; font-size: 11px; letter-spacing: 0.1em; }

/* ===== Stock cards (mobile-first) ===== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold-dim);
  padding: 16px 18px;
  position: relative;
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--gold); transform: translateY(-1px); }
.card.grade-A { border-left-color: var(--green); background: rgba(78, 169, 112, 0.04); }
.card.grade-B { border-left-color: var(--blue); }
.card.grade-C { border-left-color: var(--orange); }
.card.grade-D { border-left-color: var(--red); opacity: 0.7; }
.card.grade-WATCH { border-left-color: var(--magenta); }
.card.grade-TIER0 { border-left-color: var(--tw); background: rgba(231, 76, 60, 0.04); }

.card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 8px;
}
.card-title {
  font-family: 'Noto Serif TC', serif;
  font-weight: 700;
  font-size: 17px;
}
.card-id {
  font-family: 'JetBrains Mono', monospace;
  color: var(--gold);
  font-size: 13px;
  margin-right: 6px;
}
.card-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 14px;
  font-size: 13px;
  color: var(--text-dim);
}
.card-meta dt { color: var(--text-dim); display: inline; }
.card-meta dd {
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  display: inline;
  margin-left: 6px;
}
.card-meta .row { display: flex; justify-content: space-between; }
.card-tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  background: rgba(201, 168, 76, 0.12);
  color: var(--gold);
  padding: 2px 7px;
  letter-spacing: 0.06em;
  margin-top: 8px;
}
.card-breakout {
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  background: var(--green);
  color: #0a0b0f;
  padding: 2px 6px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.empty {
  padding: 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  border: 1px dashed var(--line);
}

/* ===== History list ===== */
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  margin-top: 16px;
}
.history-item {
  display: block;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  text-align: center;
  transition: border-color 0.15s, color 0.15s;
}
.history-item:hover { border-color: var(--gold); color: var(--gold); }
.history-item .badge {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ===== Banner (Tier 0 explanation) ===== */
.banner {
  background: linear-gradient(90deg, rgba(231, 76, 60, 0.10), transparent);
  border-left: 3px solid var(--tw);
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.65;
}
.banner b { color: var(--tw); }

/* ===== Footer ===== */
footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px dashed var(--line);
  text-align: center;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
}
footer a { color: var(--gold-soft); text-decoration: none; }

/* ===== Mobile ===== */
@media (max-width: 768px) {
  body { font-size: 17px; }
  .wrap { padding: 20px 16px 60px; }
  .header { padding: 22px 18px; }
  .header h1 { font-size: 22px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat-num { font-size: 22px; }
  .cards { grid-template-columns: 1fr; }
  .section h2 { font-size: 19px; }
}
