:root {
  --bg: #06110d;
  --bg-soft: #0a1b14;
  --panel: rgba(15, 36, 27, 0.86);
  --panel-strong: #10271d;
  --ink: #f2f7eb;
  --muted: #9fb1a5;
  --soft: rgba(198, 226, 190, 0.12);
  --soft-strong: rgba(198, 226, 190, 0.2);
  --gold: #d8b45a;
  --gold-soft: #f0d994;
  --jade: #74d7a0;
  --line: rgba(218, 234, 211, 0.16);
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
  --radius: 8px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  background: var(--bg);
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    linear-gradient(160deg, rgba(116, 215, 160, 0.12), transparent 36%),
    linear-gradient(25deg, transparent 48%, rgba(216, 180, 90, 0.08)),
    var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  touch-action: manipulation;
}

button,
input {
  font: inherit;
}

button {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

button:focus,
button:active {
  outline: none;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
}

.home-page,
.detail-page {
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(28px + env(safe-area-inset-top)) clamp(18px, 4vw, 64px) calc(56px + env(safe-area-inset-bottom));
}

.home-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.detail-page {
  display: none;
}

body.detail-open {
  overflow: hidden;
}

body.detail-open .home-page {
  display: none;
}

body.detail-open .detail-page {
  display: flex;
  flex-direction: column;
  max-height: 100vh;
  max-height: 100dvh;
  overflow-y: auto;
}

.top-bar,
.detail-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-bar {
  min-height: 48px;
}

.brand-mark,
.round-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.16);
}

.brand-mark,
.round-button {
  display: grid;
  place-items: center;
  min-width: 44px;
  width: auto;
  height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--gold-soft);
}

.brand-mark {
  width: 44px;
  padding: 0;
  border-radius: 50%;
  overflow: hidden;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
}

.round-button {
  font-size: 1.2rem;
  transition:
    transform 180ms ease,
    background 180ms ease;
}

.round-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.1);
}

.category-chip:hover {
  border-color: rgba(116, 215, 160, 0.5);
  background: rgba(255, 255, 255, 0.1);
}

.top-spacer {
  flex: 1;
}

.saved-total {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.home-hero {
  max-width: 900px;
  padding-top: clamp(14px, 5vw, 62px);
}

.quiet-label,
.section-label,
.category-name {
  margin: 0;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  max-width: 900px;
  margin: 10px 0 0;
  font-size: clamp(3rem, 8vw, 7rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 620px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.7;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.18);
}

.search-icon {
  position: relative;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.search-icon::before,
.search-icon::after {
  content: "";
  position: absolute;
  display: block;
}

.search-icon::before {
  inset: 2px 5px 5px 2px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.search-icon::after {
  width: 8px;
  height: 2px;
  right: 1px;
  bottom: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(45deg);
  transform-origin: center;
}

.search-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
}

.search-wrap input::placeholder {
  color: #789184;
}

.category-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0 8px;
}

.category-chip,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.category-chip {
  padding: 0 15px;
}

.category-chip.is-active {
  border-color: rgba(116, 215, 160, 0.72);
  background: rgba(116, 215, 160, 0.16);
  color: #dff8e6;
}

.list-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.dhikr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(315px, 1fr));
  gap: 16px;
  padding-bottom: 40px;
}

.dhikr-card {
  display: grid;
  gap: 14px;
  min-height: 292px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035)),
    var(--panel);
  color: inherit;
  text-align: left;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.2);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.dhikr-card:hover,
.dhikr-card.is-active {
  transform: translateY(-2px);
  border-color: rgba(116, 215, 160, 0.58);
  background:
    linear-gradient(180deg, rgba(116, 215, 160, 0.12), rgba(255, 255, 255, 0.04)),
    var(--panel);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.arabic-card {
  min-height: 60px;
  margin: 0;
  font-family: "Noto Naskh Arabic", Amiri, serif;
  font-size: clamp(1.85rem, 3.4vw, 2.75rem);
  font-weight: 700;
  line-height: 1.62;
  color: var(--ink);
  word-spacing: 0.12em;
}

.dhikr-name,
.translation-card {
  margin: 0;
}

.dhikr-name {
  color: #dff8e6;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.35;
}

.translation-card {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.count-chip {
  display: grid;
  min-width: 64px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(116, 215, 160, 0.12);
  color: var(--jade);
  font-size: 1rem;
  font-weight: 900;
  text-align: center;
}

.count-chip small {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.level-line {
  display: grid;
  gap: 10px;
  align-self: end;
}

.level-copy {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.milestone-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: center;
  gap: 4px;
}

.milestone {
  display: grid;
  place-items: center;
  min-width: 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.milestone::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-bottom: 4px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
}

.milestone.is-reached {
  color: var(--gold-soft);
}

.milestone.is-reached::before {
  border-color: var(--jade);
  background: var(--jade);
  box-shadow: 0 0 18px rgba(116, 215, 160, 0.7);
}

.progress-track {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--jade), var(--gold));
}

.detail-topbar {
  justify-content: space-between;
}

.detail-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(22px, 3.4vw, 34px);
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 28px 0;
  text-align: center;
}

.selected-copy {
  display: grid;
  gap: 22px;
  max-width: min(100%, 1080px);
}

.arabic-main {
  margin: 0;
  max-width: min(100%, 980px);
  font-family: "Noto Naskh Arabic", Amiri, serif;
  font-size: clamp(3.3rem, 8.2vw, 6.8rem);
  font-weight: 700;
  line-height: 1.62;
  color: var(--ink);
  direction: rtl;
  letter-spacing: 0;
  overflow-wrap: normal;
  text-wrap: balance;
  unicode-bidi: plaintext;
  word-break: normal;
  word-spacing: 0.16em;
  text-shadow: 0 18px 70px rgba(116, 215, 160, 0.2);
}

.arabic-main.is-long {
  max-width: min(100%, 1080px);
  font-size: clamp(2.3rem, 4.8vw, 4.35rem);
  line-height: 1.78;
  word-spacing: 0.2em;
}

.arabic-main.is-very-long {
  font-size: clamp(2rem, 4vw, 3.65rem);
  line-height: 1.9;
  word-spacing: 0.18em;
}

.translit-main {
  margin: 0;
  color: #dff8e6;
  font-size: clamp(1.35rem, 2.5vw, 2rem);
  font-weight: 900;
  line-height: 1.25;
}

.translation-main {
  max-width: 680px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  line-height: 1.65;
}

.tap-button {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(260px, 34vw, 430px);
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid rgba(116, 215, 160, 0.34);
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 28%, rgba(255, 255, 255, 0.16), transparent 28%),
    radial-gradient(circle, rgba(116, 215, 160, 0.24), rgba(13, 42, 29, 0.96) 64%);
  color: var(--ink);
  box-shadow:
    inset 0 -28px 70px rgba(0, 0, 0, 0.36),
    inset 0 18px 42px rgba(255, 255, 255, 0.08),
    0 0 0 12px rgba(116, 215, 160, 0.06),
    0 34px 110px rgba(0, 0, 0, 0.52),
    0 0 90px rgba(116, 215, 160, 0.24);
  transition:
    transform 120ms ease,
    box-shadow 120ms ease;
  -webkit-tap-highlight-color: transparent;
}

.tap-button::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.tap-button:active {
  transform: scale(0.972);
  box-shadow:
    inset 0 -18px 48px rgba(0, 0, 0, 0.4),
    0 0 0 18px rgba(116, 215, 160, 0.1),
    0 18px 60px rgba(0, 0, 0, 0.5),
    0 0 120px rgba(216, 180, 90, 0.22);
}

.tap-ripple {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(240, 217, 148, 0.45);
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0);
  animation: ripple 650ms ease-out forwards;
}

.tap-count,
.tap-label {
  position: relative;
  z-index: 1;
}

.tap-count {
  display: block;
  font-size: clamp(5.2rem, 12vw, 10rem);
  font-weight: 900;
  line-height: 0.88;
}

.tap-label {
  margin-top: 18px;
  color: #b5c6b9;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.counter-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.secondary-button {
  padding: 0 18px;
}

.reset-button {
  border-color: rgba(216, 180, 90, 0.36);
  color: var(--gold-soft);
}

.tasbeeh-save {
  display: grid;
  gap: 12px;
  width: min(100%, 640px);
}

.bead-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 800;
}

.bead-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  min-height: 36px;
}

.bead {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(240, 217, 148, 0.24);
  box-shadow:
    inset -3px -4px 8px rgba(0, 0, 0, 0.28),
    inset 3px 3px 7px rgba(255, 255, 255, 0.2);
}

.bead.is-full {
  background: var(--gold);
  box-shadow:
    inset -3px -4px 8px rgba(0, 0, 0, 0.24),
    0 0 22px rgba(216, 180, 90, 0.48);
}

.empty-state {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 34px 18px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

@keyframes ripple {
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(18);
  }
}

@media (max-width: 780px) {
  .home-page,
  .detail-page {
    padding: calc(18px + env(safe-area-inset-top)) 16px calc(88px + env(safe-area-inset-bottom));
  }

  h1 {
    font-size: clamp(2.65rem, 13.6vw, 3.3rem);
    line-height: 0.96;
  }

  .top-bar strong {
    font-size: 0.95rem;
  }

  .saved-total {
    display: none;
  }

  .dhikr-grid {
    grid-template-columns: 1fr;
  }

  .dhikr-card {
    min-height: 250px;
    padding: 20px;
  }

  .list-meta,
  .level-copy {
    flex-direction: column;
    gap: 5px;
  }

  .arabic-main {
    font-size: clamp(2.7rem, 12.4vw, 4.8rem);
    line-height: 1.65;
  }

  .arabic-main.is-long {
    font-size: clamp(1.95rem, 8.8vw, 3.25rem);
    line-height: 1.86;
  }

  .arabic-main.is-very-long {
    font-size: clamp(1.65rem, 7.5vw, 2.65rem);
    line-height: 1.96;
  }

  .tap-button {
    width: min(68vw, 292px);
  }
}

@media (max-width: 430px) {
  .home-page {
    gap: 20px;
  }

  .home-hero {
    padding-top: 22px;
  }

  .hero-copy {
    font-size: 1rem;
    line-height: 1.55;
  }

  .search-wrap {
    min-height: 56px;
    padding: 0 16px;
  }

  .search-wrap input {
    font-size: 0.95rem;
  }

  .category-chip,
  .secondary-button {
    min-height: 40px;
  }

  .arabic-card {
    font-size: 2rem;
    line-height: 1.62;
  }

  .milestone {
    font-size: 0.62rem;
  }

  .translation-main {
    font-size: 1rem;
  }

  body.detail-open .detail-page {
    overflow-y: auto;
  }

  .detail-topbar {
    min-height: 44px;
  }

  .detail-content {
    justify-content: flex-start;
    gap: 18px;
    padding: 10px 0 44px;
  }

  .selected-copy {
    gap: 12px;
  }

  .translit-main {
    font-size: 1.28rem;
    line-height: 1.24;
  }

  .tap-button {
    width: min(64vw, 270px);
  }

  .tap-count {
    font-size: clamp(4.2rem, 16vw, 5.4rem);
  }

  .tasbeeh-save {
    gap: 8px;
  }

  .bead-summary {
    font-size: 0.88rem;
    line-height: 1.35;
  }
}
