/* ---------- GRID LAYOUTS (max 4 per row, centered when odd) ---------- */
.main-view {
  min-height: 400px;
}

.form-letter {
  font-size: 3.5rem;
  display: inline-block;
}


.letters-grid,
.syllables-grid,
.makhraj-grid,
.group-letters-grid,
.letter-group-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 1.5rem;
  margin: 2rem 0;
}

.letters-grid > *,
.syllables-grid > *,
.makhraj-grid > *,
.group-letters-grid > *,
.letter-group-cards > * {
  flex: 0 1 calc(25% - 1.125rem);
  max-width: calc(25% - 1.125rem);
}

.letter-combo-panel .syllables-grid {
  justify-content: center;
}

.letter-combo-panel .syllables-grid > * {
  flex-basis: calc(33.333% - 1rem);
  max-width: calc(33.333% - 1rem);
  min-width: min(100%, 220px);
}

.section-switcher,
.home-grid,
.section-letters-grid,
.forms-grid,
.blend-letter-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin: 2rem 0;
}

.makhraj-mode-switcher {
  width: fit-content;
  max-width: 100%;
  grid-template-columns: repeat(2, minmax(240px, 320px));
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
}

/* Forms grid specific max-width */
.forms-grid {
  max-width: 600px;
  margin: 0 auto;
}

/* Responsive breakpoints */
@media (max-width: 1024px) {
  .letters-grid > *,
  .syllables-grid > *,
  .makhraj-grid > *,
  .group-letters-grid > *,
  .letter-group-cards > * {
    flex-basis: calc(50% - 0.75rem);
    max-width: calc(50% - 0.75rem);
  }

  .letter-combo-panel .syllables-grid > * {
    flex-basis: calc(50% - 0.75rem);
    max-width: calc(50% - 0.75rem);
  }

  .makhraj-group-grid {
    grid-template-columns: repeat(2, minmax(280px, 1fr));
  }

  /* Home cards: 2 per row on iPads */
  .home-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .letters-grid,
  .syllables-grid,
  .makhraj-grid,
  .group-letters-grid,
  .letter-group-cards,
  .blend-letter-cards,
  .section-switcher,
  .home-grid,
  .section-letters-grid,
  .forms-grid {
    gap: 1rem;
  }

  .section-switcher,
  .section-letters-grid,
  .forms-grid,
  .blend-letter-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .makhraj-mode-switcher {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 640px) {
  .letters-grid > *,
  .syllables-grid > *,
  .makhraj-grid > *,
  .group-letters-grid > *,
  .letter-group-cards > * {
    flex-basis: 100%;
    max-width: 100%;
  }

  .letter-combo-panel .syllables-grid > * {
    flex-basis: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .makhraj-group-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 550px) {
  .blend-letter-cards,
  .section-switcher,
  .home-grid,
  .section-letters-grid {
    grid-template-columns: 1fr;
  }

  /* Show 2 forms per row instead of 1 */
  .forms-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .makhraj-mode-switcher {
    width: 100%;
    grid-template-columns: 1fr;
  }
}

/* ---------- CARDS & INTERACTIVE ELEMENTS (base) ---------- */
.letter-card,
.syllable-card,
.makhraj-card,
.form-card,
.section-card,
.home-card {
  border: 2px solid var(--border-light);
  border-radius: var(--radius-card);
  text-align: center;
  padding: 1.2rem 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
}

.syllable-card,
.makhraj-card,
.form-card,
.section-card {
  background: var(--bg-card);
}

.letter-card:hover,
.syllable-card:hover,
.makhraj-card:hover,
.form-card:hover,
.section-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  background: var(--bg-hover);
}

.home-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
}

/* Focus accessibility */
button:focus-visible,
.letter-card:focus-visible,
.syllable-card:focus-visible,
.makhraj-card:focus-visible,
.section-card:focus-visible {
  outline: 3px solid var(--accent-deep);
  outline-offset: 3px;
}

/* Completed state */
.letter-card.completed {
  border-color: var(--accent-dark);
  background: #eff7e8;
  box-shadow: 0 0 0 3px #cbe5bc;
}

/* Letter card specifics */
.letter-card span {
  font-size: 3rem;
  font-weight: 500;
  display: block;
}

.letter-card small {
  font-size: 0.9rem;
  color: #6e5e3e;
}

/* Syllable card inner elements (global) */
.syllable-text {
  font-size: 2.7rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  text-align: center;
}

.breakdown {
  font-size: 1rem;
  font-weight: 700;
  color: #2c5a2a;
  background: #f0f7e8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 1rem;
  border-radius: 40px;
  margin: 0.4rem 0;
  text-align: center;
  align-self: center;
}

/* Audio button (global) */
.audio-btn {
  background: var(--accent);
  border: none;
  border-radius: 40px;
  padding: 0.6rem 1.2rem;
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1rem;
  margin-top: 0.25rem;
}

.audio-btn svg {
  width: 18px;
  height: 18px;
  stroke: white;
}

.audio-btn:hover,
.audio-btn:focus {
  transform: translateY(-2px);
  background: var(--accent-dark);
  box-shadow: 0 6px 12px rgba(122, 168, 106, 0.25);
}

/* Microphone / feedback */
.micro-btn {
  background: #e8e0cf;
  border: none;
  font-size: 1.2rem;
  padding: 0.3rem 0.8rem;
  border-radius: 40px;
  margin-top: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  color: #4f6e3c;
}

.feedback-msg {
  font-size: 0.8rem;
  color: #9b9b6f;
  margin-top: 0.5rem;
}

/* Section cards (toggle style) */
.section-card {
  padding: 1rem 1.2rem;
}

.section-card h3 {
  margin: 0.2rem 0;
  font-size: 1.1rem;
  color: #3b5e36;
}

.section-card p {
  color: #6f6c4f;
  font-size: 0.95rem;
}

.section-card.active {
  border-color: var(--accent);
  background: var(--bg-hover);
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 20px rgba(122, 168, 106, 0.25);
}

/* Active state for letter sections (مخرج / حركات / تنوين / مدود) */
.letter-section-switcher .section-card.active {
  background: linear-gradient(135deg, #f0f7e8, #e6f2dd);
}

.letter-section-switcher .section-card.active h3 {
  color: var(--accent-dark);
  font-weight: 700;
}

.letter-section-switcher .section-card.active p {
  color: #4f6e3c;
}

/* Shared accordion / expandable letter-card styles */
.section {
  margin-bottom: 1.75rem;
}

.section-body {
  display: none;
  margin-top: 0.75rem;
  background: var(--bg-card);
  border-radius: 28px;
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.section-body.expanded {
  display: block;
  animation: fadeSlideIn 0.3s ease;
  padding: 1rem 1.5rem;
}

.toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--border-medium);
  color: #4a6741;
  font-size: 1.7rem;
  font-weight: 600;
  transition: all var(--transition-smooth);
  margin-right: 0.75rem;
}

.letter-combo-card {
  background: var(--bg-card);
  border-radius: 28px;
  border: 2px solid var(--border-light);
  overflow: hidden;
  transition: all var(--transition-smooth);
  box-shadow: var(--shadow-sm);
  height: fit-content;
}

.letter-combo-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
}

.letter-card-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.3rem;
  background: #faf7ef;
  border: none;
  border-bottom: 1px solid var(--border-light);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}

.letter-card-toggle:hover {
  background: #f5f0e4;
}

.letter-card-toggle .toggle-icon {
  margin-right: 0.5rem;
}

.letter-card-toggle.active .toggle-icon {
  /* No rotation: icon text changes via JS (+ ↔ x) */
  background: var(--accent);
  color: white;
}

.letter-combo-panel {
  display: none;
  padding: 1rem;
  background: #fffdf8;
}

.letter-combo-panel.expanded {
  display: block;
  animation: fadeSlideIn 0.2s ease;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive refinements for toggle icons */
@media (max-width: 480px) {
  .toggle-icon {
    width: 1.8rem;
    height: 1.8rem;
    font-size: 1rem;
  }
}

/* Home card disabled */
/* Home card with background image */
.home-card {
  background-image: url('../../assets/images/ui/homepagecards.png');
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
}

.home-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.92);
  transition: background var(--transition);
  pointer-events: none;
}

.home-card:hover::before,
.home-card:active::before {
  background: rgba(255, 255, 255, 0.7);
}

.home-card > * {
  position: relative;
  z-index: 1;
}

.home-card.disabled {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
  background-image: none;
  background: #f2efe6;
}

.home-card .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: #e6dfca;
  color: #5b5a44;
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

/* Makhraj specific */
.makhraj-group {
  margin-bottom: 2rem;
}

.makhraj-group-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #3b5e36;
  text-align: center;
  margin-bottom: 1rem;
}

.makhraj-letters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  width: 100%;
}


.makhraj-card .makhraj-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: #faf7ef;
  border: none;
  border-bottom: 1px solid var(--border-light);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}

.makhraj-card .makhraj-header:hover {
  background: #f5f0e4;
}

.makhraj-card .makhraj-header .letter-char {
  font-size: 2.5rem;
}

.makhraj-card .makhraj-header .toggle-icon {
  margin-left: 0.5rem;
}

.makhraj-card .makhraj-header.active .toggle-icon {
  background: var(--accent);
  color: white;
}

.makhraj-card .makhraj-content {
  position: relative;
  padding: 1.5rem;
  background: #fffdf8;
  text-align: center;
}

.makhraj-card .completion-indicator {
  position: static;
  margin: 0 auto 1rem;
  display: block;
  width: 36px;
  height: 36px;
  font-size: 16px;
  line-height: 1;
  border-radius: 50%;
  border: 2px solid #ddd;
  background: white;
  color: transparent;
  align-items: center;
  justify-content: center;
  display: inline-flex;
}

.makhraj-card .completion-indicator.completed {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.makhraj-card .makhraj-image-container {
  margin-bottom: 1rem;
}

.makhraj-card .makhraj-image {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.makhraj-card .makhraj-description {
  margin-top: 1rem;
}

.makhraj-card .makhraj-description p {
  font-size: 1.1rem;
  color: #2c5a2a;
  margin: 0;
}

.makhraj-group-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  justify-content: center;
  align-items: stretch;
}

/* Tablet (iPad Air etc.) → 2 cards per row */
@media (max-width: 820px) {
  .makhraj-group-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }
}

/* Completion Indicator */
.completion-indicator {
  position: static;
  width: 28px;
  height: 28px;
  margin: 0 auto 0.85rem;
  border-radius: 50%;
  border: 2px solid #ddd;
  background: white;
  color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all var(--transition);
}

.blend-group-header .completion-indicator,
.letter-with-completion .completion-indicator {
  margin: 0;
}

.completion-indicator.completed {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.completion-indicator:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Letter with completion in makhraj */
.letter-with-completion {
  position: relative;
  display: inline-block;
  margin: 0 4px;
}

.letter-char {
  display: inline-block;
  font-size: 1.5rem;
  padding: 4px 8px;
}

.letter-with-completion .completion-indicator {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  font-size: 12px;
}

/* Progress bars for home cards */
.progress-container {
  margin-top: 1rem;
  width: 100%;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.85rem;
  color: #4a6741;
  text-align: center;
  margin-bottom: 2px;
}

.progress-percentage {
  font-size: 0.75rem;
  color: #6f6c4f;
  text-align: center;
}

/* Ensure syllable cards have relative positioning for absolute indicators */
.syllable-card {
  position: relative;
}

.syllable-card > .completion-indicator {
  position: static;
  margin: 0 auto 1rem;
  display: block;
}

/* Mobile → 1 card per row */
@media (max-width: 640px) {
  .makhraj-group-grid {
    grid-template-columns: 1fr;
  }
}

.makhraj-group-grid > .makhraj-group-card {
  max-width: none;
  min-width: 0;
  align-self: stretch;
}

.makhraj-group-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 1.5rem;
  padding: 1.75rem 1rem 1rem;
  height: 100%;
}

.makhraj-group-card .letter-detail {
  max-width: none;
}

.makhraj-group-card .big-letter {
  font-size: 5.5rem;
  padding: 0.8rem 1.3rem;
  margin: 0 0 0.75rem;
}

.makhraj-group-card .letter-name {
  font-size: 1.15rem;
  margin-bottom: 0;
}

.makhraj-group-card .makhraj-display {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0;
  padding: 1rem;
  width: 100%;
  flex: 1;
}

.makhraj-group-card .makhraj-image-container {
  max-width: 210px;
}

.makhraj-group-card .makhraj-description {
  width: 100%;
  max-width: none;
  font-size: 1rem;
  line-height: 1.8;
  padding: 1.25rem;
  flex: 1;
}

.makhraj-card.collapsible {
  padding: 0;
  overflow: hidden;
  display: block;
  align-self: flex-start;
  justify-content: flex-start;
  background: var(--bg-card);
}

.makhraj-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.3rem;
  background: #faf7ef;
  border: none;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  font-family: inherit;
  text-align: right;
}

.makhraj-header:hover {
  background: #f5f0e4;
}

.makhraj-header .makhraj-letters {
  flex: 1;
  justify-content: flex-end;
}

.makhraj-card.collapsible .makhraj-letters span {
  background: transparent;
  border-radius: 0;
  padding: 0;
  min-width: 0;
  font-size: 1.9rem;
  line-height: 1;
}

.makhraj-header .toggle-icon {
  flex-shrink: 0;
  margin-right: 0;
}

.makhraj-card.collapsible.expanded .makhraj-header {
  border-bottom-color: var(--border-light);
}

.makhraj-card.collapsible.expanded .makhraj-header .toggle-icon {
  /* No rotation: icon text changes via JS (+ ↔ x) */
  background: var(--accent);
  color: white;
}

.makhraj-content {
  width: 100%;
  padding: 1.25rem;
  background: #fffdf8;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.makhraj-card.collapsible .makhraj-display,
.makhraj-card.collapsible .makhraj-image-container,
.makhraj-card.collapsible .makhraj-description {
  margin-top: 0;
}

.makhraj-card.collapsible .makhraj-image-container,
.makhraj-card.collapsible .makhraj-description {
  max-width: none;
}

.makhraj-letters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.makhraj-letters span {
  background: #f5f2e5;
  border-radius: 16px;
  padding: 0.7rem 1rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: #3b5e36;
  min-width: 48px;
  text-align: center;
}

.makhraj-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  margin-top: 2rem;
  padding: 2rem;
  background: #fef7e0;
  border-radius: 32px;
  box-shadow: var(--shadow-sm);
}

.makhraj-image-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 400px;
  background-color: white;
  border-radius: 20px;
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.makhraj-image {
  max-width: 100%;
  height: auto;
  border-radius: 20px;
  cursor: zoom-in;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.makhraj-image:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.makhraj-description {
  text-align: center;
  max-width: 600px;
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--text-dark);
  background: white;
  padding: 1.5rem;
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
}

/* Group description */
.group-description {
  background: #fef7e0;
  border-radius: 20px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.image-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.image-overlay.hidden {
  display: none !important;
}

.image-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 18, 10, 0.72);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.image-overlay-dialog {
  position: relative;
  z-index: 1;
  max-width: min(92vw, 980px);
  max-height: 90vh;
  padding: 1rem;
  border-radius: 28px;
  background: #fffdf8;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.image-overlay-img {
  display: block;
  max-width: 100%;
  max-height: calc(90vh - 2rem);
  width: auto;
  height: auto;
  border-radius: 20px;
}

.image-overlay-close {
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  width: 2.4rem;
  height: 2.4rem;
  border: none;
  border-radius: 999px;
  background: rgba(59, 94, 54, 0.92);
  color: white;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.image-overlay-close:hover {
  background: var(--accent-dark);
}

/* Letter detail page */
.letter-forms-display {
  text-align: center;
}

.letter-forms-display h2 {
  margin-bottom: 1rem;
}

.letter-section-switcher {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.letter-section-switcher > .section-card {
  flex: 0 0 auto;
  min-width: 220px;
  max-width: 260px;
}

.letter-detail {
  text-align: center;
  max-width: 500px;
  margin: 0 auto;
}

.big-letter {
  font-size: 8rem;
  background: #f9f0df;
  border-radius: 70px;
  padding: 1rem;
  margin: 1rem 0;
  font-weight: 600;
}

.letter-name {
  font-size: 2rem;
  color: #5d7a4b;
  margin-bottom: 1.5rem;
}

/* Navigation buttons */
.nav-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.nav-btn {
  background: #e1d5bd;
  padding: 0.6rem 1.4rem;
  border-radius: 40px;
  font-size: 1.1rem;
  border: none;
  font-weight: bold;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-btn:hover {
  background: #c9bfa6;
  transform: translateY(-2px);
}

.completion-status {
  background: var(--accent);
  color: white;
  padding: 0.6rem 1.4rem;
  border-radius: 40px;
  font-size: 1.1rem;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* Back link */
.back-link {
  display: inline-block;
  background: #ebe1ce;
  padding: 0.4rem 1rem;
  border-radius: 30px;
  margin-bottom: 1rem;
  text-decoration: none;
  color: #4a5c38;
  font-weight: bold;
  transition: var(--transition);
}

.back-link:hover {
  background: #ddd0b6;
  transform: translateX(-2px);
}

/* Utility classes */
.spacer {
  margin: 1rem 0;
}

/* Highlight & playing states */
.syllable-card.highlight {
  background: #f9efcf;
  border-color: #b5d3a7;
}

.syllable-card.playing {
  background: #e5f5dc;
  border-color: var(--accent-dark);
  animation: pulseGlow 0.4s ease;
}

@keyframes pulseGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(122, 168, 106, 0.4);
  }
  100% {
    box-shadow: 0 0 0 6px rgba(122, 168, 106, 0);
  }
}

/* Controls bar responsiveness */
@media (max-width: 768px) {
  .controls-bar {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
  }
  .speed-group,
  .auto-group {
    width: 100%;
    justify-content: center;
  }

  .letter-section-switcher {
    gap: 1rem;
    width: 100%;
  }

  .letter-section-switcher > .section-card {
    flex: 1 1 calc(50% - 1rem);
    max-width: calc(50% - 1rem);
  }
}

@media (max-width: 480px) {
  .syllable-text {
    font-size: 2rem;
  }
  .breakdown {
    font-size: 0.9rem;
  }
  .big-letter {
    font-size: 5rem;
  }

  .letter-section-switcher {
    width: 100%;
  }

  .letter-section-switcher > .section-card {
    flex-basis: 100%;
    max-width: 100%;
  }
}