:root {
  --bg: #f6efe4;
  --bg-soft: #fff8ef;
  --card: rgba(255, 252, 245, 0.86);
  --line: #d9c8b1;
  --ink: #25180c;
  --ink-soft: #644f38;
  --accent: #c84a1e;
  --accent-strong: #9e2e0a;
  --teal: #0d6a67;
  --shadow: 0 12px 40px rgba(94, 61, 28, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Public Sans", "Noto Sans SC", sans-serif;
  background:
    radial-gradient(circle at 20% 12%, #fff6de 0, transparent 38%),
    radial-gradient(circle at 85% 90%, #ffe3cc 0, transparent 38%),
    linear-gradient(160deg, #fef7eb 0%, #f6efe4 60%, #efe6d8 100%),
    var(--bg);
  min-height: 100vh;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(2px);
  z-index: -1;
}

.bg-orb-a {
  width: 320px;
  height: 320px;
  top: -120px;
  right: -80px;
  background: radial-gradient(circle, rgba(255, 159, 76, 0.24) 0, rgba(255, 159, 76, 0) 70%);
}

.bg-orb-b {
  width: 420px;
  height: 420px;
  left: -160px;
  bottom: -180px;
  background: radial-gradient(circle, rgba(22, 138, 128, 0.18) 0, rgba(22, 138, 128, 0) 72%);
}

.app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 18px 22px;
}

.hero,
.card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 14px;
  backdrop-filter: blur(3px);
  background: var(--card);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  animation: rise-in 450ms ease forwards;
}

.card {
  animation-delay: 90ms;
}

.kicker {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal);
  font-weight: 800;
}

.hero h1 {
  margin: 0 0 8px;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(28px, 4.2vw, 42px);
  line-height: 1.12;
  letter-spacing: 0.02em;
}

.hero-desc {
  margin: 0;
  color: var(--ink-soft);
}

label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}

textarea {
  width: 100%;
  border: 1px solid #ccb598;
  border-radius: 12px;
  padding: 12px;
  font: inherit;
  background: var(--bg-soft);
  color: var(--ink);
}

textarea:focus-visible {
  outline: 2px solid rgba(200, 74, 30, 0.32);
  outline-offset: 1px;
}

.note {
  margin: 8px 0 0;
  color: #7a6246;
  font-size: 14px;
}

.actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 9px 16px;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
  box-shadow: 0 8px 18px rgba(90, 45, 12, 0.22);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

button:hover {
  transform: translateY(-1px);
  filter: saturate(1.05);
}

button:active {
  transform: translateY(0);
}

#pauseBtn {
  background: linear-gradient(135deg, #1f7a78, #0f5654);
}

#status {
  margin: 10px 0 0;
  color: #6e4f31;
  font-weight: 600;
}

.chart-card {
  padding-top: 14px;
}

.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}

#yearTitle {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(24px, 3.4vw, 34px);
  line-height: 1;
}

.chart-note {
  margin: 0;
  color: var(--teal);
  font-weight: 700;
}

.chart {
  height: 58vh;
  min-height: 360px;
}

@keyframes rise-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .app {
    padding: 16px 12px 18px;
  }

  .hero,
  .card {
    border-radius: 14px;
    padding: 12px;
  }

  .chart-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .chart {
    min-height: 320px;
    height: 52vh;
  }
}

/* === Dark Mode Override (auto-generated) === */
:root[data-theme="dark"] {
  --bg: #1a1a2e;
  --bg-soft: #242438;
  --card: #242438;
  --line: #3a3a50;
  --ink: #e8e8f0;
  --ink-soft: #aaaabc;
  --accent: #ff7b54;
  --accent-strong: #d0d0e0;
  --teal: #aaaabc;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --bg: #1a1a2e;
  --bg-soft: #242438;
  --card: #242438;
  --line: #3a3a50;
  --ink: #e8e8f0;
  --ink-soft: #aaaabc;
  --accent: #ff7b54;
  --accent-strong: #d0d0e0;
  --teal: #aaaabc;
  }
}

/* === CSS Professor Animation Upgrade (Round 22) === */

/* Page entrance */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.app, main, body > .container { animation: fadeInUp 0.4s ease-out; }

/* Staggered card entrance */
@keyframes cardReveal {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.card, [class*="card"], .mission-card, .module-card, .stat-card {
  animation: cardReveal 0.35s ease-out both;
}
.card:nth-child(2), [class*="card"]:nth-child(2) { animation-delay: 0.05s; }
.card:nth-child(3), [class*="card"]:nth-child(3) { animation-delay: 0.1s; }
.card:nth-child(4), [class*="card"]:nth-child(4) { animation-delay: 0.15s; }
.card:nth-child(5), [class*="card"]:nth-child(5) { animation-delay: 0.2s; }

/* Subtle pulse for primary buttons */
@keyframes btnPulse {
  0%, 100% { box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
  50% { box-shadow: 0 2px 12px rgba(199,73,31,0.25); }
}
button[id*="Btn"]:not(:disabled), .btn-primary {
  animation: btnPulse 3s ease-in-out infinite;
}
button:disabled { animation: none; opacity: 0.6; }

/* Smooth height transitions for collapsible sections */
details { transition: all 0.2s ease; }
details[open] summary { margin-bottom: 8px; }

/* Tooltip fade */
[title] { position: relative; }

/* Progress bar animation */
@keyframes progressFill {
  from { width: 0; }
}
.mc-bar-fill, .mod-progress-fill, .bar-fill, progress::-webkit-progress-value {
  animation: progressFill 0.6s ease-out;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* === Loading & Feedback States === */
@keyframes spin { to { transform: rotate(360deg); } }
.btn-loading { position: relative; pointer-events: none; opacity: 0.7; }
.btn-loading::after {
  content: '';
  position: absolute;
  right: 8px; top: 50%;
  width: 14px; height: 14px;
  margin-top: -7px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.toast-msg {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #333; color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 0.9rem; z-index: 9999; opacity: 0;
  transition: opacity 0.3s ease;
}
.toast-msg.show { opacity: 1; }


/* === Onboarding Pulse Dot === */
@keyframes onboardPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}
.onboard-dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--accent, #c7491f);
  border-radius: 50%;
  animation: onboardPulse 1.5s ease-in-out infinite;
  margin-right: 4px;
  vertical-align: middle;
}
