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

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1e1e1e;
  --text: #f0f0f0;
  --text-secondary: #999;
  --border: #2a2a2a;
  --accent: #6366f1;
  --accent-light: #a5b4fc;
  --highlight: rgba(99, 102, 241, 0.15);
  --highlight-border: #6366f1;
  --radius: 12px;
  --radius-sm: 8px;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
}

.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* --- Header --- */
.page-header {
  text-align: center;
  margin-bottom: 32px;
}

.back-link {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--accent-light);
  text-decoration: none;
  margin-bottom: 20px;
}
.back-link:hover { text-decoration: underline; }

.page-title {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* --- Loading & Error --- */
.loading-wrap {
  text-align: center;
  padding: 80px 0;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--surface-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.error-wrap {
  display: none;
  text-align: center;
  padding: 80px 20px;
}

.error-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.error-retry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 28px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  cursor: pointer;
}
.error-retry:hover { border-color: var(--accent); }

.stats-content { display: none; }

/* --- Section --- */
.stats-section {
  margin-bottom: 32px;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-icon { font-size: 1.2rem; }

/* --- Number Cards --- */
.number-cards {
  display: flex;
  gap: 12px;
}

.number-card {
  flex: 1;
  padding: 16px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.card-icon {
  font-size: 1.3rem;
  margin-bottom: 6px;
}

.card-value {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--accent-light);
  margin-bottom: 4px;
}

.card-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* --- Bar Chart --- */
.bar-row {
  margin-bottom: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s, background 0.2s;
}

.bar-row.highlighted {
  border-color: var(--highlight-border);
  background: var(--highlight);
}

.bar-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.bar-name {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bar-you-tag {
  font-size: 0.65rem;
  color: var(--accent-light);
  font-weight: 700;
  white-space: nowrap;
}

.bar-count {
  color: var(--text-secondary);
  font-size: 0.8rem;
  white-space: nowrap;
}

.bar-track {
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  border-radius: 3px;
  transition: width 0.6s ease;
}

.bar-row.highlighted .bar-fill {
  background: linear-gradient(90deg, #6366f1, #a78bfa);
}

/* --- Dimension Bars --- */
.dim-section {
  margin-bottom: 20px;
}

.dim-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.dim-left-label { font-weight: 700; color: var(--accent-light); }
.dim-right-label { font-weight: 700; color: #f0abfc; }

.dim-track-wrap {
  position: relative;
  height: 24px;
  margin-bottom: 4px;
}

.dim-bar-bg {
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
}

.dim-bar-left {
  height: 100%;
  background: var(--accent);
  transition: width 0.6s ease;
}

.dim-bar-right {
  height: 100%;
  background: #c084fc;
  flex: 1;
}

.dim-pct-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.dim-user-marker {
  position: absolute;
  top: -2px;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: var(--accent-light);
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  z-index: 1;
}

/* --- Footer --- */
.page-footer {
  text-align: center;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

.footer-credit {
  font-size: 0.75rem;
  color: #444;
  margin-bottom: 12px;
}

.footer-link {
  font-size: 0.85rem;
  color: var(--accent-light);
  text-decoration: none;
}
.footer-link:hover { text-decoration: underline; }

/* --- Responsive --- */
@media (max-width: 480px) {
  .number-cards {
    flex-direction: column;
  }

  .bar-label-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .bar-count {
    font-size: 0.75rem;
  }
}
