:root {
  --bg: #0b1220;
  --bg2: #050814;
  --card: rgba(17, 27, 46, .95);
  --border: rgba(148, 163, 184, .15);
  --txt: #e5e7eb;
  --muted: #94a3b8;
  --accent: #22c55e;
  --accent2: #3b82f6;
  --warn: #f59e0b;
  --danger: #ef4444;
}

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

html,
body {
  height: 100%;
  overflow: hidden
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Arial;
  background: linear-gradient(180deg, var(--bg), var(--bg2));
  color: var(--txt);
  user-select: none;
}

.wrap {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.card {
  width: min(480px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 20px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, .5);
  backdrop-filter: blur(10px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.pill {
  background: rgba(148, 163, 184, .1);
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.actions {
  display: flex;
  gap: 8px
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 700;
  transition: all .2s;
  font-size: 14px;
}

.btn.main-install {
  background: var(--accent2);
  color: white;
}

.btn.settings {
  background: rgba(148, 163, 184, .12);
  color: var(--txt);
  padding: 8px 10px;
}

.stats-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.stat-pill {
  flex: 1;
  background: rgba(148, 163, 184, .08);
  border: 1px solid var(--border);
  padding: 10px;
  border-radius: 16px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.stat-pill span {
  color: var(--txt);
  font-weight: 800;
  font-size: 18px
}

.stat-pill.primary {
  border-color: rgba(59, 130, 246, .3);
  background: rgba(59, 130, 246, .05)
}

.stat-pill.primary span {
  color: var(--accent2)
}

.badges {
  background: rgba(148, 163, 184, .05);
  border-radius: 18px;
  padding: 12px;
  margin-bottom: 20px;
}

.badge {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin: 4px 0;
}

#counter {
  font-size: 24px;
  color: var(--txt);
  font-weight: 900
}

.dhikr-container {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dhikr {
  font-size: clamp(32px, 8vw, 42px);
  font-weight: 900;
  text-align: center;
  color: white;
  text-shadow: 0 0 20px rgba(255, 255, 255, .1);
}

.count {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 20px;
}

.tap {
  width: 100%;
  aspect-ratio: 1/0.45;
  border: none;
  border-radius: 24px;
  font-size: 24px;
  font-weight: 900;
  cursor: pointer;
  color: #06210f;
  background: linear-gradient(135deg, #34d399, var(--accent));
  box-shadow: 0 12px 40px rgba(34, 197, 94, .3);
  transition: transform .1s;
}

.tap:active {
  transform: scale(.98)
}

.row {
  display: flex;
  gap: 12px;
  margin-top: 16px
}

.sbtn {
  flex: 1;
  border: none;
  border-radius: 18px;
  padding: 14px;
  cursor: pointer;
  font-weight: 800;
  font-size: 15px;
}

.reset {
  background: rgba(148, 163, 184, .15);
  color: var(--txt)
}

.next {
  background: rgba(59, 130, 246, .15);
  color: var(--accent2)
}

/* Modals */
.modalBack {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .8);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal {
  width: min(440px, 100%);
  background: #111827;
  border: 1px solid var(--border);
  border-radius: 24px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px 20px 10px;
  border-bottom: 1px solid var(--border)
}

.modal-header h2 {
  margin: 0;
  font-size: 20px
}

.modal-content {
  padding: 20px;
  overflow-y: auto
}

.modal .close {
  margin: 0 20px 20px;
  padding: 14px;
  border: none;
  border-radius: 16px;
  background: rgba(148, 163, 184, .1);
  color: var(--txt);
  font-weight: 700;
  cursor: pointer;
}

.grid {
  display: grid;
  gap: 12px
}

.field {
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
}

.field.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between
}

label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px
}

select,
input {
  width: 100%;
  background: #0b1220;
  border: 1px solid var(--border);
  color: white;
  padding: 10px;
  border-radius: 10px;
  font-size: 14px;
}

input[type="checkbox"] {
  width: auto
}

.dhikr-item {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.dhikr-item input:first-child {
  flex: 2
}

.dhikr-item input:last-child {
  flex: 1
}

.backup-zone {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn-small {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .05);
  color: var(--txt);
  cursor: pointer;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  background: #1f2937;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 16px;
  display: none;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  z-index: 200;
}

.tbtn {
  background: var(--warn);
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}