/* Adrabic app. Design rules: .claude/skills/mobile-app-design + old repo PRINZIPIEN (karte/quellen/wiederholung-repo.md).
   Dark first, warm neutrals, one accent, 44px+ targets, slow-in slow-out motion, reduced-motion respected. */

@font-face { font-family: "Literata"; src: url(fonts/literata-latin-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Literata"; src: url(fonts/literata-latin-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Amiri"; src: url(fonts/amiri-arabic-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
/* The sign ﷺ inside German text: Amiri glyph, drawn larger so it reads at a glance */
@font-face { font-family: "Sign"; src: url(fonts/amiri-arabic-400.woff2) format("woff2"); unicode-range: U+FDFA; size-adjust: 160%; font-display: swap; }

/* Neutral ramp tinted warm (hue ~70). Dark steps ~5% apart, surfaces get lighter as they rise. */
/* Dark = "night" look (owner's reference: TikTok Quran video, 2026-11-08): near-black, warm amber light, gold glow. */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #050403;
  --surface: #120e0a;
  --surface-2: #1d1610;
  --line: #33281b;
  --text: #fbecd3;      /* warm cream: live text */
  --body: #e4d1b2;      /* secondary text */
  --muted: #a38c6c;     /* metadata, Arabic original */
  --accent: #f0a93e;    /* amber gold */
  --accent-ink: #1a1006;
  --accent-soft: rgba(240, 169, 62, .14);
  --glow: rgba(255, 168, 60, .55);
  --glow-soft: rgba(255, 168, 60, .22);
  --live: #f0a93e;
  --danger: #ff7a5c;
  --scrim: rgba(0, 0, 0, .6);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f6f3ed; --surface: #fffdf9; --surface-2: #ece7de; --line: #dbd4c8;
    --text: #1d1a16; --body: #3a352e; --muted: #6b655b;
    --accent: #7d5f22; --accent-ink: #fffdf9; --accent-soft: rgba(125, 95, 34, .10);
    --live: #2f7d47; --danger: #b3392e; --scrim: rgba(20, 16, 10, .35);
  }
}
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --seg-on: #fffdf9; } }
:root[data-theme="light"] {
  --seg-on: #fffdf9;
  color-scheme: light;
  --bg: #f6f3ed; --surface: #fffdf9; --surface-2: #ece7de; --line: #dbd4c8;
  --text: #1d1a16; --body: #3a352e; --muted: #6b655b;
  --accent: #7d5f22; --accent-ink: #fffdf9; --accent-soft: rgba(125, 95, 34, .10);
  --live: #2f7d47; --danger: #b3392e; --scrim: rgba(20, 16, 10, .35);
}

:root {
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --read: "Literata", "Sign", Georgia, serif;   /* "Sign" renders ﷺ in German text */
  --ar: "Amiri", "Geeza Pro", "Noto Naskh Arabic", serif;
  --fs: 22px;            /* live text size, set by settings */
  --ease: cubic-bezier(.4, 0, .2, 1);   /* slow in, slow out: calm */
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --r: 14px;
  --gut: 20px;
}
:root[data-size="s"] { --fs: 19px; }
:root[data-size="m"] { --fs: 22px; }
:root[data-size="l"] { --fs: 25px; }
:root[data-size="xl"] { --fs: 29px; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 17px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
p { margin: 0; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Buttons: the more important, the stronger. Pressed = darker. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 20px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 16px;
  transition: transform .15s var(--ease), background-color .2s var(--ease), opacity .2s var(--ease);
}
.btn:active { transform: scale(.98); filter: brightness(.92); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.big { width: 100%; min-height: 60px; font-size: 18px; }
.btn.ghost { background: transparent; color: var(--body); font-weight: 500; }
.btn.quiet { min-height: 40px; padding: 0 16px; font-size: 15px; background: var(--surface-2); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 999px;
  border: 0; background: transparent; color: var(--body); cursor: pointer;
  transition: background-color .2s var(--ease);
}
.icon-btn:active { background: var(--surface-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 12px; }

/* Loading state in a button */
.btn.loading .ic { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- START ---------- */
.screen { min-height: 100%; }
.start {
  display: flex; flex-direction: column; min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 20px) var(--gut) calc(env(safe-area-inset-bottom) + 24px);
  max-width: 560px; margin: 0 auto;
}
.brand { font: 600 15px/1 var(--read); letter-spacing: .04em; color: var(--accent); padding: 12px 0; }
.start-copy { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: 32px 0; }
.start h1 {
  margin: 0; font: 600 38px/1.12 var(--read); letter-spacing: -.025em; color: var(--text);
}
.lead { font-size: 18px; line-height: 1.55; color: var(--body); max-width: 30ch; }
.start-actions { display: flex; flex-direction: column; gap: 8px; }
.hint { text-align: center; font-size: 14px; color: var(--muted); padding-top: 4px; }
.msg.err { color: var(--danger); font-size: 15px; line-height: 1.45; padding-bottom: 8px; }

/* ---------- LIVE ---------- */
.live { min-height: 100dvh; }
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px var(--gut);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .3s var(--ease);
}
.bar.scrolled { border-bottom-color: var(--line); }
.status { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; color: var(--text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); }
.status.is-connecting .dot { background: var(--muted); animation: breathe 1.6s var(--ease) infinite; }
.status.is-paused .dot, .status.is-ended .dot { background: var(--muted); }
.status.is-live .dot { animation: breathe 2.4s var(--ease) infinite; }
@keyframes breathe { 50% { opacity: .35; } }
.timer { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.meter { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; margin-left: 2px; }
.meter i { width: 3px; height: 4px; border-radius: 2px; background: var(--muted); transition: height .12s var(--ease-out), background-color .2s; }
.meter.on i { background: var(--live); }
.bar-actions { display: flex; align-items: center; gap: 4px; }

.banner {
  position: sticky; top: calc(env(safe-area-inset-top) + 60px); z-index: 4;
  margin: 8px var(--gut) 0; padding: 10px 10px 10px 16px; border-radius: var(--r);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface-2); color: var(--text); font-size: 15px;
}

.feed {
  max-width: 680px; margin: 0 auto;
  padding: 24px var(--gut) calc(env(safe-area-inset-bottom) + 140px);
}

/* Empty state: says what is happening, shows the mic hears something */
.empty { min-height: 60dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; }
.pulse { width: 64px; height: 64px; border-radius: 50%; background: var(--accent-soft); position: relative; margin-bottom: 16px; }
.pulse::after { content: ""; position: absolute; inset: 22px; border-radius: 50%; background: var(--accent); transform: scale(var(--lvl, 1)); transition: transform .12s var(--ease-out); }
.empty-title { font: 600 20px/1.2 var(--read); color: var(--text); }
.empty-sub { color: var(--muted); font-size: 15px; max-width: 28ch; }

/* Transcript */
.seg-item { margin: 0 0 28px; animation: rise .45s var(--ease-out) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.de { font: 400 var(--fs)/1.5 var(--read); color: var(--text); letter-spacing: -.003em; overflow-wrap: anywhere; }
.de .tent { color: var(--muted); }               /* not final yet */
.de.pending { color: var(--muted); animation: breathe 1.6s var(--ease) infinite; }   /* waiting for the translation */
.de.fallback { color: var(--body); font-style: italic; }   /* quick translation, not checked */
.ar-line {
  margin-top: 6px; direction: rtl; text-align: right;
  font: 400 calc(var(--fs) * .82)/1.8 var(--ar); color: var(--muted);
}
:root:not([data-arabic="on"]) .ar-line { display: none; }

/* Quran / Hadith: marked by a thin accent rule, no card inside a card */
.ref { padding-left: 16px; border-left: 2px solid var(--accent); }
.ref-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; min-height: 36px; }
.tag { font: 600 13px/1 var(--ui); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.src-btn {
  min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--body); font-size: 14px; cursor: pointer;
}
.src-btn[aria-expanded="true"] { background: var(--surface-2); }
.ref .ar-verse {
  direction: rtl; text-align: right; margin-bottom: 10px;
  font: 400 calc(var(--fs) * 1.12)/1.9 var(--ar); color: var(--text);
}
.chain { font: 400 calc(var(--fs) * .8)/1.5 var(--read); color: var(--muted); margin-bottom: 6px; }
.src {
  display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--ease);
}
.src.open { grid-template-rows: 1fr; }
.src > div { overflow: hidden; }
.src p { margin-top: 10px; font-size: 14px; line-height: 1.5; color: var(--muted); }

.jump {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); z-index: 6;
  transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--text); color: var(--bg); font-size: 15px; font-weight: 600;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
  animation: rise .3s var(--ease-out) both;
}
.jump .ic { width: 18px; height: 18px; }

.end {
  max-width: 680px; margin: -100px auto 0; padding: 24px var(--gut) calc(env(safe-area-inset-bottom) + 32px);
  display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line);
}
.end p { color: var(--muted); font-size: 15px; text-align: center; padding-bottom: 8px; }

/* ---------- SETTINGS SHEET ---------- */
.scrim { position: fixed; inset: 0; z-index: 20; background: var(--scrim); animation: fade .3s var(--ease) both; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
  max-width: 560px; margin: 0 auto; max-height: 88dvh; overflow-y: auto;
  padding: 8px var(--gut) calc(env(safe-area-inset-bottom) + 24px);
  background: var(--surface); border-radius: 24px 24px 0 0;
  animation: up .38s var(--ease-out) both;
}
.sheet.closing { animation: down .26s var(--ease) both; }
.scrim.closing { animation: fade .26s var(--ease) reverse both; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes down { to { transform: translateY(100%); } }
.grip { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 8px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet h2 { margin: 0; font: 600 22px/1.2 var(--read); letter-spacing: -.02em; }
.field { padding: 16px 0; border-top: 1px solid var(--line); }
.field.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.label { font-size: 16px; font-weight: 600; color: var(--text); }
.sub { font-size: 14px; color: var(--muted); margin-top: 2px; }
.field > .label + .seg { margin-top: 12px; }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); }
.seg button {
  flex: 1; min-height: 44px; border: 0; border-radius: 10px; background: transparent;
  color: var(--body); font-size: 15px; font-weight: 500; cursor: pointer;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.seg button[aria-checked="true"] { background: var(--seg-on, var(--line)); color: var(--text); font-weight: 600; }
.preview { margin-top: 12px; font: 400 var(--fs)/1.45 var(--read); color: var(--text); }
.switch {
  flex: none; width: 52px; height: 32px; border-radius: 999px; border: 0; padding: 0; cursor: pointer;
  background: var(--line); position: relative; transition: background-color .25s var(--ease);
}
.switch span {
  position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; transition: transform .25s var(--ease);
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] span { transform: translateX(20px); }
.switch::before { content: ""; position: absolute; inset: -6px; }  /* 44px tap area */

/* ---------- NIGHT LOOK (dark theme only) ---------- */
/* Warm light from the side, like a lamp behind flowers; stays behind everything. */
.ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; display: none; }
.ambient::before, .ambient::after { content: ""; position: absolute; border-radius: 50%; filter: blur(60px); }
.ambient::before { width: 70vmax; height: 70vmax; left: -38vmax; top: -12vmax; background: radial-gradient(circle, rgba(255, 140, 40, .42), rgba(255, 110, 20, .12) 45%, transparent 70%); animation: drift 26s ease-in-out infinite alternate; }
.ambient::after { width: 55vmax; height: 55vmax; left: -30vmax; bottom: -22vmax; background: radial-gradient(circle, rgba(255, 120, 30, .30), transparent 65%); animation: drift 34s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate(4vmax, -3vmax) scale(1.08); } }
#sparks { position: fixed; inset: 0; z-index: 0; pointer-events: none; display: none; }
:root[data-look="night"] .ambient, :root[data-look="night"] #sparks { display: block; }
:root[data-look="night"][data-effects="off"] .ambient, :root[data-look="night"][data-effects="off"] #sparks { display: none; }
.screen, .feed, .end { position: relative; z-index: 1; }   /* .bar keeps position: sticky */

/* Text glows softly; labels in spaced capitals like the video's translation line. */
:root[data-look="night"] .start h1 { text-shadow: 0 0 28px var(--glow-soft); }
:root[data-look="night"] .brand, :root[data-look="night"] .tag { letter-spacing: .16em; text-transform: uppercase; font: 600 12px/1 var(--ui); }
:root[data-look="night"] .btn.primary { box-shadow: 0 0 0 1px rgba(255, 190, 100, .35), 0 8px 34px rgba(255, 150, 40, .28); }

/* Focus: the newest finished sentence glows, earlier ones step back. */
.seg-item { transition: opacity .6s var(--ease), filter .6s var(--ease); }
:root[data-look="night"] .feed .seg-item { opacity: .5; }
:root[data-look="night"] .feed .seg-item.current, :root[data-look="night"] .feed .seg-item:last-child { opacity: 1; }
:root[data-look="night"] .seg-item.current .de { text-shadow: 0 0 22px var(--glow-soft), 0 0 2px rgba(255, 220, 170, .35); }
/* Gold bar under the current sentence, growing from the centre (the video's highlight bar). */
.seg-item.current::after {
  content: ""; display: block; height: 3px; margin-top: 12px; border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--accent) 12%, #ffd9a0 50%, var(--accent) 88%, transparent);
  box-shadow: 0 0 16px var(--glow), 0 0 4px rgba(255, 210, 150, .8); transform-origin: center; animation: bar .7s var(--ease-out) both;
}
:root:not([data-look="night"]) .seg-item.current::after { display: none; }
@keyframes bar { from { transform: scaleX(0); opacity: 0; } }
:root[data-look="night"] .ref { border-left-color: var(--accent); box-shadow: -8px 0 18px -10px var(--glow); }
:root[data-look="night"] .ref .ar-verse { text-shadow: 0 0 18px var(--glow-soft); }
:root[data-look="night"] .dot { box-shadow: 0 0 10px var(--glow); }

@media (prefers-reduced-motion: reduce) {
  .ambient::before, .ambient::after { animation: none; }
  #sparks { display: none !important; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (min-width: 720px) {
  .start h1 { font-size: 48px; }
}
