/* ============ Murojaah — aplikasi ============ */
body.app-body {
  background: #f7f4ec;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

.app-shell {
  max-width: 620px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--cream);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px rgba(230, 223, 208, .7);
}
@media (min-width: 700px) {
  body.app-body { background: #f1ece1; }
  .app-shell { margin: 0 auto; box-shadow: 0 24px 80px rgba(16, 36, 31, .1); }
}

/* topbar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: rgba(251, 248, 241, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { font-size: 15px; gap: 8px; }
.topbar .brand-mark { width: 28px; height: 28px; border-radius: 9px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 11px; border: 1px solid var(--line);
  background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--ink-soft);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--cream-2); color: var(--ink); }

.plan-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 800;
  letter-spacing: .04em; text-transform: uppercase; cursor: pointer; border: 1px solid transparent;
}
.plan-pill.free { background: #f0ece1; color: #7a6a45; border-color: #e3dac4; }
.plan-pill.pro { background: linear-gradient(180deg, #e3bd66, var(--gold)); color: #3a2a06; }

/* screens */
.screen { flex: 1; padding: 18px 16px 34px; display: none; animation: fade .28s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* home */
.greet { display: flex; align-items: flex-start; gap: 14px; }
.greet h1 { font-size: 22px; letter-spacing: -.025em; margin: 0; line-height: 1.25; }
.greet p { margin: 4px 0 0; font-size: 13.5px; color: var(--muted); }
.streak-ring {
  margin-left: auto; flex: none; width: 62px; height: 62px; border-radius: 50%;
  display: grid; place-items: center; text-align: center;
  background: conic-gradient(var(--gold) calc(var(--p, 0) * 1%), #ece5d4 0);
  position: relative;
}
.streak-ring::after { content: ''; position: absolute; inset: 5px; background: var(--cream); border-radius: 50%; }
.streak-ring div { position: relative; z-index: 1; line-height: 1.05; }
.streak-ring b { display: block; font-size: 19px; letter-spacing: -.03em; }
.streak-ring span { font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

.section-label {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 26px 0 12px; font-size: 12px; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.section-label button {
  background: none; border: 0; color: var(--brand); font-weight: 800; font-size: 11.5px;
  letter-spacing: .04em; cursor: pointer; text-transform: uppercase;
}

.quick {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.q-tile {
  position: relative; text-align: left; border: 1px solid var(--line); background: #fff;
  border-radius: 16px; padding: 16px 14px; cursor: pointer; overflow: hidden;
  box-shadow: var(--shadow-sm); transition: transform .16s, box-shadow .2s, border-color .2s;
}
.q-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #d9d0ba; }
.q-tile:active { transform: translateY(0); }
.q-tile .ar-num {
  font-family: var(--arabic); font-size: 20px; color: var(--gold); line-height: 1;
}
.q-tile h3 { margin: 8px 0 3px; font-size: 15px; letter-spacing: -.01em; }
.q-tile p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.q-tile .lock {
  position: absolute; top: 10px; right: 10px; background: var(--gold-soft); color: #8a6a12;
  border-radius: 999px; font-size: 9.5px; font-weight: 800; padding: 3px 8px; letter-spacing: .05em;
}
.q-tile.primary {
  grid-column: span 2; background: linear-gradient(150deg, #0e6a56, #08473a); border-color: #0b5243; color: #fff;
}
.q-tile.primary h3 { font-size: 18px; }
.q-tile.primary p { color: #b6d2c9; }
.q-tile.primary .ar-num { color: #e3bd66; }
.q-tile.primary::after {
  content: ''; position: absolute; right: -40px; bottom: -50px; width: 150px; height: 150px;
  border-radius: 50%; border: 1px solid rgba(227, 189, 102, .22);
  box-shadow: 0 0 0 26px rgba(227, 189, 102, .05);
}

.juz-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.juz-scroll::-webkit-scrollbar { display: none; }
.juz-chip {
  flex: none; min-width: 52px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; text-align: center; font-size: 13px; font-weight: 700;
  color: var(--ink-soft); transition: all .15s;
}
.juz-chip small { display: block; font-size: 9.5px; font-weight: 600; color: var(--muted); }
.juz-chip:hover { border-color: var(--brand); color: var(--brand); }
.juz-chip.sel { background: var(--brand); border-color: var(--brand); color: #fff; }
.juz-chip.sel small { color: #b9d3ca; }
.juz-chip.locked { opacity: .5; }
.juz-chip.locked::after { content: '🔒'; font-size: 8px; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-box { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; }
.stat-box b { display: block; font-size: 19px; letter-spacing: -.02em; }
.stat-box span { font-size: 10.5px; color: var(--muted); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }

/* review list */
.review-item {
  display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.review-item:hover { border-color: var(--brand); transform: translateX(2px); }
.review-item .badge-ar {
  width: 38px; height: 38px; border-radius: 11px; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: none;
}
.review-item h4 { margin: 0; font-size: 14px; }
.review-item p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.review-item .go { margin-left: auto; color: var(--muted); }
.empty {
  text-align: center; padding: 26px 18px; border: 1px dashed var(--line); border-radius: 14px;
  color: var(--muted); font-size: 13.5px; background: #fffdf8;
}

/* setup */
.setup-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.back-btn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink-soft); display: grid; place-items: center; }
.setup-head h2 { margin: 0; font-size: 19px; letter-spacing: -.02em; }

.field { margin-bottom: 22px; }
.field > label { display: block; font-size: 12px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.seg { display: grid; grid-auto-flow: column; gap: 8px; }
.seg button {
  padding: 12px 8px; border-radius: 12px; border: 1px solid var(--line); background: #fff;
  font-size: 13.5px; font-weight: 700; color: var(--ink-soft); cursor: pointer; transition: all .15s;
}
.seg button.sel { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(13, 107, 87, .22); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }

.surah-picker { max-height: 230px; overflow-y: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.surah-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #f2ece0;
  cursor: pointer; font-size: 14px;
}
.surah-row:last-child { border-bottom: 0; }
.surah-row:hover { background: #fbf8f1; }
.surah-row.sel { background: var(--brand-soft); }
.surah-row .no { width: 24px; font-size: 11px; color: var(--muted); font-weight: 700; }
.surah-row .nm { flex: 1; }
.surah-row .ar { font-family: var(--arabic); font-size: 17px; color: var(--brand); }

/* quiz */
.quiz-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.progress-bar { flex: 1; height: 6px; border-radius: 4px; background: #e9e2d2; overflow: hidden; }
.progress-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #12917a); border-radius: 4px; transition: width .3s ease; }
.hearts { display: flex; gap: 3px; }
.hearts svg { width: 15px; height: 15px; }
.score-chip { font-size: 12.5px; font-weight: 800; color: var(--brand); background: var(--brand-soft); padding: 4px 10px; border-radius: 999px; }

.q-box {
  background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 18px 16px;
  box-shadow: var(--shadow-sm);
}
.q-hint { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; }
.q-hint .lvl { color: var(--gold); }
.q-arabic {
  font-family: var(--arabic); direction: rtl; text-align: right;
  font-size: 27px; line-height: 2.05; margin: 12px 0 4px; color: #12261f;
  transition: font-size .2s;
}
.q-arabic.long { font-size: 22px; line-height: 1.95; }
.q-arabic.xlong { font-size: 18.5px; line-height: 1.9; }
.q-trans { font-size: 13px; color: var(--muted); margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 10px; }

.opt-list { margin-top: 16px; display: grid; gap: 9px; }
.opt-btn {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 13px 14px; border-radius: 13px; border: 1px solid var(--line); background: #fff;
  cursor: pointer; font-size: 15px; color: var(--ink); transition: border-color .15s, background .15s, transform .12s;
  box-shadow: 0 1px 2px rgba(16, 36, 31, .03);
}
.opt-btn:hover:not(:disabled) { border-color: #cbbfa4; transform: translateX(2px); }
.opt-btn:disabled { cursor: default; }
.opt-btn .key {
  width: 24px; height: 24px; border-radius: 8px; background: var(--cream-2); color: var(--muted);
  display: grid; place-items: center; font-size: 11px; font-weight: 800; flex: none;
}
.opt-btn .txt { flex: 1; }
.opt-btn .txt.arabic { font-size: 19px; line-height: 1.85; text-align: right; }
.opt-btn .txt.arabic.long { font-size: 16px; }
.opt-btn.correct { border-color: #6fc3a3; background: #eefaf4; }
.opt-btn.correct .key { background: var(--ok); color: #fff; }
.opt-btn.wrong { border-color: #e0a294; background: #fdf1ee; }
.opt-btn.wrong .key { background: var(--danger); color: #fff; }
.opt-btn.dim { opacity: .55; }

/* order mode */
.order-pool, .order-slot { display: grid; gap: 8px; }
.order-slot { margin-top: 12px; }
.slot-line {
  min-height: 54px; border: 1px dashed #d7cdb7; border-radius: 12px; display: flex; align-items: center;
  padding: 8px 12px; font-family: var(--arabic); direction: rtl; font-size: 17px; line-height: 1.7; background: #fffdf8;
  cursor: pointer; color: #7b8c86;
}
.slot-line.filled { border-style: solid; border-color: var(--line); background: #fff; color: var(--ink); }
.slot-line .idx { font-family: var(--font); font-size: 10px; font-weight: 800; color: var(--muted); margin-inline-end: 8px; direction: ltr; }
.pool-item {
  border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 12px;
  font-family: var(--arabic); direction: rtl; font-size: 17px; line-height: 1.7; cursor: pointer; text-align: right;
}
.pool-item:hover { border-color: var(--brand); }
.pool-item.used { opacity: .3; pointer-events: none; }

/* feedback */
.feedback {
  margin-top: 14px; border-radius: 14px; padding: 13px 15px; font-size: 13.5px; display: none;
  border: 1px solid transparent;
}
.feedback.show { display: block; animation: fade .2s ease; }
.feedback.ok { background: #eefaf4; border-color: #bfe6d6; color: #14624b; }
.feedback.no { background: #fdf1ee; border-color: #f0c9bf; color: #8f3626; }
.feedback b { display: block; margin-bottom: 3px; font-size: 14px; }

.quiz-foot { margin-top: 16px; display: flex; gap: 10px; }
.quiz-foot .btn { flex: 1; }

/* result */
.result-card { text-align: center; padding: 12px 0 0; }
.score-circle {
  width: 148px; height: 148px; margin: 10px auto 18px; border-radius: 50%;
  display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--brand) calc(var(--p, 0) * 1%), #e9e2d2 0);
}
.score-circle::after { content: ''; position: absolute; inset: 11px; background: var(--cream); border-radius: 50%; }
.score-circle div { position: relative; z-index: 1; }
.score-circle b { display: block; font-size: 38px; letter-spacing: -.04em; line-height: 1; }
.score-circle span { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.result-card h2 { font-size: 22px; margin: 0 0 6px; letter-spacing: -.025em; }
.result-card p { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 22px; }
.result-grid div { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 11px; }
.result-grid b { display: block; font-size: 18px; }
.result-grid span { font-size: 10.5px; color: var(--muted); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.miss-list { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 20px; }
.miss-list h4 { margin: 0 0 8px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.miss-list .row { font-size: 13px; padding: 6px 0; border-bottom: 1px dashed #f0e9da; }
.miss-list .row:last-child { border-bottom: 0; }
.miss-list .row b { color: var(--danger); }

/* report */
.report-sum { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
.bar-row { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 11px 13px; margin-bottom: 8px; }
.bar-row .top { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; }
.bar-row .top span { color: var(--muted); font-weight: 600; font-size: 12px; }
.bar-track { height: 5px; background: #eee7d7; border-radius: 4px; margin-top: 7px; overflow: hidden; }
.bar-track i { display: block; height: 100%; border-radius: 4px; background: var(--brand); }
.bar-track i.mid { background: var(--gold); }
.bar-track i.low { background: #c9694f; }

/* license */
.lic-card {
  background: linear-gradient(160deg, #0e6a56, #08473a); color: #fff; border-radius: 20px;
  padding: 22px; margin-bottom: 18px; position: relative; overflow: hidden;
}
.lic-card::after {
  content: ''; position: absolute; right: -50px; top: -50px; width: 170px; height: 170px;
  border: 1px solid rgba(227, 189, 102, .25); border-radius: 50%; box-shadow: 0 0 0 30px rgba(227, 189, 102, .05);
}
.lic-card .k { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #a9c8be; font-weight: 800; }
.lic-card h3 { margin: 6px 0 2px; font-size: 21px; }
.lic-card p { margin: 0; font-size: 13px; color: #b6d2c9; }
.lic-card .btn { margin-top: 16px; position: relative; z-index: 1; }
.lic-meta { display: grid; gap: 8px; margin-top: 14px; font-size: 12.5px; color: #a9c8be; }
.lic-meta code { background: rgba(255,255,255,.1); padding: 2px 7px; border-radius: 6px; color: #f6e7bd; font-size: 11.5px; }

.input-code {
  width: 100%; padding: 15px 16px; border-radius: 13px; border: 1px solid var(--line);
  font-size: 17px; font-weight: 800; letter-spacing: .16em; text-align: center; text-transform: uppercase;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.input-code:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(13, 107, 87, .12); }
.input-code.err { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(180, 68, 47, .1); }

.help-note { font-size: 12.5px; color: var(--muted); margin-top: 12px; text-align: center; line-height: 1.6; }
.help-note a { color: var(--brand); font-weight: 700; text-decoration: underline; }

.msg { border-radius: 12px; padding: 11px 14px; font-size: 13px; margin-top: 12px; display: none; }
.msg.show { display: block; }
.msg.ok { background: #eefaf4; color: #14624b; border: 1px solid #bfe6d6; }
.msg.no { background: #fdf1ee; color: #8f3626; border: 1px solid #f0c9bf; }

/* modal */
.modal-bg {
  position: fixed; inset: 0; background: rgba(11, 31, 26, .5); backdrop-filter: blur(3px);
  display: none; align-items: flex-end; justify-content: center; z-index: 100; padding: 0;
}
.modal-bg.show { display: flex; }
@media (min-width: 640px) { .modal-bg { align-items: center; padding: 20px; } }
.modal {
  background: var(--cream); width: 100%; max-width: 460px; border-radius: 22px 22px 0 0;
  padding: 26px 22px calc(26px + env(safe-area-inset-bottom)); animation: slideUp .3s cubic-bezier(.2,.9,.3,1);
}
@media (min-width: 640px) { .modal { border-radius: 22px; } }
@keyframes slideUp { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal h3 { margin: 0 0 8px; font-size: 20px; letter-spacing: -.02em; }
.modal p { margin: 0 0 16px; font-size: 14px; color: var(--ink-soft); }
.modal ul { margin: 0 0 20px; padding-left: 18px; font-size: 13.5px; color: var(--ink-soft); }
.modal ul li { margin-bottom: 6px; }
.modal-actions { display: grid; gap: 9px; }
.modal .link-btn { background: none; border: 0; color: var(--muted); font-size: 13px; cursor: pointer; padding: 8px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); opacity: 0;
  background: #10241f; color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 13px;
  font-weight: 600; z-index: 200; pointer-events: none; transition: all .25s; max-width: 88vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.skeleton { background: linear-gradient(90deg, #efe9dc 25%, #f7f3ea 50%, #efe9dc 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.daily-note {
  display: flex; align-items: center; gap: 9px; background: var(--gold-soft); border: 1px solid #ecdcb4;
  color: #7a5c12; border-radius: 12px; padding: 10px 13px; font-size: 12.5px; margin-top: 12px;
}

/* bottom tabs */
.tabbar {
  position: sticky; bottom: 0; z-index: 30;
  display: flex; align-items: stretch;
  background: rgba(251, 248, 241, .96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1; background: none; border: 0; padding: 10px 4px 9px; cursor: pointer;
  display: grid; justify-items: center; gap: 3px; color: var(--muted);
  font-size: 10.5px; font-weight: 700; letter-spacing: .03em; transition: color .15s;
}
.tabbar button.on { color: var(--brand); }
.tabbar button.on svg { transform: translateY(-1px); }

.blank {
  display: inline-block; min-width: 74px; text-align: center;
  border-bottom: 2px solid var(--gold); color: var(--gold); font-weight: 700;
}
.screen { padding-bottom: 20px; }
