/* andalus.css: the kingdom's look. Day phases share the light tokens; night switches to the dark ones.
   The sky colours change with html[data-phase]: sunrise | day | sunset | night. */
:root {
  --bg: #FBF6F2; --card: #FFFCFA; --blush: #F7DCE3; --rose: #D98BA0; --rosewood: #A85A70;
  --blue: #C6E0F2; --sky: #4A7595; --gold: #C2A36B; --ink: #3F3236; --muted: #7A6A6E;
  --title: #A85A70; --line: rgba(194, 163, 107, .45); --btn-bg: #A85A70; --btn-fg: #FFFCFA;
  --shadow: 0 10px 30px rgba(168, 90, 112, .12);
  --font: "Amiri", "Noto Naskh Arabic", serif;
  /* the gate's materials by day */
  --plaster: #F3E8DA; --plaster2: #EBDDCB; --plaster3: #DCC8AE; --relief-d: #B89F80; --relief-l: #FFF9F0;
  --v1: #EBC3CD; --v2: #FBF2E8; --band: #4A7595; --band-ink: #F1DDA6;
  --mb1: #FFFFFF; --mb2: #ECE6DE; --mb3: #C9C0B4; --lamp-glass: #F6D9A0; --lamp: .45; --door-b: 1;
}
html[data-phase="sunset"] { --lamp: .75; --lamp-glass: #FFD48A; }
html[data-phase="night"] {
  --bg: #1F2433; --card: #262C42; --blush: #3A3550; --rose: #E8A3B5; --rosewood: #E8A3B5;
  --blue: #2A3045; --sky: #9CC3DF; --gold: #D9BE86; --ink: #F3E9EC; --muted: #B8B0C4;
  --title: #D9BE86; --line: rgba(217, 190, 134, .35); --btn-bg: #D9BE86; --btn-fg: #1F2433;
  --shadow: 0 10px 30px rgba(0, 0, 0, .3);
  --plaster: #2C3146; --plaster2: #343A52; --plaster3: #454C68; --relief-d: #1E2233; --relief-l: #565E7E;
  --v1: #5A4660; --v2: #3B3D58; --band: #1E2A44; --band-ink: #D9BE86;
  --mb1: #A6ACC0; --mb2: #7A8098; --mb3: #4E546C; --lamp-glass: #FFCE7A; --lamp: 1; --door-b: .78;
}

/* ---- sky palettes ---- */
html[data-phase="sunrise"] {
  --sk1: #C6E0F2; --sk2: #DCE8F3; --sk3: #F6E3E4; --sk4: #FBE3D6; --sea1: #A9CBE4; --sea2: #8FB8D8;
  --sun: #F8D98B; --glow: #F8D98B; --sun-up: .14; --refl: #F8D98B; --stars-o: 0; --moon-o: 0; --cloud-o: .55;
  --birds-o: .4; --use-moon: 0; --h1: #B5D3AE; --h2: #9DC1A2; --h3: #7FAA8C; --cy: #5E8A6E; --tint: #EAF2F8;
}
html[data-phase="day"] {
  --sk1: #9FC9E8; --sk2: #B9D9EF; --sk3: #D4E7F4; --sk4: #E6F1F8; --sea1: #8DB7DA; --sea2: #6E9CC6;
  --sun: #FFF4D6; --glow: #FFF4D6; --sun-up: .3; --refl: #FFFFFF; --stars-o: 0; --moon-o: 0; --cloud-o: .9;
  --birds-o: 0; --use-moon: 0; --h1: #A9CBA6; --h2: #8FB39A; --h3: #6E9C86; --cy: #557A66; --tint: #EEF5FA;
}
html[data-phase="sunset"] {
  --sk1: #B9B3DA; --sk2: #D9A6C8; --sk3: #F2A7BB; --sk4: #F9CDB0; --sea1: #7E98BE; --sea2: #5E7FA8;
  --sun: #F6A98A; --glow: #F6A98A; --sun-up: .07; --refl: #F6A98A; --stars-o: 0; --moon-o: 0; --cloud-o: 0;
  --birds-o: .75; --use-moon: 0; --h1: #9DBB98; --h2: #7FA58C; --h3: #648F7C; --cy: #557A66; --tint: #F7DCE3;
}
html[data-phase="night"] {
  --sk1: #10152B; --sk2: #161C38; --sk3: #1E2546; --sk4: #2A3358; --sea1: #24334A; --sea2: #1A2638;
  --sun: #F6A98A; --glow: #F6A98A; --sun-up: -.5; --refl: #E9D8A6; --stars-o: 1; --moon-o: 1; --cloud-o: 0;
  --birds-o: 0; --use-moon: 1; --h1: #2E4A40; --h2: #263D35; --h3: #1F332C; --cy: #1C2E27; --tint: #1B2140;
}

/* ---- page ---- */
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--font); font-size: 19px; line-height: 2;
  background: linear-gradient(to bottom, var(--tint), var(--bg) 75vh) no-repeat fixed;
  transition: color .8s; -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
.app { position: relative; }
.main { position: relative; z-index: 3; }
.topbar { position: relative; z-index: 6; }
html.home .main { position: static; z-index: auto; }
html.home body { overflow: hidden; }
.main { max-width: 1000px; margin: 0 auto; padding: 0 16px 24px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.nastaliq { font-family: "Noto Nastaliq Urdu", "Aref Ruqaa", serif; font-weight: 400; word-spacing: .18em; }
.quran { font-family: "Amiri Quran", "Amiri", serif; }
a { color: var(--sky); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }

/* ---- top bar ---- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1000px; margin: 0 auto; padding: 10px 16px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--title); font-weight: 700; font-size: 18px; white-space: nowrap; }
.brand .icon { width: 30px; height: 30px; }
.sky-picker { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.chip { font: inherit; font-size: 15px; line-height: 1.6; padding: 1px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--muted); transition: background .3s, color .3s; }
.chip.on { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-fg); }
@media (max-width: 560px) { .brand span { display: none; } .chip { font-size: 14px; padding: 0 9px; } }

/* ---- stage: the portal beside its words ---- */
.stage { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px 40px; align-items: center; padding-top: 4px; }
@media (min-width: 860px) { .stage { grid-template-columns: minmax(0, 420px) minmax(0, 1fr); } .court .rooms { grid-column: 1 / -1; } }
.stage-text { text-align: center; }
.portal { position: relative; width: min(100%, 470px); aspect-ratio: 560 / 660; margin: 0 auto; border-radius: 6px; overflow: hidden; }
.portal-svg { display: block; width: 100%; height: 100%; }
@media (max-width: 560px) { .portal { width: min(100%, 420px); } }
@media (min-width: 860px) { .stage { grid-template-columns: minmax(0, 470px) minmax(0, 1fr) !important; } }

.chapter-title { color: var(--title); font-size: clamp(26px, 6vw, 38px); line-height: 2.5; margin: 0; padding-top: .2em; transition: color .8s; }
.title-xl { font-size: clamp(30px, 7vw, 46px); }
.ink-go { animation: ink 1.7s cubic-bezier(.45, .05, .35, 1) both; }
@keyframes ink { from { clip-path: inset(-30% 0 -30% 100%); } to { clip-path: inset(-30% 0 -30% 0); } }
.lead { margin: 0; font-size: 20px; }
.hint { color: var(--muted); font-size: 16px; margin: 6px 0 0; }
.err { color: var(--rosewood); min-height: 2em; margin: 4px 0 0; font-size: 17px; }
.sky-ayah { margin: 0 0 6px; }
.sky-ayah .quran { font-size: 25px; color: var(--sky); }
.ref { color: var(--muted); font-size: 15px; }
.law { margin: 14px auto 0; max-width: 34em; padding: 10px 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 19px; }

/* ---- the gate's form ---- */
.pass { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 18px auto 0; max-width: 440px; }
.pass input { flex: 1 1 200px; min-width: 0; font: inherit; font-size: 21px; line-height: 1.6; padding: 8px 18px; text-align: center;
  border: 1.5px solid var(--gold); border-radius: 999px; background: var(--card); color: var(--ink); }
.pass input::placeholder { color: var(--muted); opacity: .7; }
.btn { font: inherit; font-weight: 700; font-size: 18px; line-height: 1.6; padding: 8px 24px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--btn-bg); background: var(--btn-bg); color: var(--btn-fg); transition: transform .2s, background .4s; }
.btn:hover { transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--rosewood); border-color: var(--line); }
.shake { animation: shake .5s; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

/* ---- the portal's drawing ---- */
.sk1 { stop-color: var(--sk1); } .sk2 { stop-color: var(--sk2); } .sk3 { stop-color: var(--sk3); } .sk4 { stop-color: var(--sk4); }
.sea1 { stop-color: var(--sea1); } .sea2 { stop-color: var(--sea2); }
.glow1 { stop-color: var(--glow); stop-opacity: .6; } .glow2 { stop-color: var(--glow); stop-opacity: 0; }
:is(.sk1, .sk2, .sk3, .sk4, .sea1, .sea2, .glow1, .glow2) { transition: stop-color 2s ease; }
.z-base { fill: var(--blue); transition: fill 1.5s; }
.z-line { fill: none; stroke: var(--sky); stroke-width: 1; transition: stroke 1.5s; }
.z-dot { fill: var(--rose); }
.hill { transition: fill 2s; } .h1 { fill: var(--h1); } .h2 { fill: var(--h2); } .h3 { fill: var(--h3); }
.cypress { fill: var(--cy); transition: fill 2s; }
.bush-leaf { fill: none; stroke: #7FA58C; stroke-width: 4; stroke-linecap: round; }
.stars { fill: #F3E9EC; opacity: var(--stars-o); transition: opacity 2s; }
.stars circle { animation: twinkle 3.2s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.moon { opacity: var(--moon-o); transition: opacity 2s; } .moon-disc { fill: #E9D8A6; } .moon-cut { fill: var(--sk2); }
.clouds { fill: #FFFFFF; opacity: var(--cloud-o); transition: opacity 2s; }
.birds { fill: none; stroke: #7B6A9B; stroke-width: 1.4; stroke-linecap: round; opacity: var(--birds-o); transition: opacity 2s; }
.bird-drift { animation: birds 22s linear infinite alternate; }
@keyframes birds { from { transform: translateX(-12px); } to { transform: translateX(26px); } }
.sun-wrap { transform: translate(var(--sx), calc(var(--hz) * (1 - var(--sun-up)))); transition: transform 2.5s cubic-bezier(.4, 0, .2, 1); }
.sun-disc { fill: var(--sun); transition: fill 2s; }
.sun-bob { animation: bob 9s ease-in-out infinite alternate; }
@keyframes bob { from { transform: translateY(-3px); } to { transform: translateY(4px); } }
.refl { fill: var(--refl); opacity: .8; transform: translate(calc(var(--rx) + (var(--rmx) - var(--rx)) * var(--use-moon)), var(--hz));
  transition: transform 2s, fill 2s; }
html[data-phase="day"] .refl { opacity: .45; }
.wave { animation: wave 5s ease-in-out infinite; }
@keyframes wave { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-6px); } }

/* ---- the gate: stone, plaster, marble, brass (colours follow the sky) ---- */
.wall { fill: var(--plaster); transition: fill 1.5s; }
.wall-tex { opacity: .55; }
.pl-base { fill: var(--plaster2); transition: fill 1.5s; }
.pl-mid, .pl-shadow, .pl-light { fill: none; stroke-width: 2.2; stroke-linecap: round; }
.pl-mid { stroke: var(--plaster3); } .pl-shadow { stroke: var(--relief-d); } .pl-light { stroke: var(--relief-l); }
.vs1 { fill: var(--v1); transition: fill 1.5s; } .vs2 { fill: var(--v2); transition: fill 1.5s; }
:is(.vs1, .vs2) { stroke: var(--relief-d); stroke-width: .8; }
.gold-line { fill: none; stroke: var(--gold); }
.cornice { fill: var(--plaster2); stroke: var(--relief-d); stroke-width: 1; }
.dentil { fill: var(--plaster); stroke: var(--relief-d); stroke-width: 1; }
.band { fill: var(--band); transition: fill 1.5s; }
.callig { font-family: "Amiri Quran", "Amiri", serif; font-size: 24px; fill: var(--band-ink); }
.band-star rect { fill: none; stroke: var(--band-ink); stroke-width: 1.4; }
.mb1 { stop-color: var(--mb1); } .mb2 { stop-color: var(--mb2); } .mb3 { stop-color: var(--mb3); }
.cap-abacus, .plinth { fill: var(--mb2); stroke: var(--relief-d); stroke-width: 1; }
.cap-carve { fill: none; stroke: var(--relief-d); stroke-width: 1.2; }
.cap-ring { fill: var(--gold); opacity: .85; }
.vein { fill: none; stroke: var(--relief-d); stroke-width: .8; opacity: .55; }
.threshold { fill: var(--mb2); stroke: var(--relief-d); stroke-width: 1; }
.reveal-shadow { stroke: rgba(40, 25, 20, .28); stroke-width: 14; }
.vstem { fill: none; stroke: #6B8F5E; stroke-width: 2.4; stroke-linecap: round; }
.vleaf { fill: #8FB39A; stroke: #5E8A6E; stroke-width: 1.6; } .vleaf.dark { fill: #6E9C86; }
.iron { fill: none; stroke: #3A2E28; stroke-width: 3; stroke-linecap: round; } .iron.thin { stroke-width: 2; }
.chain { stroke: #6B5A3E; stroke-width: 2; stroke-dasharray: 3 2; }
.brass-line { stroke: #6E5020; stroke-width: 1; }
.brass-frame { fill: none; stroke: #B48A3C; stroke-width: 1.8; }
.lamp-glass { fill: var(--lamp-glass); transition: fill 1.5s; }
.lamp-stars { fill: #B48A3C; }
.lamp1 { stop-color: #FFE2A0; stop-opacity: .95; } .lamp2 { stop-color: #FFC873; stop-opacity: .35; } .lamp3 { stop-color: #FFC873; stop-opacity: 0; }
.lamp-glow { opacity: var(--lamp); }
.lamp-pool { opacity: calc(var(--lamp) * .8); mix-blend-mode: soft-light; }
@keyframes flicker { 0%, 100% { opacity: var(--lamp); } 30% { opacity: calc(var(--lamp) * .82); } 34% { opacity: calc(var(--lamp) * .95); } 62% { opacity: calc(var(--lamp) * .88); } }

/* ---- the gate's doors (HTML over the drawing, clipped to the scalloped arch) ---- */
.doors { position: absolute; left: var(--dx); top: var(--dy); width: var(--dw); height: var(--dh);
  display: flex; direction: ltr; perspective: 1300px; }
.door { position: relative; flex: 1; height: 100%; transition: transform 1.9s cubic-bezier(.55, .05, .3, 1), filter 1.5s; filter: brightness(var(--door-b)); }
.door.l { transform-origin: left center; } .door.r { transform-origin: right center; }
.door svg { display: block; width: 100%; height: 100%; }
.opening .door.l { transform: rotateY(-100deg); } .opening .door.r { transform: rotateY(100deg); }
.spill { position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse 40% 60% at 50% 60%, rgba(255, 226, 170, .95), rgba(255, 210, 140, .35) 45%, transparent 75%); }
.opening .spill { animation: spill 2.4s ease-out both; }
@keyframes spill { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }

/* rain (the right word): thin drops over the whole gate, and a wet sheen on the stone */
.rain { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .6s; overflow: hidden; }
.rain span { position: absolute; top: -12%; left: var(--x); width: 1.8px; height: var(--h); opacity: var(--o); border-radius: 1px;
  background: linear-gradient(to bottom, transparent, var(--rain)); transform: rotate(10deg);
  animation: drop var(--d) linear infinite; animation-delay: var(--delay); animation-play-state: paused; }
.raining .rain { opacity: 1; }
.raining .rain span { animation-play-state: running; }
@keyframes drop { to { transform: translate(-22px, 125vh) rotate(10deg); } }
.wet { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1.2s;
  background: linear-gradient(120deg, transparent 20%, rgba(255, 255, 255, .18) 35%, transparent 50%, rgba(255, 255, 255, .12) 70%, transparent 85%),
              linear-gradient(to bottom, rgba(60, 78, 110, .26), rgba(60, 78, 110, .1)); }
.gate-layer { --rain: rgba(96, 126, 168, .95); }
html[data-phase="night"] .gate-layer { --rain: rgba(214, 230, 255, .95); }
.raining .wet { opacity: 1; }

/* ---- rooms ---- */
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 14px; margin-top: 26px; }
.room { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--ink);
  font: inherit; cursor: pointer; padding: 26px 10px 14px; border-radius: 90px 90px 16px 16px; background: var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .3s, background .8s; }
.room:hover { transform: translateY(-3px); }
.room .icon { width: 38px; height: 38px; color: var(--sky); }
.room-name { font-weight: 700; font-size: 20px; line-height: 1.7; }
.room-sub { color: var(--muted); font-size: 15px; line-height: 1.5; }
.room.locked { opacity: .62; }
.soon { position: absolute; top: 8px; font-size: 12px; line-height: 1.6; padding: 0 8px; border-radius: 999px; background: var(--blush); color: var(--rosewood); }

/* ---- garden ---- */
.banner { height: 150px; margin: 0 -16px; border-radius: 0 0 28px 28px; overflow: hidden; }
.banner-svg { display: block; width: 100%; height: 100%; }
@media (min-width: 700px) { .banner { margin: 0; border-radius: 28px; height: 180px; } }
.back { display: inline-block; margin-top: 12px; text-decoration: none; font-size: 17px; }
.chapter { text-align: center; max-width: 36em; margin: 0 auto 10px; }
.beds { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 150px)); justify-content: center; gap: 10px 14px; margin-top: 14px; }
.bed { position: relative; display: flex; flex-direction: column; align-items: center; border: 0; background: none; cursor: pointer;
  padding: 6px 4px 10px; border-radius: 20px; font: inherit; color: var(--ink); -webkit-tap-highlight-color: transparent; }
.bed:hover .flower-svg { transform: translateY(-2px); }
.flower-svg { width: 112px; height: 150px; transition: transform .4s; overflow: visible; }
.soil { width: 72%; height: 14px; margin-top: -12px; border-radius: 50%; background: var(--blush); opacity: .8; }
.bed-label { margin-top: 4px; font-size: 17px; line-height: 1.7; min-height: 1.7em; color: var(--muted); }
.bed.is-open .bed-label { color: var(--rosewood); font-weight: 700; }
.bed.today:not(.is-open) .bed-label { color: var(--rosewood); }
.day-no { position: absolute; top: 2px; inset-inline-start: 8px; font-size: 13px; line-height: 1.6; color: var(--muted); }
.bed.today .day-no { color: var(--rosewood); font-weight: 700; }
.day-count { margin: 8px 0 0; color: var(--sky); font-size: 17px; }
.bed-title { text-align: center; font-size: 20px; font-weight: 700; color: var(--title); margin: 18px 0 0; }
.month { margin: 22px auto 0; max-width: 820px; border-top: 1px solid var(--line); padding-top: 8px; }
.month summary { cursor: pointer; text-align: center; font-weight: 700; font-size: 18px; color: var(--title); list-style: none; }
.month summary::-webkit-details-marker { display: none; }
.month summary::before { content: "▾ "; color: var(--gold); }
.month:not([open]) summary::before { content: "◂ "; }
.garden > .beds { grid-template-columns: repeat(auto-fit, minmax(96px, 116px)); }
.garden > .beds .flower-svg { width: 100px; height: 134px; }
.beds.small { grid-template-columns: repeat(auto-fit, minmax(92px, 108px)); }
.beds.small .flower-svg { width: 84px; height: 112px; }
.hint2 { color: var(--rosewood); animation: ink 1.4s ease both; }

.flower .head .layer { transform-box: fill-box; transform-origin: center; opacity: 1;
  transition: transform 1.2s cubic-bezier(.2, .8, .2, 1), opacity .7s ease; }
.flower.is-bud .head .layer { transform: scale(.12) rotate(-60deg); opacity: 0; }
.flower.is-open .head :is(.r-mid, .j-core) { transition-delay: .08s; }
.flower.is-open .head :is(.r-inner, .j-small) { transition-delay: .16s; }
.flower.is-open .head .r-core { transition-delay: .24s; }
.flower .bud { transform-box: fill-box; transform-origin: center bottom; transition: opacity .45s, transform .6s; }
.flower.is-open .bud { opacity: 0; transform: scale(.5); }
.flower.is-bud:not(.locked) .bud { animation: invite 2.4s ease-in-out infinite alternate; }
.flower.is-bud.locked .bud { animation: sway 3.6s ease-in-out infinite alternate; }
.flower.locked .flower-svg { filter: saturate(.75); }
@keyframes invite { from { transform: scale(1); } to { transform: scale(1.07); } }
@keyframes sway { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }

/* ---- the flower's card ---- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(31, 36, 51, .42); animation: fade .3s ease both; }
.sheet { width: min(560px, 100%); max-height: 86vh; overflow: auto; box-sizing: border-box; text-align: center;
  padding: 24px 22px 22px; background: var(--card); border-top: 3px solid var(--gold); border-radius: 28px 28px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .18); animation: lift .65s cubic-bezier(.2, .8, .2, 1) both; }
@media (min-width: 700px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 28px; border: 1px solid var(--line); border-top: 3px solid var(--gold); } }
@keyframes fade { from { opacity: 0; } }
@keyframes lift { from { opacity: 0; transform: translateY(40px) scale(.97); } }
.kind { display: inline-block; font-size: 15px; line-height: 1.7; padding: 0 12px; border-radius: 999px; color: var(--sky); border: 1px solid var(--line); }
.ayah { font-size: 27px; line-height: 2.3; margin: 14px 0 4px; }
.said { margin: 12px 0 0; color: var(--muted); font-size: 17px; }
.hadith { font-size: 25px; font-weight: 700; line-height: 2; margin: 6px 0 4px; }
.prose { font-size: 22px; line-height: 2.1; margin: 14px 0 4px; }
.word { display: inline-block; margin: 14px 0 0; padding: 2px 16px; border-radius: 999px; background: var(--blush); color: var(--rosewood); font-size: 18px; }
.teaser { color: var(--muted); font-size: 17px; margin: 12px 0 0; }
.sheet .btn { margin-top: 16px; }

/* ---- toast, footer ---- */
.mk-toasts { right: 50%; transform: translateX(50%); bottom: 20px; width: min(92vw, 460px); }
.mk-toast { font-family: var(--font); font-size: 17px; line-height: 1.9; text-align: center; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 18px; padding: 10px 18px; box-shadow: var(--shadow); }
.foot { text-align: center; color: var(--muted); font-size: 15px; padding: 26px 16px 34px; }

/* ---- petals: a layer behind the content ---- */
.petals { position: fixed; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.petal { position: absolute; top: -4vh; left: var(--x); width: var(--w); height: calc(var(--w) * .72); background: var(--c);
  border-radius: 80% 0 80% 0; opacity: .62; animation: fall var(--d) linear infinite; animation-delay: var(--delay); }
html[data-petals="few"] .petal:nth-child(n+5) { display: none; }
@keyframes fall {
  0% { transform: translate(0, -4vh) rotate(0); }
  30% { transform: translate(calc(var(--dx) * .5), 30vh) rotate(calc(var(--rot) * .3)); }
  60% { transform: translate(calc(var(--dx) * -.2), 62vh) rotate(calc(var(--rot) * .6)); }
  100% { transform: translate(var(--dx), 108vh) rotate(var(--rot)); }
}
html.paused * { animation-play-state: paused !important; }

@media (prefers-reduced-motion: reduce) {
  .petals { display: none; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .2s !important; }
}

/* =====================================================================
   The full-screen wall, the walk-through and the living scene
   ===================================================================== */

/* what lives in each sky (opacity 0 hides a creature) */
html[data-phase="sunrise"] { --rise-o: 1; --home-o: 0; --bfly-o: .8; --boat-o: .9; --ff-o: 0; --dew-o: 1; --shoot-o: 0;
  --olive1: #8FA37A; --olive2: #B5C49A; --olive3: #6E8460; --trunk: #7A6A58; --sail: #FFF8EE; --hull: #7A5A44;
  --bush1: #6E9C76; --bush2: #86B08C; --grass: #6E9C76; --bird: #6A5A70; }
html[data-phase="day"] { --rise-o: 0; --home-o: 0; --bfly-o: 1; --boat-o: 1; --ff-o: 0; --dew-o: .25; --shoot-o: 0;
  --olive1: #8FA37A; --olive2: #B5C49A; --olive3: #6E8460; --trunk: #7A6A58; --sail: #FFFFFF; --hull: #7A5A44;
  --bush1: #6E9C76; --bush2: #86B08C; --grass: #6E9C76; --bird: #5B5468; }
html[data-phase="sunset"] { --rise-o: 0; --home-o: 1; --bfly-o: .3; --boat-o: .85; --ff-o: .15; --dew-o: 0; --shoot-o: 0;
  --olive1: #7F9470; --olive2: #A3B48C; --olive3: #5F7356; --trunk: #6B5A4C; --sail: #F7D6C8; --hull: #6B4A3A;
  --bush1: #5F8E6E; --bush2: #78A385; --grass: #5F8E6E; --bird: #5B4E66; }
html[data-phase="night"] { --rise-o: 0; --home-o: 0; --bfly-o: 0; --boat-o: 0; --ff-o: 1; --dew-o: 0; --shoot-o: 1;
  --olive1: #2B4036; --olive2: #355042; --olive3: #22342C; --trunk: #2A2A2A; --sail: #9AA7C0; --hull: #222;
  --bush1: #22402F; --bush2: #2C4D39; --grass: #2E4A3C; --bird: #A7A0B8; }

/* ---- layers: scene (1) < petals (2) < wall (3) < words and rooms (4) < top bar (6) ---- */
.home-world { position: fixed; inset: 0; }
.scene-layer { position: fixed; inset: 0; z-index: 1; overflow: hidden; transform: scale(1.08);
  transition: transform 2.6s cubic-bezier(.2, .7, .2, 1); }
.scene-layer.inside, html.walking .scene-layer { transform: none; }
.scene-svg { display: block; width: 100%; height: 100%; }

.gate-layer { position: fixed; inset: 0; z-index: 3; overflow: hidden;
  transition: transform 1.5s cubic-bezier(.55, 0, .8, .2), opacity 1.4s ease-in; }
.gate-layer.walk { transform: scale(3.2); opacity: 0; pointer-events: none; }
.wall-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* the lantern light lives in HTML, so the textured wall is never repainted */
.lamp-light { position: absolute; top: calc(var(--ly) - var(--lr)); width: calc(var(--lr) * 2); height: calc(var(--lr) * 2);
  border-radius: 50%; pointer-events: none; opacity: var(--lamp);
  background: radial-gradient(circle, rgba(255, 222, 150, .6), rgba(255, 200, 120, .18) 42%, transparent 70%);
  animation: flicker 4.2s ease-in-out infinite; transition: opacity 1.5s; }
.lamp-light.l { left: calc(var(--l1x) - var(--lr)); }
.lamp-light.r { left: calc(var(--l2x) - var(--lr)); animation-delay: -1.7s; }

/* ---- the brass plaque on the doors ---- */
.plaque { --ink: #3F3236; --muted: #7A6A6E; --rosewood: #A85A70; --title: #A85A70; --card: #FFFCFA; --gold: #B8893A;
  --btn-bg: #A85A70; --btn-fg: #FFFCFA; --line: rgba(160, 120, 60, .5);
  position: absolute; left: var(--px); top: var(--py); width: var(--pw); transform: translate(-50%, -50%);
  box-sizing: border-box; padding: 6px 14px 8px; text-align: center; color: var(--ink);
  border: 5px solid transparent; border-image: linear-gradient(135deg, #F3DE9E, #B8893A 35%, #F0D58C 60%, #8E6A2A) 1;
  background:
    radial-gradient(circle at 7px 7px, #F6E3A8 0 2.6px, #7A5A22 3px, transparent 3.8px),
    radial-gradient(circle at calc(100% - 7px) 7px, #F6E3A8 0 2.6px, #7A5A22 3px, transparent 3.8px),
    radial-gradient(circle at 7px calc(100% - 7px), #F6E3A8 0 2.6px, #7A5A22 3px, transparent 3.8px),
    radial-gradient(circle at calc(100% - 7px) calc(100% - 7px), #F6E3A8 0 2.6px, #7A5A22 3px, transparent 3.8px),
    linear-gradient(to bottom, #F8EEDA, #EEDDBC);
  box-shadow: 0 10px 28px rgba(30, 15, 5, .45), inset 0 0 0 1px rgba(120, 80, 30, .35), inset 0 0 22px rgba(160, 110, 50, .18);
  transition: opacity .6s ease, transform .6s ease; }
.opening .plaque { opacity: 0; transform: translate(-50%, -46%); pointer-events: none; }
.plaque .chapter-title { font-size: clamp(23px, calc(var(--pw) * .095), 34px); line-height: 2.2; padding-top: .1em; }
.plaque .lead { font-size: 18px; line-height: 1.75; }
.plaque .lead.missed { color: var(--rosewood); }
.plaque .pass { margin-top: 8px; gap: 6px; }
.plaque .pass input { font-size: 20px; padding: 4px 12px; flex-basis: 150px; }
.plaque .btn { font-size: 18px; padding: 4px 18px; }
.plaque .hint { font-size: 16px; line-height: 1.7; margin-top: 4px; }
.plaque .err { font-size: 16px; line-height: 1.6; min-height: 0; margin: 2px 0 0; }
.plaque .err:empty { display: none; }

/* ---- inside: the words over the sky, the rooms along the bottom ---- */
.court-ui { position: fixed; inset: 0; z-index: 4; display: flex; flex-direction: column; justify-content: space-between;
  padding: 54px 12px 12px; pointer-events: none; animation: rise-in 1.1s .2s cubic-bezier(.2, .7, .2, 1) both; }
.court-ui > * { pointer-events: auto; }
@keyframes rise-in { from { opacity: 0; transform: translateY(14px); } }
.court-head { text-align: center; max-width: 680px; margin: 0 auto; text-shadow: 0 0 14px var(--tint), 0 0 4px var(--tint), 0 0 2px var(--tint); }
.court-head .chapter-title { line-height: 2.3; }
.court-head .sky-ayah .quran { font-size: 23px; }
.court-head .lead { font-size: 18px; }
.court-head .law { font-size: 16.5px; line-height: 1.9; padding: 6px 14px; margin-top: 8px; max-width: 30em; }
.dock { display: flex; gap: 10px; overflow-x: auto; justify-content: safe center; padding: 6px 4px 4px; scrollbar-width: none; }
.dock::-webkit-scrollbar { display: none; }
.dock .room { flex: 0 0 auto; width: 126px; padding: 22px 8px 10px; border-radius: 70px 70px 14px 14px;
  background: color-mix(in srgb, var(--card) 86%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.dock .room .icon { width: 32px; height: 32px; }
.dock .room-name { font-size: 17.5px; line-height: 1.6; }
.dock .room-sub { font-size: 13.5px; }
.dock .soon { top: 5px; font-size: 11px; }
@media (max-width: 560px) {
  .court-head .chapter-title { font-size: 30px; }
  .court-head .sky-ayah .quran { font-size: 20px; }
  .court-head .lead { font-size: 16px; } .court-head .law { font-size: 15px; }
  .dock .room { width: 108px; padding: 18px 6px 8px; } .dock .room-name { font-size: 16px; } .dock .room-sub { display: none; }
}
html.home .chip { background: color-mix(in srgb, var(--card) 70%, transparent); }
html.home .brand { text-shadow: 0 0 10px var(--tint); }

/* ---- the living scene ---- */
.px { transition: transform .9s ease-out; }
.px-far { transform: translate(calc(var(--mx, 0) * -4px), calc(var(--my, 0) * -2px)); }
.px-mid { transform: translate(calc(var(--mx, 0) * -9px), calc(var(--my, 0) * -4px)); }
.px-near { transform: translate(calc(var(--mx, 0) * -16px), calc(var(--my, 0) * -6px)); }
.clouds .cloud-a { animation: cloud 95s linear infinite alternate; }
.clouds .cloud-b { animation: cloud 70s linear infinite alternate-reverse; }
@keyframes cloud { from { transform: translateX(-70px); } to { transform: translateX(120px); } }
.bird { fill: none; stroke: var(--bird); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.flock { transition: opacity 2s; }
.flock-rise { opacity: var(--rise-o); } .flock-home { opacity: var(--home-o); }
.flock-rise .flock-move { animation: rise-fly 24s linear infinite; }
@keyframes rise-fly { 0% { transform: translate(0, 0) scale(1); opacity: 0; } 8%, 82% { opacity: 1; } 100% { transform: translate(-380px, -170px) scale(.6); opacity: 0; } }
.flock-home .flock-move { animation: home-fly 42s linear infinite; }
@keyframes home-fly { 0% { transform: translate(0, 0); opacity: 0; } 8%, 88% { opacity: 1; } 100% { transform: translate(-980px, 70px); opacity: 0; } }
.boat { opacity: var(--boat-o); transition: opacity 2s; }
.boat-move { animation: sail 90s ease-in-out infinite alternate; }
@keyframes sail { from { transform: translate(650px, 590px); } to { transform: translate(950px, 594px); } }
.hull { fill: var(--hull); } .mast { stroke: var(--hull); stroke-width: 2; } .sail { fill: var(--sail); transition: fill 2s; }
.trunk { fill: none; stroke: var(--trunk); stroke-width: 9; stroke-linecap: round; transition: stroke 2s; } .trunk.thin { stroke-width: 5; }
.olive1 { fill: var(--olive1); } .olive2 { fill: var(--olive2); } .olive3 { fill: var(--olive3); }
:is(.olive1, .olive2, .olive3, .bush-g1, .bush-g2) { transition: fill 2s; }
.tree-sway { transform-origin: 1004px 760px; animation: tree 7s ease-in-out infinite alternate; }
@keyframes tree { from { transform: rotate(-.7deg); } to { transform: rotate(.8deg); } }
.grass { fill: none; stroke: var(--grass); stroke-width: 2.2; stroke-linecap: round; transform-origin: 0 0; animation: tree 3.4s ease-in-out infinite alternate; }
.dews { opacity: var(--dew-o); transition: opacity 2s; }
.dew { stroke: #FFFFFF; stroke-width: 1.5; stroke-linecap: round; animation: twinkle 2.6s ease-in-out infinite; }
.bush-g1 { fill: var(--bush1); } .bush-g2 { fill: var(--bush2); }
.bfly { opacity: var(--bfly-o); transition: opacity 2s; animation: wander 15s ease-in-out infinite; }
.bfly.b2 { animation-duration: 18s; animation-direction: reverse; }
@keyframes wander { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(38px, -32px); } 50% { transform: translate(8px, -62px); } 75% { transform: translate(-34px, -24px); } }
.wings { animation: flap .17s ease-in-out infinite alternate; }
@keyframes flap { from { transform: scaleX(1); } to { transform: scaleX(.22); } }
.bfly .wings path { stroke: #A85A70; stroke-width: .7; }
.bfly-line { stroke: #6B5060; stroke-width: 1.6; stroke-linecap: round; }
.fireflies { opacity: var(--ff-o); transition: opacity 2s; }
.ff { animation: ff-move var(--fd) ease-in-out infinite alternate, ff-blink var(--fb) ease-in-out infinite alternate; }
@keyframes ff-move { to { transform: translate(var(--fx), var(--fy)); } }
@keyframes ff-blink { from { opacity: .15; } to { opacity: 1; } }
.ff-core { fill: #FFF8C8; }
.shoot { opacity: var(--shoot-o); }
.shoot line { animation: shoot 27s linear infinite; animation-delay: 4s; transform: translate(-500px, 0); }
@keyframes shoot { 0% { transform: translate(760px, 110px) rotate(152deg) scaleX(0); } 2% { transform: translate(640px, 175px) rotate(152deg) scaleX(1); }
  4%, 100% { transform: translate(520px, 240px) rotate(152deg) scaleX(0); } }
.merlon { fill: var(--plaster2); stroke: var(--relief-d); stroke-width: 1; }
.coping { fill: var(--plaster2); }
html.home .chip.on { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-fg); }
.reveal-shadow { stroke: rgba(40, 25, 20, .16); stroke-width: 12; }

/* the words inside, in the light skies: a soft frosted panel and darker ink (night is unchanged) */
html:not([data-phase="night"]) .court-head { --ink: #2E2328; --muted: #5E4E54; --sky: #2F5878; --title: #8E3F57;
  padding: 4px 22px 10px; border-radius: 26px; text-shadow: none;
  background: color-mix(in srgb, #FFFCFA 74%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 30px rgba(120, 70, 80, .12); }
html:not([data-phase="night"]) .court-head .law { border-color: rgba(160, 120, 60, .45); }

/* the speaker button */
.chip.sound { display: inline-flex; align-items: center; padding: 0 9px; }
.chip.sound .icon { width: 20px; height: 20px; }
.chip.sound .waves-on { display: none; }
.chip.sound.on .waves-on { display: inline; } .chip.sound.on .waves-off { display: none; }

/* the Hijri date: a quiet line above the courtyard title, and under ركن السكينة's heading */
.hijri { margin: 0 auto 2px; font-size: 16px; color: var(--muted); letter-spacing: .2px; }
.court-head .hijri { display: inline-block; padding: 2px 14px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); }
.chapter .hijri { margin-top: 10px; }
@media (max-width: 560px) { .hijri { font-size: 14.5px; } }
