/* Floating Subha Bubble — Fast, direct-touch counter (Messenger style) */
:root {
  --subha-z: 3200;
  --subha-size: 68px;
}

#subha-bubble-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--subha-z);
  font-family: var(--font, "Cairo", "Segoe UI", sans-serif);
  direction: rtl;
}

#subha-bubble-root * { box-sizing: border-box; }

/* The Fast Circular Subha Bubble */
.subha-head {
  position: absolute;
  width: var(--subha-size);
  height: var(--subha-size);
  border-radius: 50%;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 243, 176, 0.25) 0%, transparent 55%),
    linear-gradient(145deg, #184a35 0%, #0a2016 100%);
  border: 2px solid #D4AF37;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.6),
    0 0 15px rgba(212, 175, 55, 0.25),
    inset 0 1px 1px rgba(255, 255, 255, 0.35);
  cursor: pointer;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  transition: transform 0.12s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.15s ease;
  overflow: visible;
}

.subha-head:hover {
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.65),
    0 0 20px rgba(212, 175, 55, 0.4);
}

.subha-head:active,
.subha-head.is-popping {
  transform: scale(0.92) translate3d(0, 0, 0) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 8px rgba(212, 175, 55, 0.3) !important;
}

.subha-head.is-dragging {
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.75), 0 0 24px rgba(212, 175, 55, 0.5) !important;
  transition: none !important;
  cursor: grabbing !important;
}

/* Title on top of the circle */
.subha-head-title {
  font-size: 10px;
  font-weight: 800;
  color: #E6C65C;
  line-height: 1;
  margin-bottom: 2px;
  pointer-events: none;
  letter-spacing: 0.5px;
}

/* Big ascending counter number */
.subha-head-number {
  font-size: 21px;
  font-weight: 800;
  color: #FFF3B0;
  line-height: 1;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), 0 0 10px rgba(255, 243, 176, 0.3);
}

/* Mini Reset Button "↺" */
.subha-head-reset {
  position: absolute;
  top: -3px;
  left: -3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #E6C65C, #D4AF37);
  border: 1.5px solid #06120D;
  color: #06120D;
  font-size: 13px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, background 0.15s ease;
  z-index: 2;
  padding: 0;
  line-height: 1;
}

.subha-head-reset:hover {
  transform: scale(1.15) rotate(-30deg);
  background: #FFF3B0;
}

.subha-head-reset:active {
  transform: scale(0.9);
}

/* Dhikr Label Pill below the bubble */
.subha-head-dhikr-label {
  position: absolute;
  bottom: -24px;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  color: #FAF6E8;
  background: rgba(10, 24, 18, 0.88);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 999px;
  padding: 2px 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.subha-head-dhikr-label:hover {
  background: rgba(18, 45, 33, 0.95);
  border-color: #FFF3B0;
  transform: scale(1.05);
}

/* Bottom Dismiss Drop Zone */
.subha-dismiss {
  position: absolute;
  left: 50%;
  bottom: 28px;
  width: 64px;
  height: 64px;
  margin-left: -32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(0, 24px, 0) scale(0.85);
  transition: opacity 0.18s ease, transform 0.18s ease, background 0.15s ease;
  background: rgba(255, 107, 107, 0.18);
  border: 2px solid rgba(255, 107, 107, 0.55);
  color: #ff8f8f;
  font-size: 28px;
  font-weight: 700;
}

.subha-dismiss.is-show {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.subha-dismiss.is-hot {
  background: rgba(255, 107, 107, 0.45);
  border-color: #ff6b6b;
  color: #fff;
  transform: translate3d(0, 0, 0) scale(1.15);
}

/* Floating Launcher in app dock/tools */
.subha-launcher {
  position: fixed;
  bottom: calc(var(--dock, 64px) + 12px + env(safe-area-inset-bottom, 0px));
  right: max(14px, env(safe-area-inset-right, 0px));
  z-index: 110;
  height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(30, 70, 52, 0.95), rgba(13, 34, 24, 0.98));
  border: 1.5px solid rgba(212, 175, 55, 0.75);
  color: #FFF3B0;
  font-size: 13.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), 0 0 16px rgba(212, 175, 55, 0.25);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.subha-launcher:hover {
  transform: translateY(-2px) scale(1.04);
  border-color: #FFF3B0;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.65), 0 0 22px rgba(212, 175, 55, 0.45);
}

.subha-launcher:active {
  transform: scale(0.95);
}

.subha-launcher[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .subha-head,
  .subha-dismiss {
    transition: none !important;
  }
}

/* t304: فقاعة السبحة — عدّاد + ورد، من غير صفحة كبيرة */
#subha-sheet,
.subha-sheet { display: none !important; visibility: hidden !important; pointer-events: none !important; }

.subha-hud {
  position: fixed;
  left: 10px;
  right: 76px;
  bottom: calc(var(--dock, 64px) + env(safe-area-inset-bottom, 0px) + 10px);
  z-index: 230;
  display: none;
  max-width: 340px;
  pointer-events: none;
}
.subha-hud.open { display: block; }
.subha-hud[hidden] { display: none !important; }
.subha-hud-card {
  pointer-events: auto;
  background: linear-gradient(175deg, rgba(16, 38, 28, 0.98), rgba(6, 16, 12, 0.99));
  border: 1px solid rgba(212, 175, 55, 0.5);
  border-radius: 22px;
  padding: 12px 14px 12px;
  color: #faf6e8;
  box-shadow: 0 16px 40px rgba(0,0,0,0.55);
  max-height: min(62vh, 500px);
  overflow-y: auto;
  position: relative;
}
.subha-hud-close {
  position: absolute;
  top: 8px;
  left: 8px;
  border: 0;
  background: transparent;
  color: #cfc6a0;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 4px 8px;
}
.subha-hud-phase {
  margin: 0 0 4px;
  font-size: 0.75rem;
  color: #d4af37;
  font-weight: 800;
  text-align: center;
}
.subha-hud-dhikr {
  margin: 4px 8px 6px;
  font-size: 1.05rem;
  line-height: 1.65;
  color: #fff8dc;
  text-align: center;
  font-weight: 700;
}
.subha-hud-virtue {
  margin: 0 4px 8px;
  font-size: 0.78rem;
  color: #b9c8be;
  line-height: 1.55;
  text-align: center;
}
.subha-hud-remain {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: #e8d48a;
  text-align: center;
  font-weight: 700;
}
.subha-hud-count {
  display: block;
  width: 118px;
  height: 118px;
  margin: 8px auto 6px;
  border-radius: 50%;
  border: 3px solid #d4af37;
  background: radial-gradient(circle at 35% 30%, #3d7352, #102018);
  color: #fff3b0;
  font-size: 2.5rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0,0,0,0.35), inset 0 0 0 4px rgba(212,175,55,0.15);
  -webkit-tap-highlight-color: transparent;
}
.subha-hud-count:active { transform: scale(0.96); }
.subha-hud-hint {
  margin: 0 0 8px;
  font-size: 0.72rem;
  color: #9aab9f;
  text-align: center;
}
.subha-hud-start {
  display: block;
  width: 100%;
  min-height: 46px;
  margin: 4px 0 8px;
  border-radius: 14px;
  border: 1px solid rgba(212,175,55,0.55);
  background: linear-gradient(160deg, #c9a44a, #8a6a1e);
  color: #06120d;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
}
.subha-hud-start[hidden] { display: none !important; }
.subha-hud-suggest { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.subha-hud-suggest[hidden] { display: none !important; }
.subha-hud-pick {
  text-align: right;
  border-radius: 14px;
  border: 1px solid rgba(212,175,55,0.3);
  background: rgba(212,175,55,0.07);
  color: #faf6e8;
  padding: 10px 12px;
  cursor: pointer;
}
.subha-hud-pick strong { display: block; font-size: 0.9rem; color: #fff3b0; line-height: 1.6; margin-bottom: 4px; }
.subha-hud-pick span { display: block; font-size: 0.72rem; color: #b9c8be; line-height: 1.5; }
.subha-hud-tools {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.subha-hud-tools button {
  flex: 1;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(212,175,55,0.35);
  background: #163325;
  color: #e8d48a;
  font-size: 0.78rem;
  cursor: pointer;
}

/* t304: كومبو صوت الأذان في صف مستقل من غير تداخل */
#view-azan .azan-voice-picker,
#view-azan .azan-sound,
#view-azan #azan-sound-wrap,
#view-azan label[for="azan-sound-select"] {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  grid-column: 1 / -1 !important;
  position: relative !important;
  z-index: 8;
  margin: 12px 0 18px !important;
  float: none !important;
  overflow: visible !important;
  inset: auto !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  transform: none !important;
}
#view-azan #azan-sound-select,
#view-azan .azan-voice-picker select {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 48px;
  font-size: 16px;
  position: relative;
  z-index: 9;
  background: #0e2218;
  color: #faf6e8;
  border: 1px solid rgba(212,175,55,0.45);
  border-radius: 12px;
  padding: 10px 12px;
  appearance: auto;
  -webkit-appearance: menulist;
  margin: 6px 0 0;
  float: none !important;
  transform: none !important;
}
#view-azan .azan-actions {
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px;
  grid-template-columns: none !important;
  width: 100%;
  position: relative;
  z-index: 2;
}
#view-azan .azan-times,
#view-azan .azan-grid,
#view-azan .prayer-row,
#view-azan .azan-notes,
#view-azan .azan-note {
  position: relative;
  z-index: 1;
  clear: both;
}
