body {
  background: #f5f8fc;
  font-family: 'Inter', sans-serif;
  color: #2c3e50;
}

/* Card Styling */
.calc-card, .graphic-card {
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  min-height: 420px;
}

/* Title + Subtitle */
.calc-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1a2a40;
}

.calc-subtitle {
  font-size: 1.1rem;
  margin-top: -6px;
  color: #4a6c8b;
}

/* Given Variables List */
.vars-list {
  padding-left: 0;
  list-style: none;
  margin-bottom: 15px;
}

.vars-list p, .vars-list li {
  padding: 4px 0;
  font-size: 1.05rem;
}

/* Labels + Inputs */
.input-label {
  font-weight: 600;
  margin-bottom: 4px;
  display: block;
}

.answer-input {
  max-width: 220px;
  border-radius: 12px;
  padding: 10px;
  font-size: 1.1rem;
}

/* Hint + Solution Buttons */
.action-row {
  display: flex;
  gap: 12px;
}

.hint-btn, .solution-btn {
  border-radius: 20px;
  padding: 8px 18px;
  background: #eaf1ff;
  border: 1px solid #d8e5ff;
  color: #1e4b89;
  font-weight: 500;
}

.hint-btn:hover, .solution-btn:hover {
  background: #dbe8ff;
}

/* Submit Button */
.calc-submit-btn {
  background: #4f8adf;
  color: #fff;
  padding: 12px 26px;
  font-size: 1.1rem;
  border-radius: 20px;
}

.calc-submit-btn:hover {
  background: #3f74c4;
}

/* Right Panel Graphic */
.graphic-card {
  min-height: 420px;
  text-align: center;
}

/* Mobile Layout Tweaks */
@media (max-width: 768px) {
  .calc-card, .graphic-card {
    border-radius: 18px;
  }

  .calc-title {
    font-size: 1.5rem;
  }
}



.side-card {
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  min-height: 420px;
}

.action-buttons {
  display: flex;
  gap: 12px;
}

.hint-btn, .solution-btn {
  border-radius: 20px;
  padding: 8px 18px;
  background: #eaf1ff;
  border: 1px solid #d8e5ff;
  color: #1e4b89;
  font-weight: 500;
}

.hint-btn:hover, .solution-btn:hover {
  background: #dbe8ff;
}

#hint-box, #solution-box {
  font-size: 1rem;
  border-radius: 16px;
}
#visual {
  height: 20vh;
  max-height: 30vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#visual svg {
  width: 100%;
  height: 100%;
}

/* Challenge a Friend — confetti burst */
#confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2000;
}

.confetti {
  position: fixed;
  top: -20px;
  width: var(--size, 8px);
  height: var(--size, 8px);
  background: hsl(var(--hue, 210), 90%, 60%);
  border-radius: var(--round, 2px);
  animation: confetti-fall var(--duration, 3s) ease-in forwards;
}

@keyframes confetti-fall {
  from { transform: translateY(0) rotate(0deg); opacity: 1; }
  to   { transform: translateY(105vh) rotate(360deg); opacity: 0; }
}

/* Challenge a Friend — shared layout bits */
.challenge-code {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  color: #1a2a40;
}

.leaderboard-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-radius: 14px;
  background: #f5f8fc;
  margin-bottom: 8px;
}

.leaderboard-row.is-me {
  background: #eaf1ff;
  border: 1px solid #d8e5ff;
}

.score-badge {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1e4b89;
}

.winner-banner {
  text-align: center;
  padding: 2rem;
}

.winner-banner h1 {
  font-size: 2.4rem;
  font-weight: 700;
  color: #1a2a40;
}

/* ============================================================
   Math Aid branding — site header, logo mark, hero
   ============================================================ */
:root {
  --ma-primary: #4f8adf;
  --ma-primary-dark: #1e4b89;
  --ma-ink: #1a2a40;
  --ma-muted: #6b859e;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.site-header-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

/* Header logo mark — sized to sit next to the "Math Aid" wordmark text. */
.logo-mark {
  display: inline-block;
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.site-header-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--ma-ink);
  letter-spacing: -0.01em;
}

.site-header-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-challenge {
  background: #fff;
  color: var(--ma-primary-dark);
  border: 1.5px solid #d8e5ff;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-size: 0.95rem;
  transition: background 0.15s, transform 0.1s;
}

.btn-challenge svg {
  width: 15px;
  height: 15px;
}

.btn-challenge:hover {
  background: #eaf1ff;
  color: var(--ma-primary-dark);
}

.btn-challenge:active {
  transform: scale(0.97);
}

.site-hero {
  text-align: center;
  padding: 1rem 0 2.5rem;
}

.site-hero-logo {
  display: block;
  width: min(420px, 85%);
  height: auto;
  margin: 0 auto 1.5rem;
}

.page-heading {
  text-align: center;
  margin-bottom: 2.5rem;
}

.page-heading h1 {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--ma-ink);
}

/* ============================================================
   Topic pages — collapsible, compact grid (replaces the old
   full-width stacked-row cards, which got cluttered past a
   handful of items)
   ============================================================ */
.topic-section {
  border: none;
  margin-bottom: 12px;
  padding: 0;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04);
}

.topic-section > summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  font-weight: 700;
  color: var(--ma-ink);
  font-size: 1.05rem;
}

.topic-section > summary::-webkit-details-marker {
  display: none;
}

.topic-section > summary .topic-count {
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--ma-muted);
  background: #f0f4fa;
  padding: 3px 10px;
  border-radius: 12px;
  margin-left: 10px;
}

.topic-section > summary::after {
  content: "\25BE";
  margin-left: auto;
  color: var(--ma-muted);
  transition: transform 0.15s;
}

.topic-section[open] > summary::after {
  transform: rotate(180deg);
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
  padding: 4px 24px 22px;
}

.mini-card {
  border: 1px solid #eef1f6;
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.mini-card:hover {
  border-color: #d8e5ff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.mini-card h5 {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ma-ink);
  margin: 0;
}

.mini-card p {
  font-size: 0.83rem;
  color: var(--ma-muted);
  margin: 0;
  flex-grow: 1;
}

.mini-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-card-actions .btn {
  flex: 1;
  font-size: 0.82rem;
  padding: 7px 12px;
  border-radius: 14px;
  white-space: nowrap;
}

/* Small numbered chip — replaces the old 30px circle badge repeated down
   the page; keeps the cheatsheet item numbers without dominating the card */
.item-number {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ma-primary-dark);
  background: #eaf1ff;
  padding: 2px 7px;
  border-radius: 8px;
  margin-right: 2px;
  vertical-align: middle;
}
