/* المدود بصوت ميار — الأنماط */
:root {
  --navy: #072030; --navy-2: #0a3855; --blue: #0065a5; --sky: #2ea3f2; --gold: #ffc40e;
  --bg: #fbf7ef; --card: #ffffff; --ink: #15202b; --muted: #5b6b7a; --line: #e6e0d4;
  --green: #159a6b; --green-bg: #e3f6ee; --green-ink: #0b6b49;
  --amber: #e08a00; --amber-bg: #fff3dc; --amber-ink: #8a5300;
  --violet: #6d3fd3; --violet-bg: #efe8ff; --violet-ink: #4a2797;
  --blue-bg: #e3f1fb; --blue-ink: #054a78;
  --radius: 18px; --shadow: 0 10px 30px rgba(7, 32, 48, .08);
  --ui: 'Cairo', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --quran: 'Amiri', 'Scheherazade New', 'Traditional Arabic', serif;
}
.g-green { --g: var(--green); --g-bg: var(--green-bg); --g-ink: var(--green-ink); }
.g-amber { --g: var(--amber); --g-bg: var(--amber-bg); --g-ink: var(--amber-ink); }
.g-violet { --g: var(--violet); --g-bg: var(--violet-bg); --g-ink: var(--violet-ink); }
.g-blue { --g: var(--blue); --g-bg: var(--blue-bg); --g-ink: var(--blue-ink); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--ui); color: var(--ink); line-height: 1.7; background: var(--bg);
  background-image:
    radial-gradient(circle at 15% 10%, rgba(46,163,242,.08), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(255,196,14,.10), transparent 40%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23072030' stroke-opacity='.06' stroke-width='1'%3E%3Cpath d='M36 6l8 22 22 8-22 8-8 22-8-22-22-8 22-8z'/%3E%3Cpath d='M36 14l5 17 17 5-17 5-5 17-5-17-17-5 17-5z'/%3E%3C/g%3E%3C/svg%3E");
  background-attachment: fixed;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .4em; font-weight: 900; }
p { margin: 0 0 .8em; }
.small { font-size: .9rem; color: var(--muted); }
.quran { font-family: var(--quran); font-size: 1.45em; line-height: 2.1; direction: rtl; }
mark.m { background: linear-gradient(transparent 55%, color-mix(in srgb, var(--g, var(--gold)) 45%, transparent) 55%); color: var(--g-ink, inherit); padding: 0 .08em; border-radius: 4px; font-weight: 700; }
.skip { position: absolute; right: -999px; top: 8px; background: var(--gold); padding: 6px 12px; border-radius: 8px; }
.skip:focus { right: 8px; z-index: 100; }

/* الرأس */
.top { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--navy); color: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.2); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-weight: 900; font-size: 1.1rem; white-space: nowrap; }
.brand img { border-radius: 9px; }
.topnav { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.topnav a { color: #dfe9f2; padding: 6px 10px; border-radius: 999px; font-weight: 600; font-size: .92rem; }
.topnav a:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.topnav a.pill { background: var(--gold); color: var(--navy); }
main { max-width: 1120px; margin: 0 auto; padding: 16px; }

/* الأزرار */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 999px; font-weight: 800; font-family: inherit; font-size: 1rem; border: 2px solid var(--navy); color: var(--navy); background: #fff; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn.primary { background: var(--navy); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }

/* زر التشغيل */
.play { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; background: var(--g, var(--blue)); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--g, var(--blue)) 40%, transparent); transition: transform .15s; font-family: inherit; }
.play:hover { transform: scale(1.06); }
.play:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.play .ico { width: 0; height: 0; border-style: solid; border-width: 9px 0 9px 15px; border-color: transparent transparent transparent #fff; margin-right: -3px; transition: all .15s; }
.play.playing .ico { width: 14px; height: 16px; border: 0; margin: 0; background: linear-gradient(90deg, #fff 0 36%, transparent 36% 64%, #fff 64%); }
.play.big { width: 128px; height: 128px; }
.play.big .ico { border-width: 24px 0 24px 40px; margin-right: -8px; }
.play.big.playing .ico { width: 36px; height: 40px; border: 0; margin: 0; }
.ring { position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--g, var(--blue)); opacity: 0; pointer-events: none; }
.playing .ring { animation: ring 1.8s ease-out infinite; }
.playing .r2 { animation-delay: .6s; } .playing .r3 { animation-delay: 1.2s; }
.play.nudge { animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes ring { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.9); opacity: 0; } }

/* الحركات */
.beats { display: inline-flex; gap: 7px; align-items: center; }
.beats .dot { width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid var(--g, var(--blue)); background: transparent; transition: transform .2s; }
.beats .dot.solid { background: var(--g, var(--blue)); }
.beats .dot.hollow { border-style: dashed; opacity: .7; }
.beats.animate .dot { animation: beat .9s ease-in-out infinite; animation-delay: calc(var(--i) * .3s); }
@keyframes beat { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.55); box-shadow: 0 0 0 5px color-mix(in srgb, var(--g, var(--blue)) 25%, transparent); } }

/* البطل */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: center; padding: 28px 0 12px; }
.kicker { color: var(--blue); font-weight: 800; letter-spacing: .02em; margin-bottom: .2em; font-size: .95rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); color: var(--navy); }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 46ch; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.stats { list-style: none; display: flex; gap: 22px; padding: 0; margin: 10px 0 0; flex-wrap: wrap; }
.stats li { display: flex; flex-direction: column; }
.stats strong { font-size: 1.9rem; color: var(--navy); line-height: 1; }
.stats span { color: var(--muted); font-size: .9rem; }
.hero-art { background: var(--navy); color: #fff; border-radius: 28px; padding: 28px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.hero-art::before { content: ''; position: absolute; inset: -40% -20% auto auto; width: 70%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, rgba(46,163,242,.35), transparent 65%); }
.stretch { position: relative; display: flex; justify-content: center; align-items: baseline; font-size: 5rem; direction: rtl; gap: 0; }
.stretch .alif { display: inline-block; color: var(--gold); animation: stretch 3.6s ease-in-out infinite; transform-origin: bottom center; }
@keyframes stretch { 0%, 15% { transform: scaleY(1); } 45%, 60% { transform: scaleY(1.35); } 90%, 100% { transform: scaleY(1); } }
.legend { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.lg { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; background: rgba(255,255,255,.08); padding: 4px 10px; border-radius: 999px; }
.lg i { width: 10px; height: 10px; border-radius: 50%; background: var(--g); display: inline-block; }

.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 0 32px; }
.how-item { background: var(--card); border-radius: var(--radius); padding: 16px; display: flex; gap: 12px; align-items: flex-start; box-shadow: var(--shadow); }
.how-item .num { flex: none; width: 38px; height: 38px; border-radius: 12px; background: var(--gold); color: var(--navy); font-weight: 900; display: grid; place-items: center; font-size: 1.2rem; }
.how-item p { margin: 0; }

.sec-title { font-size: 1.7rem; color: var(--navy); }
.sec-sub { color: var(--muted); max-width: 70ch; }

/* الشجرة */
.tree-wrap { margin: 24px 0 36px; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-right: 22px; padding-right: 18px; border-right: 2px dashed #c9c1b1; margin-top: 8px; }
.tree li { position: relative; margin: 8px 0; }
.tree li::before { content: ''; position: absolute; right: -20px; top: 22px; width: 18px; border-top: 2px dashed #c9c1b1; }
.tree > .root::before { display: none; }
.node { display: inline-flex; flex-direction: column; padding: 8px 16px; border-radius: 14px; background: var(--g-bg, #fff); color: var(--g-ink, var(--navy)); border: 2px solid var(--g, var(--navy)); font-weight: 800; }
.node small { font-weight: 600; opacity: .8; font-size: .8rem; }
.root-node { background: var(--navy); color: #fff; border-color: var(--navy); font-size: 1.3rem; padding: 10px 26px; }
.leaf { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.leaf > a { display: inline-flex; align-items: baseline; gap: 10px; background: #fff; border: 1.5px solid color-mix(in srgb, var(--g) 50%, transparent); padding: 6px 14px; border-radius: 999px; color: var(--ink); transition: box-shadow .15s, transform .15s; }
.leaf > a:hover { text-decoration: none; box-shadow: var(--shadow); transform: translateX(-2px); }
.leaf-name { font-weight: 800; }
.leaf-beats { font-size: .78rem; color: var(--g-ink); background: var(--g-bg); padding: 1px 8px; border-radius: 999px; }
.dot-play { width: 32px; height: 32px; }
.dot-play .ico { border-width: 6px 0 6px 10px; margin-right: -2px; }
.dot-play.playing .ico { width: 10px; height: 11px; }
.has-kids > ul { flex-basis: 100%; }

/* المجموعات والبطاقات */
.group { margin: 10px 0 34px; }
.group-head { border-right: 6px solid var(--g); padding-right: 14px; margin-bottom: 14px; }
.group-head h2 { color: var(--g-ink); font-size: 1.5rem; }
.group-head p { color: var(--muted); margin: 0; max-width: 70ch; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); border-top: 6px solid var(--g); display: flex; flex-direction: column; gap: 6px; transition: transform .15s; }
.card:hover { transform: translateY(-3px); }
.card.playing { outline: 3px solid var(--g); outline-offset: 2px; }
.card-head { display: flex; justify-content: space-between; align-items: center; }
.badge { font-size: .8rem; font-weight: 800; color: var(--g-ink); background: var(--g-bg); padding: 2px 10px; border-radius: 999px; }
.card-title { font-size: 1.2rem; margin: 4px 0 0; }
.card-title a { color: var(--navy); }
.card-alt { color: var(--muted); font-size: .88rem; margin: 0; min-height: 1.5em; }
.card-ex { margin: 4px 0; color: var(--ink); }
.card-link { margin-top: auto; font-weight: 700; font-size: .92rem; }

.about { background: var(--card); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin: 20px 0 30px; }

/* صفحة الصوت */
.crumbs { font-size: .9rem; color: var(--muted); margin: 6px 0 14px; }
.sound-head { text-align: center; padding: 10px 0 0; }
.sound-head h1 { font-size: clamp(1.9rem, 5vw, 3rem); color: var(--g-ink); }
.sound-head .alt { color: var(--muted); font-size: 1.05rem; }
.player { display: flex; flex-direction: column; align-items: center; gap: 12px; background: var(--card); border-radius: 28px; padding: 30px 20px 22px; box-shadow: var(--shadow); margin: 10px auto 18px; max-width: 640px; border: 2px solid var(--g-bg); }
.player-hint { margin: 0; color: var(--muted); font-weight: 700; min-height: 1.6em; }
.progress { width: 100%; max-width: 420px; height: 8px; background: var(--g-bg); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--g); transition: width .2s linear; }
.measure { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.measure-label { font-weight: 800; color: var(--muted); }
.measure-text { font-weight: 800; color: var(--g-ink); }
.info { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.box { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.box h2 { font-size: 1.05rem; color: var(--g-ink); display: inline-block; border-bottom: 3px solid var(--g); padding-bottom: 2px; margin-bottom: 10px; }
.box p { margin: 0; }
.box.wide { grid-column: 1 / -1; }
.box.tip { background: var(--g-bg); border: 1.5px dashed var(--g); }
.examples { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.examples li { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-radius: 12px; background: var(--bg); }
.examples li.is-mayar { background: var(--g-bg); border-right: 4px solid var(--g); }
.examples .ref { color: var(--muted); font-size: .85rem; }
.tag-mayar { background: var(--gold); color: var(--navy); font-size: .75rem; padding: 1px 8px; border-radius: 999px; margin-left: 4px; }
.kids { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.kids li { background: var(--bg); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; }
.kids a { font-weight: 800; }
.share { margin: 16px 0; }
.share details { background: var(--card); border-radius: var(--radius); padding: 12px 18px; box-shadow: var(--shadow); }
.share summary { cursor: pointer; font-weight: 800; color: var(--navy); }
.qr-one { width: 180px; margin: 12px auto 6px; }
.qr-one svg { width: 100%; height: auto; display: block; }
.pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; margin: 22px 0 10px; }
.pager a { background: var(--card); border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow); color: var(--navy); font-weight: 800; display: flex; flex-direction: column; }
.pager a small { color: var(--muted); font-weight: 600; }
.pager .next { text-align: left; }
.pager .home { align-self: center; background: var(--navy); color: #fff; }

/* ورقة QR */
.qr-intro { text-align: center; padding: 16px 0 8px; }
.qr-intro code { background: #fff; padding: 2px 8px; border-radius: 6px; direction: ltr; display: inline-block; }
.qsheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 14px 0 30px; }
.qcard { background: #fff; border: 2px dashed #c9c1b1; border-radius: 14px; padding: 12px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; border-top: 8px solid var(--g, var(--navy)); break-inside: avoid; page-break-inside: avoid; }
.qcard h3 { font-size: 1.05rem; color: var(--navy); margin: 0; }
.qcard-top { display: flex; justify-content: space-between; width: 100%; font-size: .72rem; color: var(--g-ink); font-weight: 700; }
.qcard .qr { width: 150px; height: 150px; }
.qcard .qr svg { width: 100%; height: 100%; display: block; }
.qcard-ex { margin: 0; font-size: 1.15rem; line-height: 1.6; }
.qcard-foot { margin: 0; font-size: .72rem; color: var(--muted); }
.qcard.title-card { background: var(--navy); color: #fff; border-color: var(--navy); }
.qcard.title-card h2 { color: var(--gold); font-size: 1.2rem; margin: 0; }
.qcard.title-card p { margin: 0; }
.qcard.title-card .small { color: #cfdbe6; }
.qcard.title-card .qr { background: #fff; padding: 6px; border-radius: 8px; }
.qcard.title-card .qcard-foot { color: #cfdbe6; }

/* الاختبار */
.quiz { max-width: 680px; margin: 0 auto; text-align: center; padding-top: 12px; }
.quiz h1 { color: var(--navy); }
.quiz-card { background: var(--card); border-radius: 28px; padding: 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.quiz-top { display: flex; justify-content: space-between; width: 100%; font-weight: 800; color: var(--muted); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.choice { font-family: inherit; font-size: 1rem; font-weight: 800; padding: 14px; border-radius: 14px; border: 2px solid var(--line); background: #fff; color: var(--navy); cursor: pointer; transition: transform .1s; }
.choice:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--blue); }
.choice.correct { background: var(--green-bg); border-color: var(--green); color: var(--green-ink); }
.choice.wrong { background: #fde8e8; border-color: #d33; color: #911; }
.feedback { min-height: 1.6em; font-weight: 800; margin: 0; }
.quiz .play.big { --g: var(--blue); }

/* التذييل */
.foot { background: var(--navy); color: #dfe9f2; margin-top: 30px; padding: 26px 16px; }
.foot-inner { max-width: 1120px; margin: 0 auto; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }
.foot-name { font-weight: 900; font-size: 1.2rem; color: #fff; }
.foot-meta { font-size: .9rem; }
.foot-note { font-size: .85rem; color: #a9bccb; max-width: 40ch; }

@media (max-width: 760px) {
  main { padding: 12px 16px; }
  .hero, .how, .info { grid-template-columns: 1fr; }
  .hero { padding-top: 10px; }
  .stretch { font-size: 3.6rem; }
  .tree ul { margin-right: 10px; padding-right: 12px; }
  .tree li::before { right: -14px; width: 12px; }
  .leaf > a { padding: 5px 10px; font-size: .92rem; }
  .pager { grid-template-columns: 1fr 1fr; }
  .pager .home { grid-column: 1 / -1; text-align: center; }
  .choices { grid-template-columns: 1fr; }
  .topnav a { padding: 5px 8px; font-size: .85rem; }
  .brand { font-size: .95rem; gap: 6px; }
  .brand img { width: 28px; height: 28px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff; }
  .top, .foot, .no-print, .skip { display: none !important; }
  main { max-width: none; padding: 0; }
  .qsheet { grid-template-columns: repeat(3, 1fr); gap: 6mm; margin: 0; }
  .qcard { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
