/* ---------- The player: a "now playing" bar docked across the bottom of the window ----------
   Chosen 2026-10-11 (option B of three): always in reach however long the Ayah is. Since 2026-10-13
   (founder chose test option 5) it is one centred column, like Apple Music: controls (play always dead
   centre, "..." beside 1x), the progress line, then one small line "Surah c:v · reciter" under it.
   It lives outside the card on purpose: the card's backdrop-filter would trap a fixed element. */

/* Enough room below the page that, scrolled to the end, the card finishes well clear of the bar. */
body { padding-bottom: calc(var(--dock-h, 72px) + 32px); }

.player.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: var(--dock-bg, rgba(10, 14, 32, 0.97));
  background-image: var(--grain, none); /* hides colour bands in the blurred sky (js/sky.js) */
  background-size: 128px 128px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(30px) saturate(140%);
  -webkit-backdrop-filter: blur(30px) saturate(140%);
}

/* No fade above the bar (removed 2026-10-13): over the card's glass it showed as a band. A long Ayah
   simply scrolls under the near-solid bar, the same as the back of the card. */

.audio {
  display: grid;
  grid-template-columns: minmax(0, 520px);
  justify-content: center;
  align-items: center;
  gap: 24px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 24px 12px;
}

.dock-centre { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.dock-centre { gap: 5px; }
/* Three columns so the play button is always exactly in the middle, whatever sits either side. */
.dock-ctl { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.ctl-l, .ctl-r { display: flex; align-items: center; gap: 12px; }
.ctl-l { justify-content: flex-end; }
.ctl-r { justify-content: flex-start; }
.ctl-r .ctl-speed { margin-left: 4px; }

/* What is playing, small and quiet under the progress line. The reciter's name is the full name when
   it fits, the family name when it does not (js/reciterpicker.js), and only then does its end fade. */
.np-line { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-width: 0; padding: 0 12px; }
.np-ref { flex: none; font-size: var(--fs-xs); font-weight: 500; letter-spacing: 0.01em; color: var(--text-2); white-space: nowrap; }
.np-dot { flex: none; font-size: var(--fs-xs); color: var(--text-3); }
.np-reciter { display: inline-flex; align-items: center; gap: 3px; min-width: 0; padding: 1px 4px; margin-left: -4px; border: 0; border-radius: 6px; background: transparent; color: var(--text-3); font: 400 var(--fs-xs) var(--font-ui); cursor: pointer; text-shadow: none; transition: background 0.15s, color 0.15s, transform 0.12s ease-out; }
.np-reciter span { white-space: nowrap; overflow: hidden; text-overflow: clip; }
.np-reciter span.is-cut { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 18px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 18px), transparent); }
.np-reciter[aria-expanded='true'] { background: rgba(255, 255, 255, 0.08); color: var(--text); }
@media (hover: hover) and (pointer: fine) { .np-reciter:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); } }
.np-reciter .rc-chev { width: 10px; height: 10px; color: inherit; }
.np-reciter:active { transform: scale(0.97); }

.play-btn {
  position: relative;
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s;
  text-shadow: none;
}
.play-btn:active { transform: scale(0.94); }
.play-btn .ico-pause, .play-btn .spinner { display: none; }
.audio.is-playing .ico-play, .audio.is-loading .ico-play { display: none; }
.audio.is-playing .ico-pause { display: block; }
.audio.is-loading .spinner { display: block; }

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(22, 24, 43, 0.25);
  border-top-color: var(--ink);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.audio-main { display: flex; align-items: center; gap: 10px; width: 100%; }
.audio-bar {
  position: relative;
  flex: 1;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  cursor: pointer;
  touch-action: none;
}
.audio-bar::before { content: ''; position: absolute; inset: -10px 0; }
.audio-fill { height: 100%; width: 0; border-radius: inherit; background: var(--accent); }
.audio-time, .audio-dur {
  font-size: var(--fs-xs);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-shadow: none;
}
.audio-time { min-width: 30px; text-align: right; }

.audio-msg { margin: 0; font-size: var(--fs-m); color: #ffd0c4; }

/* ---------- Controls: plain icons that light up on hover ---------- */

.ctl {
  flex: none;
  min-width: 38px;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--text);
  font: 600 var(--fs-xs)/1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  text-shadow: none;
}
@media (hover: hover) and (pointer: fine) { .ctl:hover { border-color: rgba(255, 255, 255, 0.4); } }
.ctl.on { border-color: rgba(242, 212, 147, 0.6); color: var(--accent); background: rgba(242, 212, 147, 0.1); }

.audio .ctl { border: 0; color: var(--text-2); transition: background 0.15s, color 0.15s; }
@media (hover: hover) and (pointer: fine) { .audio .ctl:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); } }
.audio .ctl.on { background: rgba(242, 212, 147, 0.12); color: var(--accent); }
.ctl-icon { width: 36px; min-width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.ctl-icon svg { width: 17px; height: 17px; }
/* fixed width so nothing shifts as 0.75x / 1x / 1.25x / 1.5x change */
.ctl-speed { width: 44px; min-width: 44px; height: 36px; padding: 0; font-size: var(--fs-s); text-align: center; }

/* Repeat / auto-play: opens upwards from the middle of the bar, where the "..." button is. */
.audio-panel {
  position: fixed;
  z-index: 31;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--dock-h, 100px) + 10px);
  width: 300px;
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  text-align: left;
  text-shadow: none;
  box-shadow: var(--panel-shadow);
  -webkit-backdrop-filter: var(--panel-blur);
  backdrop-filter: var(--panel-blur);
}
.ap-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: var(--fs-m); color: var(--text-2); }
.ap-group { display: inline-flex; gap: 4px; }

/* ---------- Reciter: the monogram (used in the list) and the choose-a-reciter list ---------- */

.rc-mono {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font: 600 var(--fs-xs)/1 var(--font-ui);
  letter-spacing: 0.06em;
  color: var(--accent);
  background: radial-gradient(circle at 30% 25%, rgba(242, 212, 147, 0.22), rgba(242, 212, 147, 0.06));
  box-shadow: inset 0 0 0 1px rgba(242, 212, 147, 0.45);
  text-shadow: none;
}
.rc-chev { flex: none; color: var(--text-3); transition: transform 0.2s var(--ease); }
.np-reciter[aria-expanded='true'] .rc-chev { transform: rotate(180deg); }

.reciter-pop {
  position: fixed;
  z-index: 31;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--dock-h, 100px) + 10px);
  width: min(440px, calc(100vw - 32px));
  padding: 8px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
  text-align: left;
  text-shadow: none;
  -webkit-backdrop-filter: var(--panel-blur);
  backdrop-filter: var(--panel-blur);
}
.rc-head { margin: 6px 10px 8px; font-size: var(--fs-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.rc-list { display: grid; gap: 2px; max-height: min(300px, 50vh); overflow-y: auto; scrollbar-width: thin; }
.rc-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) { .rc-item:hover { background: rgba(255, 255, 255, 0.06); } }
.rc-item[aria-selected='true'] { background: rgba(242, 212, 147, 0.1); }
.rc-item[aria-selected='true'] .rc-name { color: var(--accent); }
.rc-names { flex: 1; display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.rc-name { font-size: var(--fs-base); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-sub { font-size: var(--fs-xs); color: var(--text-3); }
.rc-ar { flex: none; font-family: var(--font-arabic); font-size: var(--fs-ar-s); color: var(--text-3); }

/* ---------- Narrow screens: previous Ayah is a swipe away ---------- */

@media (max-width: 760px) {
  .audio { padding: 8px 12px 10px; }
  #prevBtn { display: none; }
  .dock-ctl, .ctl-l, .ctl-r { gap: 6px; }
  .ctl-r .ctl-speed { margin-left: 0; }
}
/* The smallest phones: just enough room for the play button to stay dead centre. */
@media (max-width: 360px) {
  .dock-ctl, .ctl-l, .ctl-r { gap: 4px; }
}

/* ---------- Your place in the Quran: a thin line along the top edge of the player bar ----------
   (2026-10-12: replaces the slider at the foot of the card.) Silver so it never reads as the gold
   recitation progress below it. It thickens on hover, shows the Surah marks, and a label says exactly
   where a click will land; drag to move; the gold diamond is today's Ayah. */
.rail.rail-dock { position: absolute; top: -9px; left: 0; right: 0; z-index: 2; width: auto; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; display: block; }
.rail-dock .rail-arrow, .rail-dock .rail-num { display: none; }
.rail-dock .rail-track { height: 18px; }
.rail-dock .rail-line, .rail-dock .rail-fill { top: 8px; height: 2px; border-radius: 0; transition: height 0.15s, top 0.15s; }
.rail-dock .rail-line { background: rgba(255, 255, 255, 0.1); }
.rail-dock .rail-fill { background: rgba(255, 255, 255, 0.55); }
.rail-dock .rail-ticks { top: 6px; height: 6px; opacity: 0; transition: opacity 0.15s; }
.rail-dock .rail-ticks i { height: 6px; background: rgba(255, 255, 255, 0.35); }
.rail-dock .rail-handle { top: 4px; width: 10px; height: 10px; margin-left: -5px; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15); opacity: 0; transition: opacity 0.15s; }
.rail-dock .rail-today { top: 3px; width: 12px; height: 12px; margin-left: -6px; }
.rail-dock .rail-track:focus-visible .rail-line, .rail-dock .rail-track:focus-visible .rail-fill { top: 6px; height: 6px; }
@media (hover: hover) and (pointer: fine) { .rail-dock:hover .rail-line, .rail-dock:hover .rail-fill { top: 6px; height: 6px; } }
.rail-dock .rail-track:focus-visible .rail-handle { opacity: 1; }
@media (hover: hover) and (pointer: fine) { .rail-dock:hover .rail-ticks, .rail-dock:hover .rail-handle { opacity: 1; } }
.rail-dock .rail-tip { bottom: calc(100% + 4px); }
.player.dock { border-top-color: transparent; }

/* Pop-up messages ("Saved to your Ayahs") sit just above the player bar, not on top of its controls. */
.toast { bottom: calc(var(--dock-h, 72px) + 16px); }

/* The Quran line is drawn by js/railwave.js (silver line, Dock-style hump, hold to zoom) on a canvas that
   reaches up above the bar; the plain line, fill, Surah marks and handle underneath are kept for the
   script's measurements but not shown. Today's diamond and the label stay on top. */
.rail-dock .rail-track { overflow: visible; }
.rail-canvas { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 48px; pointer-events: none; z-index: 0; }
.rail-dock .rail-line, .rail-dock .rail-fill, .rail-dock .rail-ticks, .rail-dock .rail-handle { opacity: 0 !important; }
.rail-dock .rail-today, .rail-dock .rail-tip { z-index: 2; }
