* {
  box-sizing: border-box;
}

:root {
  --bg: #d9f5d3;
  --panel: rgba(255, 255, 255, 0.76);
  --panel-2: rgba(255, 255, 255, 0.9);
  --text: #1f2937;
  --muted: #4b5563;
  --accent: #2f855a;
  --accent-2: #22c55e;
  --border: rgba(31, 41, 55, 0.12);
  --shadow: 0 20px 50px rgba(47, 133, 90, 0.16);
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  min-height: 100vh;
  background: var(--bg);
}

.app-shell {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero {
  display: flex;
  gap: 24px;
  justify-content: space-between;
  align-items: end;
  padding: 24px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.05;
}

.subtext {
  margin: 12px 0 0;
  color: var(--muted);
  max-width: 62ch;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(84px, 1fr));
  gap: 12px;
}

.stats div {
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  text-align: center;
}

.stats strong {
  display: block;
  font-size: 1.5rem;
}

.stats span {
  color: var(--muted);
  font-size: 0.9rem;
}

.controls {
  margin-top: 18px;
  padding: 20px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.search-wrap input {
  width: 100%;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  outline: none;
  font-size: 1rem;
}

.search-wrap input:focus {
  border-color: rgba(47, 133, 90, 0.65);
  box-shadow: 0 0 0 4px rgba(47, 133, 90, 0.12);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.filter-btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.filter-btn.active {
  background: linear-gradient(135deg, var(--accent), #16a34a);
  border-color: transparent;
  color: #ffffff;
}

.grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.topic-card {
  perspective: 1200px;
}

.card-toggle {
  width: 100%;
  min-height: 250px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
  color: inherit;
  padding: 18px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 180ms ease, border-color 180ms ease;
}

.card-toggle:hover {
  transform: translateY(-2px);
  border-color: rgba(47, 133, 90, 0.28);
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #0f5132;
  background: #bbf7d0;
}

.difficulty {
  color: var(--muted);
  font-size: 0.85rem;
}

.title {
  margin: 16px 0 10px;
  font-size: 1.35rem;
}

.summary,
.notes {
  color: var(--muted);
  line-height: 1.55;
}

.card-back {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.notes {
  padding-left: 18px;
  margin: 10px 0 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.55);
}

@media (max-width: 700px) {
  .hero {
    flex-direction: column;
    align-items: start;
  }

  .stats {
    width: 100%;
  }
}
