/* rooms.css: the library, ركن السكينة, the chocolate tin, the night sky and the closing. */

.room-page { padding-bottom: 20px; }
.card { position: relative; max-width: 760px; margin: 18px auto 0; padding: 18px 20px 16px; box-sizing: border-box; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.card > .kind { margin-bottom: 4px; }
.ayah.small { font-size: 21px; line-height: 2.1; margin: 8px 0 2px; }

/* =========================== the library =========================== */
.bookcase { max-width: 900px; margin: 18px auto 0; padding: 14px 14px 6px; border-radius: 14px;
  background: linear-gradient(180deg, #5E3B27, #4A2E1F 60%, #3E2619);
  box-shadow: inset 0 0 0 4px #6E4831, inset 0 0 30px rgba(0, 0, 0, .45), 0 14px 34px rgba(40, 20, 10, .35); }
.shelf { position: relative; margin-bottom: 14px; }
.shelf-label { display: inline-block; margin: 0 6px 6px; padding: 0 12px; font-size: 14px; line-height: 1.8; color: #3A2A14; border-radius: 4px;
  background: linear-gradient(135deg, #F3DE9E, #C9A04A 55%, #E9CF8A); box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.shelf-row { display: flex; align-items: flex-end; gap: 3px; overflow-x: auto; overflow-y: visible; padding: 26px 8px 0; min-height: 200px;
  scrollbar-width: thin; scrollbar-color: #8C6446 transparent; }
.shelf-board { height: 14px; margin-top: -1px; border-radius: 2px; background: linear-gradient(180deg, #8C6446, #6B4A33 55%, #4A2E1F);
  box-shadow: 0 6px 10px rgba(0, 0, 0, .45); }
.spine { position: relative; flex: 0 0 auto; width: var(--w); height: var(--h); padding: 0; border: 0; cursor: pointer;
  border-radius: 3px 3px 2px 2px; color: var(--ink); font-family: var(--font);
  background: linear-gradient(90deg, rgba(0, 0, 0, .28), rgba(255, 255, 255, .12) 30%, rgba(0, 0, 0, .05) 60%, rgba(0, 0, 0, .3)), var(--c);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25), 2px 0 3px rgba(0, 0, 0, .25);
  transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.spine:hover, .spine:focus-visible { transform: translateY(-8px); }
.spine-band { position: absolute; inset: 12px 4px auto; height: 8px; border-top: 2px solid #E2C27A; border-bottom: 2px solid #E2C27A; opacity: .85; }
.spine-title { position: absolute; inset: 28px 0 12px; writing-mode: vertical-rl; font-size: 14px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center; overflow: hidden; text-shadow: 0 1px 1px rgba(0, 0, 0, .35); }
.spine-ribbon { position: absolute; top: -2px; left: 6px; width: 8px; height: 26px; background: #D98BA0; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%); }
.spine-dot { position: absolute; bottom: 6px; left: 50%; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: #F1DDA6; }
.spine.pulled { animation: pull .45s cubic-bezier(.4, 0, .6, 1) forwards; }
@keyframes pull { 40% { transform: translateY(-30px) rotate(-3deg); } 100% { transform: translateY(-60px) rotate(-6deg) scale(.9); opacity: 0; } }
.shelf-row.reading .spine { --w: 54px !important; --h: 188px !important; }
.shelf-row.reading .spine-title { font-size: 16px; }

/* the open book */
.reader-backdrop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px;
  background: rgba(31, 24, 20, .55); animation: fade .3s ease both; }
.reader { position: relative; width: min(560px, 100%); height: min(76vh, 640px); perspective: 1600px; display: flex; flex-direction: column; }
.cover { position: absolute; inset: 0 0 64px 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border-radius: 6px 14px 14px 6px; color: #FBF3E6; backface-visibility: hidden; transform-origin: right center;
  background: linear-gradient(90deg, rgba(0, 0, 0, .25), rgba(255, 255, 255, .08) 20%, rgba(0, 0, 0, .1)), var(--c);
  box-shadow: inset -10px 0 14px rgba(0, 0, 0, .3), 0 18px 40px rgba(0, 0, 0, .4); transition: transform 1s cubic-bezier(.6, .05, .3, 1), opacity 1s; }
.cover::before { content: ""; position: absolute; inset: 14px; border: 2px solid rgba(241, 221, 166, .7); border-radius: 8px; }
.cover-title { font-size: 34px; line-height: 2.2; padding: 0 20px; text-align: center; }
.cover-author { font-size: 17px; opacity: .9; }
.reader.opened .cover { transform: rotateY(-165deg); opacity: 0; pointer-events: none; }
.page { flex: 1; overflow: auto; box-sizing: border-box; padding: 22px 24px; text-align: center; color: #3F3236; border-radius: 6px 14px 14px 6px;
  background: linear-gradient(90deg, #EADBC0, #F8EEDA 8%, #FBF4E6 50%, #F6EAD2); box-shadow: inset -12px 0 16px rgba(140, 100, 60, .18), 0 18px 40px rgba(0, 0, 0, .35);
  transform-origin: right center; touch-action: pan-y; --ink: #3F3236; --muted: #7A6A6E; --sky: #4A7595; }
.page.out-next { animation: page-out .26s ease-in forwards; } .page.in-next { animation: page-in .28s ease-out; }
.page.out-prev { animation: page-out-r .26s ease-in forwards; } .page.in-prev { animation: page-in-r .28s ease-out; }
@keyframes page-out { to { transform: rotateY(80deg); opacity: .2; } }
@keyframes page-in { from { transform: rotateY(-80deg); opacity: .2; } }
@keyframes page-out-r { to { transform: rotateY(-80deg); opacity: .2; } }
@keyframes page-in-r { from { transform: rotateY(80deg); opacity: .2; } }
.reader-nav { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; padding-top: 10px; }
.reader-nav .chip { background: #FBF4E6; color: #3F3236; font-size: 18px; padding: 0 14px; }
.reader-nav .chip:disabled { opacity: .35; cursor: default; }
.reader-nav .btn.ghost { background: #FBF4E6; color: #8E3F57; }
.reader-nav .ref { color: #F3E9EC; }
.pg-kicker { margin: 0; color: #7A6A6E; font-size: 16px; }
.pg-title { margin: 0; color: #8E3F57; font-size: 34px; line-height: 2.3; }
.pg-note { font-size: 20px; line-height: 2; margin: 8px 0; }
.pg-sign { color: #7A6A6E; font-size: 16px; margin: 6px 0 0; }
.pg-marks { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.mark { font: inherit; font-size: 17px; padding: 2px 18px; border-radius: 999px; cursor: pointer; border: 1.5px solid #C2A36B; background: transparent; color: #8E3F57; }
.mark.on { background: #A85A70; border-color: #A85A70; color: #FFFCFA; }
.pg-poem { min-height: 100%; display: flex; flex-direction: column; justify-content: center; }
.verses { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; font-size: 21px; line-height: 2; }
.verses span:nth-child(odd) { text-align: left; } .verses span:nth-child(even) { text-align: right; }
@media (max-width: 520px) { .verses { grid-template-columns: 1fr; gap: 2px; } .verses span { text-align: center !important; }
  .verses span:nth-child(even) { margin-bottom: 10px; } }
.returned { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.returned li { display: flex; flex-direction: column; padding: 6px; border-bottom: 1px dashed #D9C8A8; }
.returned .rw { font-size: 24px; color: #8E3F57; font-weight: 700; }

/* =========================== ركن السكينة =========================== */
.today-ayah .ayah { font-size: 26px; }
.tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 8px; }
.tabs .chip { font-size: 16px; padding: 2px 16px; }
.adhkar, .card .dua { text-align: center; }
.dhikr { padding: 12px 6px 10px; border-top: 1px solid var(--line); transition: opacity .5s; }
.dhikr.done { opacity: .5; }
.dhikr-title { margin: 0; color: var(--title); font-weight: 700; font-size: 17px; }
.dhikr-text { font-size: 20px; line-height: 2; margin: 6px 0; }
.dhikr-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dhikr-foot .ref { text-align: start; }
.counter { flex: 0 0 auto; width: 54px; height: 54px; border-radius: 50%; cursor: pointer; font: inherit; font-size: 19px; font-weight: 700;
  color: var(--rosewood); background: var(--card); border: 2px solid var(--gold); box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--gold) 18%, transparent);
  transition: transform .12s; }
.counter:active { transform: scale(.93); }
.dhikr.done .counter { background: var(--gold); color: var(--card); }
.card .dua { padding: 10px 4px; border-top: 1px solid var(--line); }
.khatma-line { font-size: 17px; margin: 4px 0 10px; }
.juz-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
@media (max-width: 560px) { .juz-grid { grid-template-columns: repeat(6, 1fr); } }
.juz { aspect-ratio: 1; border-radius: 10px; cursor: pointer; font: inherit; font-size: 16px; color: var(--ink); background: transparent;
  border: 1.5px solid var(--line); transition: background .3s, color .3s; }
.juz.on { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-bg); }
.khatma-count { margin: 10px 0 0; color: var(--sky); font-size: 17px; }
.recitation .surahs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 6px 0 10px; }
.recitation .chip { font-size: 16px; padding: 1px 14px; }
.recitation .chip.fri { border-color: var(--gold); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 35%, transparent); }
.friday { margin: 0; color: var(--rosewood); font-size: 16px; }
.player { display: flex; align-items: center; gap: 12px; direction: rtl; }
.player .play { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer; font-size: 16px;
  background: var(--btn-bg); color: var(--btn-fg); }
.player input[type=range] { flex: 1; accent-color: var(--rosewood); }
.player .ref { flex: 0 0 auto; min-width: 88px; }

/* =========================== the chocolate tin =========================== */
.tin { position: relative; width: min(520px, 100%); margin: 22px auto 0; }
.tin-inside { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 18px; border-radius: 20px;
  background: radial-gradient(circle at 50% 40%, #7A2E44, #4E1A2B 75%);
  border: 10px solid transparent; border-image: linear-gradient(135deg, #F3DE9E, #B8893A 35%, #F0D58C 60%, #8E6A2A) 1;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, .55), 0 16px 36px rgba(60, 20, 30, .4); }
.tin-lid { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border-radius: 12px; border: 10px solid transparent; border-image: linear-gradient(135deg, #F3DE9E, #B8893A 35%, #F0D58C 60%, #8E6A2A) 1;
  background: radial-gradient(circle at 30% 25%, #F7DCE3, #E8A3B5 45%, #C77790); box-shadow: 0 14px 30px rgba(60, 20, 30, .35);
  transition: transform 1.1s cubic-bezier(.6, .05, .3, 1), opacity 1.1s; }
.tin-rose .icon { width: 72px; height: 72px; }
.tin-name { font-size: 30px; line-height: 2.2; color: #6B2E3E; }
.tin.open .tin-lid { transform: translateY(-70%) rotate(-7deg); opacity: 0; pointer-events: none; }
.cup { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px 8px; border: 0; cursor: pointer;
  font: inherit; color: #F8EEDA; border-radius: 16px;
  background: radial-gradient(circle at 50% 38%, #9A6A47 0 30%, #7A4E33 31% 46%, transparent 47%),
              repeating-conic-gradient(from 0deg at 50% 38%, #8A5A3C 0 7deg, #6E4631 7deg 14deg);
  background-size: 100% 100%; -webkit-tap-highlight-color: transparent; }
.cup-label { font-size: 13px; line-height: 1.6; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); min-height: 3.2em; display: flex; align-items: center; }
.choc { width: 62px; height: 62px; transition: transform .6s cubic-bezier(.2, .8, .2, 1), opacity .5s; }
.choc.round { border-radius: 50%; background: radial-gradient(circle at 35% 30%, #8A5A3C, #3A2216 70%);
  box-shadow: inset 0 -4px 8px rgba(0, 0, 0, .4), 0 3px 6px rgba(0, 0, 0, .5); }
.choc.round::after { content: ""; display: block; margin: 18px auto 0; width: 34px; height: 8px; border-top: 3px solid #F2B8C6; border-radius: 50%; }
.choc.square { border-radius: 12px; background: linear-gradient(135deg, #A87250, #6B4430);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .12), 0 3px 6px rgba(0, 0, 0, .5); }
.choc.square::after { content: ""; display: block; margin: 25px auto 0; width: 36px; height: 12px;
  background: repeating-linear-gradient(90deg, #F8EEDA 0 2px, transparent 2px 7px); opacity: .8; }
.choc.flower { clip-path: polygon(50% 0, 61% 22%, 85% 15%, 78% 39%, 100% 50%, 78% 61%, 85% 85%, 61% 78%, 50% 100%, 39% 78%, 15% 85%, 22% 61%, 0 50%, 22% 39%, 15% 15%, 39% 22%);
  background: radial-gradient(circle at 50% 50%, #FBE3EA 0 20%, #F4C9D4 21% 60%, #E8A3B5 61%); }
.cup.lifting .choc { transform: translateY(-34px) rotate(200deg) scale(1.15); }
.cup.eaten .choc { opacity: 0; transform: scale(.4); }
.cup.eaten::after { content: "· · ·"; position: absolute; top: 34px; color: #C9A07A; letter-spacing: 3px; }
.refill { text-align: center; color: var(--rosewood); margin-top: 14px; }
.choc-line { font-size: 18px; }

/* =========================== the night sky and the closing (full screen) =========================== */
.room-full { position: static; }
.full-scene { position: fixed; inset: 0; z-index: 1; overflow: hidden; }
.full-scene > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.full-ui { position: fixed; z-index: 4; left: 0; right: 0; text-align: center; padding: 0 16px; pointer-events: none; }
.full-ui > * { pointer-events: auto; }
.full-ui.bottom { bottom: 0; padding-bottom: 18px; text-shadow: 0 0 14px var(--tint), 0 0 4px var(--tint); }
.full-ui.bottom .chapter-title { font-size: clamp(24px, 6vw, 34px); }
.full-ui.bottom .lead { font-size: 17px; }
.full-ui .back { display: inline-block; margin: 0 0 4px; }
.sky-touch .tstar { cursor: pointer; outline: none; }
.sky-touch .halo { fill: #FFF6C8; opacity: 0; transition: opacity .4s; }
.sky-touch .spark { fill: #FFF6C8; opacity: .22; transform: scale(.55); transform-box: fill-box; transform-origin: center; transition: opacity .5s, fill .5s; }
.sky-touch .tstar.lit .spark { opacity: 1; transform: scale(1); animation: star-twinkle 3s ease-in-out infinite; }
.sky-touch .tstar.lit .halo { opacity: .08; }
.sky-touch .tstar.lit:hover .halo, .sky-touch .tstar.lit:focus-visible .halo { opacity: .22; }
.sky-touch .tstar.seen .spark { fill: #F2D98B; }
@keyframes star-twinkle { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }
.constellation { stroke: rgba(233, 216, 166, .55); stroke-width: 1.6; stroke-dasharray: 2000; stroke-dashoffset: 2000; animation: draw-line 2.4s ease forwards; }
@keyframes draw-line { to { stroke-dashoffset: 0; } }
.full-ui.center { top: 0; bottom: 0; display: flex; align-items: center; justify-content: center; padding-top: 56px; }
.closing-card { max-width: 620px; padding: 6px 26px 18px; border-radius: 26px; text-align: center; --ink: #2E2328; --muted: #5E4E54; --title: #8E3F57;
  color: var(--ink); background: color-mix(in srgb, #FFFCFA 76%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 34px rgba(120, 70, 80, .16); }
.closing-dua { font-size: 23px; line-height: 2.1; margin: 6px 0 2px; color: #6B2E3E; }
.ink-slow { animation: ink 4.2s cubic-bezier(.45, .05, .35, 1) .6s both; }
.closing-line { font-size: 18.5px; line-height: 2; margin: 8px 0 0; animation: rise-in 1.4s ease both; }
.closing-card .btn { display: inline-block; margin-top: 14px; text-decoration: none; }
@media (max-width: 560px) { .closing-dua { font-size: 20px; } .closing-line { font-size: 16.5px; } }

/* a single book needs only the height of its page */
.reader.short { height: auto; }
.reader.short .page { flex: none; min-height: 300px; }
/* the closing card steps aside on wide screens so the setting sun stays in view */
@media (min-width: 900px) { .full-ui.center { justify-content: flex-start; padding-inline-start: 4vw; } .closing-card { max-width: 460px; } }

/* the drawn chocolates and today's tag */
.choc { display: block; width: 64px; height: 64px; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .55)); }
.choc svg { display: block; width: 100%; height: 100%; }
.today-tag { position: absolute; top: 4px; inset-inline-start: 6px; font-size: 11px; line-height: 1.6; padding: 0 7px; border-radius: 999px;
  color: #3A2A14; background: linear-gradient(135deg, #F3DE9E, #C9A04A); box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
