:root {
  --bg: #f2f7f5;
  --ink: #152b2b;
  --muted: #4c6a69;
  --line: #bfd6cf;
  --card: #ffffff;
  --accent: #0d6a66;
  --accent-2: #1e8f72;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Noto Sans SC", sans-serif;
  background:
    radial-gradient(circle at 15% 8%, #dcf5ea 0, transparent 36%),
    radial-gradient(circle at 84% 92%, #dff1ff 0, transparent 34%),
    var(--bg);
}

.app {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px;
}

.hero,
.panel,
.item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.hero {
  padding: 14px;
  margin-bottom: 12px;
}

.hero h1 {
  margin: 0 0 8px;
  letter-spacing: 0.02em;
}

.hero p {
  margin: 0 0 10px;
  color: var(--muted);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #bcd1cb;
  border-radius: 10px;
  padding: 10px;
  font: inherit;
  background: #fbfffe;
}

.meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.panel {
  padding: 12px;
  margin-bottom: 12px;
}

.filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-row.compact {
  margin-top: 8px;
}

.filter-row.compact label {
  font-weight: 700;
  color: var(--muted);
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid #b8d6cd;
  border-radius: 999px;
  padding: 6px 12px;
  background: #eefaf6;
  color: #1d4f48;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
}

.chip.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  margin-bottom: 12px;
}

.item {
  padding: 12px;
}

.item-top {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: flex-start;
}

.item h3 {
  margin: 0;
  font-size: 18px;
}

.item a {
  color: #13465e;
  text-decoration: none;
}

.item a:hover,
.item a:focus-visible {
  text-decoration: underline;
}

.desc {
  margin: 8px 0;
  color: #355754;
  font-size: 14px;
  line-height: 1.55;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.cat {
  color: #2a5852;
  font-weight: 700;
}

.tags {
  color: #577876;
}

.fav {
  border: 1px solid #b8d6cd;
  border-radius: 999px;
  background: #fff;
  color: #2b6660;
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
}

.fav.on {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #eb7e3b, #d55a2d);
}

.config-panel h2 {
  margin: 0 0 6px;
}

.help {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
}

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

.actions button {
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font: inherit;
}

#status {
  margin: 8px 0 0;
  color: #365f59;
  font-size: 14px;
}

@media (max-width: 760px) {
  .filter-row.compact {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 520px) {
  input, textarea, select { font-size: 16px; }
  .chip, .fav { font-size: 16px; }
}

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

/* === CSS Professor Upgrade (Round 20) === */

/* Card system */
.card, [class*="card"], section, .panel, .container > div { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.card:hover, [class*="card"]:hover { transform: translateY(-2px); }

/* Button polish */
button, .btn, [type="submit"], [type="button"] {
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
button:hover, .btn:hover, [type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
button:active, .btn:active { transform: scale(0.98); }

/* Input polish */
input, textarea, select {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus, textarea:focus, select:focus {
  box-shadow: 0 0 0 3px rgba(199,73,31,0.15);
}

/* Link hover */
a { transition: color 0.15s ease; }

/* Focus outline */
:focus-visible { outline: 2px solid var(--accent, #c7491f); outline-offset: 2px; }

/* Mobile responsive */
@media (max-width: 600px) {
  body { padding: 8px; }
  .app, main, .container { padding: 12px; }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.2rem; }
  button, .btn { width: 100%; }
}

/* === 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; }
