:root {
  --bg: #F7F3EA;
  --card: #FFFFFF;
  --text: #1E2A2F;
  --muted: #5B6670;
  --ring: #1E2A2F;
  --tile-color: #1E2A2F;
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Geeza Pro", "SF Arabic", "Noto Naskh Arabic", "Segoe UI", Tahoma, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}

.screen {
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 16px);
  display: flex;
  flex-direction: column;
}
.screen[hidden] { display: none; }

/* الشعار */
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 4px 0 14px;
}
.brand-logo { width: 40px; height: 40px; }
.brand-name { font-size: 26px; font-weight: 700; color: #23785A; }

/* شريط الصلاة */
.prayer-bar {
  appearance: none;
  border: 0;
  font: inherit;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin: 0 0 14px;
  padding: 12px 16px;
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 2px 10px rgba(30, 42, 47, .08);
  text-align: right;
  cursor: pointer;
  touch-action: manipulation;
}
.prayer-icon { width: 46px; height: 46px; flex: none; fill: #23785A; }
.prayer-icon .door { fill: var(--card); }
.prayer-text { display: flex; flex-direction: column; gap: 2px; }
.prayer-main { font-size: 24px; font-weight: 700; }
.prayer-sub { font-size: 19px; color: var(--muted); }

.prayer-bar.now { background: #23785A; color: #FFFFFF; }
.prayer-bar.now .prayer-icon { fill: #FFFFFF; }
.prayer-bar.now .prayer-icon .door { fill: #23785A; }
.prayer-bar.now .prayer-sub { color: #E6F2EC; }

/* الأيقونات */
.tiles {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: 14px;
}

.tile {
  appearance: none;
  border: 4px solid transparent;
  border-radius: 28px;
  background: var(--card);
  box-shadow: 0 2px 10px rgba(30, 42, 47, .08);
  color: var(--tile-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  font: inherit;
  cursor: pointer;
  transition: transform .2s ease, background-color .2s ease, box-shadow .2s ease;
  touch-action: manipulation;
}
.tile svg { width: 62%; max-width: 140px; max-height: 120px; }
.tile .ink { fill: currentColor; }
.tile .stroke { stroke: currentColor; }
.tile .paper { fill: var(--card); }
.tile .label { font-size: 24px; font-weight: 700; color: var(--text); }

.tile-wide { grid-column: 1 / -1; }
.tile-wide svg { width: auto; height: 70%; }

/* إبراز ذكر الوقت */
.tile.now { border-color: var(--tile-color); }

/* الأيقونة المختارة: تكبر وتتلوّن */
.tile.selected {
  background: var(--tile-color);
  color: #FFFFFF;
  border-color: var(--ring);
  transform: scale(1.06);
  box-shadow: 0 8px 26px rgba(30, 42, 47, .28);
  z-index: 1;
}
.tile.selected .paper { fill: var(--tile-color); }
.tile.selected .label { color: #FFFFFF; }

/* شاشة القسم */
.back {
  appearance: none;
  align-self: flex-start;
  width: 84px;
  height: 84px;
  border-radius: 24px;
  border: 0;
  background: var(--card);
  box-shadow: 0 2px 10px rgba(30, 42, 47, .1);
  padding: 16px;
  cursor: pointer;
}
.back svg { width: 100%; height: 100%; fill: var(--text); }

.section-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.section-icon { width: 60vw; max-width: 260px; }
.section-icon svg { width: 100%; height: auto; }
.section-icon .ink { fill: currentColor; }
.section-icon .stroke { stroke: currentColor; }
.section-icon .paper { fill: var(--bg); }
.section-title { font-size: 34px; margin: 0; }

#section { height: 100dvh; }
.section-body[hidden] { display: none; }

/* قسم الأذكار */
.section-content { flex: 1; display: flex; min-height: 0; }
.section-content[hidden] { display: none; }
.adhkar { flex: 1; display: flex; flex-direction: column; gap: 12px; min-height: 0; padding-top: 10px; }
.adhkar-top { display: flex; justify-content: space-between; align-items: center; min-height: 34px; }
.adhkar-count { font-size: 24px; font-weight: 700; color: #23785A; }
.adhkar-progress { font-size: 18px; color: var(--muted); }
.adhkar-text {
  flex: 1;
  overflow-y: auto;
  background: var(--card);
  border-radius: 24px;
  padding: 20px 18px;
  font-family: "Amiri Quran", "KFGQPC Uthmanic Script HAFS", "Geeza Pro", "Noto Naskh Arabic", serif;
  font-size: 30px;
  line-height: 2.1;
  text-align: right;
  box-shadow: 0 2px 10px rgba(30, 42, 47, .08);
}
.adhkar-text .seg { color: #8A949B; transition: color .3s ease, background-color .3s ease; border-radius: 10px; padding: 0 4px; }
.adhkar-text .seg.current { color: var(--text); background: #FCEFC7; }
.adhkar-text.quran .seg.current { background: #DDF0E6; }

.controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ctl {
  appearance: none;
  border: 0;
  height: 92px;
  border-radius: 24px;
  background: #23785A;
  cursor: pointer;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ctl svg { width: 46px; height: 46px; fill: #FFFFFF; }
.ctl .i-play { display: none; }
.ctl.is-paused .i-play { display: block; }
.ctl.is-paused .i-pause { display: none; }
.ctl.is-paused { background: #C97A00; }
