:root {
  --night: #0C191E;
  --night2: #122A2B;
  --sand: #E8C98C;
  --mist: rgba(255, 255, 255, .92);
  --mist2: rgba(255, 255, 255, .62);
  --mist3: rgba(255, 255, 255, .40);
  --line: rgba(255, 255, 255, .08);
  --fill: rgba(255, 255, 255, .07);
  --ink: #121719;
  --sans: Inter, "Anek Bangla", system-ui, sans-serif;
  /* Numbers: Anek Bangla draws both Bangla and Latin digits cleanly at large sizes. */
  --num: "Anek Bangla", Inter, system-ui, sans-serif;
  color-scheme: dark;
}
:lang(bn) { --sans: "Anek Bangla", Inter, system-ui, sans-serif; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--night); }
/* No text selection, magnifier, callout or Paste menu anywhere except form fields. */
* { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
input, textarea { -webkit-touch-callout: default; -webkit-user-select: text; user-select: text; }
body {
  background: linear-gradient(180deg, var(--night2), var(--night));
  touch-action: manipulation;
  color: var(--mist);
  font-family: var(--sans);
  overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* Pinned to the real screen edges: 100dvh comes up short in iPhone Home Screen apps. */
#app {
  position: fixed; inset: 0; overflow: hidden;
  display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 14px) 16px calc(env(safe-area-inset-bottom) + 10px);
  max-width: 520px; margin: 0 auto;
}

.top { display: flex; justify-content: space-between; align-items: flex-start; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .14em; color: var(--sand); }
:lang(bn) .eyebrow { letter-spacing: 0; }
h1 { margin: 2px 0 0; font: 600 28px/1.1 "Source Serif 4", Georgia, serif; letter-spacing: -.01em; }
:lang(bn) h1 { font-family: "Anek Bangla", sans-serif; font-weight: 600; font-size: 26px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--fill); color: var(--mist2);
}

.banner {
  margin-top: 12px; padding: 10px 14px; border-radius: 14px;
  background: rgba(232, 201, 140, .12); color: var(--sand);
  font-size: 14px; font-weight: 500;
}

.chips { display: flex; gap: 6px; overflow-x: auto; margin: 16px -16px 0; padding: 0 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 8px 13px; border-radius: 999px;
  background: var(--fill); color: var(--mist2); font-size: 13px; font-weight: 500;
  display: flex; gap: 6px; align-items: center;
}
.chip.on { background: var(--sand); color: var(--ink); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }

.dhikr { text-align: center; margin-top: 22px; }
.arabic { font: 400 34px/1.5 Amiri, serif; color: var(--sand); direction: rtl; }
.name { font-size: 15px; font-weight: 600; margin-top: 2px; }
.meaning { font-size: 13px; color: var(--mist3); margin-top: 2px; }

.progress { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.progress:empty { display: none; }
.stat { background: var(--fill); border-radius: 14px; padding: 10px 12px; }
.stat b { display: block; font: 600 21px/1.15 var(--num); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.stat span { font-size: 11.5px; color: var(--mist3); }
.bar { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: var(--fill); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--sand); border-radius: 4px; transition: width .3s ease; }

/* The whole lower screen is the counter; taps anywhere outside buttons count too. */
.tapzone {
  flex: 1; min-height: 0; margin: 8px -16px 0;
  position: relative; display: grid; place-items: center;
  touch-action: none;
  container-type: size;
}
.tapzone.flash::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at center, rgba(232, 201, 140, .10), transparent 65%);
  animation: flash .25s ease-out forwards;
}
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
/* Sized to the space left, keeping clear of the hint line at the bottom. */
.ring { position: absolute; --r: min(80cqw, calc(100cqh - 64px), 340px); width: var(--r); height: var(--r);
  top: calc((100cqh - 36px - var(--r)) / 2); transform: rotate(-90deg); }
.count { margin-bottom: 36px; --r: min(80cqw, calc(100cqh - 64px), 340px); max-width: calc(var(--r) * .78); }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, .08); stroke-width: 4; }
.ring-fg { fill: none; stroke: var(--sand); stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset .2s ease-out; }
.count { position: relative; text-align: center; }
.num { font: 500 clamp(44px, calc(var(--r) * .3), 96px)/1 var(--num); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.of { font: 500 clamp(12px, calc(var(--r) * .045), 15px)/1.3 var(--num); color: var(--mist2); margin-top: 8px; }
.hint { position: absolute; bottom: 6px; font-size: 12px; color: var(--mist3); }
.pop { animation: pop .14s ease-out; }
@keyframes pop { 50% { transform: scale(1.06); } }

.foot { display: flex; justify-content: space-between; align-items: center; padding: 10px 4px 0; font-size: 12px; color: var(--mist3); }
#sync.ok { color: #7fc8a0; }
#sync.wait { color: var(--sand); }
#sync.off { color: #e08a7a; }
.link { color: var(--mist2); font-size: 13px; padding: 6px 4px; }

.haptic { position: fixed; left: -100px; top: 0; opacity: 0; pointer-events: none; }

dialog {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 520px;
  background: transparent; color: var(--mist);
}
dialog::backdrop { background: rgba(0, 0, 0, .55); }
.sheet {
  background: #13262A; border-radius: 24px 24px 0 0;
  padding: 18px 16px calc(env(safe-area-inset-bottom) + 18px);
  max-height: 88dvh; overflow-y: auto;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
h2 { margin: 0; font: 600 22px/1.2 "Source Serif 4", Georgia, serif; }
:lang(bn) h2 { font-family: "Anek Bangla", sans-serif; }
.note { color: var(--mist3); font-size: 13px; line-height: 1.45; margin: 6px 0 14px; }
.goal-list { display: grid; gap: 6px; }
.goal { display: flex; align-items: center; gap: 10px; background: var(--fill); border-radius: 14px; padding: 10px 12px; }
.goal .g-name { flex: 1; font-size: 15px; }
.goal .g-ar { font-family: Amiri, serif; color: var(--mist3); font-size: 15px; }
input {
  font: inherit; color: var(--mist); background: rgba(0, 0, 0, .25);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
  -webkit-user-select: text; user-select: text;
}
.goal input { width: 96px; text-align: right; font-variant-numeric: tabular-nums; font-size: 16px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 4px 0; font-size: 15px; }
.row input { font-size: 16px; }
.row.muted { color: var(--mist3); font-size: 13px; padding-top: 6px; }
.seg { display: inline-flex; background: var(--fill); border-radius: 999px; padding: 3px; }
.seg button { padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--mist2); }
.seg button.on { background: var(--sand); color: var(--ink); }
.card { background: var(--fill); border-radius: 16px; padding: 14px; margin-top: 18px; font-size: 14px; line-height: 1.45; color: var(--mist2); }
.btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn { padding: 11px 16px; border-radius: 12px; background: var(--fill); font-weight: 600; font-size: 14px; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.solid { background: var(--sand); color: var(--ink); width: 100%; margin-top: 18px; padding: 14px; font-size: 16px; }
.btn[disabled] { opacity: .4; }

.gate {
  position: fixed; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 14px;
  padding: 24px; background: var(--night); max-width: 520px; margin: 0 auto;
}
.gate[hidden], .banner[hidden] { display: none; }
.gate p { color: var(--mist2); line-height: 1.5; margin: 0; }
.gate input { font-size: 16px; padding: 12px; }
.gate-icon { width: 64px; height: 64px; border-radius: 15px; }
.gate .code { font-size: 34px; letter-spacing: .25em; text-align: center; padding: 14px; font-variant-numeric: tabular-nums; }
.gate-error { color: #e08a7a; font-size: 14px; }
.gate-error[hidden] { display: none; }
.gate-key summary { color: var(--mist3); font-size: 13px; padding: 6px 0; }
.gate-key input { width: 100%; margin-top: 8px; }
