:root {
  --bg: #FFF5F7;
  --card-bg: #FFFFFF;
  --primary: #FF6B9D;
  --primary-light: #FFB3C6;
  --primary-dark: #E5537F;
  --text: #4A3340;
  --text-secondary: #8B6B75;
  --border: #FFD6E0;
  --shadow: 0 2px 12px rgba(255,107,157,0.08);
  --radius: 16px;
}

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

html {
  scroll-behavior: smooth;
}

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

#sakura-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
}

#effect-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 100;
}

#app {
  position: relative;
  z-index: 2;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  text-align: center;
  padding: 60px 0 30px;
}

.title {
  font-size: 36px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 2px;
}

.subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* Nav */
.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 0 0 24px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-item:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.nav-item.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Main content */
.main {
  flex: 1;
  padding-bottom: 40px;
}

.section {
  animation: fadeIn 0.4s ease;
  scroll-margin-top: 20px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Card */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 16px;
}

.card-title svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--primary);
}

.card-content {
  font-size: 15px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ===== Quantification ===== */
.quant-wrapper {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Chart area: pie + tooltip + hint + legend, all stacked with generous gap */
.quant-chart-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* Pie: fixed square, CSS controls display size, canvas attributes control resolution */
.quant-pie-container {
  position: relative;
  width: 240px;
  height: 240px;
  flex-shrink: 0;
}

.quant-pie-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.quant-pie-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.quant-pie-center-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
}

.quant-pie-center-label {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Tooltip: standalone block below pie */
.quant-pie-tooltip {
  width: 100%;
  max-width: 280px;
  padding: 0;
  border-radius: 12px;
  background: transparent;
  text-align: center;
  min-height: 0;
  overflow: hidden;
  transition: all 0.3s ease;
}

.quant-pie-tooltip.show {
  padding: 14px 18px;
  background: #FFF0F3;
  border: 1px solid var(--border);
  min-height: 60px;
}

.quant-pie-tooltip-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.quant-pie-tooltip-pct {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
}

.quant-pie-tooltip-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.5;
}

.quant-pie-hint {
  font-size: 12px;
  color: var(--text-secondary);
  opacity: 0.5;
}

/* Legend */
.quant-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
}

.quant-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-secondary);
}

.quant-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* List */
.quant-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.quant-item {
  position: relative;
}

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

.quant-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.quant-weight {
  font-size: 13px;
  color: var(--primary);
  font-weight: 700;
}

.quant-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.quant-fill {
  height: 100%;
  border-radius: 4px;
  width: 0;
  transition: width 1s ease;
}

.quant-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ===== Daily quote ===== */
.quote-card {
  text-align: center;
}

.quote-text {
  font-size: 15px;
  color: var(--text);
  line-height: 2;
  margin-bottom: 12px;
}

.quote-author {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ===== Like counter ===== */
.like-card {
  text-align: center;
}

.like-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border: 2px solid var(--primary);
  border-radius: 24px;
  background: var(--card-bg);
  color: var(--primary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.like-btn svg {
  width: 22px;
  height: 22px;
  transition: transform 0.2s;
}

.like-btn:active svg {
  transform: scale(1.4);
}

.like-btn.liked {
  background: var(--primary);
  color: #fff;
}

.like-count {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 12px;
}

/* ===== Back to top ===== */
.back-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(255,107,157,0.3);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  z-index: 50;
}

.back-top.show {
  opacity: 1;
  transform: translateY(0);
}

.back-top svg {
  width: 20px;
  height: 20px;
}

/* Footer */
.footer {
  text-align: center;
  padding: 20px 0;
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.footer-heart {
  color: var(--primary);
  animation: heartbeat 1.5s ease infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* ===== Mobile ===== */
@media (max-width: 480px) {
  .title { font-size: 28px; }
  .header { padding: 40px 0 20px; }
  .card { padding: 20px 16px; }
  .nav-item { padding: 6px 12px; font-size: 12px; }
  .quant-pie-container { width: 180px; height: 180px; }
  .quant-pie-center-num { font-size: 22px; }
  .quant-chart-area { gap: 16px; }
  .quant-pie-tooltip.show { max-width: 100%; }
  .back-top { bottom: 16px; right: 16px; width: 40px; height: 40px; }
}
