/* Surabar web demo: the fake desktop and the reader that opens from its menu bar. */

/* ---------- Tokens ---------- */
:root {
  --menubar-h: 28px;
  --accent: #5B45D6;            /* the app icon's violet (the reader sets its own accent) */
  --font-display: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-arabic: "SF Arabic", "Geeza Pro", -apple-system, "Noto Naskh Arabic", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-card: 12px;
  --r-btn: 8px;
}

:root[data-mode="light"] {
  --wallpaper:
    radial-gradient(1100px 800px at 10% 16%, #c6bcff 0%, transparent 60%),
    radial-gradient(760px 620px at 92% 10%, #bdeedb 0%, transparent 60%),
    radial-gradient(640px 520px at 82% 74%, #d8d0ff 0%, transparent 60%),
    radial-gradient(1000px 900px at 40% 108%, #a99af0 0%, transparent 62%),
    #f2effd;
  --wall-mini: linear-gradient(135deg, #c6bcff, #e3defc 60%, #c9f0e0);
  --mint: #2E9E7E;
  --menubar-bg: rgba(255, 255, 255, 0.45);
  --menubar-text: rgba(0, 0, 0, 0.85);
  --menubar-hover: rgba(0, 0, 0, 0.1);
  --hint-bg: rgba(255, 255, 255, 0.55);
  --page-bg: #f6f4fc;

  --panel-bg: rgba(246, 246, 246, 0.72);
  --panel-solid: #f3f3f4;
  --panel-border: rgba(0, 0, 0, 0.08);
  --menu-bg: rgba(250, 250, 250, 0.9);
  --toast-bg: rgba(0, 0, 0, 0.8);
  --toast-text: #fff;

  --text: rgba(0, 0, 0, 0.85);
  --text-2: rgba(0, 0, 0, 0.5);
  --text-3: rgba(0, 0, 0, 0.26);
  --separator: rgba(0, 0, 0, 0.1);
  --fill: rgba(0, 0, 0, 0.04);
  --fill-hover: rgba(0, 0, 0, 0.07);
  --fill-strong: rgba(0, 0, 0, 0.12);
  --seg-on: #fff;
  --danger: #FF3B30;

  --mushaf: #fff;
  --ink: #000;
}

:root[data-mode="dark"] {
  --wallpaper:
    radial-gradient(1100px 800px at 10% 16%, #2c2275 0%, transparent 60%),
    radial-gradient(760px 620px at 92% 10%, #0f4a3e 0%, transparent 60%),
    radial-gradient(640px 520px at 82% 74%, #2a2f70 0%, transparent 60%),
    radial-gradient(1000px 900px at 40% 108%, #3b2c8f 0%, transparent 62%),
    #0b0a18;
  --wall-mini: linear-gradient(135deg, #2c2275, #1c1846 60%, #0f4a3e);
  --mint: #9FE6CB;
  --menubar-bg: rgba(0, 0, 0, 0.35);
  --menubar-text: rgba(255, 255, 255, 0.9);
  --menubar-hover: rgba(255, 255, 255, 0.15);
  --hint-bg: rgba(30, 30, 30, 0.55);
  --page-bg: #0c0b15;

  --panel-bg: rgba(32, 32, 32, 0.72);
  --panel-solid: #2a2a2a;
  --panel-border: rgba(255, 255, 255, 0.12);
  --menu-bg: rgba(44, 44, 44, 0.9);
  --toast-bg: rgba(255, 255, 255, 0.9);
  --toast-text: #000;

  --text: rgba(255, 255, 255, 0.88);
  --text-2: rgba(255, 255, 255, 0.55);
  --text-3: rgba(255, 255, 255, 0.28);
  --separator: rgba(255, 255, 255, 0.1);
  --fill: rgba(255, 255, 255, 0.06);
  --fill-hover: rgba(255, 255, 255, 0.1);
  --fill-strong: rgba(255, 255, 255, 0.16);
  --seg-on: rgba(255, 255, 255, 0.2);
  --danger: #FF453A;

  --mushaf: #1e1e1e;
  --ink: rgba(255, 255, 255, 0.92);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 13px/1.4 var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  background: var(--page-bg);
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
input, select, textarea { font: inherit; color: inherit; user-select: text; -webkit-user-select: text; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic { width: 1em; height: 1em; display: block; }
.muted { color: var(--text-2); }

/* ---------- Fake desktop ---------- */
.desktop {
  position: relative; overflow: hidden;
  height: 100vh; height: 100svh; min-height: 640px;
  background: var(--wallpaper);
  user-select: none; -webkit-user-select: none;
}

.menubar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 30;
  height: var(--menubar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  background: var(--menubar-bg);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  color: var(--menubar-text);
  font-size: 13px;
}
.mb-left { display: flex; align-items: center; gap: 18px; white-space: nowrap; overflow: hidden; }
.mb-brand { display: flex; align-items: center; gap: 7px; font-weight: 700; text-decoration: none; }
.mb-logo { width: 18px; height: 16px; }
.mb-logo .ic, .mark-slot .ic { width: 100%; height: 100%; }
.mb-right { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.mb-icon { position: relative; width: 30px; height: 22px; border-radius: 5px; display: grid; place-items: center; font-size: 16px; }
.mb-icon .ic { width: 18px; height: 16px; }
#themeToggle .ic { width: 15px; height: 15px; }
.mb-icon:hover, .mb-icon.active { background: var(--menubar-hover); }
/* Until the first open, the menu bar icon glows so visitors know where to click. */
.status-item.beacon::after {
  content: ""; position: absolute; inset: -3px; border-radius: 8px; pointer-events: none;
  animation: beacon 1.6s ease-in-out infinite;
}
@keyframes beacon {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--accent) 18%, transparent); }
  60% { box-shadow: 0 0 0 9px transparent; background: color-mix(in srgb, var(--accent) 30%, transparent); }
}

/* ---------- Hero (the page's headline, sitting on the desktop) ---------- */
.hero {
  position: absolute; inset: var(--menubar-h) 0 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 16px 150px; text-align: center;
}
/* The hero logo is the app icon: a violet tile with the mint mark (black with an indigo mark in dark mode). */
.hero-logo {
  width: 104px; height: 104px; border-radius: 23%; display: grid; place-items: center;
  background: linear-gradient(165deg, #7a64dc 0%, #5440c4 45%, #4332b7 100%); color: #b6edd0;
  box-shadow: inset 0 1.5px 1px rgba(255, 255, 255, 0.45), inset 0 -2px 6px rgba(20, 10, 80, 0.35), 0 20px 44px rgba(67, 50, 183, 0.38);
}
:root[data-mode="dark"] .hero-logo {
  background: linear-gradient(165deg, #26262a 0%, #0b0b0d 70%); color: #7d93d4;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.18), 0 20px 44px rgba(80, 90, 200, 0.28);
}
.hero-logo .logo-float { width: 66%; height: 58%; }
.hero-logo .ic { width: 100%; height: 100%; overflow: visible; }
/* The mark floats gently; its audio bars move with the recitation (demo.js). */
.hero-logo { animation: logo-float 5s ease-in-out infinite; }
@keyframes logo-float { 0%, 100% { translate: 0 -3px; } 50% { translate: 0 4px; } }
.desktop.offscreen .hero-logo { animation-play-state: paused; }
.mark .bar { transform-box: fill-box; transform-origin: 50% 100%; transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); }
.hero h1 { margin: 22px 0 0; font-family: var(--font-display); font-size: clamp(44px, 7.4vw, 70px); line-height: 1.05; letter-spacing: -0.01em; font-weight: 600; }
.hero-tag { margin: 10px 0 0; color: color-mix(in srgb, var(--accent) 70%, var(--text)); font-size: clamp(18px, 2.6vw, 24px); font-weight: 500; line-height: 1.3; }
.hero-sub { margin: 6px 0 0; font-size: 15px; color: var(--text-2); }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 26px; user-select: text; -webkit-user-select: text; }
.cmd {
  display: inline-flex; align-items: center; gap: 12px; max-width: 100%;
  height: 42px; padding: 0 6px 0 16px; border-radius: 12px;
  background: var(--hint-bg);
  backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 0 0 0.5px var(--panel-border), 0 4px 16px rgba(0, 0, 0, 0.08);
}
.cmd code { font: 500 13px var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd code::before { content: "$ "; color: var(--text-3); }
.cmd-copy {
  flex: none; height: 30px; padding: 0 12px; border-radius: 8px;
  display: inline-flex; align-items: center; font-size: 12px; font-weight: 600;
  background: var(--fill-hover);
}
.cmd:hover .cmd-copy { background: var(--fill-strong); }
.cmd.copied .cmd-copy { background: var(--accent); color: #fff; }
.hero-btn {
  display: inline-flex; align-items: center; height: 42px; padding: 0 20px; border-radius: 12px;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 600; text-decoration: none;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 35%, transparent);
}
.hero-btn:hover { filter: brightness(1.08); }
.desktop-hint {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 28px 0 0; padding: 9px 16px; border-radius: 999px;
  background: var(--hint-bg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  font-size: 13px; line-height: 1.4;
  transition: opacity 0.2s;
}
.desktop-hint.dim { opacity: 0.35; }
.hint-arrow { flex: none; width: 16px; height: 16px; color: var(--accent); }
.hint-arrow .ic { width: 100%; height: 100%; stroke-width: 2.4; }
kbd { font: 600 12px var(--font); padding: 1px 6px; border-radius: 5px; background: var(--fill-hover); box-shadow: inset 0 -1px 0 var(--fill-strong); }

/* ---------- Dock ---------- */
.dock {
  --icon: 52px;
  position: absolute; left: 50%; bottom: 10px; z-index: 10; transform: translateX(-50%);
  display: flex; align-items: flex-end; gap: 16px;
  padding: 8px 14px 14px; border-radius: 22px;
  background: var(--dock-bg);
  border: 1px solid var(--dock-edge);
  backdrop-filter: blur(36px) saturate(185%); -webkit-backdrop-filter: blur(36px) saturate(185%);
  box-shadow: inset 0 1px 0 var(--dock-rim), 0 22px 54px var(--dock-shadow);
}
:root[data-mode="light"] { --dock-bg: rgba(255, 255, 255, 0.38); --dock-edge: rgba(0, 0, 0, 0.1); --dock-rim: rgba(255, 255, 255, 0.7); --dock-shadow: rgba(0, 0, 0, 0.2); }
:root[data-mode="dark"] { --dock-bg: rgba(60, 60, 70, 0.34); --dock-edge: rgba(255, 255, 255, 0.16); --dock-rim: rgba(255, 255, 255, 0.16); --dock-shadow: rgba(0, 0, 0, 0.44); }
.dock-sep { align-self: center; width: 1px; height: 46px; background: var(--separator); }
/* Each icon's size follows --s, set by demo.js from the pointer's distance (macOS-style magnification). */
.dock-item {
  --s: 1;
  position: relative; flex: none;
  width: calc(var(--icon) * var(--s)); height: calc(var(--icon) * var(--s));
  display: block; text-decoration: none; border-radius: 22.5%;
}
.dock-item:active .dock-img, .dock-item:active .dock-tile { filter: brightness(0.8); }
.dock-item:focus-visible { outline: none; }
.dock-item:focus-visible .dock-img, .dock-item:focus-visible .dock-tile { box-shadow: 0 0 0 3px var(--accent); border-radius: 22.5%; }
.dock-item::before {
  content: attr(data-label);
  position: absolute; bottom: calc(100% + 17px); left: 50%; transform: translateX(-50%);
  padding: 3px 10px; border-radius: 7px; white-space: nowrap;
  background: var(--menu-bg); color: var(--text); font-size: 12px; font-weight: 500;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 0 0 0.5px var(--panel-border), 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0; pointer-events: none; transition: opacity 120ms;
}
.dock-item:hover::before, .dock-item:focus-visible::before { opacity: 1; }
.dock-item::after { content: ""; position: absolute; inset: -8px -8px -14px; }
.dock-img { width: 100%; height: 100%; display: block; }
:root[data-mode="light"] .dock-img-dark, :root[data-mode="dark"] .dock-img-light { display: none; }
.dock-tile {
  width: 100%; height: 100%; border-radius: 22.5%;
  display: grid; place-items: center; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 0 0 0.5px rgba(255, 255, 255, 0.12);
}
.dock-tile .ic { width: 46%; height: 46%; }
.dock-download { background: linear-gradient(180deg, #7a64dc, #4332b7); }
.dock-download .ic { stroke-width: 2.2; }
.dock-github { background: linear-gradient(180deg, #33363d, #16181c); }
.dock-features { background: linear-gradient(180deg, #6fd3b4, #2a9478); }
.dock-features .ic { stroke-width: 2; }
.dock-github .ic { width: 52%; height: 52%; }
.dock-badge {
  position: absolute; top: -3px; right: -5px;
  width: calc(18px * var(--s)); height: calc(18px * var(--s)); border-radius: 50%;
  display: grid; place-items: center;
  background: #1c1c1e; color: #fff; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.5);
}
.dock-badge .ic { width: 55%; height: 55%; stroke-width: 3; }
.dock-dot { position: absolute; bottom: -9px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--text-2); opacity: 0; transition: opacity 0.2s; }
.dock-item.running .dock-dot { opacity: 1; }

/* ---------- The reader (an NSPopover under the menu bar icon, or a detached window) ---------- */
.panel {
  --radius: 16px;
  --w: 440px;
  position: absolute; z-index: 20;
  top: calc(var(--menubar-h) + 12px); left: var(--x, 8px);
  width: var(--w); height: var(--h, 600px);
  display: flex; flex-direction: column;
  border-radius: var(--radius);
  /* Closed: shrunk toward the menu bar icon, like a popover. */
  opacity: 0; visibility: hidden; transform: scale(0.85);
  transform-origin: var(--arrow-x, 90%) 0;
  transition:
    transform 180ms cubic-bezier(0.45, 0, 0.9, 0.55),
    opacity 180ms cubic-bezier(0.8, 0, 1, 0.6),
    visibility 0s linear 180ms;
}
.panel.open {
  opacity: 1; visibility: visible; transform: none;
  transition: transform 260ms cubic-bezier(0.2, 0.9, 0.25, 1), opacity 160ms ease-out, visibility 0s,
    height 260ms cubic-bezier(0.2, 0.9, 0.25, 1), width 260ms cubic-bezier(0.2, 0.9, 0.25, 1), left 260ms cubic-bezier(0.2, 0.9, 0.25, 1);
}
.panel.open.dragging { transition: none; }
.r-shell { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; border-radius: inherit; overflow: hidden; }

/* The popover's arrow, pointing at the menu bar icon (hidden once detached). */
.r-arrow {
  position: absolute; top: -7px; left: var(--arrow-x, 90%); width: 16px; height: 16px; margin-left: -8px;
  transform: rotate(45deg); border-radius: 3px 0 0 0; pointer-events: none;
  background: var(--arrow-bg);
  box-shadow: -0.5px -0.5px 0 var(--panel-border);
}
.panel.detached .r-arrow { display: none; }
.panel.detached { top: var(--y, 80px); }

/* Frosted (macOS 14–15, and an option on 26): a blurred, tinted sheet with a hairline edge. */
.panel[data-style="frosted"] .r-shell {
  background: var(--panel-bg);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
}
.panel[data-style="frosted"] { --arrow-bg: var(--panel-bg); box-shadow: 0 0 0 0.5px var(--panel-border), 0 12px 40px rgba(0, 0, 0, 0.25); }

/* Liquid Glass (macOS 26): clearer, rounder, with a bright specular rim. A web imitation of Apple's material. */
.panel[data-style="glass"] { --radius: 22px; --arrow-bg: var(--glass-arrow); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22), 0 2px 8px rgba(0, 0, 0, 0.08); }
.panel[data-style="glass"] .r-shell {
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(200%) brightness(var(--glass-bright));
  -webkit-backdrop-filter: blur(16px) saturate(200%) brightness(var(--glass-bright));
  box-shadow: inset 0 1px 1px var(--glass-rim-top), inset 0 -1px 1px var(--glass-rim-bottom);
}
.panel[data-style="glass"] .r-shell::before {
  content: ""; position: absolute; inset: 0; z-index: 40; pointer-events: none;
  border-radius: inherit; padding: 1px;
  background: linear-gradient(140deg, var(--glass-edge) 0%, transparent 30%, transparent 65%, var(--glass-edge-2) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
:root[data-mode="light"] {
  --glass-bg: linear-gradient(170deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.35));
  --glass-arrow: rgba(255, 255, 255, 0.62);
  --glass-bright: 1.06;
  --glass-rim-top: rgba(255, 255, 255, 0.9);
  --glass-rim-bottom: rgba(255, 255, 255, 0.35);
  --glass-edge: rgba(255, 255, 255, 1);
  --glass-edge-2: rgba(255, 255, 255, 0.7);
  --glass-control: rgba(255, 255, 255, 0.45);
  --glass-control-on: rgba(255, 255, 255, 0.85);
}
:root[data-mode="dark"] {
  --glass-bg: linear-gradient(170deg, rgba(58, 58, 64, 0.55), rgba(24, 24, 28, 0.48));
  --glass-arrow: rgba(58, 58, 64, 0.7);
  --glass-bright: 0.9;
  --glass-rim-top: rgba(255, 255, 255, 0.28);
  --glass-rim-bottom: rgba(255, 255, 255, 0.08);
  --glass-edge: rgba(255, 255, 255, 0.45);
  --glass-edge-2: rgba(255, 255, 255, 0.2);
  --glass-control: rgba(255, 255, 255, 0.08);
  --glass-control-on: rgba(255, 255, 255, 0.24);
}
.panel[data-style="glass"] { --lens: inset 0 1px 1px var(--glass-rim-top), inset 0 -1px 1px var(--glass-rim-bottom), 0 2px 10px rgba(0, 0, 0, 0.1); }

/* Sepia: warm paper. The page around the reader stays light. */
.panel[data-theme="sepia"] {
  --text: #2e2416; --text-2: #6a5a42; --text-3: rgba(46, 36, 22, 0.3);
  --mushaf: #f8f0de; --ink: #2e2416;
  --separator: rgba(46, 36, 22, 0.14); --fill: rgba(46, 36, 22, 0.05); --fill-hover: rgba(46, 36, 22, 0.09); --fill-strong: rgba(46, 36, 22, 0.15);
  --panel-bg: rgba(238, 228, 207, 0.86); --glass-bg: linear-gradient(170deg, rgba(244, 233, 210, 0.72), rgba(238, 228, 207, 0.58));
  --glass-arrow: rgba(244, 233, 210, 0.8); --menu-bg: rgba(246, 238, 220, 0.95); --seg-on: #fffaf0;
  --glass-control: rgba(255, 250, 238, 0.5); --glass-control-on: rgba(255, 250, 238, 0.95);
}

/* ---------- Header ---------- */
.r-header { flex: none; height: 46px; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 14px; }
.panel.detached .r-header { cursor: grab; }
.panel.detached.dragging .r-header { cursor: grabbing; }
.surah-btn { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 3px 6px 3px 0; border-radius: 8px; text-align: left; }
.surah-btn-text { display: flex; flex-direction: column; min-width: 0; }
.surah-name { font-size: 15px; font-weight: 700; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.surah-sub { font-size: 11px; color: var(--text-2); white-space: nowrap; }
.surah-btn .chev { width: 13px; height: 13px; color: var(--text-2); flex: none; }
.surah-btn:hover .chev { color: var(--text); }
.r-header .spacer { flex: 1; }

/* A group of round controls in one capsule (the app's ControlCluster). */
.cluster { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 999px; background: var(--fill); box-shadow: inset 0 0 0 0.5px var(--panel-border); }
.panel[data-style="glass"] .cluster { background: var(--glass-control); box-shadow: var(--lens); }
.cbtn { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: var(--text); transition: background 0.12s, transform 0.08s; }
.cbtn .ic { width: 16px; height: 16px; }
.cbtn:hover:not(:disabled) { background: var(--fill-hover); }
.cbtn:active:not(:disabled) { transform: scale(0.92); }
.cbtn:disabled { opacity: 0.35; cursor: default; }
.cbtn.on { color: var(--accent); }

/* ---------- Page ---------- */
.r-main { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.page-card {
  position: relative; flex: none; margin: 0 8px; border-radius: 14px; overflow: hidden;
  background: var(--mushaf); color: var(--ink);
  box-shadow: 0 0 0 0.5px var(--panel-border), 0 1px 3px rgba(0, 0, 0, 0.06);
}
.page-viewport { position: relative; overflow: hidden; }
.page { position: absolute; inset: 0; direction: rtl; cursor: default; }
.page.turn-in { animation: page-in 260ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.page.turn-out { animation: page-out 260ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards; pointer-events: none; }
@keyframes page-in { from { transform: translateX(calc(var(--dir) * -100%)); } }
@keyframes page-out { to { transform: translateX(calc(var(--dir) * 100%)); } }
.line { position: absolute; left: 0; right: 0; display: flex; align-items: center; white-space: nowrap; }
.line.just { justify-content: space-between; }
.line.center { justify-content: center; }
.w { position: relative; z-index: 1; display: inline-block; cursor: pointer; }
.line.title { font-family: var(--font-arabic); justify-content: center; }
.hl { position: absolute; z-index: 0; border-radius: 6px; background: color-mix(in srgb, var(--accent) 20%, transparent); pointer-events: none; }
.bm-dot { position: absolute; z-index: 2; width: 7px; height: 7px; margin: -3px 0 0 -3.5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1.5px var(--mushaf); pointer-events: none; }
.page-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: 12px; }
.page-footer { height: 28px; display: flex; align-items: center; justify-content: space-between; padding: 0 6px; font-size: 11px; color: var(--text-2); }
.page-footer .cbtn { width: 22px; height: 22px; color: var(--text-2); }
.page-footer .cbtn .ic { width: 13px; height: 13px; }
.follow-pill {
  position: absolute; left: 50%; bottom: 36px; z-index: 6; transform: translateX(-50%); white-space: nowrap;
  height: 28px; padding: 0 12px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 600;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent);
}

/* ---------- Translation strip ---------- */
.translation { flex: none; height: 80px; padding: 8px 14px 6px; overflow: hidden; }
.tr-head { display: flex; align-items: baseline; gap: 6px; font-size: 11px; color: var(--text-2); }
.tr-key { color: var(--accent); font-weight: 700; }
.tr-head .spacer { flex: 1; }
.tr-text { margin: 3px 0 0; font-size: 13px; line-height: 1.4; max-height: 2.8em; overflow: hidden; }
.tr-foot { margin: 3px 0 0; font-size: 10.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Player ---------- */
.player { flex: none; padding: 0 10px 10px; }
.now { display: flex; align-items: baseline; gap: 8px; padding: 2px 4px 6px; font-size: 13px; }
.now b { font-weight: 700; }
.now span { color: var(--text-2); font-size: 12px; }
.progress { position: relative; height: 14px; margin: 0 -2px 2px; cursor: pointer; }
.progress::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 3px; border-radius: 2px; background: var(--fill-strong); }
.progress-fill { position: absolute; left: 0; top: 6px; height: 3px; width: 0; border-radius: 2px; background: var(--accent); }
.transport { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; height: 50px; }
.play {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent);
  transition: transform 0.08s, filter 0.12s;
}
.play:hover { filter: brightness(1.08); }
.play:active { transform: scale(0.94); }
.play .ic { width: 18px; height: 18px; }
.play.loading { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { filter: brightness(1.25); } }
.vol-btn { position: absolute; right: 2px; }
.options { display: flex; gap: 6px; margin-top: 6px; }
.option {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px;
  padding: 5px 8px 5px 10px; border-radius: 10px; background: var(--fill); text-align: left;
}
.panel[data-style="glass"] .option { background: var(--glass-control); box-shadow: var(--lens); }
.option:hover { background: var(--fill-hover); }
.option.reciter { flex: 2.2; }
.opt-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.opt-label { font-size: 9.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-2); }
.opt-value { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.opt-value .ic { width: 12px; height: 12px; flex: none; }
.option > .ic { width: 11px; height: 11px; color: var(--text-2); flex: none; }

/* ---------- Menus and popovers inside the reader ---------- */
.menu {
  position: absolute; z-index: 50;
  min-width: 190px; max-height: 360px; overflow-y: auto; overscroll-behavior: contain; padding: 5px; border-radius: 10px;
  background: var(--menu-bg); color: var(--text);
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  box-shadow: 0 0 0 0.5px var(--panel-border), 0 8px 24px rgba(0, 0, 0, 0.22);
  animation: fade 0.12s;
}
.menu h4 { margin: 4px 8px 2px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-2); }
.menu hr { border: 0; height: 0.5px; margin: 4px 6px; background: var(--separator); }
.menu button { width: 100%; display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 5px; text-align: left; font-size: 13px; }
.menu button:hover:not(:disabled), .menu button:focus-visible { background: var(--accent); color: #fff; outline: none; }
.menu button:disabled { color: var(--text-3); cursor: default; }
.menu .check { width: 14px; flex: none; display: grid; place-items: center; }
.menu .check .ic { width: 12px; height: 12px; }
.menu .menu-note { margin-left: auto; font-size: 10.5px; color: var(--text-3); white-space: nowrap; }
.menu button:hover .menu-note { color: rgba(255, 255, 255, 0.75); }
.vol-pop { padding: 10px 12px; min-width: 0; }
.vol-pop input { width: 150px; accent-color: var(--accent); }

/* ---------- Overlays on the page (surah picker, jump) ---------- */
.overlay {
  position: absolute; z-index: 8; left: 8px; right: 8px; top: 0;
  display: flex; flex-direction: column; border-radius: 14px; overflow: hidden;
  background: var(--menu-bg); color: var(--text);
  backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 0 0 0.5px var(--panel-border), 0 10px 30px rgba(0, 0, 0, 0.18);
  animation: overlay-in 0.16s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes overlay-in { from { opacity: 0; transform: translateY(-6px); } }
@keyframes fade { from { opacity: 0; } }
.ov-top { flex: none; padding: 10px 10px 6px; display: grid; gap: 8px; }
.search { width: 100%; height: 28px; padding: 0 10px; border-radius: 7px; border: 0.5px solid var(--separator); background: var(--fill); outline: none; font-size: 13px; }
.search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.ov-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 6px 6px; }
.srow { width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; text-align: left; }
.srow:hover { background: var(--fill-hover); }
.srow.on { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.srow.off .srow-main, .srow.off .srow-n, .srow.off .srow-ar { opacity: 0.45; }
.srow-n { width: 24px; text-align: center; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.srow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.srow-main b { font-size: 13px; font-weight: 600; }
.srow-main span { font-size: 11px; color: var(--text-2); }
.srow-ar { font-family: var(--font-arabic); font-size: 15px; color: var(--text-2); }
.mac-tag { font-size: 9.5px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-2); background: var(--fill-hover); padding: 2px 6px; border-radius: 999px; white-space: nowrap; }
.mac-card { margin: 10px; padding: 16px; border-radius: 12px; background: var(--fill); text-align: center; }
.mac-card b { display: block; font-size: 14px; margin-bottom: 6px; }
.mac-card p { margin: 0; color: var(--text-2); line-height: 1.45; }
.jump { padding: 10px; }
.jump .fine { margin: 6px 2px 0; font-size: 11px; color: var(--text-2); }

/* ---------- Segmented controls ---------- */
.seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--r-btn); background: var(--fill-hover); }
.seg button { flex: 1; height: 24px; padding: 0 12px; border-radius: 6px; font-size: 12.5px; font-weight: 500; white-space: nowrap; transition: background 0.15s; }
.seg button:hover:not(.on) { background: var(--fill); }
.seg button.on { background: var(--seg-on); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04); }
.panel[data-style="glass"] .seg { border-radius: 999px; background: var(--glass-control); box-shadow: inset 0 0 0 0.5px var(--panel-border); }
.panel[data-style="glass"] .seg button { border-radius: 999px; }
.panel[data-style="glass"] .seg button.on { background: var(--glass-control-on); box-shadow: var(--lens); }
.seg-full { display: flex; }

/* ---------- Settings (in place of the reader) ---------- */
.settings { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.set-head { flex: none; height: 46px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 14px; }
.set-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.done-btn { height: 26px; padding: 0 14px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; }
.set-tabs { flex: none; display: flex; justify-content: center; gap: 4px; padding: 0 10px 8px; border-bottom: 0.5px solid var(--separator); }
.set-tab { width: 74px; padding: 6px 0 4px; border-radius: 9px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--text-2); }
.set-tab .ic { width: 20px; height: 20px; }
.set-tab:hover { background: var(--fill); }
.set-tab.on { color: var(--accent); background: var(--fill-hover); }
.set-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px 14px 14px; }
.sec { margin: 16px 4px 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-2); }
.sec:first-child { margin-top: 2px; }
.group { padding: 0 12px; border-radius: var(--r-card); background: var(--mushaf); box-shadow: 0 0 0 0.5px var(--separator); }
.row { padding: 9px 0; border-bottom: 0.5px solid var(--separator); }
.group > :last-child { border-bottom: 0; }
.row-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 24px; }
.row-label { font-size: 13px; }
.row-label small { display: block; font-size: 11px; color: var(--text-2); }
.row-value { font-size: 12px; color: var(--text-2); }
.row .seg { margin-top: 6px; }
.row-line .seg { margin-top: 0; }
.row-note { margin: 5px 0 0; font-size: 11px; color: var(--text-2); line-height: 1.4; }
.row-mac .row-label { color: var(--text-3); }
.row-ctl { display: flex; align-items: center; gap: 8px; }
.btn { display: inline-flex; align-items: center; height: 24px; padding: 0 11px; border-radius: 7px; background: var(--fill-hover); font-size: 12px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--fill-strong); }
.btn-primary { background: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.panel[data-style="glass"] .btn { border-radius: 999px; background: var(--glass-control); box-shadow: var(--lens); }
.panel[data-style="glass"] .btn-primary { background: var(--accent); color: #fff; }
.switch { position: relative; flex: none; width: 32px; height: 18px; border-radius: 999px; background: var(--fill-strong); transition: background 0.15s; }
.switch span { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); transition: transform 0.15s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] span { transform: translateX(14px); }
.select { height: 24px; padding: 0 24px 0 10px; border-radius: 7px; border: 0; background: var(--fill-hover); font-size: 12px; appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 12px) 50%, calc(100% - 8px) 50%; background-size: 4px 4px; background-repeat: no-repeat; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.swatch { position: relative; width: 22px; height: 22px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.15); }
.swatch.on { box-shadow: 0 0 0 2px var(--mushaf), 0 0 0 4px var(--sw); }
.swatch-system { background: radial-gradient(circle, var(--sw) 0 5px, transparent 5.5px), conic-gradient(#ff3b30, #ff9500, #ffcc00, #34c759, #5ac8fa, #007aff, #af52de, #ff2d55, #ff3b30); }
.swatch-custom { background: conic-gradient(#ff3b30, #ff9500, #ffcc00, #34c759, #5ac8fa, #007aff, #af52de, #ff2d55, #ff3b30); }
.swatch-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; padding: 0; }
.icon-choices { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.icon-choice { width: 34px; height: 28px; border-radius: 7px; display: grid; place-items: center; color: var(--text-2); box-shadow: inset 0 0 0 0.5px var(--separator); }
.icon-choice .ic { width: 18px; height: 16px; }
.icon-choice:hover { background: var(--fill-hover); }
.icon-choice.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); box-shadow: inset 0 0 0 1.5px var(--accent); }

/* ---------- Toast ---------- */
.toast {
  position: absolute; left: 50%; top: 52px; z-index: 60;
  transform: translate(-50%, 8px);
  max-width: calc(100% - 32px); padding: 7px 14px; border-radius: 999px;
  background: var(--toast-bg); color: var(--toast-text);
  font-size: 12px; font-weight: 500; text-align: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Accessibility preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  .panel, .panel.open { transform: none !important; }
  .page.turn-in, .page.turn-out, .overlay, .menu, .status-item.beacon::after, .play.loading, .hero-logo { animation: none !important; }
  .status-item.beacon::after { background: color-mix(in srgb, var(--accent) 25%, transparent); }
}
@media (prefers-reduced-transparency: reduce) {
  .panel[data-style] .r-shell { background: var(--panel-solid); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .panel[data-style] { --arrow-bg: var(--panel-solid); }
  .panel[data-style="glass"] .r-shell::before { display: none; }
  .cmd, .desktop-hint, .menubar, .dock, .dock-item::before, .menu, .overlay { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .dock { background: var(--panel-solid); }
}

/* ---------- Phones and tablets ---------- */
.touch .desktop-hint { display: none; }
.touch .dock-item::before { display: none; }
.touch .hero { transition: opacity 0.2s; }
.touch .desktop:has(.panel.open) .hero { opacity: 0; }
@media (max-width: 600px) {
  .touch .dock { transition: opacity 0.2s; }
  .touch .desktop:has(.panel.open) .dock { opacity: 0; pointer-events: none; }
}

/* ---------- Narrow windows ---------- */
@media (max-width: 720px) {
  #clock { display: none; }
}
