:root {
  --bg-body: #081a16;
  --bg-card: #0d2822;
  --bg-card-subtle: #12342d;
  --border-color: #1e4a40;
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-light: #34d399;
  --gold: #d4af37;
  --text-main: #e6f4f1;
  --text-muted: #94b8af;
  --text-arabic: #f8fafc;
  --card-done-bg: rgba(16, 185, 129, 0.12);
  --card-done-border: #10b981;
  --font-scale: 1;
}

body.light-theme {
  --bg-body: #f4f8f6;
  --bg-card: #ffffff;
  --bg-card-subtle: #ebf3f0;
  --border-color: #cbdcd5;
  --primary: #059669;
  --primary-hover: #047857;
  --primary-light: #10b981;
  --gold: #b38e1b;
  --text-main: #132a24;
  --text-muted: #4e6b63;
  --text-arabic: #0b1f1a;
  --card-done-bg: #ecfdf5;
  --card-done-border: #10b981;
}

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

body {
  font-family: 'Tajawal', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.7;
  padding-bottom: 90px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* شريط الرأس */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(8, 26, 22, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 16px;
}
body.light-theme header {
  background-color: rgba(244, 248, 246, 0.95);
}

.header-content {
  max-width: 850px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.app-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--gold);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.controls-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-icon {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}
.btn-icon:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* شريط التنقل بين الصفحات */
.tabs-wrapper {
  max-width: 850px;
  margin: 14px auto 8px;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs-wrapper::-webkit-scrollbar {
  display: none;
}

.tabs-nav {
  display: flex;
  gap: 8px;
  min-width: max-content;
}

.tab-link {
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tab-link.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

/* شريط التقدم */
.progress-section {
  max-width: 850px;
  margin: 10px auto 16px;
  padding: 0 16px;
}

.progress-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--bg-card-subtle);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--primary));
  transition: width 0.3s ease;
}

/* الحاوية الأساسية للبطاقات */
.container {
  max-width: 850px;
  margin: 0 auto;
  padding: 0 16px;
}

.item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
  transition: all 0.3s ease;
}

.item-card.completed {
  background: var(--card-done-bg);
  border-color: var(--card-done-border);
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 8px;
}

.item-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--gold);
}

.item-badge {
  font-size: 0.8rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.quran-text {
  font-family: 'Amiri', serif;
  font-size: calc(1.35rem * var(--font-scale));
  line-height: 2.2;
  color: var(--text-arabic);
  text-align: justify;
  margin-bottom: 16px;
  letter-spacing: 0.3px;
}

.quran-text span.ayah-end {
  color: var(--gold);
  font-weight: bold;
  padding: 0 4px;
}

.instruction-note {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding: 6px 12px;
  background: var(--bg-card-subtle);
  border-right: 3px solid var(--gold);
  border-radius: 4px;
}

.counter-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-counter {
  flex: 1;
  height: 52px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
  transition: all 0.15s ease;
  user-select: none;
}
.btn-counter:active {
  transform: scale(0.97);
}

.item-card.completed .btn-counter {
  background: var(--bg-card-subtle);
  color: var(--primary);
  border: 1px solid var(--primary);
  box-shadow: none;
}

.btn-reset-single {
  width: 48px;
  height: 52px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-reset-single:hover {
  color: #ef4444;
  border-color: #ef4444;
}

/* واجهة المسبحة */
.misbaha-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 24px 20px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.misbaha-select, .misbaha-input {
  width: 100%;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 12px 14px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  outline: none;
}
.misbaha-select:focus, .misbaha-input:focus {
  border-color: var(--primary);
}

.target-chips {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.target-chip {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.target-chip.active {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
}

.misbaha-display-wrap {
  margin: 10px auto 26px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.misbaha-circle-btn {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--bg-card-subtle), var(--bg-body));
  border: 6px solid var(--primary);
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.3), inset 0 0 15px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s ease, border-color 0.2s ease;
}
.misbaha-circle-btn:active {
  transform: scale(0.94);
  border-color: var(--gold);
}

.misbaha-circle-btn .count-big {
  font-size: 3.4rem;
  font-weight: 800;
  color: var(--primary-light);
  line-height: 1;
  font-family: 'Tajawal', sans-serif;
}

.misbaha-circle-btn .count-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.misbaha-stats {
  display: flex;
  justify-content: space-around;
  background: var(--bg-card-subtle);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.misbaha-stats span strong {
  color: var(--gold);
}

.misbaha-actions-bar {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-misbaha-action {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 20px;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.92rem;
  transition: all 0.2s ease;
}
.btn-misbaha-action:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* بطاقات الدليل */
.guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}

.guide-card h3 {
  color: var(--gold);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
}

.guide-card ul {
  padding-right: 20px;
  color: var(--text-main);
}

.guide-card li {
  margin-bottom: 8px;
}

/* التذييل المنظم (Footer) */
footer.app-footer {
  max-width: 850px;
  margin: 40px auto 0;
  padding: 24px 16px;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.footer-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 22px 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.footer-title {
  font-weight: 700;
  color: var(--gold);
  font-size: 1.05rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.footer-dev {
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.footer-dev span {
  color: var(--primary-light);
  font-weight: 700;
}

.footer-dua {
  background: var(--bg-card-subtle);
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.9;
}

.footer-dua strong {
  color: var(--text-main);
}

.footer-copyright {
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* الشريط السفلي العائم */
.floating-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(8, 26, 22, 0.95);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border-color);
  padding: 10px 16px;
  display: flex;
  justify-content: center;
  z-index: 99;
}
body.light-theme .floating-bar {
  background: rgba(244, 248, 246, 0.95);
}

.floating-inner {
  max-width: 850px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.btn-next-target {
  flex: 1;
  height: 44px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--primary-light);
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.92rem;
}
.btn-next-target:hover {
  border-color: var(--primary);
}

.btn-reset-all {
  height: 44px;
  padding: 0 16px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: #ef4444;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.88rem;
}