:root {
  --bg: #0f172a;
  --bg-soft: #1e293b;
  --card: #1e293b;
  --line: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #6366f1;
  --accent-2: #22c55e;
  --danger: #ef4444;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ── Top bar ─────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand-name { font-size: 1.05rem; letter-spacing: 0.2px; }
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--muted); transition: background 0.3s;
  box-shadow: 0 0 0 0 rgba(34,197,94,0.6);
}
.dot.online { background: var(--accent-2); animation: ping 2s infinite; }
.dot.offline { background: var(--danger); }
@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
  70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

.lang-picker select {
  appearance: none;
  background: var(--bg-soft) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>") no-repeat right 12px center;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 34px 9px 16px;
  font-size: 0.95rem;
  font-family: var(--font);
}
.lang-picker select:focus { outline: 2px solid var(--accent); }

/* ── Tabs ────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 6px;
  padding: 10px 14px;
  background: var(--bg);
  position: sticky; top: 57px; z-index: 9;
}
.tab {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
}
.tab.is-active { background: var(--accent); color: white; border-color: var(--accent); }

/* ── Banner (custom operator message) ────────────────── */
.banner {
  margin: 4px 14px 0;
  padding: 12px 16px;
  background: linear-gradient(135deg, #4338ca, #6366f1);
  border-radius: 12px;
  font-size: 1rem;
  line-height: 1.4;
  box-shadow: 0 4px 14px rgba(99,102,241,0.3);
}

/* ── Stage / views ───────────────────────────────────── */
.stage { flex: 1; position: relative; overflow: hidden; display: flex; }
.view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.read-list {
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px 14px 32px;
}
.segment {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 1.25rem;
  line-height: 1.5;
  animation: rise 0.25s ease;
}
.segment.latest { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.empty {
  height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 4px; padding: 40px;
}
.empty p { margin: 2px; }

/* ── Listen tab ──────────────────────────────────────── */
.listen-panel {
  height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; padding: 32px; text-align: center;
}
.pulse { display: flex; gap: 8px; height: 60px; align-items: center; opacity: 0.25; transition: opacity 0.3s; }
.pulse.active { opacity: 1; }
.pulse span {
  width: 10px; height: 20px; background: var(--accent); border-radius: 6px;
  animation: bounce 1s infinite ease-in-out;
}
.pulse span:nth-child(2) { animation-delay: 0.15s; }
.pulse span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%,100% { height: 16px; } 50% { height: 46px; } }

.listen-caption { max-width: 320px; font-size: 1rem; }
.now-reading {
  max-width: 460px; font-size: 1.3rem; line-height: 1.5;
  min-height: 1.5em;
}

.btn-primary {
  background: var(--accent); color: white; border: none;
  padding: 14px 28px; font-size: 1.05rem; font-weight: 600;
  border-radius: 999px; cursor: pointer; font-family: var(--font);
  box-shadow: 0 6px 18px rgba(99,102,241,0.35);
}
.btn-primary.stop { background: var(--danger); box-shadow: 0 6px 18px rgba(239,68,68,0.35); }

.btn-ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  padding: 13px 22px; font-size: 1rem; font-weight: 600;
  border-radius: 999px; cursor: pointer; font-family: var(--font);
}

/* ── Report a problem ────────────────────────────────── */
.report-btn {
  position: fixed; right: 14px; bottom: 14px; z-index: 30;
  background: var(--bg-soft); color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; font-size: 0.82rem; font-family: var(--font);
  cursor: pointer; opacity: 0.85; box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
.report-btn:hover { opacity: 1; color: var(--text); }

.report-overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(15, 23, 42, 0.85);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; backdrop-filter: blur(4px);
}
.report-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
  width: 100%; max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.report-card h2 { margin: 0 0 8px; font-size: 1.25rem; }
.report-desc { font-size: 0.9rem; line-height: 1.4; margin: 0 0 14px; }
.report-card textarea {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font-size: 1rem; font-family: var(--font);
  resize: vertical;
}
.report-card textarea:focus { outline: 2px solid var(--accent); }
.report-status { font-size: 0.88rem; min-height: 1.2em; margin-top: 10px; color: var(--muted); }
.report-status.ok { color: var(--accent-2); }
.report-status.err { color: var(--danger); }
.report-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

/* ── Overlay (prayer / idle) ─────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(15, 23, 42, 0.96);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px);
}
.overlay-card { text-align: center; animation: rise 0.3s ease; }
.overlay-icon { font-size: 4.5rem; margin-bottom: 12px; }
.overlay-text { font-size: 1.6rem; font-weight: 600; color: var(--text); }

@media (min-width: 720px) {
  .segment { font-size: 1.4rem; }
  .read-list { max-width: 760px; margin: 0 auto; width: 100%; }
}
