.overview-card,
.split-card,
.reference-card,
.recap-card {
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  line-height: 1.7;
}

.overview-card p,
.split-card p,
.reference-card p {
  margin: 10px 0 0;
}

.overview-jump {
  margin-top: 16px !important;
}

.overview-jump a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

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

/* ── Stacked fractions (used in equations + tree labels) ──────── */
.frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
  vertical-align: middle;
  margin: 0 2px;
}

.frac-num {
  padding: 0 6px 2px;
  border-bottom: 2px solid currentColor;
}

.frac-den {
  padding: 2px 6px 0;
}

/* ── Equations (e.g. 1 = 1/2 + 1/2) ────────────────────────────── */
.split-equation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent);
}

.split-equation-big {
  font-size: 1.3rem;
}

.eq-op {
  color: var(--muted);
  font-weight: 800;
  font-size: 1.1rem;
}

/* ── Mini split trees (one step at a time) ─────────────────────── */
.split-tree {
  margin-top: 16px;
}

.tree-arrow {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  margin: 8px 0;
  letter-spacing: 0.02em;
}

/* ── Shared level-row component (fraction bar + note icon) ────── */
.level-row {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-top: 10px;
}

.level-row-label {
  flex: 0 0 168px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.level-row-icon {
  width: 40px;
  height: 50px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #fffdf9 0%, var(--staff) 100%);
  border-radius: 8px;
  overflow: hidden;
}

.level-row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.level-row-name {
  font-weight: 800;
  font-size: 0.84rem;
}

.level-row-count {
  font-size: 0.72rem;
  color: var(--muted);
}

.level-row-bar {
  flex: 1;
  display: flex;
  gap: 3px;
  min-width: 0;
}

.level-seg {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0b1220;
  font-weight: 700;
  font-size: 0.7rem;
  padding: 12px 2px;
}

.level-seg .frac-num,
.level-seg .frac-den {
  padding: 0 3px;
}

.level-seg.is-alt {
  background: linear-gradient(180deg, #6facff 0%, #4a8ef0 100%);
}

.level-seg.is-dense {
  padding: 8px 1px;
  border-radius: 4px;
}

.level-seg.is-dense .frac {
  display: none;
}

/* ── Step footer (kodály tip + play button) ────────────────────── */
.split-footer {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.split-kodaly {
  margin: 0 !important;
  flex: 1 1 320px;
}

.split-play {
  flex-shrink: 0;
}

.split-play.is-playing {
  background: rgba(78, 204, 163, 0.18);
  border-color: rgba(78, 204, 163, 0.5);
}

/* ── Full reference tree ───────────────────────────────────────── */
.reference-tree {
  margin-top: 18px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.reference-tree .level-row {
  margin-top: 16px;
}

.reference-tree .level-row:first-child {
  margin-top: 0;
}

.reference-tree .level-row-label {
  flex-basis: 190px;
}

.reference-row-play {
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: background 140ms ease, transform 140ms ease;
}

.reference-row-play:hover,
.reference-row-play:focus-visible {
  background: rgba(78, 204, 163, 0.22);
  transform: translateY(-1px);
  outline: none;
}

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

  .level-row-label {
    flex-basis: auto;
  }

  .level-seg.is-dense {
    min-width: 3px;
  }

  .split-footer {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
}
