:root {
  /* the room: a powder-blue wall (cool, so the warm champagne player stands out) under a
     soft lamp */
  --wall: #c7d5de;
  --wall-deep: #9fb3c0;
  --lamp: rgba(255, 250, 240, .55);
  --ink: #24323b;
  --ink-soft: #5d6f7b;
  --accent: #1f5a44;
  --chip: rgba(255, 255, 255, .55);
  --sheet: #f8f4ec;
  --line: rgba(58, 51, 38, .12);
  /* the player: sized from its width */
  --w: clamp(248px, min(84vw, 43vh), 400px);
  --h: calc(var(--w) * .72);
  --d: calc(var(--w) * .25);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --wall: #1b2733; --wall-deep: #0d141b; --lamp: rgba(255, 236, 200, .12);
    --ink: #e9eef2; --ink-soft: #9fb0bd; --accent: #6fbf98;
    --chip: rgba(255, 255, 255, .08); --sheet: #202227; --line: rgba(236, 227, 207, .12);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --wall: #1b2733; --wall-deep: #0d141b; --lamp: rgba(255, 236, 200, .12);
  --ink: #e9eef2; --ink-soft: #9fb0bd; --accent: #6fbf98;
  --chip: rgba(255, 255, 255, .08); --sheet: #202227; --line: rgba(236, 227, 207, .12); color-scheme: dark;
}

@font-face {
  font-family: 'qcf-surah-names';
  src: url('https://verses.quran.foundation/fonts/quran/surah-names/v1/sura_names.woff2') format('woff2');
  font-display: block;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--wall);
  color: var(--ink);
  font-family: Inter, system-ui, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
}
button { font: inherit; color: inherit; }

/* the room: a deep green wall, a lamp above the player */
.room {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(70% 42% at 50% 30%, var(--lamp), rgba(0, 0, 0, 0) 70%),
    radial-gradient(150% 100% at 50% 120%, var(--wall-deep), rgba(0, 0, 0, 0) 62%),
    linear-gradient(180deg, color-mix(in srgb, var(--wall) 88%, #000), var(--wall) 45%);
  background-color: var(--wall);
}

/* ---------- the top bar: back, and where we are ---------- */
.bar {
  position: fixed; z-index: 5; left: 0; right: 0; top: 0;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 0;
  display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 8px;
}
.back {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink);
  background: var(--chip); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.where {
  justify-self: center;
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 16px; border: 0; border-radius: 19px;
  background: var(--chip); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-size: 14px; font-weight: 600; letter-spacing: .01em; cursor: pointer;
  max-width: 100%; white-space: nowrap;
}
.where svg { opacity: .6; flex: none; }
#whereText { overflow: hidden; text-overflow: ellipsis; }

/* ---------- the scene ---------- */
.scene {
  position: fixed; inset: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: space-evenly;
  padding: calc(env(safe-area-inset-top) + 64px) 16px calc(env(safe-area-inset-bottom) + 14px);
}
.stage {
  position: relative;
  width: var(--w); height: calc(var(--h) + var(--d) * .55);
  display: grid; place-items: end center;
  perspective: 1500px; perspective-origin: 50% 0%;
  touch-action: none;
  flex: none;
}
.shadow {
  position: absolute; left: 16%; right: 16%; bottom: 4%; height: 22%;
  border-radius: 50%;
  box-shadow: 0 20px 44px 18px rgba(30, 50, 66, .32), 0 6px 14px 4px rgba(30, 50, 66, .2);
  transform: translate(var(--sx, 0px), 0) scaleX(var(--sw, 1));
  will-change: transform;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .shadow { box-shadow: 0 18px 44px 16px rgba(0, 0, 0, .6), 0 6px 14px 4px rgba(0, 0, 0, .35); } }

/* ---------- the player: a box of six faces ---------- */
.deck {
  position: relative;
  width: var(--w); height: var(--h);
  transform-style: preserve-3d;
  will-change: transform;
  cursor: grab;
}
.face { position: absolute; -webkit-backface-visibility: hidden; backface-visibility: hidden; }

/* brushed, champagne-coloured aluminium */
.f-front, .f-top, .key .cap {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .07) 0 1px, rgba(0, 0, 0, .025) 1px 2px, rgba(255, 255, 255, 0) 2px 3px),
    linear-gradient(180deg, #e3ddd1 0%, #cfc7b8 55%, #bdb4a3 100%);
}
.f-front {
  inset: 0;
  transform: translateZ(calc(var(--d) / 2));
  border-radius: calc(var(--w) * .022);
  transform-style: preserve-3d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75), inset 0 -2px 3px rgba(0, 0, 0, .18), inset 1px 0 0 rgba(255, 255, 255, .3), inset -1px 0 0 rgba(0, 0, 0, .12);
}
/* the cavity the cassette sits in, seen when the door swings out */
.f-front::before {
  content: ''; position: absolute;
  left: 5%; right: 5%; top: calc(var(--w) * .045); height: calc(var(--w) * .54);
  border-radius: calc(var(--w) * .016);
  background: radial-gradient(120% 90% at 50% 40%, #2b2824, #141210);
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, .7);
}
.f-back { inset: 0; transform: rotateY(180deg) translateZ(calc(var(--d) / 2)); background: #2a2723; border-radius: calc(var(--w) * .022); }
.f-top, .f-bottom {
  left: 0; width: var(--w); height: var(--d); top: calc((var(--h) - var(--d)) / 2);
}
.f-top {
  transform: rotateX(90deg) translateZ(calc(var(--h) / 2));
  transform-style: preserve-3d;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .06) 0 1px, rgba(0, 0, 0, .03) 1px 2px, rgba(255, 255, 255, 0) 2px 3px),
    linear-gradient(0deg, #b8af9e, #a59c8a);
  border-radius: calc(var(--w) * .02);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .5);
}
.f-bottom { transform: rotateX(-90deg) translateZ(calc(var(--h) / 2)); background: #23211e; }
.f-left, .f-right {
  top: 0; width: var(--d); height: var(--h); left: calc((var(--w) - var(--d)) / 2);
  background: linear-gradient(90deg, #8f8676, #a59c8a 40%, #8f8676);
  border-radius: calc(var(--w) * .02);
}
.f-left { transform: rotateY(-90deg) translateZ(calc(var(--w) / 2)); }
.f-right { transform: rotateY(90deg) translateZ(calc(var(--w) / 2)); }
/* the volume wheel's ridged edge, on the right side */
.wheel {
  position: absolute; left: 30%; width: 40%; top: 22%; height: 30%; border-radius: 3px;
  background: repeating-linear-gradient(0deg, #3b3833 0 2px, #6d675d 2px 3px);
  box-shadow: inset 0 0 4px rgba(0, 0, 0, .6);
}
.jack {
  position: absolute; left: 8%; top: 38%; width: calc(var(--w) * .045); height: calc(var(--w) * .045);
  border-radius: 50%; background: radial-gradient(circle, #050505 35%, #3d3a35 38%, #7d766a 62%, #b6ad9c 66%);
}

/* ---------- the keys ---------- */
.keys {
  position: absolute; right: 6%; left: 22%; bottom: 14%; height: 60%;
  display: flex; gap: 5%; justify-content: flex-end;
  transform-style: preserve-3d;
}
.key {
  --up: calc(var(--w) * .024);
  position: relative; flex: 0 0 17%; height: 100%;
  padding: 0; border: 0; background: none; cursor: pointer;
  transform-style: preserve-3d;
  transform: translateZ(var(--up));
  transition: transform .09s ease-out;
  -webkit-tap-highlight-color: transparent;
}
.key-play { flex-basis: 22%; }
.key .cap {
  position: absolute; inset: 0; border-radius: 3px;
  display: grid; place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), inset 0 -1px 0 rgba(0, 0, 0, .15);
}
.key svg { width: 46%; height: 46%; fill: #4a453c; }
.key-play .cap { background: linear-gradient(180deg, #3f7d61, #2a5f47); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -1px 0 rgba(0, 0, 0, .25); }
.key-play svg { fill: #f3efe4; }
.key-stop .cap { grid-auto-flow: column; gap: 4%; }
.key-stop svg { width: 34%; }
.key-stop i { font-style: normal; font-size: calc(var(--w) * .038); line-height: 1; color: #4a453c; }
.key .skirt {
  position: absolute; left: 0; right: 0; top: 100%; height: var(--up);
  transform-origin: 50% 0; transform: rotateX(-90deg);
  background: linear-gradient(180deg, #9d9483, #7f7768);
  border-radius: 0 0 2px 2px;
}
.key-play .skirt { background: linear-gradient(180deg, #24513d, #1a3d2e); }
.key.down { transform: translateZ(calc(var(--w) * .006)); }
.key.down .skirt { height: calc(var(--w) * .006); }
.key:focus-visible .cap { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- the door, its glass, and the cassette in it ---------- */
.door {
  position: absolute;
  left: 5%; right: 5%; top: calc(var(--w) * .045); height: calc(var(--w) * .54);
  transform-origin: 50% 100%;
  transform: translateZ(1px) rotateX(0deg);
  transform-style: preserve-3d;
  /* shutting: pushed by a thumb, quick at the end */
  transition: transform .62s cubic-bezier(.55, 0, .75, .4);
}
/* opening: the spring lets it swing out slowly and settle */
.door.open { transform: translateZ(1px) rotateX(-24deg); transition: transform 1s cubic-bezier(.2, .9, .3, 1.12); }
.door.open.pushing { transform: translateZ(1px) rotateX(-21deg); transition-duration: .12s; }
.bay {
  position: absolute; left: 6.6%; width: 86.8%; top: calc(var(--w) * .021); height: calc(var(--w) * .78 * .638);
  transform-style: preserve-3d;
}
.glass {
  position: absolute; inset: 0;
  border-radius: calc(var(--w) * .016);
  border: calc(var(--w) * .013) solid #2b2926;
  background:
    linear-gradient(112deg, rgba(255, 255, 255, .2) 0%, rgba(255, 255, 255, .06) 22%, rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, 0) 64%, rgba(255, 255, 255, .09) 72%, rgba(255, 255, 255, 0) 84%),
    rgba(18, 20, 24, .1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), 0 1px 0 rgba(255, 255, 255, .5);
  transform: translateZ(4px);
  pointer-events: none;
}

/* ---------- a cassette: six faces, 12 mm thick ---------- */
.cassette { transform-style: preserve-3d; aspect-ratio: 100 / 63.8; }
.cf {
  position: absolute; -webkit-backface-visibility: hidden; backface-visibility: hidden;
  opacity: calc(var(--op, 1) * var(--dim, 1));
}
.cf-front, .cf-back { inset: 0; }
.cf-front { transform: translateZ(calc(var(--t, 12px) / 2)); }
.cf-back { transform: rotateY(180deg) translateZ(calc(var(--t, 12px) / 2)); }
.cf .shell { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cf-top, .cf-bottom {
  left: 0; width: 100%; height: var(--t, 12px); top: calc(50% - var(--t, 12px) / 2);
  background: linear-gradient(90deg, rgba(0, 0, 0, .25), rgba(255, 255, 255, .12) 50%, rgba(0, 0, 0, .25)), var(--shell);
  border-radius: 2px;
}
.cf-top { transform: rotateX(90deg) translateZ(calc(var(--ch, 64px) / 2)); }
.cf-bottom { transform: rotateX(-90deg) translateZ(calc(var(--ch, 64px) / 2)); background: linear-gradient(rgba(0, 0, 0, .35), rgba(0, 0, 0, .35)), var(--shell); }
/* the write-protect tabs */
.cf-top i { position: absolute; top: 22%; width: 6%; height: 56%; background: rgba(0, 0, 0, .55); border-radius: 1px; }
.cf-top i:first-child { left: 9%; } .cf-top i:last-child { right: 9%; }
.cf-left, .cf-right {
  top: 0; height: 100%; width: var(--t, 12px); left: calc(50% - var(--t, 12px) / 2);
  background: linear-gradient(0deg, rgba(0, 0, 0, .3), rgba(255, 255, 255, .1) 50%, rgba(0, 0, 0, .3)), var(--shell);
  border-radius: 2px;
}
.cf-left { transform: rotateY(-90deg) translateZ(calc(var(--cwp, 100px) / 2)); }
.cf-right { transform: rotateY(90deg) translateZ(calc(var(--cwp, 100px) / 2)); }

/* in the player only its front is ever seen (and the other faces would only confuse the depth) */
.cassette.in-deck {
  position: absolute; inset: 0;
  transform: translateZ(1.5px);
  transition: transform .76s cubic-bezier(.45, 0, .25, 1);
}
.cassette.in-deck .cf:not(.cf-front) { display: none; }
.cassette.in-deck .cf-front { transform: none; }
.cassette.in-deck.popped { transform: translate3d(0, -9%, 1.5px); transition: transform .5s cubic-bezier(.3, 1.6, .5, 1); }
.cassette.in-deck.rising { transform: translate3d(0, -46%, 8px); }
.cassette.in-deck.appear { --op: 0; transition: none; }
.cassette.in-deck .cf-front { transition: opacity .16s; }
.cassette.in-deck.lowering { transform: translateZ(1.5px); transition: transform .9s cubic-bezier(.35, 0, .2, 1); }

.reels { position: absolute; inset: 0; border-radius: 3%; overflow: hidden; }
.pack, .hub { position: absolute; top: var(--hy); will-change: transform; }
.pack {
  width: var(--rmax); aspect-ratio: 1; border-radius: 50%;
  background:
    repeating-radial-gradient(circle, rgba(0, 0, 0, 0) 0 2px, rgba(0, 0, 0, .1) 2px 3px),
    radial-gradient(circle, #6b4a2c 0%, #4e3420 70%, #3f2a19 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .3);
}
.pack-l { left: var(--hxl); }
.pack-r { left: var(--hxr); }
.hub { width: 13%; aspect-ratio: 1; }
.hub svg { width: 100%; height: 100%; display: block; }
.hub-l { left: var(--hxl); }
.hub-r { left: var(--hxr); }

/* ---------- the name plate: brand, light, tape counter ---------- */
.plate {
  position: absolute; left: 6%; right: 6%; bottom: calc(var(--w) * .03); height: calc(var(--w) * .1);
  display: flex; align-items: center; gap: 4%;
}
.brand {
  font-size: calc(var(--w) * .036); font-weight: 700; letter-spacing: .32em;
  color: #6f685b; text-shadow: 0 1px 0 rgba(255, 255, 255, .7), 0 -1px 0 rgba(0, 0, 0, .12);
  display: flex; align-items: baseline; gap: .6em; flex: 1;
}
.brand { gap: .55em; }
.brand em { font-style: normal; font-weight: 700; letter-spacing: 0; font-size: 1.12em; color: #5e574b; }
.led {
  width: calc(var(--w) * .022); height: calc(var(--w) * .022); border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #6f7a68, #3c4338);
  box-shadow: inset 0 0 1px rgba(0, 0, 0, .6);
}
.led.on { background: radial-gradient(circle at 35% 35%, #d9ffcf, #47d16a 55%, #23893f); box-shadow: 0 0 8px 2px rgba(80, 220, 110, .55); }
.led.wait { animation: ledWait 1s ease-in-out infinite; }
@keyframes ledWait { 50% { opacity: .35; } }
.counter {
  display: flex; gap: 2px; padding: 3px 4px; border-radius: 4px;
  background: #1c1b19; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .8), 0 1px 0 rgba(255, 255, 255, .55);
}
.dig {
  --dh: calc(var(--w) * .052);
  width: calc(var(--w) * .036); height: var(--dh); overflow: hidden; border-radius: 1px;
  background: linear-gradient(180deg, #0c0c0b, #2b2a27 50%, #0c0c0b);
}
.wheel-d { display: flex; flex-direction: column; transition: transform .5s cubic-bezier(.3, 1.3, .6, 1); }
.wheel-d span {
  height: var(--dh); display: grid; place-items: center;
  color: #f1ede2; font-size: calc(var(--w) * .038); font-weight: 600; font-variant-numeric: tabular-nums;
}

/* ---------- what's playing: the surah, and the ayah being recited ---------- */
.now { display: grid; justify-items: center; gap: 6px; text-align: center; width: min(100%, 520px); }
/* the ayah being recited, one line — a plain pill like the top chip */
.peek {
  width: min(100%, 360px); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  height: 44px; padding: 0 14px 0 16px; border: 0; border-radius: 22px; cursor: pointer; text-align: start;
  background: var(--chip); color: var(--ink);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.peek-k { font-size: 13px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.peek-i { color: var(--ink-soft); }
/* the window the line slides through, its edges softened */
.peek-win {
  position: relative; min-width: 0; height: 44px; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.peek-t {
  position: absolute; left: 0; top: 0; white-space: nowrap;
  font-family: 'Noto Naskh Arabic', 'Amiri Quran', serif; font-weight: 500; font-size: 17px; line-height: 44px;
  transition: transform .5s cubic-bezier(.3, .1, .3, 1); will-change: transform;
}
.peek-t.jump { transition: none; }
.peek.id .peek-t { font-family: Inter, system-ui, sans-serif; font-weight: 500; font-size: 14px; }
/* while it plays, the words not yet reached are quieter */
.pw { transition: color .25s; }
.peek.live .pw { color: var(--ink-soft); }
.peek.live .pw.on { color: var(--ink); }

/* ---------- on the home screen: the install suggestion, and short notes ---------- */
.install, .note {
  position: fixed; left: 50%; z-index: 7; bottom: calc(env(safe-area-inset-bottom) + 76px);
  transform: translate(-50%, 14px); opacity: 0; transition: transform .4s ease, opacity .4s ease;
  width: min(calc(100% - 32px), 380px);
  border-radius: 18px; background: rgba(255, 255, 255, .92); color: var(--ink);
  box-shadow: 0 12px 30px rgba(30, 50, 66, .2);
  font-size: 13px; line-height: 1.4;
}
.install { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 12px; }
.install[hidden], .note[hidden] { display: none; }
.install.shown, .note.shown { transform: translate(-50%, 0); opacity: 1; }
.install img { border-radius: 8px; flex: none; }
.install-text { margin: 0; flex: 1; }
.install-text svg { width: 16px; height: 16px; vertical-align: -3px; color: #2f6fd6; }
.install-go { flex: none; border: 0; border-radius: 999px; padding: 7px 14px; background: #24323b; color: #fff; font: 600 13px Inter, system-ui, sans-serif; cursor: pointer; }
.install-x { flex: none; width: 30px; height: 30px; border: 0; background: none; color: var(--ink-soft); font-size: 20px; line-height: 1; cursor: pointer; }
.note { margin: 0; padding: 11px 16px; text-align: center; font-weight: 500; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .install, :root:not([data-theme="light"]) .note { background: rgba(40, 48, 58, .95); } }
:root[data-theme="dark"] .install, :root[data-theme="dark"] .note { background: rgba(40, 48, 58, .95); }

/* ---------- the ayat, full screen (Spotify's lyrics view) ---------- */
.lyrics {
  --ly: #1f5a44;
  position: fixed; inset: 0; z-index: 8;
  display: grid; grid-template-rows: auto 1fr auto;
  /* deep slate blue, like the room at dusk, with a hint of the tape's colour */
  background: linear-gradient(180deg, color-mix(in srgb, var(--ly) 18%, #3d566a), color-mix(in srgb, var(--ly) 12%, #1f2c37));
  color: #fff;
  transform: translateY(100%); transition: transform .38s cubic-bezier(.3, .9, .35, 1);
  padding-top: env(safe-area-inset-top);
}
.lyrics.open { transform: none; }
.ly-head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; padding: 6px 12px 0; position: relative; touch-action: none; }
.ly-head .grip { position: absolute; left: 50%; top: 4px; transform: translateX(-50%); width: 38px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .3); }
.ly-close { width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; display: grid; place-items: center; cursor: pointer; }
.ly-title { display: grid; justify-items: center; line-height: 1.25; padding: 10px 0 8px; }
.ly-surah-ar { font-family: 'qcf-surah-names', Amiri, serif; font-size: 26px; line-height: 1.1; opacity: .9; }
.ly-surah { font-weight: 700; font-size: 15px; }
.ly-sub { font-size: 12px; opacity: .7; }
.ly-list { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 10px 22px 0; scroll-padding-top: 20vh; }
.ly-wait { opacity: .7; text-align: center; margin-top: 30vh; }
.ly-ol { list-style: none; margin: 0; padding: 0; }
/* each ayah: its Arabic, centred; only the one being recited opens its meaning underneath */
.ly-ayah { padding: 14px 0; cursor: pointer; text-align: center; color: rgba(255, 255, 255, .34); transition: color .3s; }
.ly-ar, .ly-id { margin: 0; }
.ly-ar { font-family: 'Noto Naskh Arabic', 'Amiri Quran', serif; font-weight: 500; font-size: clamp(23px, 6.4vw, 29px); line-height: 2; }
.ly-n { font-size: .78em; opacity: .6; }
.ly-tail { white-space: nowrap; }
.ly-tr { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .45s ease, opacity .45s ease; }
.ly-tr > .ly-id { overflow: hidden; min-height: 0; }
.ly-id { font-size: 15px; line-height: 1.55; font-weight: 500; color: rgba(255, 255, 255, .82); padding: 0 6px; }
.ly-ayah.now .ly-tr { grid-template-rows: 1fr; opacity: 1; }
.ly-ayah.now .ly-id { padding-top: 6px; }
/* upcoming dim, past half-bright, the one being recited bright; its words light up as they're reached */
.ly-ayah.past { color: rgba(255, 255, 255, .58); }
.ly-ayah.now { color: #fff; }
.ly-ayah.now .w { color: rgba(255, 255, 255, .4); transition: color .25s ease, text-shadow .25s ease; }
.ly-ayah.now .w.on { color: #fff; }
.ly-ayah.now .w.at { text-shadow: 0 0 14px rgba(255, 255, 255, .55); }
.ly-end { height: 55vh; }
.ly-sync {
  position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 92px); transform: translateX(-50%);
  border: 0; border-radius: 18px; padding: 8px 16px; font-size: 13px; font-weight: 700; cursor: pointer;
  background: #fff; color: #1c2731; box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}
.ly-bar {
  display: flex; justify-content: center; align-items: center; gap: 28px;
  padding: 12px 0 calc(env(safe-area-inset-bottom) + 16px);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, .18));
}
.ly-bar button { border: 0; background: none; color: #fff; width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; }
.ly-bar svg { width: 24px; height: 24px; fill: currentColor; }
.ly-bar .ly-play { width: 58px; height: 58px; border-radius: 50%; background: #fff; color: #1c2731; }
.ly-bar .ly-play svg { width: 26px; height: 26px; }
.ly-play .i-pause, .ly-play.on .i-play { display: none; }
.ly-play.on .i-pause { display: block; }

.now-hint { font-size: 12.5px; color: var(--ink-soft); transition: opacity .6s; }
.now-hint.gone { display: none; }

/* ---------- the shelf: the reciter's tapes in a 3D row ---------- */
.shelf { --cw2: clamp(104px, 30vw, 150px); position: relative; width: 100%; display: grid; justify-items: center; gap: 2px; flex: none; }
.shelf-label { position: relative; color: #f3e6cf; text-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.shelf-label small { color: rgba(243, 230, 207, .72) !important; }
.shelf-stage {
  width: 100%; height: calc(var(--cw2) * .638 + 46px);
  display: grid; place-items: center;
  perspective: 900px; perspective-origin: 50% 20%;
  touch-action: pan-y; cursor: grab;
}
.shelf-track { position: relative; width: var(--cw2); aspect-ratio: 100 / 63.8; transform-style: preserve-3d; transform: rotateX(-12deg); }
.on-shelf { position: absolute; inset: 0; will-change: transform; cursor: pointer; outline: none; }
.on-shelf.loaded { --dim: .18; }
.on-shelf.lifting { translate: 0 -38% 60px; transition: translate .38s cubic-bezier(.3, 0, .2, 1); }
.on-shelf:focus-visible .cf-front { outline: 2px solid var(--accent); outline-offset: 3px; }
/* its reflection on the shelf would be nice; a soft shadow underneath will do */
.shelf-track::after {
  content: ''; position: absolute; left: 4%; right: 4%; bottom: -14%; height: 12%;
  border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, .35), rgba(0, 0, 0, 0));
  transform: rotateX(80deg) translateZ(-30px);
}
.shelf-label { margin: 0; font-size: 14px; font-weight: 600; text-align: center; min-height: 20px; }
.shelf-label small { font-weight: 500; color: var(--ink-soft); }

/* ---------- a cassette in the air ---------- */
.flight { position: fixed; inset: 0; z-index: 4; pointer-events: none; perspective: 1400px; }
.cassette.flying { position: absolute; left: 0; top: 0; will-change: transform; }

/* ---------- the back and the sides of the player ---------- */
.f-back {
  overflow: hidden;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .07) 0 1px, rgba(0, 0, 0, .025) 1px 2px, rgba(255, 255, 255, 0) 2px 3px),
    linear-gradient(180deg, #ddd6c9 0%, #c9c0b0 55%, #b7ad9b 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), inset 0 -2px 3px rgba(0, 0, 0, .18);
}
.clip {
  position: absolute; left: 42%; width: 16%; top: 7%; height: 50%; border-radius: 4px;
  background: linear-gradient(90deg, #8d8473, #b9b09f 30%, #a39a88 70%, #7e7666);
  box-shadow: 0 4px 8px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.battery {
  position: absolute; left: 6%; right: 6%; bottom: 7%; height: 30%; border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, .18); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 1px 0 rgba(255, 255, 255, .4);
  background: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0) 0 6px, rgba(0, 0, 0, .06) 6px 7px);
  display: grid; place-items: center;
}
.battery i { font-style: normal; font-size: calc(var(--w) * .026); letter-spacing: .2em; color: #6f685b; text-shadow: 0 1px 0 rgba(255, 255, 255, .6); }
.sticker {
  position: absolute; left: 6%; top: 8%; width: 30%; padding: 2% 2.4%;
  background: #f4efe4; border-radius: 3px; box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  display: grid; gap: 2px; color: #4a453c; font-size: calc(var(--w) * .019); line-height: 1.25;
}
.sticker b { font-size: 1.15em; letter-spacing: .08em; }
.sticker .ar { font-family: Amiri, serif; font-size: 1.5em; direction: rtl; }
.f-left, .f-right { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6%; }
.f-left small, .f-right small { font-size: calc(var(--w) * .022); letter-spacing: .14em; color: #3f3a32; opacity: .75; }
.hold { width: 34%; height: 18%; border-radius: 6px; background: #3b3833; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .7); position: relative; }
.hold i { position: absolute; left: 12%; right: 12%; top: 8%; height: 40%; border-radius: 3px; background: linear-gradient(#cfc7b8, #9d9483); }
.dc { width: calc(var(--w) * .05); height: calc(var(--w) * .05); border-radius: 50%; background: radial-gradient(circle, #0b0b0b 30%, #3d3a35 34%, #8d8676 62%, #b6ad9c 66%); }
.f-right .wheel { position: static; width: 40%; height: 34%; }

/* ---------- the sheet: juz, surah, qari ---------- */
/* listening without internet: the tape in the player */
.offline-card {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  padding: 12px 12px 14px 14px; margin: 2px 0 10px; border-radius: 14px;
  background: rgba(36, 50, 59, .06); border: 1px solid var(--line);
}
.oc-icon { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(36, 50, 59, .08); color: var(--ink); }
.offline-card.saved .oc-icon { background: #2f7d5b; color: #fff; }
.oc-text { display: grid; gap: 2px; min-width: 0; }
.oc-text b { font-size: 14px; }
.oc-text span { font-size: 12px; color: var(--ink-soft); }
.oc-btn { border: 0; border-radius: 999px; padding: 8px 16px; font: 600 13px Inter, system-ui, sans-serif; cursor: pointer; background: #24323b; color: #fff; }
.offline-card.saved .oc-btn, .offline-card.busy .oc-btn { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.oc-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: transparent; }
.oc-bar i { display: block; height: 100%; width: 0; background: #2f7d5b; transition: width .3s; }
.oc-total { margin: -4px 2px 10px; font-size: 12px; color: var(--ink-soft); }
.jcell { position: relative; }
.jcell.saved::after {
  content: '✓'; position: absolute; top: 4px; right: 5px; width: 15px; height: 15px; border-radius: 50%;
  background: #2f7d5b; color: #fff; font-size: 9px; font-weight: 700; display: grid; place-items: center;
}
.jgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding-top: 4px; }
.jcell {
  border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .4);
  padding: 8px 2px 7px; display: grid; justify-items: center; gap: 1px; cursor: pointer;
}
.jcell b { font-size: 17px; }
.jcell span { font-size: 10px; color: var(--ink-soft); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 3px; }
.jcell.current { background: rgba(31, 90, 68, .12); border-color: rgba(31, 90, 68, .35); }

.sheet { position: fixed; inset: 0; z-index: 10; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(20, 16, 10, .35); opacity: 0; transition: opacity .3s; }
/* the sheet is paper-light whatever the room: its own ink */
.sheet { --ink: #3a3326; --ink-soft: #7a6d58; --line: rgba(58, 51, 38, .12); color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sheet { --ink: #ece3cf; --ink-soft: #a89c84; --line: rgba(236, 227, 207, .12); } }
:root[data-theme="dark"] .sheet { --ink: #ece3cf; --ink-soft: #a89c84; --line: rgba(236, 227, 207, .12); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 78vh; max-width: 640px; margin: 0 auto;
  display: flex; flex-direction: column;
  background: var(--sheet); border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .2);
  transform: translateY(100%); transition: transform .32s cubic-bezier(.3, .9, .4, 1);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet.open .sheet-scrim { opacity: 1; }
.sheet.open .sheet-panel { transform: none; }
.sheet-head { padding: 8px 16px 10px; display: grid; justify-items: center; gap: 10px; touch-action: none; }
.grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
.tabs { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: var(--line); }
.tabs button { border: 0; background: none; padding: 7px 22px; border-radius: 9px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--ink-soft); }
.tabs button[aria-selected="true"] { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.panel { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 16px 16px; }
.search {
  width: 100%; height: 42px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .5); color: var(--ink); padding: 0 14px; font: inherit; font-size: 16px; margin-bottom: 8px;
  -webkit-user-select: text; user-select: text;
}
.slist, .qlist { list-style: none; margin: 0; padding: 0; }
.srow, .qrow {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 10px 6px; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer;
}
.srow.current, .qrow.current { background: rgba(31, 90, 68, .08); border-radius: 10px; }
.snum { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--line); }
.stext { display: grid; gap: 2px; flex: 1; min-width: 0; }
.sname { font-weight: 600; font-size: 15px; }
.smeta { font-size: 12px; color: var(--ink-soft); }
.sar { font-family: 'qcf-surah-names', Amiri, serif; font-size: 26px; flex: none; color: var(--ink); }
.qtape { width: 54px; height: 34px; flex: none; border-radius: 4px; position: relative; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.qtape::before { content: ''; position: absolute; left: 8%; right: 8%; top: 10%; height: 50%; border-radius: 2px; background: var(--label); border-top: 4px solid var(--band); }
.qtape::after { content: ''; position: absolute; left: 30%; right: 30%; top: 30%; height: 18%; border-radius: 3px; background: rgba(0, 0, 0, .55); }
.credit { font-size: 12px; color: var(--ink-soft); line-height: 1.5; margin: 14px 4px 4px; }

@media (prefers-reduced-motion: reduce) {
  .door, .cassette, .key, .wheel-d, .on-shelf { transition-duration: .01s !important; }
}
/* short phones: a little less of everything */
@media (max-height: 700px) {
  :root { --w: clamp(230px, min(78vw, 38vh), 400px); }
}
@media (max-height: 600px) {
  .peek-t { font-size: 15px; }
  .shelf { --cw2: clamp(96px, 28vw, 130px); }
}
