@import url(/css/fonts.css);
:root {
  --ink: #f6f0e1; --muted: #b9bfd8; --faint: #8f97b8; --gold: #ffcf70; --night: #070b1f;
  --glass: rgba(16, 22, 58, .62); --line: rgba(255, 233, 190, .16);
  --ar: "Amiri Quran", "Noto Sans Thaana", serif;
  --dv: "Noto Sans Thaana", "Amiri Quran", sans-serif;
  --display: "Fraunces", Georgia, serif;
  --body: "Plus Jakarta Sans", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--night); color-scheme: dark; }
body { margin: 0; color: var(--ink); font: 400 16px/1.55 var(--body); min-height: 100dvh; -webkit-tap-highlight-color: transparent; overflow-x: hidden; background: radial-gradient(90% 70% at 50% 35%, #182150, #070b1f); }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.dv { font-family: var(--dv); }
.ar { font-family: var(--ar); }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; }
.no-gl #scene { display: none; }
.no-gl .jar-anchor { background: url(/img/icon.svg) center/contain no-repeat; }

/* ---- corners ---- */
.top { position: fixed; z-index: 30; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 16px 104px 0 22px; pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 600 21px var(--display); letter-spacing: .01em; }
.brand img { border-radius: 9px; box-shadow: 0 0 20px rgba(255, 207, 112, .35); }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px 7px 11px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); font-size: 14px; font-weight: 600; transition: border-color .2s, transform .2s; }
.pill svg { width: 16px; height: 16px; fill: var(--gold); }
.pill:hover { border-color: var(--gold); transform: translateY(-1px); }
.admin-tab { position: fixed; z-index: 40; top: 0; right: 22px; padding: 9px 14px 8px; border-radius: 0 0 11px 11px; background: rgba(255, 207, 112, .13); border: 1px solid var(--line); border-top: 0; color: var(--muted); font-size: 12.5px; font-weight: 600; letter-spacing: .05em; text-decoration: none; backdrop-filter: blur(8px); transition: padding .2s, color .2s, background .2s; }
.admin-tab:hover { color: #241a05; background: var(--gold); padding-top: 14px; }

.foot { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1fr minmax(0, 620px) 1fr; align-items: end; gap: 16px; padding: 0 22px 16px; pointer-events: none; }
.foot > * { pointer-events: auto; }
.product { justify-self: start; color: var(--muted); font-size: 13px; text-decoration: none; padding: 7px 13px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); white-space: nowrap; transition: color .2s, border-color .2s; }
.product b { color: var(--gold); font-weight: 700; }
.product:hover { color: var(--ink); border-color: var(--gold); }
.note { grid-column: 2; margin: 0; text-align: center; font-size: 12.5px; line-height: 1.5; color: var(--muted); text-wrap: balance; }
.note button { background: none; border: 0; padding: 0; color: var(--gold); text-decoration: underline; text-underline-offset: 2px; font-size: inherit; }
.reading .note { opacity: 0; pointer-events: none; }

/* ---- home ---- */
.home { position: fixed; z-index: 10; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; justify-items: center; gap: 6px; padding: 66px 24px 72px; pointer-events: none; transition: opacity .45s, transform .55s cubic-bezier(.2, .8, .2, 1); }
.home button { pointer-events: auto; }
.reading .home, .drawing .home { opacity: 0; transform: scale(1.04); }
.reading .home { visibility: hidden; transition: opacity .45s, transform .55s, visibility 0s .5s; }
.drawing .home button { pointer-events: none; }
.intro { text-align: center; animation: rise .9s both; }
h1 { margin: 0; font: 600 clamp(27px, 3.8vw, 46px)/1.12 var(--display); letter-spacing: -.01em; text-wrap: balance; text-shadow: 0 2px 28px rgba(7, 11, 31, .9); }
.tagline-dv { margin: 6px 0 0; font-size: clamp(17px, 1.7vw, 21px); color: var(--gold); line-height: 1.7; }
.announce { display: inline-block; margin: 0 0 10px; padding: 5px 15px; border-radius: 999px; background: rgba(255, 207, 112, .14); border: 1px solid var(--line); font-size: 14px; }
.stage { width: 100%; max-width: 1180px; min-height: 0; display: grid; grid-template-columns: minmax(180px, 270px) minmax(260px, 470px) minmax(180px, 270px); grid-auto-rows: 1fr; justify-content: space-between; align-items: center; column-gap: 28px; }
.moods { display: contents; }
.jar-anchor { grid-column: 2; grid-row: 1 / span var(--rows, 6); align-self: stretch; min-height: 240px; width: 100%; }
.mood { grid-column: var(--col); grid-row: var(--row); position: relative; display: flex; align-items: center; gap: 11px; width: 100%; min-height: 52px; padding: 9px 16px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(11px); overflow: hidden; text-align: left; transition: transform .25s cubic-bezier(.2, 1.3, .4, 1), border-color .25s, box-shadow .25s; animation: pop .6s calc(var(--i) * 45ms + .15s) both; }
.mood::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, color-mix(in srgb, var(--c) 40%, transparent), transparent 75%); opacity: 0; transition: opacity .25s; }
.mood:hover, .mood:focus-visible { transform: translateY(-2px) scale(1.03); border-color: var(--c); box-shadow: 0 8px 30px color-mix(in srgb, var(--c) 34%, transparent); }
.mood:hover::before, .mood:focus-visible::before { opacity: 1; }
.mood:active { transform: scale(.97); }
.mood > * { position: relative; }
.dot { flex: none; width: 15px; height: 15px; border-radius: 50%; background: var(--c); box-shadow: 0 0 13px 2px var(--c); }
.mood .en { font-weight: 600; font-size: 15.5px; line-height: 1.2; }
.mood .dv { margin-left: auto; font-size: 14px; color: var(--muted); line-height: 1.5; text-align: right; }
.surprise { background: none; border: 0; color: var(--muted); font-size: 14px; padding: 5px 12px; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; animation: rise 1s .5s both; }
.surprise:hover { color: var(--gold); }

/* ---- reading a verse ---- */
.reader { position: relative; z-index: 15; display: flex; justify-content: center; padding: 19vh 18px 96px; perspective: 1400px; min-height: 100dvh; }
.card { position: relative; width: min(780px, 100%); align-self: flex-start; padding: 30px clamp(22px, 4vw, 48px) 26px; border-radius: 26px; background: linear-gradient(165deg, rgba(23, 29, 74, .93), rgba(9, 12, 40, .95)); border: 1px solid color-mix(in srgb, var(--c) 42%, transparent); box-shadow: 0 30px 90px rgba(2, 4, 18, .7), 0 0 80px color-mix(in srgb, var(--c) 22%, transparent); transform: rotateX(var(--rx, 0)) rotateY(var(--ry, 0)); transition: transform .3s ease-out; animation: unroll .8s cubic-bezier(.16, .9, .25, 1) both; outline: none; }
.card.leaving { animation: rollup .28s ease-in both; }
.card-glow { position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; background: radial-gradient(70% 45% at 50% 0%, color-mix(in srgb, var(--c) 22%, transparent), transparent 75%); }
.card > * { position: relative; }
.card-top { display: flex; align-items: center; gap: 12px; }
.tag { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 9px; border-radius: 999px; font-size: 13px; font-weight: 700; background: color-mix(in srgb, var(--c) 18%, transparent); }
.tag i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 9px var(--c); }
.card h2 { flex: 1; margin: 0; font: 600 18px var(--display); }
.card h2 span { color: var(--gold); margin-left: 4px; font-family: var(--body); font-size: 14.5px; font-weight: 700; }
.close { width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 255, 255, .07); border: 1px solid var(--line); font-size: 21px; line-height: 1; display: grid; place-items: center; }
.close:hover { background: rgba(255, 255, 255, .15); }
.blurb { margin: 12px 0 0; color: var(--muted); font-size: 14.5px; }
.card .ar { margin: 20px 0 2px; font-size: clamp(25px, 3.5vw, 37px); line-height: 2.25; text-align: center; color: #fffaf0; text-shadow: 0 0 26px color-mix(in srgb, var(--c) 38%, transparent); }
.card.mid .ar { font-size: clamp(23px, 3vw, 31px); line-height: 2.15; }
.card.long .ar { font-size: clamp(21px, 2.5vw, 26px); line-height: 2.1; }
.end { color: var(--gold); white-space: nowrap; }
.rule { height: 1px; margin: 12px auto 16px; width: 62%; background: linear-gradient(90deg, transparent, var(--c), transparent); }
.tr { margin-top: 15px; }
.tr h3 { margin: 0 0 3px; font-size: 12px; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); font-weight: 700; }
.tr p { margin: 0; font-size: 17.5px; line-height: 1.62; }
.tr sup { color: var(--gold); font-size: .68em; margin-inline-end: 2px; }
.tr.dv h3 { letter-spacing: 0; font-size: 14px; font-weight: 600; }
.tr.dv p { font-size: 19.5px; line-height: 1.95; }
.credit { margin: 18px 0 0; font-size: 12.5px; color: var(--faint); line-height: 1.5; }
.support { margin: 12px 0 0; padding: 9px 13px; border-radius: 12px; background: rgba(255, 255, 255, .06); font-size: 14px; }
.support a { font-weight: 700; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 18px; }
.primary { padding: 11px 22px; border-radius: 999px; border: 0; font-weight: 700; color: #1b1405; background: linear-gradient(180deg, #ffe09c, #f5b64a); box-shadow: 0 6px 22px rgba(245, 182, 74, .35); transition: transform .18s, box-shadow .18s; }
.primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(245, 182, 74, .5); }
.icon { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .07); border: 1px solid var(--line); transition: transform .18s, background .18s; }
.icon svg { width: 19px; height: 19px; fill: var(--ink); }
.icon:hover { transform: translateY(-2px); background: rgba(255, 255, 255, .15); }
.icon.on svg { fill: #ff6b81; }
.icon.on { animation: beat .4s; }
.ghost { padding: 10px 16px; border-radius: 999px; background: none; border: 1px solid var(--line); color: var(--ink); font-size: 14px; text-decoration: none; transition: border-color .2s; }
.ghost:hover { border-color: var(--gold); }
.actions .ghost { margin-inline-start: auto; }
.progress { margin: 13px 0 0; font-size: 12.5px; color: var(--faint); }
.reveal { animation: reveal .8s var(--d, 0s) cubic-bezier(.2, .7, .2, 1) both; }
.card.done { text-align: center; }
.card.done h2 { font-size: 25px; line-height: 1.25; }
.card.done .ar { font-size: 44px; margin: 14px 0; }
.card.done .actions { justify-content: center; }
.card.done .actions .ghost { margin: 0; }

/* ---- chat ---- */
.chat-fab { position: fixed; z-index: 45; right: 22px; bottom: 16px; display: inline-flex; align-items: center; gap: 9px; padding: 9px 17px 9px 10px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(12px); font-weight: 600; font-size: 14.5px; transition: transform .2s, border-color .2s; }
.chat-fab:hover { transform: translateY(-2px); border-color: var(--gold); }
.chat-open .chat-fab { opacity: 0; pointer-events: none; }
.orb { flex: none; width: 27px; height: 27px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff5d5, #ffc765 45%, #d1812a); box-shadow: 0 0 16px 3px rgba(255, 199, 101, .55); animation: breathe 3.4s ease-in-out infinite; }
.chat { position: fixed; z-index: 50; right: 22px; bottom: 16px; width: min(392px, calc(100vw - 32px)); height: min(590px, calc(100dvh - 96px)); display: flex; flex-direction: column; border-radius: 22px; background: rgba(12, 16, 46, .97); border: 1px solid var(--line); box-shadow: 0 24px 70px rgba(0, 0, 0, .6); animation: pop .3s both; overflow: hidden; }
.chat[hidden] { display: none; }
.chat > header { display: flex; align-items: center; gap: 11px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.chat header b { display: block; font-size: 15px; }
.chat header small { color: var(--faint); font-size: 12.5px; }
.chat header button { margin-left: auto; background: none; border: 0; font-size: 25px; line-height: 1; color: var(--muted); padding: 0 6px; }
.chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 92%; padding: 9px 13px; border-radius: 15px; font-size: 14.5px; line-height: 1.5; animation: reveal .3s both; }
.msg p { margin: 0; }
.msg.me { align-self: flex-end; background: linear-gradient(180deg, #ffdd96, #f4b64d); color: #1c1505; border-bottom-right-radius: 5px; }
.msg.bot { align-self: flex-start; background: rgba(255, 255, 255, .075); border-bottom-left-radius: 5px; }
.typing { display: flex; gap: 5px; padding: 13px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
.chips, .chat-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.chips button, .chat-acts button { padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .07); border: 1px solid var(--line); font-size: 13px; }
.chips button:hover { border-color: var(--gold); }
.chat-acts button { border-color: var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); font-weight: 600; }
.chat-call { display: inline-block; margin-top: 9px; padding: 9px 17px; border-radius: 999px; background: var(--gold); color: #1c1505; font-weight: 700; text-decoration: none; }
.chat-verse { margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line); }
.chat-verse .ar { font-size: 21px; line-height: 2.1; }
.chat-verse p { margin: 5px 0 0; }
.chat-verse .dv { font-size: 16px; line-height: 1.85; }
.chat form { display: flex; gap: 7px; padding: 11px; border-top: 1px solid var(--line); }
.chat input { flex: 1; min-width: 0; padding: 10px 14px; border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid var(--line); color: var(--ink); font: inherit; font-size: 16px; }
.chat form button { width: 42px; height: 42px; flex: none; border-radius: 50%; border: 0; background: var(--gold); color: #1c1505; font-size: 15px; }

/* ---- sheets ---- */
.sheet { width: min(640px, calc(100vw - 28px)); max-height: 86dvh; padding: 26px clamp(20px, 4vw, 34px); border-radius: 22px; background: #0e1336; color: var(--ink); border: 1px solid var(--line); }
.sheet::backdrop { background: rgba(3, 5, 20, .7); backdrop-filter: blur(4px); }
.sheet h2 { margin: 0 34px 10px 0; font: 600 25px var(--display); }
.sheet h3 { margin: 18px 0 4px; font-size: 16px; }
.sheet .x { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 255, 255, .08); border: 0; font-size: 22px; line-height: 1; }
.sheet dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 14px 0; }
.sheet dt { font-weight: 700; color: var(--gold); } .sheet dd { margin: 0; }
.small { font-size: 13.5px; color: var(--muted); }
.saved-card { padding: 14px 0; border-top: 1px solid var(--line); }
.saved-card h3 { margin: 0; } .saved-card h3 small { color: var(--faint); font-weight: 400; margin-left: 6px; }
.saved-card .ar { font-size: 23px; line-height: 2.1; margin: 8px 0; }
.saved-card .dv { font-size: 17px; line-height: 1.85; }
.saved-card p { margin: 6px 0; }
.empty { color: var(--muted); }

.toast { position: fixed; z-index: 90; left: 50%; bottom: 82px; transform: translateX(-50%); padding: 9px 18px; border-radius: 999px; background: #fff3d6; color: #1c1505; font-weight: 600; font-size: 14px; animation: pop .25s both; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.94); } }
@keyframes reveal { from { opacity: 0; transform: translateY(12px); filter: blur(5px); } }
@keyframes unroll { from { opacity: 0; clip-path: inset(46% 0 46% 0 round 26px); transform: scale(.82); } to { opacity: 1; clip-path: inset(-30% -30% -30% -30%); } }
@keyframes rollup { to { opacity: 0; transform: scale(.82) translateY(-30px); } }
@keyframes breathe { 50% { transform: scale(1.1); box-shadow: 0 0 24px 7px rgba(255, 199, 101, .6); } }
@keyframes blink { 50% { opacity: .25; } }
@keyframes beat { 40% { transform: scale(1.22); } }

/* ---- phones and small tablets ---- */
@media (max-width: 899px) {
  .home { position: relative; inset: auto; display: flex; flex-direction: column; min-height: auto; padding: 66px 16px 8px; gap: 4px; }
  .reading .home { display: none; }
  .stage { display: flex; flex-direction: column; }
  .jar-anchor { order: -1; height: 32vh; min-height: 200px; max-height: 340px; grid-row: auto; }
  .moods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; max-width: 560px; }
  .mood { grid-column: auto; grid-row: auto; flex-direction: column; justify-content: center; gap: 2px; min-height: 76px; padding: 8px 4px; text-align: center; border-radius: 14px; }
  .mood .dot { width: 11px; height: 11px; margin-bottom: 2px; }
  .mood .en { font-size: 13.5px; }
  .mood .dv { margin: 0; font-size: 12.5px; text-align: center; }
  .foot { position: relative; display: flex; flex-direction: column-reverse; align-items: flex-start; padding: 14px 16px 74px; gap: 11px; }
  .note { text-align: left; }
  .reader { padding: 25vh 12px 12px; min-height: auto; }
  .reading .foot .note { display: none; }
  .reading .foot { padding-top: 6px; }
  .card { padding: 22px 18px 20px; }
  .actions .ghost { margin-inline-start: 0; }
  .top { padding: 13px 86px 0 16px; }
  .admin-tab { right: 14px; }
  .chat-fab { right: 14px; bottom: 14px; padding: 8px; }
  .chat-fab > span:last-child { display: none; }
  .chat { right: 12px; bottom: 12px; width: calc(100vw - 24px); height: min(76dvh, 620px); }
}
@media (max-height: 640px) and (min-width: 900px) {
  .home { padding: 54px 22px 60px; } h1 { font-size: 26px; } .tagline-dv { font-size: 15px; margin-top: 0; }
  .mood { min-height: 40px; padding: 5px 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}
