/* AyahSync — mobile-first, dark. Designed at 390px; ≥768px is the enhancement (§6). */

/* --- fonts: vendored locally, same files the video renderer uses (§2) --- */
@font-face {
  font-family: "Amiri";
  src: url("/assets/fonts/Amiri-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Amiri";
  src: url("/assets/fonts/Amiri-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/Inter.ttf") format("truetype");
  font-weight: 100 900; /* variable font */
  font-display: swap;
}

:root {
  --bg: #0a0e13;
  --surface: #121a23;
  --surface-2: #1a2530;
  --border: #24313f;
  --text: #e9eff6;
  --muted: #8ba0b6;
  --accent: #17b890;
  --accent-ink: #04150f;
  --warn: #e0a92a;
  --danger: #e0553f;

  --radius: 14px;
  --tap: 44px; /* every tap target is at least this (§6) */
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* zero horizontal scroll at any width (§6) */
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--safe-t);
  /* --dock-h is the dock's MEASURED height, written by app.js on every resize, so the
     content is never hidden behind it no matter how the dock grows */
  padding-bottom: calc(var(--dock-h, 76px) + 16px);
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}
/* Short screens (upload, and any step that opts in) should sit in the MIDDLE of the room
   below the header, not cling to the top with a screenful of black underneath. Tall screens
   (video / result / check) keep the default top-alignment and simply scroll. */
.wrap.center {
  min-height: calc(100vh - 130px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* --- header + step indicator --- */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 6px;
  max-width: 720px;
  margin: 0 auto;
}
.brand {
  font-weight: 650;
  letter-spacing: -0.01em;
}
.brand .dot {
  color: var(--accent);
}

.steps {
  display: flex;
  gap: 6px;
  max-width: 720px;
  margin: 0 auto 18px;
  padding: 0 16px;
}
.steps li {
  flex: 1;
  list-style: none;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}
.steps .rail {
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  margin-bottom: 6px;
}
.steps li.active .rail,
.steps li.past .rail {
  background: var(--accent);
}
.steps li.active {
  color: var(--text);
  font-weight: 600;
}

/* --- generic bits --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
h1 {
  font-size: 22px;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.sub {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 18px;
}
.hidden {
  display: none !important;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 12px;
  border: 1px solid transparent;
  min-height: var(--tap);
  transition: background 0.12s, border-color 0.12s;
}
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
  padding: 0 18px;
}
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-secondary {
  width: 100%;
  background: transparent;
  color: var(--text);
  border-color: var(--border);
  padding: 0 18px;
}
.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
  padding: 0 14px;
}
.btn-ghost.on {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

/* --- the bottom dock: player + primary action, within thumb reach (§6) ---
   Both live in ONE fixed container. The action bar changes height (a secondary button
   appears on step 3), and anything positioned at a hardcoded offset above it gets
   buried — so nothing is: the dock stacks them and JS feeds its real height back into
   body's padding (see --dock-h in app.js). */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: linear-gradient(to top, var(--bg) 80%, rgba(10, 14, 19, 0.92));
  padding-bottom: var(--safe-b);
}
.actionbar {
  padding: 10px 16px;
}
.actionbar .inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* --- step 1: upload --- */
.drop {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 34px 18px;
  text-align: center;
  background: var(--surface);
}
.drop.over {
  border-color: var(--accent);
  background: var(--surface-2);
}
.drop .big {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
  border-radius: 12px;
  padding: 0 22px;
  min-height: var(--tap);
  width: 100%;
}
.drop .hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 12px;
}
.drop-only {
  display: none;
}

.picked {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}
.picked .name {
  font-weight: 600;
  word-break: break-all;
}
.picked .meta {
  color: var(--muted);
  font-size: 13px;
}

/* --- step 2: processing --- */
.processing {
  text-align: center;
  padding: 40px 20px;
}
.pct {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.bar {
  height: 8px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
  margin: 16px 0 12px;
}
.bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.35s ease;
}
.eta {
  color: var(--muted);
  font-size: 13px;
}

/* --- banners --- */
.banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.banner.ok {
  background: rgba(23, 184, 144, 0.12);
  border: 1px solid rgba(23, 184, 144, 0.35);
}
.banner.warn {
  background: rgba(224, 169, 42, 0.12);
  border: 1px solid rgba(224, 169, 42, 0.35);
}
.banner.bad {
  background: rgba(224, 85, 63, 0.12);
  border: 1px solid rgba(224, 85, 63, 0.35);
}
.banner .title {
  font-weight: 650;
}
.banner .sub {
  margin: 2px 0 0;
  font-size: 13px;
}

/* --- step 3: the current ayah card --- */
.ayah-card {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  text-align: center;
  touch-action: pan-y; /* let the swipe handler see horizontal drags */
}
.arabic {
  font-family: Amiri, serif;
  font-size: 30px;
  line-height: 1.9;
  direction: rtl;
  word-spacing: 2px;
}
.translation {
  color: #cfdae6;
  font-size: 16px;
  line-height: 1.6;
}
.caption {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.nav-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.nav-row button {
  flex: 1;
}

/* --- entry list --- */
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 18px 0 10px;
}
.list-head h2 {
  font-size: 15px;
  margin: 0;
}
.entries {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 46vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.entry {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
}
.entry.current {
  border-color: var(--accent);
  background: var(--surface-2);
}
.entry .t {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  min-width: 46px;
}
.entry .label {
  flex: 1;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.entry .ar {
  font-family: Amiri, serif;
  direction: rtl;
  font-size: 15px;
  color: var(--muted);
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pip {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  flex: none;
  background: transparent;
}
.pip.low {
  background: var(--warn);
}

/* --- editor --- */
.editor {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.nudge {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nudge .lbl {
  min-width: 44px;
  color: var(--muted);
  font-size: 13px;
}
.nudge button {
  flex: 1;
  min-width: var(--tap);
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  padding: 0 4px;
}
.nudge .val {
  min-width: 62px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--muted);
}
.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.row > * {
  flex: 1;
  min-width: 120px;
}

select,
input[type="text"],
input[type="number"] {
  width: 100%;
  min-height: var(--tap);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 12px;
  font: inherit;
}
label.field {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

/* --- player bar: the top half of the dock --- */
.player {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 8px 16px;
}
.player .inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.player button {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
  min-width: var(--tap);
  padding: 0 10px;
  font-size: 13px;
}
.player .play {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 700;
}
.player .time {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  min-width: 84px;
  text-align: center;
}
.scrub {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: var(--tap);
  background: transparent;
}
.scrub::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 99px;
  background: var(--surface-2);
}
.scrub::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border-radius: 99px;
  background: var(--accent);
}
.scrub::-moz-range-track {
  height: 5px;
  border-radius: 99px;
  background: var(--surface-2);
}
.scrub::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 99px;
  background: var(--accent);
}

/* --- step 4: video --- */
.tiles {
  display: flex;
  gap: 10px;
}
.tile {
  flex: 1;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 6px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.tile.on {
  border-color: var(--accent);
  color: var(--text);
}
.tile .shape {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.tile.on .shape {
  border-color: var(--accent);
}
.shape-916 {
  width: 22px;
  height: 39px;
}
.shape-169 {
  width: 44px;
  height: 25px;
}
.shape-11 {
  width: 32px;
  height: 32px;
}

.swipe-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.swipe-row::-webkit-scrollbar {
  height: 0;
}
.bg-tile {
  flex: none;
  width: 76px;
  height: 76px;
  border-radius: 12px;
  border: 2px solid var(--border);
  scroll-snap-align: start;
  position: relative;
  overflow: hidden;
  padding: 0;
  color: var(--text);
  font-size: 11px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 0;
  background-size: cover;
  background-position: center;
}
/* The library tiles are the video, so they are shaped like the video — and the plain
   (gradient / solid / upload) row sits right beneath it in the same shape, so the two rows
   read as one background picker rather than two unrelated things. */
#backgrounds .bg-tile,
#backgrounds-plain .bg-tile {
  width: 64px;
  height: 104px;
}
.bg-plain-row {
  margin-top: 10px;
}
.bg-tile.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}
.bg-tile span {
  width: 100%;
  background: rgba(0, 0, 0, 0.45);
  padding: 3px 0;
}

.preview-wrap {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}
/* The preview is a scale model of the render, not an impression of it — every size in it
   is a fraction of the real canvas (see drawPreview). So: no padding of its own, and the
   same 86% text column and the same line heights as app/cards.py. */
.preview {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0;
  background-size: cover;
  background-position: center;
}
/* No scrim. The renderer stopped drawing a dark box behind the text and puts a soft
   shadow under the glyphs instead (app/cards.py), so the preview has to do the same or it
   is lying about what you are going to download. */
.preview .inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0; /* real value is set inline per-frame by drawPreview() in px (short * 0.05) —
             a CSS percentage here can't resolve against this element's intrinsic height */
  width: 86%; /* cards.py: max_w = w * 0.86 */
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85), 0 0 10px rgba(0, 0, 0, 0.6);
}
.preview .p-ar {
  font-family: Amiri, serif;
  direction: rtl;
  line-height: 1.85; /* Quranic text carries harakat above AND below — cards.py: ar_lh */
  color: #fff;
}
.preview .p-tr {
  color: #fff;
  font-weight: 600; /* matches TRANSLATION_WEIGHT in cards.py */
  line-height: 1.45;
}
.preview .p-cap {
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.6;
}
/* The stage is what drawPreview rebuilds. The play control and the progress bar are its
   siblings, not its children, so a redraw (a new background, a new size) cannot delete the
   button you are currently pressing. */
.preview-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
/* The whole tile is the button: on a phone a thumb aims at the picture, not at a 40px disc.
   The disc itself sits at the BOTTOM, not in the middle — the verse is centred, and a play
   button centred on top of it hides the one thing the preview exists to show. */
.preview-play {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: end center;
  padding: 0 0 12px;
  border: 0;
  background: transparent;
  cursor: pointer;
  min-height: 0; /* it fills the tile; the global tap-target floor would stretch the layout */
}
.preview-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.preview-play:hover .preview-icon {
  transform: scale(1.06);
}
/* Once it is playing the button gets out of the way — the point is to watch the verses, not
   the chrome — but it comes back the moment you reach for it. */
.preview-play.playing .preview-icon {
  opacity: 0;
}
.preview-play.playing:hover .preview-icon,
.preview-play.playing:focus-visible .preview-icon {
  opacity: 1;
}
.preview-icon.play::after {
  content: "";
  border-left: 12px solid #fff;
  border-top: 7.5px solid transparent;
  border-bottom: 7.5px solid transparent;
  margin-left: 3px; /* a triangle looks off-centre when it is centred */
}
.preview-icon.pause::after {
  content: "";
  width: 11px;
  height: 13px;
  border-left: 3.5px solid #fff;
  border-right: 3.5px solid #fff;
}
.preview-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 16px; /* a bigger tap/drag target than the visible line, for a thumb to grab */
  z-index: 4;
  cursor: pointer;
  touch-action: none; /* we do our own dragging, not the page's scroll */
}
.preview-progress::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.18);
}
.preview-progress i {
  position: absolute;
  left: 0;
  bottom: 0;
  display: block;
  height: 3px;
  width: 0;
  background: var(--accent);
  /* no transition: the frame loop (and now dragging) already sets this 60 times a second */
}
.preview-hint {
  text-align: center;
  margin: -6px 0 0;
}

/* Both beats of the watermark carry the full credit, so the preview shows both lines. */
.preview .wm {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.3;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

/* The start button sits directly under the file it will act on. */
#btn-start {
  margin-top: 14px;
}
#recent-wrap {
  margin-top: 28px;
}
.vid .thumb svg {
  display: block;
}
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- rendering: a screen of its own, because waiting is not a footnote --- */
.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Fill the room below the header/steps and centre the card in it, rather than letting it
     cling to the top with a screenful of black underneath. */
  min-height: calc(100vh - 210px);
  gap: 18px;
}
.stage .card {
  width: 100%;
}
.leave-note {
  text-align: center;
  max-width: 340px;
  margin: 0;
  line-height: 1.5;
}

/* The check editor is a detour — give it an unmissable way back at the very top. */
.check-head {
  margin-bottom: 14px;
}
.check-head .link {
  font-weight: 600;
}

/* --- keeping the video: the email, and a tick that has to earn itself --- */
.save-card {
  margin-top: 18px;
}
.save-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.save-icon {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.save-head .title {
  font-weight: 650;
}
.save-head .sub {
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 1.45;
}

/* A floating label instead of a label stacked above a box — same information, half the
   furniture, and the field stops looking like a 2009 web form. */
.field-wrap {
  position: relative;
  margin-bottom: 4px;
}
.field-wrap input {
  width: 100%;
  min-height: 54px;
  padding: 18px 14px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
}
.field-wrap input:focus {
  outline: none;
  border-color: var(--accent);
}
.field-wrap label {
  position: absolute;
  left: 14px;
  top: 17px;
  color: var(--muted);
  font-size: 15px;
  pointer-events: none;
  transition: transform 0.12s ease, font-size 0.12s ease, color 0.12s ease;
  transform-origin: left top;
}
.field-wrap input:focus + label,
.field-wrap input:not(:placeholder-shown) + label {
  transform: translateY(-10px);
  font-size: 11px;
  color: var(--accent);
}
.field-wrap input:disabled {
  opacity: 0.75;
}

.privacy-note {
  font-size: 12px;
  margin: 12px 0 0;
  line-height: 1.5;
}
.consent-main {
  display: block;
  font-weight: 600;
  color: var(--text);
}
.consent-sub {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.45;
}

details.more {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
details.more > summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}
details.more > summary::-webkit-details-marker {
  display: none;
}
details.more > summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--muted);
}
details.more[open] > summary::after {
  content: "▴";
}
details.more .body {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--tap);
}
/* The pill still reads as 30px, but the button itself is a full 44px tap target (§6):
   ::before is the track, ::after is the knob. */
.switch {
  position: relative;
  width: 52px;
  height: var(--tap);
  min-height: var(--tap);
  flex: none;
  background: transparent;
  border: none;
  padding: 0;
}
.switch::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 52px;
  height: 30px;
  margin-top: -15px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-sizing: border-box;
  transition: background 0.15s, border-color 0.15s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 4px;
  width: 22px;
  height: 22px;
  margin-top: -11px;
  border-radius: 99px;
  background: var(--muted);
  transition: transform 0.15s, background 0.15s;
}
.switch.on::before {
  background: rgba(23, 184, 144, 0.25);
  border-color: var(--accent);
}
.switch.on::after {
  transform: translateX(22px);
  background: var(--accent);
}

.seg {
  display: flex;
  gap: 6px;
}
.seg button {
  flex: 1;
}

/* --- source picker: your own file, or a reciter from the library --- */
.source-seg {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 18px;
}
.source-seg button {
  flex: 1;
  border: none;
  border-radius: 999px;
  padding: 10px 12px;
  background: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.source-seg button.on {
  background: var(--accent);
  color: var(--accent-ink);
}

.reciter-list {
  max-height: 44vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-top: 12px;
}
.reciter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-align: left;
  font-size: 15px;
  cursor: pointer;
}
.reciter-row:last-child {
  border-bottom: none;
}
.reciter-row:hover {
  background: var(--surface-2);
}
.reciter-row.on {
  background: rgba(23, 184, 144, 0.14);
}
.reciter-empty {
  padding: 18px;
  text-align: center;
  color: var(--muted);
}
.avatar {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(23, 184, 144, 0.15);
  color: var(--accent);
  font-weight: 700;
  font-size: 15px;
}
.reciter-chosen {
  margin-top: 14px;
}
.chosen-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chosen-head .avatar {
  width: 44px;
  height: 44px;
  font-size: 17px;
}
.moshaf-seg {
  flex-wrap: wrap;
  margin-top: 14px;
}
.moshaf-seg button {
  flex: 0 1 auto;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.moshaf-seg button.on {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(23, 184, 144, 0.12);
}
#reciter-surah {
  width: 100%;
}

/* The finished clip, playing, is the first thing on the result screen — the screen used to
   announce it was ready and then make you download the file to see what you had made.
   Capped by height, not width: a 9:16 Short at full width would push everything else off
   the phone, and the point is to glance at it and reach for Download. */
.result-video {
  display: flex;
  justify-content: center;
  margin: 4px 0 14px;
}
.result-video video {
  max-height: 46vh;
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #000;
  display: block;
}
/* A landscape clip has no height to spare — let it use the width instead. */
.result-video video.wide {
  width: 100%;
  max-height: none;
}
#lbl-caption {
  display: block;
  margin-bottom: 8px;
}
#btn-caption {
  width: 100%;
  margin-top: 10px;
}
/* Download is an <a> so the browser saves the file instead of navigating — but it has to
   look and behave like the button it is. */
a.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
/* The caption is shown, not hidden behind the button: you cannot decide to post something
   you have not read, and one you have tweaked yourself is one you actually post. */
#caption-text {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
}
.link {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
}

/* --- accounts --- */
.consent {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 14px;
  min-height: var(--tap);
  padding: 6px 0;
  cursor: pointer;
  font-size: 14px;
  color: #cfdae6;
  line-height: 1.45;
}
.consent .switch {
  flex: none;
  margin-top: 2px;
}

.vid {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
}
.vid .thumb {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(160deg, #0f2027, #2c5364);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.vid .meta {
  flex: 1;
  min-width: 0;
}
.vid .meta .n {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vid .meta .s {
  color: var(--muted);
  font-size: 12px;
}
.vid .acts {
  display: flex;
  gap: 6px;
  flex: none;
}
.vid .acts a,
.vid .acts button {
  min-height: var(--tap);
  min-width: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  padding: 0 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--dock-h, 76px) + 16px);
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 99px;
  font-size: 14px;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  max-width: calc(100vw - 32px);
}
.toast.show {
  opacity: 1;
}

/* ================================================================
   ≥768px: desktop is the ENHANCEMENT (§6)
   ================================================================ */
@media (min-width: 768px) {
  body {
    padding-bottom: 40px;
  }

  .drop-only {
    display: block;
  }

  /* entry list beside the player card */
  .check-cols {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    align-items: start;
  }
  .check-cols .entries {
    max-height: 62vh;
  }
  .list-head {
    margin-top: 0;
  }

  /* on desktop the dock stops floating and sits in the flow */
  .dock {
    position: static;
    background: none;
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px;
  }
  .actionbar {
    padding: 16px 0 0;
  }
  .actionbar .inner {
    flex-direction: row-reverse;
    justify-content: flex-start;
  }
  .actionbar .inner > * {
    width: auto;
    min-width: 200px;
  }
  .player {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 16px;
  }
  .toast {
    bottom: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* --- cookie consent banner (only appears when a Meta Pixel is configured) --- */
.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 16px;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
}
.cookie-banner-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.cookie-banner-inner p {
  flex: 1 1 320px;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.cookie-banner-actions {
  display: flex;
  gap: 10px;
  flex: none;
}
.cookie-banner-actions button {
  min-height: 40px;
  padding: 0 16px;
  width: auto;
}
@media (max-width: 480px) {
  .cookie-banner-inner {
    flex-direction: column;
    align-items: stretch;
  }
  .cookie-banner-actions {
    justify-content: flex-end;
  }
}
