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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f5f5;
  color: #222;
  min-height: 100vh;
}

header {
  background: #1a56db;
  color: white;
  padding: 16px 24px 0;
}

header h1 { font-size: 1.3em; margin-bottom: 12px; }

.tabs { display: flex; gap: 4px; }

.tab-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.75);
  padding: 8px 16px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  font-size: 0.9em;
  font-weight: 500;
  transition: color 0.15s;
}

.tab-btn:hover { color: white; }
.tab-btn.active { color: white; border-bottom-color: white; }

main { padding: 24px; max-width: 900px; margin: 0 auto; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.card {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card h2 { font-size: 1em; color: #444; margin-bottom: 16px; }

.stat-row { display: flex; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }

.stat-card {
  background: white;
  border-radius: 8px;
  padding: 16px 20px;
  flex: 1;
  min-width: 140px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-card .label { font-size: 0.75em; color: #888; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .value { font-size: 1.8em; font-weight: 700; color: #1a56db; margin-top: 4px; }
.stat-card .sub { font-size: 0.8em; color: #666; margin-top: 2px; }

/* Topic bars */
.topic-bar-row { display: flex; align-items: center; margin-bottom: 12px; gap: 12px; }
.topic-label { width: 130px; font-size: 0.85em; text-align: right; flex-shrink: 0; }
.bar-track { flex: 1; background: #eee; border-radius: 4px; height: 20px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; transition: width 0.4s; }
.bar-fill.green { background: #22c55e; }
.bar-fill.yellow { background: #f59e0b; }
.bar-fill.red { background: #ef4444; }
.topic-pct { width: 44px; font-size: 0.85em; color: #555; }

/* History list */
.history-item {
  border-bottom: 1px solid #eee;
  padding: 12px 0;
  cursor: pointer;
}
.history-item:last-child { border-bottom: none; }
.history-item .row { display: flex; justify-content: space-between; align-items: center; }
.history-item .date { font-size: 0.85em; color: #888; }
.history-item .badge {
  font-size: 0.75em; padding: 2px 8px; border-radius: 12px; font-weight: 600;
}
.badge.amc8 { background: #dbeafe; color: #1e40af; }
.badge.amc10 { background: #ede9fe; color: #6d28d9; }
.badge.mathcounts { background: #d1fae5; color: #065f46; }
.history-item .score { font-weight: 700; font-size: 1.05em; }
.history-detail {
  display: none; margin-top: 10px; font-size: 0.82em;
  background: #f9fafb; border-radius: 6px; padding: 10px;
}
.history-detail.open { display: block; }
.detail-grid { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.detail-item { min-width: 80px; }
.detail-item.wrong { color: #dc2626; }
.detail-item.right { color: #16a34a; }

/* Score chart (SVG) */
#score-chart svg { width: 100%; height: 200px; }

/* This week */
.week-meta { font-size: 0.9em; color: #555; line-height: 1.8; }
.topic-tag {
  display: inline-block; background: #dbeafe; color: #1e40af;
  border-radius: 12px; padding: 2px 10px; font-size: 0.8em; margin: 2px;
}

.empty-state { text-align: center; color: #aaa; padding: 40px 0; font-size: 0.9em; }

/* Pending tests list */
.test-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}
.test-item:last-child { border-bottom: none; }

.print-btn {
  display: inline-block;
  padding: 6px 14px;
  background: #1a56db;
  color: white;
  border-radius: 6px;
  font-size: 0.85em;
  font-weight: 500;
  text-decoration: none;
}
.print-btn:hover { background: #1e40af; }
