:root{
  --off-white:#FFFFF4;
  --surface:#FFFFFF;
  --linen:#B1B6B6;
  --green-tea:#C9D2C0;
  --olive-mid:#A5AD7F;
  --olive-dark:#44482F;
  --olive-darker:#363a25;
  --blue-slate:#646E78;
  --charcoal:#233D4D;
  --gold:#FFB900;
  --gold-light:#FCCA46;
  --gold-pale:#EDD892;
  --text:#2b2f1f;
  --text-soft:#5b6157;
  --shadow-sm:0 2px 10px rgba(68,72,47,.08);
  --shadow-md:0 12px 30px rgba(68,72,47,.14);
  --shadow-lg:0 24px 60px rgba(68,72,47,.20);
  --radius-lg:28px;
  --radius-md:18px;
  --ease:cubic-bezier(.22,1,.36,1);
}

*{box-sizing:border-box;margin:0;padding:0;}
html,body{height:100%;}
body{
  font-family:'Manrope',sans-serif;
  background:var(--off-white);
  color:var(--text);
  overflow-x:hidden;
  min-height:100vh;
  position:relative;
}

/* ambient background orbs for dynamic feel */
.bg-orb{
  position:fixed; border-radius:50%; filter:blur(60px); z-index:0; pointer-events:none;
  opacity:.55; transition:background 1.2s var(--ease);
}
.orb-a{ width:480px; height:480px; top:-160px; right:-140px; background:radial-gradient(circle, var(--gold-pale), transparent 70%); animation:drift 18s ease-in-out infinite; }
.orb-b{ width:380px; height:380px; bottom:-120px; left:-120px; background:radial-gradient(circle, var(--green-tea), transparent 70%); animation:drift 22s ease-in-out infinite reverse; }
@keyframes drift{ 0%,100%{transform:translate(0,0) scale(1);} 50%{transform:translate(30px,-20px) scale(1.08);} }

body.theme-evening{ background:#233D4D; transition:background .6s var(--ease); }
body.theme-evening .orb-a{ background:radial-gradient(circle, var(--olive-mid), transparent 70%); opacity:.45; }
body.theme-evening .orb-b{ background:radial-gradient(circle, var(--blue-slate), transparent 70%); opacity:.35; }

.screen{
  display:none;
  position:relative; z-index:1;
  min-height:100vh;
  max-width:640px;
  margin:0 auto;
  padding:0 22px 24px;
}
.screen.active{ display:block; animation:fadeUp .5s var(--ease); }
@keyframes fadeUp{ from{opacity:0; transform:translateY(14px);} to{opacity:1; transform:translateY(0);} }

/* ---------- topbar / brand ---------- */
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:22px 0 6px; gap:12px;
}
.brand{ display:flex; align-items:center; }
.brand-mark{ width:22px; height:auto; object-fit:contain; display:block; }
.brand-word{
  font-family:'Montserrat Alternates', sans-serif;
  font-weight:700; font-size:18px; color:var(--olive-dark);
  letter-spacing:.2px;
}
.eyebrow{
  font-family:'Manrope'; font-size:12px; font-weight:600; letter-spacing:.12em;
  text-transform:uppercase; color:var(--blue-slate);
  background:var(--green-tea); padding:6px 12px; border-radius:999px;
  text-decoration:none; white-space:nowrap;
}

/* ---------- home ---------- */
.home-main{ padding-top:18px; }
.home-title{
  font-family:'Montserrat Alternates', sans-serif;
  font-weight:600; font-size:40px; line-height:1.08;
  color:var(--olive-darker); margin-bottom:14px;
}
.home-title .amp{ color:var(--gold); }
.home-sub{
  font-size:15.5px; line-height:1.6; color:var(--text-soft);
  max-width:480px; margin-bottom:30px;
}

.picker-group{ margin-bottom:26px; }
.picker-label{
  font-size:12px; font-weight:700; letter-spacing:.1em; text-transform:uppercase;
  color:var(--blue-slate); margin-bottom:10px;
}

.pill-row{ display:flex; gap:10px; }
.pill{
  flex:1; display:flex; align-items:center; justify-content:center; gap:8px;
  padding:14px 16px; border-radius:999px; border:1.5px solid var(--linen);
  background:var(--surface); font-family:'Manrope'; font-weight:600; font-size:15px;
  color:var(--text); cursor:pointer; transition:all .25s var(--ease);
}
.pill-icon{ width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; }
.pill:hover{ border-color:var(--gold-light); transform:translateY(-1px); box-shadow:var(--shadow-sm); }
.pill.active{
  background:var(--olive-dark); border-color:var(--olive-dark); color:var(--off-white);
  box-shadow:var(--shadow-md);
}
.pill.active .pill-icon{ fill:var(--gold); stroke:var(--gold); }
.pill[data-period="morning"].active .pill-icon circle{ fill:var(--gold); }

.length-cards{ display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.tier-card{
  display:flex; flex-direction:column; align-items:flex-start; gap:4px;
  text-align:left; padding:16px 14px; border-radius:var(--radius-md);
  border:1.5px solid var(--linen); background:var(--surface); cursor:pointer;
  transition:all .25s var(--ease); position:relative; overflow:hidden;
}
.tier-card:hover{ transform:translateY(-2px); box-shadow:var(--shadow-sm); border-color:var(--gold-light); }
.tier-card.active{ border-color:var(--gold); background:linear-gradient(160deg,#fffdf3,var(--off-white)); box-shadow:var(--shadow-md); }
.tier-card.active::after{
  content:"✓"; position:absolute; top:10px; right:10px; width:20px; height:20px;
  border-radius:50%; background:var(--gold); color:var(--olive-darker); font-size:12px;
  display:flex; align-items:center; justify-content:center; font-weight:700;
  animation:pop .25s var(--ease);
}
@keyframes pop{ from{ transform:scale(0); } to{ transform:scale(1); } }
.tier-badge{ font-family:'Montserrat Alternates'; font-weight:600; font-size:15px; color:var(--olive-darker); }
.tier-meta{ font-size:12px; font-weight:700; color:var(--gold); }
.tier-time{ font-size:11px; color:var(--blue-slate); }
.tier-desc{ font-size:11.5px; line-height:1.4; color:var(--text-soft); margin-top:4px; }

.btn-primary{
  width:100%; display:flex; align-items:center; justify-content:center; gap:10px;
  padding:16px 22px; border-radius:999px; border:none;
  background:var(--olive-dark); color:var(--off-white); font-family:'Manrope';
  font-weight:700; font-size:16px; cursor:pointer; transition:all .25s var(--ease);
  box-shadow:var(--shadow-md);
}
.btn-primary:hover:not(:disabled){ transform:translateY(-2px); box-shadow:var(--shadow-lg); background:var(--olive-darker); }
.btn-primary:disabled{ opacity:.4; cursor:not-allowed; box-shadow:none; }
.btn-arrow{ width:18px; height:18px; fill:none; stroke:var(--gold); stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; transition:transform .25s var(--ease); }
.btn-primary:hover .btn-arrow{ transform:translateX(4px); }
.btn-start{ margin-top:8px; }

/* ---------- session ---------- */
.progress-wrap{ display:flex; align-items:center; gap:12px; padding:20px 0 8px; }
.icon-btn{
  width:38px; height:38px; border-radius:50%; border:1.5px solid var(--linen);
  background:var(--surface); display:flex; align-items:center; justify-content:center;
  cursor:pointer; flex-shrink:0; transition:all .2s var(--ease);
}
.icon-btn:hover{ background:var(--green-tea); }
.icon-btn svg{ width:18px; height:18px; fill:none; stroke:var(--olive-dark); stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }

.progress-track{
  position:relative; flex:1; height:10px; border-radius:999px; background:var(--green-tea);
  overflow:hidden;
}
.progress-fill{
  position:absolute; left:0; top:0; height:100%; width:0%;
  background:linear-gradient(90deg, var(--gold-light), var(--gold));
  border-radius:999px; transition:width .55s var(--ease);
}
.progress-pips{ position:absolute; inset:0; display:flex; }
.progress-pips span{ flex:1; border-right:2px solid var(--off-white); }
.progress-pips span:last-child{ border-right:none; }

.progress-label{ font-size:13px; font-weight:700; color:var(--olive-dark); min-width:46px; text-align:right; flex-shrink:0; }

.session-meta{ display:flex; gap:8px; padding:6px 0 16px; }
.session-period-tag, .session-tier-tag{
  font-size:11.5px; font-weight:700; letter-spacing:.06em; text-transform:uppercase;
  padding:5px 11px; border-radius:999px; background:var(--green-tea); color:var(--olive-darker);
}
.session-tier-tag{ background:var(--gold-pale); color:var(--olive-darker); }

.card-stage{ position:relative; min-height:360px; padding-bottom:20px; }

.dhikr-card{
  position:absolute; inset:0;
  background:var(--surface); border-radius:var(--radius-lg);
  padding:26px 22px 24px; box-shadow:var(--shadow-md);
  border:1px solid rgba(177,182,182,.4);
  opacity:0; transform:translateX(36px) scale(.98);
  transition:opacity .42s var(--ease), transform .42s var(--ease);
  pointer-events:none;
  display:flex; flex-direction:column; gap:14px;
  max-height:62vh; overflow-y:auto;
}
.dhikr-card.current{ opacity:1; transform:translateX(0) scale(1); pointer-events:auto; position:relative; }
.dhikr-card.leaving-left{ opacity:0; transform:translateX(-44px) scale(.97); }
.dhikr-card.leaving-done{ opacity:0; transform:translateX(-44px) scale(.9); }

.dhikr-index{ font-size:12px; font-weight:700; color:var(--gold); letter-spacing:.08em; text-transform:uppercase; }
.dhikr-title{
  font-family:'Montserrat Alternates'; font-weight:600; font-size:19px; color:var(--olive-darker);
  line-height:1.3;
}
.dhikr-arabic{
  font-family:'Amiri', serif; font-size:25px; line-height:2.05; color:var(--text);
  direction:rtl; text-align:right; padding:14px 4px; background:var(--off-white);
  border-radius:14px; border:1px solid var(--green-tea); white-space:pre-line;
}
.dhikr-translit{ font-size:13.5px; font-style:italic; color:var(--blue-slate); line-height:1.55; white-space:pre-line; }
.dhikr-translation{ font-size:14.5px; line-height:1.6; color:var(--text); white-space:pre-line; }
.dhikr-source{ font-size:12px; color:var(--olive-mid); font-weight:600; line-height:1.5; padding-top:4px; border-top:1px dashed var(--linen); }

/* tasbih footer */
.tasbih-bar{
  position:sticky; bottom:0; left:0; right:0;
  display:flex; align-items:center; justify-content:center; gap:26px;
  padding:18px 0 6px; background:linear-gradient(to top, var(--off-white) 60%, transparent);
}
.tasbih-btn{
  width:54px; height:54px; border-radius:50%; border:none; cursor:pointer;
  background:var(--surface); box-shadow:var(--shadow-sm); border:1.5px solid var(--linen);
  display:flex; align-items:center; justify-content:center; transition:all .15s var(--ease);
  flex-shrink:0;
}
.tasbih-btn svg{ width:22px; height:22px; fill:none; stroke:var(--olive-dark); stroke-width:2.6; stroke-linecap:round; }
.tasbih-btn:active{ transform:scale(.9); }
.tasbih-btn.plus{ background:var(--olive-dark); border-color:var(--olive-dark); }
.tasbih-btn.plus svg{ stroke:var(--gold); }
.tasbih-btn.plus:hover{ background:var(--olive-darker); }
.tasbih-btn.minus:hover{ border-color:var(--gold); }

.counter-dial{
  position:relative; width:96px; height:96px; border-radius:50%; border:none; background:none; cursor:pointer;
  flex-shrink:0;
}
.dial-ring{ width:100%; height:100%; transform:rotate(-90deg); }
.dial-track{ fill:none; stroke:var(--green-tea); stroke-width:8; }
.dial-progress{
  fill:none; stroke:var(--gold); stroke-width:8; stroke-linecap:round;
  stroke-dasharray:327; stroke-dashoffset:327;
  transition:stroke-dashoffset .35s var(--ease), stroke .3s;
}
.dial-center{
  position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center;
}
.dial-count{ font-family:'Montserrat Alternates'; font-weight:700; font-size:26px; color:var(--olive-darker); transition:transform .15s var(--ease); }
.dial-target{ font-size:11px; color:var(--blue-slate); font-weight:600; }
.counter-dial.pulse .dial-count{ transform:scale(1.18); }
.counter-dial.complete .dial-progress{ stroke:#5a8a4f; }

.skip-btn{
  display:block; margin:6px auto 0; background:none; border:none; cursor:pointer;
  font-size:13px; color:var(--blue-slate); font-weight:600; text-decoration:underline;
  text-decoration-color:transparent; transition:text-decoration-color .2s;
}
.skip-btn:hover{ text-decoration-color:var(--blue-slate); }

/* ---------- complete screen ---------- */
.complete-wrap{
  min-height:90vh; display:flex; flex-direction:column; align-items:center; justify-content:center;
  text-align:center; gap:14px; padding:20px 10px;
}
.complete-mark{
  width:64px; height:auto; object-fit:contain; margin-bottom:6px;
  animation:floatIn .7s var(--ease), twinkle 2.2s ease-in-out 1s infinite;
}
@keyframes floatIn{ from{ opacity:0; transform:translateY(-16px) scale(.8);} to{opacity:1; transform:translateY(0) scale(1);} }
@keyframes twinkle{ 0%,100%{ filter:brightness(1);} 50%{ filter:brightness(1.18);} }
.complete-title{ font-family:'Montserrat Alternates'; font-weight:700; font-size:30px; color:var(--olive-darker); }
.complete-sub{ font-size:15.5px; color:var(--text-soft); max-width:380px; }
.complete-quote{
  font-size:13px; font-style:italic; color:var(--blue-slate); max-width:360px; line-height:1.6;
  padding:14px 18px; background:var(--green-tea); border-radius:16px; margin:10px 0 4px;
}
.complete-quote span{ display:block; margin-top:6px; font-style:normal; font-weight:700; }
#done-btn{ max-width:260px; }

/* sparkle burst layer */
.sparkle-layer{ position:fixed; inset:0; pointer-events:none; z-index:50; }
.sparkle{
  position:absolute; width:8px; height:8px; background:var(--gold); border-radius:2px;
  animation:sparkleOut .7s ease-out forwards;
}
@keyframes sparkleOut{
  0%{ opacity:1; transform:translate(0,0) rotate(0) scale(1); }
  100%{ opacity:0; transform:translate(var(--dx), var(--dy)) rotate(180deg) scale(.3); }
}

@media (max-width:480px){
  .home-title{ font-size:32px; }
  .length-cards{ grid-template-columns:1fr; }
  .tasbih-bar{ gap:18px; }
  .counter-dial{ width:84px; height:84px; }
  .dial-count{ font-size:22px; }
}

/* ---------- brand link ---------- */
.brand-link{
  display:flex; align-items:center; gap:7px;
  text-decoration:none; color:inherit;
}
.brand-link:hover .brand-word{ color:var(--gold); }
.brand-word{ text-decoration:none; }

/* ---------- app footer ---------- */
.app-footer{
  display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:6px 10px;
  text-align:center; font-size:12px; color:var(--blue-slate);
  padding:18px 0 10px; font-weight:500;
}
.app-footer a{ color:var(--blue-slate); text-decoration:none; transition:color .2s; }
.app-footer a:hover{ color:var(--gold); }
.footer-dot{ color:var(--linen); }
.footer-add-app{
  display:inline-flex; align-items:center; gap:5px;
  font-weight:600; color:var(--olive-dark) !important;
  border:1.5px solid var(--linen); border-radius:999px;
  padding:5px 12px; transition:border-color .2s, color .2s !important;
}
.footer-add-app:hover{ border-color:var(--gold) !important; color:var(--gold) !important; }
.footer-icon{ width:14px; height:14px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
body.theme-evening .app-footer{ color:var(--green-tea); }
body.theme-evening .app-footer a{ color:var(--green-tea); }
body.theme-evening .app-footer a:hover{ color:var(--gold-light); }
body.theme-evening .footer-add-app{ color:var(--green-tea) !important; border-color:rgba(201,210,192,.3); }
body.theme-evening .footer-add-app:hover{ border-color:var(--gold-light) !important; color:var(--gold-light) !important; }

/* ---- Evening theme: dark background + text/component overrides ---- */
.pill[data-period="evening"].active .pill-icon{ fill:#fff; stroke:#fff; }

body.theme-evening .brand-word{ color:var(--green-tea); }
body.theme-evening .eyebrow{ background:rgba(165,173,127,.18); color:var(--olive-mid); }
body.theme-evening .home-title{ color:var(--off-white); }
body.theme-evening .home-sub{ color:var(--green-tea); }
body.theme-evening .picker-label{ color:var(--olive-mid); }

body.theme-evening .pill{
  background:rgba(255,255,255,.06); border-color:rgba(165,173,127,.25);
  color:var(--off-white);
}
body.theme-evening .pill:hover{ border-color:var(--gold-light); background:rgba(255,255,255,.1); }
body.theme-evening .pill.active{ background:var(--olive-mid); border-color:var(--olive-mid); color:var(--olive-darker); }

body.theme-evening .btn-primary{ background:var(--olive-mid); }
body.theme-evening .btn-primary:hover:not(:disabled){ background:var(--green-tea); color:var(--olive-darker); }
body.theme-evening .tasbih-btn.plus{ background:var(--olive-mid); border-color:var(--olive-mid); }
body.theme-evening .tasbih-btn.plus svg{ stroke:var(--olive-darker); }

body.theme-evening .tier-card{
  background:rgba(255,255,255,.05); border-color:rgba(165,173,127,.2);
}
body.theme-evening .tier-card:hover{ background:rgba(255,255,255,.09); border-color:var(--gold-light); }
body.theme-evening .tier-card.active{ background:rgba(255,185,0,.07); border-color:var(--gold); }
body.theme-evening .tier-badge{ color:var(--off-white); }
body.theme-evening .tier-desc{ color:var(--olive-mid); }

body.theme-evening .icon-btn{ background:rgba(255,255,255,.07); border-color:rgba(165,173,127,.3); }
body.theme-evening .icon-btn svg{ stroke:var(--green-tea); }
body.theme-evening .icon-btn:hover{ background:rgba(165,173,127,.2); }

body.theme-evening .session-period-tag{ background:rgba(165,173,127,.2); color:var(--green-tea); }
body.theme-evening .session-tier-tag{ background:rgba(237,216,146,.12); color:var(--gold-pale); }
body.theme-evening .progress-label{ color:var(--green-tea); }
body.theme-evening .skip-btn{ color:var(--olive-mid); }

body.theme-evening .tasbih-bar{ background:linear-gradient(to top,#233D4D 60%,transparent); }
body.theme-evening .dial-count{ color:var(--off-white); }
body.theme-evening .dial-target{ color:var(--green-tea); }

body.theme-evening .complete-title{ color:var(--off-white); }
body.theme-evening .complete-sub{ color:var(--green-tea); }
