/* CSS kecil di luar Tailwind */
html { -webkit-tap-highlight-color: transparent; }
body { overscroll-behavior-y: none; -webkit-font-smoothing: antialiased; }
.pt-safe { padding-top: env(safe-area-inset-top); }
.pb-safe { padding-bottom: env(safe-area-inset-bottom); }
.arab { font-family: "Amiri", "Scheherazade New", "Traditional Arabic", serif; direction: rtl; line-height: 2.25; }
.ring-progress { transition: stroke-dashoffset .7s cubic-bezier(.2,.8,.2,1); }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }

/* Motif geometri Islami (bintang 8) — sangat tipis agar tidak ramai */
.pattern { position: relative; isolation: isolate; }
.pattern::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .09; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%23fff' stroke-width='1.2'%3E%3Cpath d='M28 6l6.4 15.6L50 28l-15.6 6.4L28 50l-6.4-15.6L6 28l15.6-6.4z'/%3E%3Crect x='16' y='16' width='24' height='24' transform='rotate(45 28 28)'/%3E%3Ccircle cx='28' cy='28' r='5'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 56px 56px;
}
.pattern-soft::before { opacity: .05; }

/* Latar halaman: gradasi lembut di atas */
.page-glow { background: radial-gradient(120% 60% at 50% -10%, rgb(61 143 110 / .10), transparent 60%); }
.dark .page-glow { background: radial-gradient(120% 60% at 50% -10%, rgb(61 143 110 / .14), transparent 60%); }

@keyframes pop { 0% { transform: scale(1) } 50% { transform: scale(1.15) } 100% { transform: scale(1) } }
.pop { animation: pop .25s ease; }
@keyframes sway { 0%,100% { transform: rotate(-1.5deg) } 50% { transform: rotate(1.5deg) } }
.sway { transform-origin: 50% 100%; animation: sway 6s ease-in-out infinite; }
@keyframes rise { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }
.rise { animation: rise .35s ease both; }
main > * { animation: rise .35s ease both; }
main > *:nth-child(2) { animation-delay: .03s; } main > *:nth-child(3) { animation-delay: .06s; }
main > *:nth-child(4) { animation-delay: .09s; } main > *:nth-child(5) { animation-delay: .12s; }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }

/* Saat terpasang di layar utama: terasa seperti aplikasi asli */
@media (display-mode: standalone) {
  body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  input, textarea, [contenteditable], .bubble, .arab, article p { -webkit-user-select: text; user-select: text; }
  html, body { overscroll-behavior: none; }
}

/* Penanda memuat halaman: garis progres di atas + kapsul "Memuat…" bila lambat */
#istq-bar {
  position: fixed; top: 0; left: 0; z-index: 80; height: 3px; width: 0; opacity: 0; pointer-events: none;
  background: linear-gradient(90deg, #1d9e8c, #3cbaa6, #e5c26b);
  box-shadow: 0 0 10px rgb(29 158 140 / .6), 0 0 4px rgb(229 194 107 / .6);
  border-radius: 0 3px 3px 0;
  transition: width .4s ease, opacity .3s ease;
}
#istq-bar.on { opacity: 1; }
#istq-loading {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 64px); z-index: 80;
  transform: translate(-50%, -8px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px;
  background: rgb(255 255 255 / .96); color: #13665d; font: 600 13px "Plus Jakarta Sans", system-ui, sans-serif;
  box-shadow: 0 8px 24px -8px rgb(20 70 65 / .35); border: 1px solid rgb(29 158 140 / .15);
  transition: opacity .25s ease, transform .25s ease;
}
#istq-loading.on { opacity: 1; transform: translate(-50%, 0); }
#istq-loading i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #a9e8da; border-top-color: #147f72; animation: istq-spin .7s linear infinite; }
@keyframes istq-spin { to { transform: rotate(360deg); } }

/* Panduan pasang iPhone */
@keyframes nudge { 0%,100% { transform: translateY(0) } 50% { transform: translateY(8px) } }
.nudge { animation: nudge 1.2s ease-in-out infinite; }

/* Chat */
.bubble { word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; }
.chat-bg { background-color: var(--color-slate-100, #f0ebe0); }
.dark .chat-bg { background-color: var(--color-slate-950, #121a18); }

@media print {
  .no-print { display: none !important; }
  body { background: #fff !important; }
  main { padding: 0 !important; max-width: none !important; }
  main > * { animation: none !important; }
}

/* Mode Anak: perayaan bintang */
.celebrate { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; pointer-events: none; animation: celebrate-out 3.2s ease forwards; }
.celebrate-card { background: #fff; border-radius: 28px; padding: 24px 32px; text-align: center; box-shadow: 0 24px 60px -16px rgb(20 70 65 / .45); animation: celebrate-pop .5s cubic-bezier(.2,1.6,.4,1) both; }
.confetti { position: absolute; top: -10%; font-size: 28px; animation: confetti-fall 2.6s ease-in both; }
@keyframes celebrate-pop { from { transform: scale(.4); opacity: 0 } to { transform: scale(1); opacity: 1 } }
@keyframes celebrate-out { 0%, 80% { opacity: 1 } 100% { opacity: 0; visibility: hidden } }
@keyframes confetti-fall { from { transform: translateY(0) rotate(0) } to { transform: translateY(115vh) rotate(540deg) } }
.kid-arab { font-family: "Amiri", "Scheherazade New", "Traditional Arabic", serif; line-height: 2.4; }
[data-ayah][data-playing="true"] .kid-arab { color: #147f72; }
@media (prefers-reduced-motion: reduce) { .celebrate { display: none; } }
