/* ---------- Arabic font ---------- */
/* Amiri Quran 1.003, in the app itself (also offline, and no other system font on iPhone/iPad that misplaces the marks).
   It draws ٰ and ٓ clearly above the letter. size-adjust: as big as the earlier font at the same font-size.
   Changed for the kursu (tools/patch-font.py): the esre of ج ح خ ع غ alone or at the end of a word goes under
   the bowl, not inside it; the med sign (ٓ) has its own red color layer. */
@font-face {
  font-family: 'Kursu Quran';
  src: url('../fonts/amiri-quran-arabic.woff2') format('woff2');
  font-display: block;
  size-adjust: 115%;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFC;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #eaf5ff;
  --ink: #1d2b4f;
  --muted: #5b6b8c;
  --card: #ffffff;
  --primary: #2f6fde;
  --primary-dark: #1f52ad;

  /* Tile colors: light tint + strong edge */
  --sun: #fff1c7;   --sun-edge: #f2b705;
  --sky: #dcecff;   --sky-edge: #4d94f5;
  --mint: #d3f4ea;  --mint-edge: #2fb38d;
  --coral: #ffe1dc; --coral-edge: #f36b5a;
  --grape: #ece5ff; --grape-edge: #8b6cf2;
  --leaf: #e2f5d4;  --leaf-edge: #6cb83f;

  --ui: 'Baloo 2', system-ui, sans-serif;
  --arabic: 'Kursu Quran', 'Amiri', 'Noto Naskh Arabic', serif;

  --radius: 24px;
  --press: 0 6px 0;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--ui);
  font-size: 1.25rem;
  line-height: 1.4;
  color: var(--ink);
  background-color: var(--bg);
  /* Soft eight-pointed star pattern */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%232f6fde' stroke-opacity='.07' stroke-width='2'%3E%3Crect x='30' y='30' width='36' height='36'/%3E%3Crect x='30' y='30' width='36' height='36' transform='rotate(45 48 48)'/%3E%3C/g%3E%3C/svg%3E");
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
body.no-scroll { overflow: hidden; }
h1, h2, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 4px solid var(--primary); outline-offset: 4px; border-radius: 12px; }
[lang='ar'] { font-family: var(--arabic); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem;
  padding: .8rem clamp(1rem, 3vw, 2rem);
  background: rgb(234 245 255 / .9);
  backdrop-filter: blur(8px);
}
.topbar__center { grid-column: 2; display: flex; align-items: center; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.4rem; }
.topnav a { padding-inline: 1.2rem; gap: .5rem; }
.topnav a [lang='ar'] { font-size: 1.4rem; line-height: 1; }
.brand svg { width: 38px; height: 38px; }
.lang { grid-column: 3; justify-self: end; display: flex; gap: .6rem; }
.lang button {
  width: 70px; height: 50px; padding: 0;
  border: 4px solid transparent; border-radius: 14px;
  overflow: hidden; background: #fff;
  box-shadow: 0 3px 0 rgb(29 43 79 / .15);
  opacity: .55; transform: scale(.92);
  transition: transform .2s, opacity .2s, border-color .2s;
}
.lang button svg { width: 100%; height: 100%; display: block; }
.lang button[aria-pressed='true'] { opacity: 1; transform: scale(1); border-color: var(--primary); }
.lang button:active { transform: scale(.88); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 60px; padding: .6rem 1.4rem;
  border: 0; border-radius: 999px;
  font-weight: 700; font-size: 1.2rem;
  background: var(--card); color: var(--ink);
  box-shadow: var(--press) rgb(29 43 79 / .18);
  transition: transform .1s, box-shadow .1s;
}
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 rgb(29 43 79 / .18); }
.btn:disabled { opacity: .4; cursor: default; }
.btn--back { grid-column: 1; justify-self: start; }
.btn--back::before { content: '‹'; font-size: 2rem; line-height: 0; margin-top: -4px; }
.btn--back[hidden] { display: none; }
.btn--video { background: #ff3b3b; color: #fff; box-shadow: var(--press) #c21f1f; font-size: 1.3rem; min-height: 64px; padding-inline: 1.8rem; }
.btn--video:active { box-shadow: 0 2px 0 #c21f1f; }
.btn--play { background: var(--primary); color: #fff; box-shadow: var(--press) var(--primary-dark); }
.btn--play:active { box-shadow: 0 2px 0 var(--primary-dark); }
.btn--listen { background: var(--primary); color: #fff; box-shadow: var(--press) var(--primary-dark); font-size: 1.4rem; min-height: 68px; padding-inline: 2rem; }
.btn--mini { min-height: 52px; font-size: 1.05rem; padding: .4rem 1.1rem; }
.btn--nav { min-width: 170px; font-size: 1.35rem; min-height: 72px; }
.btn--go { background: var(--mint-edge); color: #fff; box-shadow: var(--press) #1f8a6b; }
.btn--go:active { box-shadow: 0 2px 0 #1f8a6b; }
.btn--big { font-size: 1.4rem; min-height: 72px; padding-inline: 2.2rem; background: var(--primary); color: #fff; box-shadow: var(--press) var(--primary-dark); }
.btn--close { min-height: 56px; background: #fff; }

/* ---------- Layout ---------- */
.main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 1rem clamp(1rem, 3vw, 2rem) 3rem; }
.page-title { font-size: 2.4rem; font-weight: 800; text-align: center; margin: .3rem 0 1.4rem; }

/* ---------- Home ---------- */
.home { display: grid; gap: 2rem; padding-top: 1rem; }
.home__greet { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.mascot { width: 130px; height: auto; flex-shrink: 0; animation: bob 3s ease-in-out infinite; }
.mascot__star { transform-origin: 118px 36px; animation: twinkle 2.4s ease-in-out infinite; }
.bubble {
  position: relative; background: #fff; border-radius: var(--radius);
  padding: 1rem 1.6rem; box-shadow: 0 6px 0 rgb(29 43 79 / .1);
  font-size: 1.35rem;
}
.bubble::before {
  content: ''; position: absolute; left: -14px; top: 50%; margin-top: -14px;
  border: 14px solid transparent; border-right-color: #fff; border-left: 0;
}
.bubble__hello { font-weight: 800; font-size: 1.7rem; color: var(--primary); }

.home__choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1rem, 3vw, 2rem); }
.choice {
  display: grid; justify-items: center; gap: .3rem;
  padding: 2rem 1rem 1.8rem;
  border-radius: 36px;
  text-align: center;
  transition: transform .12s, box-shadow .12s;
}
.choice:active { transform: translateY(6px); }
.choice--elifba { background: var(--sun); box-shadow: 0 10px 0 var(--sun-edge); color: #6b4e00; }
.choice--elifba:active { box-shadow: 0 4px 0 var(--sun-edge); }
.choice--cuz { background: var(--grape); box-shadow: 0 10px 0 var(--grape-edge); color: #3f2a99; }
.choice--cuz:active { box-shadow: 0 4px 0 var(--grape-edge); }
.choice--surahs { background: var(--mint); box-shadow: 0 10px 0 var(--mint-edge); color: #0d5c46; }
.choice--surahs:active { box-shadow: 0 4px 0 var(--mint-edge); }
.choice__art { font-size: 5.5rem; line-height: 1.2; height: 8rem; display: grid; place-items: center; }
.choice__art svg { width: 150px; height: auto; }
.choice__title { font-size: 2.6rem; font-weight: 800; line-height: 1; color: var(--ink); }
.choice__sub { font-size: 1.3rem; font-weight: 600; }

/* ---------- Elif Ba grid ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 1rem; }
.tile {
  display: grid; justify-items: center; align-content: center;
  aspect-ratio: 1; border-radius: 26px;
  transition: transform .1s, box-shadow .1s;
}
.tile:active { transform: translateY(5px); }
.tile { grid-template-rows: 1fr auto; padding: .4rem 0 .6rem; }
.tile__char { font-size: 3.4rem; line-height: 1; color: var(--ink); height: 4.6rem; display: grid; place-items: center; overflow: visible; }
.tile__name { font-weight: 700; font-size: 1.1rem; line-height: 1.1; }
.tile--sun { background: var(--sun); box-shadow: 0 7px 0 var(--sun-edge); }
.tile--sky { background: var(--sky); box-shadow: 0 7px 0 var(--sky-edge); }
.tile--mint { background: var(--mint); box-shadow: 0 7px 0 var(--mint-edge); }
.tile--coral { background: var(--coral); box-shadow: 0 7px 0 var(--coral-edge); }
.tile--grape { background: var(--grape); box-shadow: 0 7px 0 var(--grape-edge); }
.tile--leaf { background: var(--leaf); box-shadow: 0 7px 0 var(--leaf-edge); }
.tile:active[class*='tile--'] { box-shadow: 0 2px 0 rgb(29 43 79 / .2); }

/* ---------- Shared: colored cards, arrows ---------- */
.card--sun { background: var(--sun); box-shadow: 0 10px 0 var(--sun-edge); }
.card--sky { background: var(--sky); box-shadow: 0 10px 0 var(--sky-edge); }
.card--mint { background: var(--mint); box-shadow: 0 10px 0 var(--mint-edge); }
.card--coral { background: var(--coral); box-shadow: 0 10px 0 var(--coral-edge); }
.card--grape { background: var(--grape); box-shadow: 0 10px 0 var(--grape-edge); }
.card--leaf { background: var(--leaf); box-shadow: 0 10px 0 var(--leaf-edge); }
.pop { animation: pop .45s cubic-bezier(.34, 1.56, .64, 1); }
.arrow {
  display: grid; place-items: center;
  width: 84px; height: 84px; border-radius: 50%;
  background: #fff; box-shadow: var(--press) rgb(29 43 79 / .18);
  font-size: 3.4rem; font-weight: 700; line-height: 1; padding-bottom: 8px;
}
.arrow:active { transform: translateY(4px); box-shadow: 0 2px 0 rgb(29 43 79 / .18); }

/* ---------- Surah list ---------- */
.surah-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.surah-card {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem;
  padding: 1rem 1.2rem; border-radius: var(--radius);
  transition: transform .1s, box-shadow .1s;
}
.surah-card:active { transform: translateY(5px); }
.surah-card--sun { background: var(--sun); box-shadow: 0 7px 0 var(--sun-edge); }
.surah-card--sky { background: var(--sky); box-shadow: 0 7px 0 var(--sky-edge); }
.surah-card--mint { background: var(--mint); box-shadow: 0 7px 0 var(--mint-edge); }
.surah-card--coral { background: var(--coral); box-shadow: 0 7px 0 var(--coral-edge); }
.surah-card--grape { background: var(--grape); box-shadow: 0 7px 0 var(--grape-edge); }
.surah-card--leaf { background: var(--leaf); box-shadow: 0 7px 0 var(--leaf-edge); }
.surah-card__num {
  width: 52px; height: 52px; display: grid; place-items: center;
  border-radius: 50%; background: #fff; font-weight: 800; font-size: 1.4rem;
}
.surah-card__text { display: grid; }
.surah-card__name { font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.surah-card__about { font-size: 1.02rem; color: var(--muted); line-height: 1.25; }
.surah-card__ar { font-size: 2.2rem; line-height: 1; }

/* ---------- Surah detail ---------- */
.surah { display: grid; gap: 1rem; }
.surah__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.surah__name { font-size: 2.6rem; font-weight: 800; line-height: 1; display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; }
.surah__ar { font-size: 2.4rem; font-weight: 400; color: var(--primary); }
.surah__about { color: var(--muted); font-size: 1.15rem; margin-top: .2rem; }
.surah__actions { display: flex; flex-wrap: wrap; gap: .8rem; }
.surah__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.surah .done, .surah .ayahs { justify-self: stretch; }
.toggle { display: inline-flex; background: #fff; border-radius: 999px; padding: 6px; box-shadow: 0 4px 0 rgb(29 43 79 / .1); }
.toggle button { border: 0; background: none; border-radius: 999px; min-height: 52px; padding: .3rem 1.3rem; font-weight: 700; font-size: 1.1rem; color: var(--muted); }
.toggle button[aria-pressed='true'] { background: var(--ink); color: #fff; }

.ayahs { display: grid; gap: 1rem; width: 100%; }
.ayah {
  width: 100%;
  display: grid; justify-items: center; gap: .5rem; text-align: center;
  background: #fff; border-radius: var(--radius); padding: 1.2rem 1.4rem 1.3rem;
  box-shadow: 0 6px 0 rgb(29 43 79 / .1);
  border: 4px solid transparent;
  transition: border-color .2s, background-color .2s;
}
.ayah.is-playing { border-color: var(--sun-edge); background: #fffbea; }
.ayah__ar { font-size: clamp(2rem, 3.4vw, 2.6rem); line-height: 2.1; }
.ayah--big .ayah__ar { font-size: clamp(2.4rem, 4.4vw, 3.4rem); line-height: 1.9; }
.ayah__num { font-size: .8em; color: var(--primary); white-space: nowrap; }
.ayah__latin { font-size: 1.35rem; font-weight: 600; color: var(--muted); max-width: 46ch; }
.ayah--big .ayah__latin { font-size: 1.6rem; }
.ayah--besmele { background: #f4f8ff; }
.ayah--besmele .ayah__ar { font-size: clamp(1.8rem, 3vw, 2.3rem); }

.step__progress { display: flex; align-items: center; gap: 1rem; font-weight: 700; color: var(--muted); }
.step__dots { display: flex; gap: .5rem; }
.step { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: clamp(.6rem, 2vw, 1.4rem); }
.step__card { display: grid; gap: .6rem; background: #fff; border-radius: var(--radius); padding: 1rem 1.2rem 1.2rem; box-shadow: 0 6px 0 rgb(29 43 79 / .1); }
.step__card .ayah { box-shadow: none; padding: .4rem; }
.besmele { display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap; padding-bottom: .6rem; border-bottom: 2px dashed #dbe5f5; border-radius: 12px; }
.besmele.is-playing { background: #fffbea; }
.besmele__ar { font-size: 1.9rem; line-height: 1.6; }
.besmele__latin { font-weight: 600; color: var(--muted); }
.besmele .btn--mini { min-height: 48px; width: 48px; padding: 0; }
button.arrow { border: 0; }
button.arrow:disabled { visibility: hidden; }
.arrow--go { background: var(--mint-edge); color: #fff; box-shadow: var(--press) #1f8a6b; }
.step__dots i { width: 18px; height: 18px; border-radius: 50%; background: #cfdbee; }
.step__dots i.is-done { background: var(--mint-edge); }
.step__dots i.is-now { background: var(--sun-edge); transform: scale(1.3); }
.step__nav { display: flex; gap: 1rem; justify-content: center; }

.done { position: relative; display: grid; justify-items: center; gap: .6rem; text-align: center; padding: 1rem 0 2rem; }
.done .mascot { width: 160px; }
.done__title { font-size: 3rem; font-weight: 800; color: var(--mint-edge); line-height: 1; }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i {
  position: absolute; top: -20px; width: 14px; height: 14px; border-radius: 3px;
  animation: fall 2.6s ease-in forwards;
}
.confetti i:nth-child(6n + 1) { background: var(--sun-edge); }
.confetti i:nth-child(6n + 2) { background: var(--sky-edge); }
.confetti i:nth-child(6n + 3) { background: var(--coral-edge); }
.confetti i:nth-child(6n + 4) { background: var(--mint-edge); }
.confetti i:nth-child(6n + 5) { background: var(--grape-edge); }
.confetti i:nth-child(6n + 6) { background: var(--leaf-edge); }
.confetti i:nth-child(1) { left: 5%; animation-delay: .0s } .confetti i:nth-child(2) { left: 12%; animation-delay: .3s }
.confetti i:nth-child(3) { left: 19%; animation-delay: .1s } .confetti i:nth-child(4) { left: 26%; animation-delay: .5s }
.confetti i:nth-child(5) { left: 33%; animation-delay: .2s } .confetti i:nth-child(6) { left: 40%; animation-delay: .6s }
.confetti i:nth-child(7) { left: 47%; animation-delay: .15s } .confetti i:nth-child(8) { left: 54%; animation-delay: .45s }
.confetti i:nth-child(9) { left: 61%; animation-delay: .05s } .confetti i:nth-child(10) { left: 68%; animation-delay: .35s }
.confetti i:nth-child(11) { left: 75%; animation-delay: .25s } .confetti i:nth-child(12) { left: 82%; animation-delay: .55s }
.confetti i:nth-child(13) { left: 89%; animation-delay: .1s } .confetti i:nth-child(14) { left: 95%; animation-delay: .4s }
.confetti i:nth-child(15) { left: 8%; animation-delay: .7s } .confetti i:nth-child(16) { left: 37%; animation-delay: .8s }
.confetti i:nth-child(17) { left: 64%; animation-delay: .75s } .confetti i:nth-child(18) { left: 90%; animation-delay: .9s }

/* ---------- Elif Ba tabs (letters / harekeler) ---------- */
.tabs { display: flex; justify-content: center; margin: -.4rem 0 1.4rem; }
.toggle a { display: inline-flex; align-items: center; border-radius: 999px; min-height: 52px; padding: .3rem 1.6rem; font-weight: 700; font-size: 1.15rem; color: var(--muted); }
.toggle a[aria-current='page'] { background: var(--ink); color: #fff; }

/* ---------- Harekeler lessons ---------- */
.lesson-card__ar { font-size: 2.6rem; line-height: 1.4; }
.lesson-card__ar--wide { font-size: 1.8rem; white-space: nowrap; }
.lesson { display: grid; gap: 1.2rem; }
.lesson__intro { display: flex; align-items: center; gap: clamp(1rem, 3vw, 2rem); background: #fff; border-radius: var(--radius); padding: 1.2rem 1.4rem; box-shadow: 0 6px 0 rgb(29 43 79 / .1); }
.lesson__card { flex-shrink: 0; width: clamp(130px, 18vw, 180px); aspect-ratio: 1; display: grid; place-items: center; border-radius: 36px; }
.lesson__sample { font-size: clamp(4rem, 8vw, 5.5rem); line-height: 1; margin-top: -.1em; }
.lesson__explain { display: grid; gap: .3rem; font-size: 1.3rem; font-weight: 600; }
.lesson__example { margin-top: .3rem; color: var(--primary); font-weight: 800; font-size: 1.45rem; }
.lesson__group { font-size: 1.6rem; font-weight: 800; margin-top: .6rem; }
.lesson__note { color: var(--muted); font-weight: 600; }
.lesson__nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: .6rem; }
button.tile { width: 100%; border: 0; font: inherit; color: inherit; }
.syllable .tile__char { font-size: 2.9rem; }
.tiles--wide { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.tiles--wide .tile { aspect-ratio: auto; min-height: 140px; }
.tiles--wide .tile__char { font-size: 2.7rem; }
.lesson__sample--wide { font-size: clamp(2.4rem, 4.4vw, 3rem); }
.tile.is-playing { outline: 5px solid var(--sun-edge); outline-offset: 2px; }

/* ---------- Player, reciter, own recordings ---------- */
.player { display: inline-flex; gap: .6rem; }
.btn--stop { background: #fff; color: var(--coral-edge); }
.reciter { display: inline-flex; align-items: center; gap: .6rem; background: #fff; border-radius: 999px; padding: 6px 6px 6px 1.1rem; box-shadow: 0 4px 0 rgb(29 43 79 / .1); }
.reciter__label { font-weight: 700; color: var(--muted); font-size: 1.05rem; white-space: nowrap; }
.reciter select {
  min-height: 52px; max-width: 100%; padding: .3rem 1rem; border: 0; border-radius: 999px;
  font: inherit; font-weight: 700; font-size: 1.05rem; color: var(--ink); background: var(--sky); cursor: pointer;
}
.own-hint { background: var(--grape); border-radius: var(--radius); padding: .8rem 1.2rem; font-weight: 600; font-size: 1.1rem; }
.rec { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5rem; }
.rec .btn--mini { min-height: 46px; font-size: 1rem; }
.rec label.btn { cursor: pointer; }
.btn--rec.is-recording { background: var(--coral-edge); color: #fff; box-shadow: var(--press) #c94a3b; animation: pulse 1.2s ease-in-out infinite; }
.rec__badge { font-weight: 700; color: var(--mint-edge); }
.rec__error { flex-basis: 100%; color: var(--coral-edge); font-weight: 600; font-size: 1rem; }
.besmele .rec { flex-basis: 100%; }
.besmele .rec .btn--mini { width: auto; padding: .4rem 1rem; }
@keyframes pulse { 50% { transform: scale(1.06); } }

/* ---------- Voice picker, teacher tools, admin page ---------- */
.center { text-align: center; justify-self: center; }
.voice-bar { display: flex; justify-content: center; margin-bottom: 1.2rem; }
.lesson .voice-bar, .dua .voice-bar { margin-bottom: 0; justify-content: flex-start; }
.tile { touch-action: manipulation; }
.tiles .has-rec { display: grid; gap: .4rem; align-content: start; }
.rec--compact { gap: .3rem; }
.rec--compact .btn--mini { min-height: 40px; min-width: 40px; padding: 0 .5rem; font-size: .95rem; }
.rec__busy { font-weight: 700; color: var(--muted); font-size: 1rem; }
.btn--danger { background: var(--coral-edge); color: #fff; box-shadow: var(--press) #c94a3b; }
.manage { text-align: center; margin-top: 2rem; }
.manage__link { color: var(--muted); font-weight: 700; font-size: 1.05rem; padding: .6rem 1rem; border-radius: 999px; }
.manage__link:hover { background: #fff; }
.admin { display: grid; gap: 1.2rem; max-width: 760px; margin: 0 auto; }
.panel { display: grid; gap: .9rem; background: #fff; border-radius: var(--radius); padding: 1.2rem 1.4rem 1.4rem; box-shadow: 0 6px 0 rgb(29 43 79 / .1); }
.panel__title { font-size: 1.5rem; font-weight: 800; }
.field { display: grid; gap: .3rem; font-weight: 700; }
.field input, .admin__add input {
  font: inherit; font-size: 1.2rem; min-height: 56px; padding: .4rem 1rem;
  border: 3px solid #dbe5f5; border-radius: 16px; background: #f7faff; color: var(--ink);
}
.field input:focus, .admin__add input:focus { outline: none; border-color: var(--primary); }
.admin__list { display: grid; gap: .5rem; }
.admin__row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: .8rem; padding: .4rem .2rem; border-bottom: 2px dashed #e5ecf8; }
.admin__row:last-child { border-bottom: 0; }
.admin__row.is-hidden .admin__name { opacity: .45; text-decoration: line-through; }
.admin__name { font-weight: 700; font-size: 1.2rem; }
.admin__meta { color: var(--muted); font-weight: 600; font-size: 1rem; }
.admin__add { display: flex; gap: .6rem; flex-wrap: wrap; }
.admin__add input { flex: 1; min-width: 200px; }
.admin__how { color: var(--muted); font-size: 1.05rem; }

/* ---------- Video modal ---------- */
.video {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  padding: 1rem;
  background: rgb(15 25 50 / .85);
}
.video[hidden] { display: none; }
.video__box { width: min(1100px, 100%); }
.video__bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.video__title { color: #fff; font-weight: 800; font-size: 1.6rem; }
.video__frame { aspect-ratio: 16 / 9; width: 100%; max-height: calc(100vh - 140px); border-radius: 20px; overflow: hidden; background: #000; }
.video__frame iframe { width: 100%; height: 100%; border: 0; }

/* ---------- Animations ---------- */
@keyframes bob { 50% { transform: translateY(-8px) rotate(-3deg); } }
@keyframes twinkle { 50% { transform: scale(1.25) rotate(15deg); } }
@keyframes pop { 0% { transform: scale(.6); } 100% { transform: scale(1); } }
@keyframes fall { to { transform: translateY(420px) rotate(540deg); opacity: 0; } }

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  .home__choices { grid-template-columns: 1fr; }
  .home__greet { flex-direction: column; text-align: center; }
  .bubble::before { display: none; }
  .brand span { display: none; }
  .topbar { grid-template-columns: auto 1fr auto; gap: .5rem; }
  .topbar__center { justify-content: center; gap: .5rem; }
  .topnav a { padding-inline: .7rem; font-size: 1rem; }
  .topnav a [lang='ar'] { display: none; }
  .admin__row { grid-template-columns: 1fr auto; }
  .admin__row .admin__meta { grid-row: 2; }
  .surah-list { grid-template-columns: 1fr; }
  .arrow { width: 64px; height: 64px; font-size: 2.6rem; }
  .btn--nav { min-width: 0; flex: 1; }
  /* Phones: verse full width, arrows underneath */
  .step { grid-template-columns: 1fr 1fr; grid-template-areas: 'card card' 'prev next'; }
  .step__card { grid-area: card; }
  .step [data-step='prev'] { grid-area: prev; justify-self: start; }
  .step [data-step='next'] { grid-area: next; justify-self: end; }
  .surah__actions .btn { flex: 1; }
  .player { flex: 1; }
  .reciter { width: 100%; }
  .reciter select { flex: 1; min-width: 0; }
  .lesson__intro { flex-direction: column; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .confetti { display: none; }
}

/* ---------- Exercises (Alıştırma) ---------- */
.exercise__lead { text-align: center; color: var(--muted); font-weight: 600; max-width: 60ch; margin: -.6rem auto 1rem; }
.exercise__intro { font-size: 1.15rem; }
.exercise__grid { display: grid; gap: .6rem; background: #fff; border-radius: var(--radius); padding: .9rem; box-shadow: 0 6px 0 rgb(29 43 79 / .1); }
.exercise__row { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: .6rem; }
.exercise__cell-wrap { display: grid; gap: .3rem; align-content: start; }
.exercise__cell {
  width: 100%; min-height: 84px; border: 3px solid #dbe5f5; border-radius: 18px;
  background: #f7faff; color: var(--ink); font-family: var(--arabic);
  font-size: clamp(2rem, 3.6vw, 2.8rem); line-height: 1.7; padding: .2rem .3rem;
  transition: background-color .15s, border-color .15s, transform .1s; touch-action: manipulation;
}
.exercise__cell.is-word { font-size: clamp(1.6rem, 2.9vw, 2.3rem); }
.exercise__cell:active { transform: scale(.96); }
.exercise__cell.is-playing { border-color: var(--sun-edge); background: #fffbea; }
.exercise__links { display: flex; flex-wrap: wrap; gap: .6rem; }
.exercise__links .btn { min-height: 52px; font-size: 1.05rem; }
.video__tabs { margin-bottom: .8rem; flex-wrap: wrap; }
@media (max-width: 720px) {
  .exercise__grid { padding: .5rem; gap: .4rem; }
  .exercise__row { gap: .4rem; }
  .exercise__cell { min-height: 64px; border-radius: 12px; }
  .exercise__cell.is-word { font-size: 1.35rem; }
}

/* ---------- Compact top of the Elif Ba pages ---------- */
.btn--small { min-height: 52px; font-size: 1.05rem; padding-inline: 1.2rem; }
.voice-bar { gap: .8rem; flex-wrap: wrap; align-items: center; }
.lesson .surah__name { font-size: 2rem; }
.lesson .surah__ar { font-size: 1.9rem; }
.lesson__intro { padding: .7rem 1rem; gap: 1rem; }
.lesson__card { width: clamp(84px, 11vw, 110px); border-radius: 24px; }
.lesson__sample { font-size: clamp(2.2rem, 4vw, 3rem); }
.lesson__sample--wide { font-size: clamp(1.3rem, 2.2vw, 1.7rem); }
.lesson__explain { font-size: 1.05rem; gap: .1rem; line-height: 1.35; }
.lesson__example { font-size: 1.15rem; margin-top: .1rem; }
.tiles .tile { grid-template-rows: 1fr; }
.tiles--wide .tile { min-height: 110px; }

/* ---------- Zoom (one tile big) ---------- */
.zoom__box { position: relative; display: grid; justify-items: center; gap: 1rem; width: min(900px, 100%); }
.zoom__close { justify-self: end; }
.zoom__stage { display: flex; align-items: center; gap: clamp(.8rem, 4vw, 3rem); width: 100%; justify-content: center; }
.zoom__card {
  border: 0; cursor: pointer; display: grid; place-items: center;
  width: min(62vw, 560px); aspect-ratio: 4 / 3; border-radius: 48px; color: var(--ink);
}
.zoom__char { font-size: clamp(5rem, 13vw, 10rem); line-height: 1.4; white-space: nowrap; }
.zoom__count { color: #fff; font-weight: 800; font-size: 1.3rem; }
.zoom .arrow { width: 96px; height: 96px; font-size: 3.8rem; border: 0; }
.zoom .arrow:disabled { visibility: hidden; }
@media (max-width: 720px) {
  .zoom .arrow { width: 60px; height: 60px; font-size: 2.6rem; }
  .zoom__card { width: 70vw; border-radius: 28px; }
  .lesson__intro { flex-direction: row; text-align: left; }
}
.zoom__char.is-long { font-size: clamp(2.6rem, 6.5vw, 5.5rem); }

.zoom__card { width: auto; flex: 1 1 auto; max-width: 560px; min-width: 0; }
.zoom__char.is-long { font-size: clamp(3.2rem, 10vw, 7rem); }
.topnav a { white-space: nowrap; }
@media (max-width: 720px) {
  .zoom__stage { gap: .5rem; }
  .zoom .arrow { width: 52px; height: 52px; flex-shrink: 0; }
  .zoom__card { width: auto; }
  .topnav__icon, .topnav a [lang='ar'] { display: none; }
  .topnav a { padding-inline: .6rem; font-size: .95rem; min-height: 44px; }
  .lang { gap: .3rem; }
  .lang button { width: 46px; height: 34px; border-width: 3px; border-radius: 10px; }
  .btn--back { padding-inline: .8rem; min-height: 48px; font-size: 1rem; }
  .brand svg { width: 30px; height: 30px; }
}

/* ---------- Equal cards and tiles ---------- */
/* Cards in one row get the same height; long names wrap instead of pushing the Arabic out */
.surah-list > li, .ex-list > li { display: grid; }
.surah-card { grid-template-columns: auto minmax(0, 1fr) auto; min-height: 96px; height: 100%; }
.surah-card__text { min-width: 0; }
.surah-card__name { overflow-wrap: anywhere; }
.surah-card__ar { max-width: 46%; justify-self: end; text-align: right; line-height: 1.5; font-size: clamp(1.5rem, 2.4vw, 2.2rem); }
.surah-card__ar.lesson-card__ar { font-size: clamp(1.5rem, 2.4vw, 2rem); white-space: nowrap; max-width: none; }

/* Letter and lesson tiles: the character sits in the middle of the tile */
.tiles .tile { grid-template-rows: 1fr; place-items: center; align-content: stretch; padding: .4rem .5rem .7rem; }
.tile__char { height: auto; line-height: 1.6; white-space: nowrap; max-width: 100%; }
.tiles--wide .tile { height: 120px; min-height: 0; }
.tiles--wide .tile__char { font-size: clamp(2rem, 3vw, 2.6rem); }
.lesson__card { padding: .3rem; overflow: visible; }
.lesson__sample--wide { white-space: nowrap; font-size: clamp(1.1rem, 1.9vw, 1.5rem); }

/* Exercise cells: all the same size, text always inside */
.exercise__cell {
  height: 96px; min-height: 0; display: grid; place-items: center;
  line-height: 1.4; white-space: nowrap; overflow: visible; padding: 0 .3rem; /* too wide: fitCells makes it smaller */
}
.exercise__cell.is-word { font-size: clamp(1.5rem, 2.6vw, 2.1rem); }

/* ---------- Exercises: explanation ---------- */
.ex-how { background: #fff; border-radius: var(--radius); padding: 1rem 1.3rem 1.1rem; box-shadow: 0 6px 0 rgb(29 43 79 / .1); margin-bottom: 1.4rem; }
.ex-how__title { font-weight: 800; font-size: 1.35rem; margin-bottom: .5rem; }
.ex-how__steps { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.ex-how__steps li { display: flex; gap: .6rem; align-items: flex-start; font-weight: 600; font-size: 1.05rem; line-height: 1.35; }
.ex-how__num {
  flex-shrink: 0; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff; font-weight: 800; font-size: 1rem; line-height: 1;
}
.ex-part { margin: 1.4rem 0 .7rem; }
.ex-part__head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.ex-part__head .lesson__group { margin: 0; }
.ex-part__link { font-weight: 700; color: var(--primary); font-size: 1.05rem; padding: .2rem .7rem; border-radius: 999px; background: #fff; }
.ex-part__hint { color: var(--muted); font-weight: 600; font-size: 1.05rem; }
.ex-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.ex-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: 'page text' 'ar ar';
  align-items: center; gap: .5rem 1rem; height: 100%;
  padding: 1rem 1.1rem 1rem; border-radius: var(--radius); transition: transform .1s, box-shadow .1s;
}
.ex-card:active { transform: translateY(5px); }
.ex-card__page {
  grid-area: page; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px;
  background: #fff; font-weight: 800; font-size: 1.6rem; line-height: 1;
}
.ex-card__page small { font-size: .7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ex-card__text { grid-area: text; display: grid; gap: .3rem; min-width: 0; }
.ex-card__name { font-size: 1.3rem; font-weight: 800; line-height: 1.15; }
.ex-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; font-size: .95rem; font-weight: 600; color: var(--muted); }
.ex-card__ar {
  grid-area: ar; background: rgb(255 255 255 / .6); border-radius: 14px; padding: .1rem .8rem;
  font-size: 1.8rem; line-height: 2.1; text-align: center; white-space: nowrap; overflow-x: clip; overflow-y: visible;
}
.ex-tag { display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .6rem; border-radius: 999px; background: #fff; color: var(--ink); font-weight: 700; font-size: .9rem; white-space: nowrap; }
.ex-tag--test { background: var(--ink); color: #fff; }
.ex-intro { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem 1.4rem; background: var(--grape); border-radius: var(--radius); padding: .9rem 1.2rem; }
.ex-intro__text { flex: 1 1 380px; display: grid; gap: .3rem; font-weight: 600; font-size: 1.1rem; }
.ex-intro__title { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.2rem; }
.ex-steps { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; }
.ex-steps li { display: inline-flex; align-items: center; gap: .4rem; background: #fff; border-radius: 999px; padding: .3rem .9rem .3rem .35rem; font-weight: 700; font-size: 1rem; white-space: nowrap; }
.ex-steps .ex-how__num { width: 28px; height: 28px; font-size: .9rem; }

/* ---------- Top bar on narrow screens ---------- */
@media (max-width: 1000px) {
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; gap: .6rem; }
  .topbar__center { justify-content: center; min-width: 0; }
  .brand span { display: none; }
}
@media (max-width: 760px) {
  .ex-how__steps { grid-template-columns: 1fr; gap: .6rem; }
  .lang button { width: 46px; height: 34px; border-width: 3px; border-radius: 10px; }
  .topnav a { padding-inline: .7rem; font-size: 1rem; }
}
@media (max-width: 560px) {
  /* Back, logo, flags on the first row; the menu on its own row underneath */
  .topbar { grid-template-columns: auto 1fr auto; grid-template-areas: 'back brand lang' 'nav nav nav'; row-gap: .5rem; padding-inline: .8rem; }
  .topbar__center { display: contents; }
  .btn--back { grid-area: back; }
  .brand { grid-area: brand; justify-self: center; }
  .lang { grid-area: lang; }
  .topnav { grid-area: nav; justify-self: stretch; justify-content: space-between; }
  .topnav a { flex: 1; justify-content: center; padding-inline: .4rem; }
  .ex-list { grid-template-columns: 1fr; }
  .exercise__cell { height: 72px; }
  .exercise__cell { padding: 0 .1rem; }
  .exercise__cell.is-word { font-size: clamp(.9rem, 3.9vw, 1.25rem); }
  .exercise.is-spaced .exercise__cell { font-size: clamp(.8rem, 3.4vw, 1.1rem); }
  .tiles--wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles--wide .tile { height: 96px; }
  .tiles--wide .tile__char { font-size: 1.7rem; }
  .surah-card__ar { font-size: 1.5rem; }
  .surah__actions, .player { min-width: 0; width: 100%; flex-wrap: wrap; }
  /* video and player each on their own full-width row (flex: 1 above would squeeze them into one) */
  .surah__actions > * { flex: 1 1 100%; }
  .player .btn { flex: 1 1 auto; padding-inline: .8rem; }
}
.surah, .lesson, .dua { grid-template-columns: minmax(0, 1fr); }

/* ---------- Every page uses the whole width, with room between the cards (like Ezber) ---------- */
.main { max-width: 1640px; }
.surah-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.8rem 2.2rem; margin-top: .6rem; }
.surah-card { padding: 1.2rem 1.6rem; min-height: 112px; }
.ex-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.8rem 2.2rem; }
.tiles { gap: 1.4rem; }
@media (max-width: 1000px) {
  .surah-list, .ex-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .surah-list, .ex-list { grid-template-columns: 1fr; gap: 1.2rem; }
  .tiles { gap: 1rem; }
}
/* Prayer names in Arabic are longer: one line, a bit smaller, so the Turkish/Dutch text keeps its room */
.main[data-page='dualar'] .surah-card__ar, .main[data-page='asr'] .surah-card__ar { white-space: nowrap; max-width: none; font-size: clamp(1.25rem, 1.7vw, 1.7rem); }

/* ---------- Kalın (blue), ince (green), peltek (red): letters keep their place, only the color tells ---------- */
.tone--kalin { --tone-bg: #e6eeff; --tone-edge: #2f56c9; --tone-ink: #1f3d99; }
.tone--ince { --tone-bg: #e2f6ec; --tone-edge: #24a06f; --tone-ink: #157350; }
.tone--peltek { --tone-bg: #ffe6e3; --tone-edge: #e0362b; --tone-ink: #c4231a; }
.tile.tone { background: var(--tone-bg); box-shadow: 0 7px 0 var(--tone-edge); }
.tile.tone .tile__char { color: var(--tone-ink); }
.exercise__cell.tone { border-color: var(--tone-edge); background: var(--tone-bg); color: var(--tone-ink); }
.exercise__cell.tone.is-playing { border-color: var(--sun-edge); background: #fffbea; }
.card--tone { background: var(--tone-bg); box-shadow: 0 10px 0 var(--tone-edge); }
.card--tone .zoom__char { color: var(--tone-ink); }
.tone-legend { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem .8rem; }
.tone-legend .tone { padding: .2rem .9rem; border-radius: 999px; background: var(--tone-edge); color: #fff; font-weight: 800; font-size: 1.05rem; }
.tone-legend__ra { padding: .2rem .9rem; border-radius: 999px; background: #fff; color: var(--muted); font-weight: 700; font-size: 1rem; }

/* ---------- Exercise groups (page 12: kalın, ince, peltek), each its own color, apart from each other ---------- */
.exercise__grid:has(.exercise__group) { gap: 1.6rem; }
.exercise__group { display: grid; gap: .6rem; padding: .8rem; border-radius: 20px; border: 3px solid var(--tone-edge); background: var(--tone-bg); }
.exercise__group-title { justify-self: start; padding: .15rem .9rem; border-radius: 999px; background: var(--tone-edge); color: #fff; font-weight: 800; font-size: 1.1rem; }
.exercise__group .exercise__cell { border-color: var(--tone-edge); background: #fff; color: var(--tone-ink); }
.exercise__group .exercise__cell.is-playing { border-color: var(--sun-edge); background: #fffbea; }
.tile--plain { background: #fff; box-shadow: 0 7px 0 #cdd7e6; } /* Ra: no kalın / ince color of its own */

/* ---------- Page 10: a light color per column (başta, ortada, sonda) with a heading ---------- */
.col--basta { --col-bg: #fff3c4; --col-edge: #f2cf5b; --col-ink: #8a6500; }
.col--ortada { --col-bg: #e3f0ff; --col-edge: #8fbcf0; --col-ink: #23589a; }
.col--sonda { --col-bg: #ffe4ec; --col-edge: #f2a0b8; --col-ink: #a3304f; }
.exercise__cell.col { background: var(--col-bg); border-color: var(--col-edge); }
.exercise__heads { align-items: end; }
.col-head {
  justify-self: center; padding: .2rem 1rem; border-radius: 999px; border: 3px solid var(--col-edge);
  background: var(--col-bg); color: var(--col-ink); font-weight: 800; font-size: 1.15rem;
}
@media (max-width: 720px) { .col-head { padding: .1rem .5rem; font-size: .95rem; } }

/* ---------- Phones and iPads: nothing sticks out of its card ---------- */
/* Long Latin words (Bismillâhirrahmânirrahîm) may wrap; Arabic words never break, the line wraps between words */
.ayah__latin, .besmele__latin, .surah__about, .surah__name, .lesson__explain { overflow-wrap: anywhere; }
.ayah, .step__card, .besmele { min-width: 0; }
.ayah__ar, .besmele__ar { max-width: 100%; overflow-wrap: normal; word-break: keep-all; }
@media (max-width: 720px) {
  .step { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ayah { padding: 1rem .9rem 1.1rem; }
  .ayah__ar { font-size: clamp(1.85rem, 8vw, 2.4rem); line-height: 2.2; }
  .ayah--big .ayah__ar { font-size: clamp(2rem, 9vw, 2.8rem); line-height: 2.1; }
  .ayah__latin { font-size: 1.15rem; }
  .ayah--big .ayah__latin { font-size: 1.3rem; }
  .surah__name { font-size: 2rem; }
  .surah__ar { font-size: 1.8rem; }
}
/* Exercise words a size bigger on phones; a word that does not fit is made smaller by fitCells (exercises.js) */
@media (max-width: 560px) {
  .exercise__cell.is-word { font-size: clamp(1.15rem, 5.2vw, 1.6rem); }
  .exercise.is-spaced .exercise__cell { font-size: clamp(1.05rem, 4.6vw, 1.4rem); }
}
