/* Kézirat — olvasói weboldal. Témák CSS-változókkal, lásd js/settings.js. */

:root {
  --reader-font: Georgia, "Times New Roman", serif;
  --fs: 18px;
  --lh: 1.8;
}

:root[data-theme="light"] {
  --bg: #fffff8;
  --text: #1a1a1a;
  --muted: #8a8a8e;
  --card: #ffffff;
  --border: #e8e8ed;
  --accent: #0066cc;
}

:root[data-theme="sepia"] {
  --bg: #f4ead5;
  --text: #3b2e1a;
  --muted: #8a7a62;
  --card: #efe5d0;
  --border: #d9ccb0;
  --accent: #8b6914;
}

:root[data-theme="dark"] {
  --bg: #1c1c1e;
  --text: #e5e5e7;
  --muted: #8a8a8e;
  --card: #2c2c2e;
  --border: #3a3a3c;
  --accent: #64b5f6;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
}

/* Fejléc (+ beállítás-panel) fent, lábjegyzet (app-letöltők) lent, mindkettő
   rögzített — csak a köztes tartalom (.view) scrollozódik, az is csak akkor,
   ha túlcsordul. A lábjegyzet ettől sosem "úszik el" felfelé. */
body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }

button {
  font-family: inherit;
  cursor: pointer;
}

/* ─── Header ─────────────────────────────────────────────────────────── */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-left)) 14px max(16px, env(safe-area-inset-right));
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.brand {
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
}

.brand-stats {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  min-height: 14px;
}

/* ─── Üzeneteim ikon a fejlécben + olvasatlan-jelvény ─────────────────── */

.inbox-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
}

.inbox-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ff3b30;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.inbox-badge[hidden] { display: none; }

/* ─── Üzeneteim lista ──────────────────────────────────────────────────── */

.thread-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.thread-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
  font-family: inherit;
}

.thread-row.unread {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.thread-icon { font-size: 20px; flex-shrink: 0; }

.thread-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.thread-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.thread-author { font-weight: 700; font-size: 15px; }
.thread-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.thread-context { font-size: 12px; color: var(--muted); }

.thread-preview {
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-row.unread .thread-preview { color: var(--text); font-weight: 600; }

.thread-unread {
  flex-shrink: 0;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}

.settings-toggle {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 15px;
  min-width: 44px;
  min-height: 44px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Az admin-fejlécben a user-badge mellett megjelenő adomány-ikon — ugyanaz a
   44px-es, négyzetes gomb-forma, mint az olvasói fejléc ✉️/Aa gombjai. A
   funkciót a `title` (hover-tooltip) közli, felirat nélkül. */
.header-support-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  flex-shrink: 0;
}

.header-support-link svg {
  width: 20px;
  height: 20px;
}

/* Általános, "üres" profil-fej, ha a szerzőnek még nincs fotója (az Apple-
   bejelentkezés nem ad képet, és a Google sem mindig). */
.user-badge-avatar-generic {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-badge-avatar-generic svg {
  width: 18px;
  height: 18px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 180px;
}

.user-badge-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.user-badge-avatar-fallback {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-badge-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.user-badge-signout-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
}

/* ─── Lábléc ikon-sáv (App Store, Android, Szerző, Adomány) ─────────────── */
/* Négy egyforma méretű, ikon-csak gomb egy sorban — a funkciót a `title`/
   `aria-label` (egérrel rávitt tooltip) közli, nem felirat, hogy kompakt
   maradjon a sáv. */
.icon-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px max(16px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-right));
  border-top: 1px solid var(--border);
  background: var(--card);
}

/* Telepített appként (Android TWA / iOS "Kezdőképernyőhöz hozzáadás") futva
   a letöltési ikonoknak nincs értelme — lásd index.html data-installed jelzőt.
   A Szerző/Adomány ikon viszont telepítve is releváns marad, ezért csak a
   `data-hide-if-installed` jelzős gombokat rejtjük, nem az egész sávot. */
:root[data-installed] .icon-bar [data-hide-if-installed] {
  display: none;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 10px;
  font-size: 18px;
  line-height: 1;
  color: var(--text);
  text-decoration: none;
}

.icon-btn:hover {
  border-color: var(--accent);
}

/* Az App Store-ikon a téma szövegszínét veszi fel (ugyanúgy, mint Apple saját,
   monokróm logója) — az Android-ikon viszont a márka saját zöldjét tartja meg,
   hogy felismerhető maradjon. */
.icon-bar-svg {
  width: 20px;
  height: 20px;
}

.icon-bar-android {
  color: #3ddc84;
}

/* Diszkrét elválasztó a letöltés-ikonok és a Szerző/Adomány ikonok között —
   két jól elkülönülő funkciócsoport. Telepítve a letöltés-ikonokkal együtt tűnik el. */
.icon-bar-sep {
  color: var(--muted);
  font-size: 18px;
  margin: 0 6px;
  user-select: none;
}

/* ─── Beállítás-panel ────────────────────────────────────────────────── */

.settings-panel {
  display: none;
  flex-direction: column;
  flex-shrink: 0;
  gap: 14px;
  padding: 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.settings-panel.open { display: flex; }

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.settings-label {
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
  min-width: 90px;
}

.push-status {
  font-size: 13px;
  color: var(--muted);
}

.push-status-denied { color: #ff3b30; }

.push-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
}

.push-off-btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
}

.settings-error {
  font-size: 13px;
  color: #ff3b30;
  margin-top: -4px;
}

.segmented {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.seg-btn, .step-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  min-height: 40px;
}

.seg-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-btn {
  width: 40px;
  font-size: 18px;
  font-weight: 700;
}

.step-value {
  min-width: 28px;
  text-align: center;
  font-weight: 600;
}

/* ─── Általános állapotok ────────────────────────────────────────────── */

.view {
  flex: 1;
  overflow-y: auto;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 20px max(16px, env(safe-area-inset-left)) 24px max(16px, env(safe-area-inset-right));
}

.state {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  font-size: 16px;
}

.state-error { color: #ff3b30; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.back-link {
  color: var(--accent);
  font-weight: 600;
  font-size: 15px;
  padding: 8px 0;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 8px;
  flex-shrink: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(16px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1100;
}

.toast.open {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Folytatás kártya ────────────────────────────────────────────────── */

.continue-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 20px;
  color: var(--text);
  text-decoration: none;
}

.continue-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.continue-title {
  font-family: Georgia, serif;
  font-size: 17px;
  font-weight: 700;
}

.continue-author {
  font-size: 13px;
  color: var(--muted);
}

/* ─── "Új" jelvény ─────────────────────────────────────────────────────── */

.new-badge {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.author-card .new-badge {
  position: absolute;
  top: 8px;
  left: 8px;
}

.read-time {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* ─── Előző/Következő a szöveg végén ───────────────────────────────────── */

.work-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.3;
}

.work-nav-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 48%;
  color: var(--text);
  text-decoration: none;
}

.work-nav-link.next {
  text-align: right;
  margin-left: auto;
}

.work-nav-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.work-nav-title {
  font-weight: 600;
}

.page-title {
  font-family: Georgia, serif;
  font-size: 26px;
  margin: 0;
}

/* ─── Bevezető (első látogatóknak) ───────────────────────────────────── */

/* Lenyitható <details>: összecsukva csak a cím-sor látszik, nyitva a szöveg is. */
.hero-banner {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 20px;
  margin-bottom: 20px;
}

.hero-title {
  font-family: Georgia, serif;
  font-size: 19px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hero-title::-webkit-details-marker { display: none; }

.hero-title::after {
  content: "▾";
  font-size: 14px;
  color: var(--muted);
  transition: transform 0.2s;
}

.hero-banner:not([open]) .hero-title::after {
  transform: rotate(-90deg);
}

.hero-text {
  font-size: 14px;
  color: var(--muted);
  margin: 8px 0 0;
  line-height: 1.5;
}

/* ─── Szerzőlista ────────────────────────────────────────────────────── */

.author-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.author-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  /* Az alsó térköz a jobb alsó sarokban ülő kedvenc-ikonnak hagy helyet, hogy
     a kétsoros bio-előnézet 2. sora ne lógjon bele. */
  padding: 16px 12px 30px;
}

/* ─── Szerző elnémítása ──────────────────────────────────────────────── */

.mute-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  border: none;
  background: var(--bg);
  color: var(--muted);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
  padding: 0;
  opacity: 0.75;
}

/* ─── Szerző kiemelése (kedvenc) ─────────────────────────────────────── */
/* Az elnémítás ikon párja a jobb ALSÓ sarokban. A kiemelt kártya a témához
   viszonyított, halvány accent-árnyalatot kap (color-mix a téma --card és
   --accent színéből), így világos, szépia és sötét témában is finoman, de
   láthatóan elüt a többi kártyától. */
.fav-btn {
  position: absolute;
  bottom: 6px;
  right: 6px;
  border: none;
  background: var(--bg);
  color: var(--muted);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 13px;
  line-height: 1;
  padding: 0;
  opacity: 0.75;
}

.author-card.favorite {
  background: color-mix(in srgb, var(--accent) 12%, var(--card));
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.author-card.favorite .fav-btn {
  color: var(--accent);
  opacity: 1;
}

.muted-section {
  margin-top: 24px;
  font-size: 14px;
  color: var(--muted);
}

.muted-section summary {
  cursor: pointer;
  font-weight: 600;
}

.muted-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.muted-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.unmute-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
}

.thumb {
  border-radius: 50%;
  object-fit: cover;
  background: var(--border);
}

.thumb-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
}

.author-name { font-weight: 700; font-size: 15px; }

.author-bio {
  font-size: 13px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.author-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}

.author-header .page-title { flex: 1; min-width: 0; }

/* ─── Cset-gomb (toolbar/author-header) ─────────────────────────────── */

.chat-btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

/* ─── Szerzői bemutatkozás (teljes, nyitható/csukható) ──────────────────── */

.author-bio-panel {
  margin-bottom: 18px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.author-bio-panel summary {
  cursor: pointer;
  font-weight: 600;
}

.author-bio-full {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
}

.author-bio-full p {
  margin: 0 0 10px;
}

.author-bio-full p:last-child {
  margin-bottom: 0;
}

/* ─── Szöveglista ────────────────────────────────────────────────────── */

.work-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 720px;
}

.work-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.work-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.work-title { font-weight: 700; font-size: 16px; }

.category-chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  color: var(--chip-color);
  background: color-mix(in srgb, var(--chip-color) 15%, transparent);
}

/* Közös, margin-left:auto konténer a doboz- és a feloldva-jelvénynek — így a
   kettő EGYÜTT marad a jobb szélen (egyetlen auto-margó), nem csúszik szét a
   kártya közepe felé, ha mindkettő jelen van. */
.work-card-badges {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.order-badge {
  font-size: 14px;
}

.unlocked-badge {
  font-size: 11px;
  font-weight: 700;
  color: #34c759;
  background: color-mix(in srgb, #34c759 15%, transparent);
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

/* ─── Zárolt szöveg ──────────────────────────────────────────────────── */

/* Balra igazított, normál (nem abszolút pozícionált) sor a kategória-címke
   alatt — ezért sosem csúszhat rá semmi a jobb szélen lévő jelvényekre. */
.locked-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.locked-preview-wrap {
  position: relative;
  margin-top: 8px;
  max-height: 60px;
  overflow: hidden;
}

.locked-preview {
  font-size: 14px;
  color: var(--muted);
  filter: blur(5px);
  user-select: none;
  pointer-events: none;
}

.locked-fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent, var(--card) 85%);
  pointer-events: none;
}

.lock-icon { width: 18px; height: 18px; flex-shrink: 0; }

.locked-note {
  color: var(--muted);
  font-size: 14px;
  margin-top: 12px;
}

.access-request-row {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.access-status {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.access-status-pending {
  color: var(--accent);
}

.access-status-revoked {
  color: #ff3b30;
}

.work-dates {
  margin: 10px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* ─── Könyvrendelés ──────────────────────────────────────────────────────── */

.order-panel {
  margin-top: 18px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

/// Ha a böngésző már rendelt ehhez a műhöz, EZ jelenik meg a form helyett —
/// egy állandó, bármikor megnyitható szál-doboz (lásd app.js orderPanelHtml).
.order-thread-box {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}

.order-thread-icon {
  font-size: 22px;
}

.order-thread-sub {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  margin-top: 2px;
}

.order-panel summary {
  cursor: pointer;
  font-weight: 600;
}

.order-form {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 320px;
}

.order-form input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.order-form .chat-btn {
  align-self: flex-start;
}

.order-status {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/* ─── Olvasó ──────────────────────────────────────────────────────────── */

.reader {
  max-width: 38em;
  margin: 0 auto;
  font-family: var(--reader-font);
  font-size: var(--fs);
  line-height: var(--lh);
}

.offline-note {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  margin: 0 0 16px;
  text-align: center;
}

.reader-title {
  font-size: calc(var(--fs) * 1.5);
  font-weight: 700;
  margin-bottom: calc(var(--fs) * 0.6);
}

.reader-paragraph {
  margin: 0 0 calc(var(--fs) * var(--lh)) 0;
}

.reader-paragraph.stanza {
  white-space: normal;
}

.reader-end {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  margin-top: 32px;
}

.like-row {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.like-btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 20px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.like-btn.liked {
  border-color: #ff2d55;
  color: #ff2d55;
  background: color-mix(in srgb, #ff2d55 10%, transparent);
}

.like-btn:disabled { cursor: default; }

/* ─── Életjel (dispatch) ─────────────────────────────────────────────── */
/* Telefonon a fotó a teljes elérhető szélességet kitölti; asztali nézetben
   (ahol a .view max-width: 960px) egy középre igazított, korlátozott méretű
   kártyaként jelenik meg, hogy ne nyúljon el aránytalanul nagyra. */

.dispatch-view {
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
}

.dispatch-author {
  font-family: Georgia, serif;
  font-size: 22px;
  margin: 0 0 4px;
}

.dispatch-meta {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 18px;
}

.dispatch-photo {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--border);
}

.dispatch-audio {
  display: block;
  width: 100%;
  margin-top: 16px;
}

.dispatch-note {
  color: var(--muted);
  font-size: 13px;
  margin-top: 18px;
}

/* ─── Reszponzivitás ─────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .page-title { font-size: 22px; }
  .settings-label { min-width: 70px; font-size: 13px; }
}

/* ─── Feldolgozás-overlay (hangátalakítás alatt) ─────────────────────────── */
/* Teljes képernyős, homályosított hátterű, kattintást is letiltó jelzés — amíg
   a hangüzenet feltöltődik/átalakul, a felület ténylegesen használhatatlan, ezért
   ez explicit jelzi (nem csak egy könnyen elnézhető apró státusz-szöveg). Közös
   a cset (olvasói ÉS admin) és a jövőbeli Életjel-feltöltés között. */
.processing-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
}

.processing-overlay.open {
  display: flex;
}

.processing-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 32px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.processing-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-top-color: var(--accent);
  animation: processing-spin 0.8s linear infinite;
}

@keyframes processing-spin {
  to { transform: rotate(360deg); }
}

/* ─── Cset ────────────────────────────────────────────────────────────── */

.chat-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) 0;
}

.chat-overlay.open { display: flex; }

.chat-panel {
  background: var(--bg);
  width: 100%;
  max-width: 480px;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 0;
}

@media (min-width: 640px) {
  .chat-panel {
    height: 80vh;
    max-height: 640px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  }
}

.chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 16px max(16px, env(safe-area-inset-left)) 12px max(16px, env(safe-area-inset-right));
  border-bottom: 1px solid var(--border);
}

.chat-author-name { font-weight: 700; font-size: 17px; }
.chat-context { font-size: 13px; color: var(--muted); margin-top: 2px; }

.chat-close {
  border: none;
  background: var(--card);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 15px;
  flex-shrink: 0;
}

.chat-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

.chat-name-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-empty {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin: auto;
  padding: 20px;
}

.chat-bubble-row { display: flex; }
.chat-bubble-row.mine { justify-content: flex-end; }

.chat-bubble {
  max-width: 78%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 14px;
}

.chat-bubble.mine {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.chat-bubble-name {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--muted);
}

.chat-bubble-text {
  font-size: 15px;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-right));
  border-top: 1px solid var(--border);
}

.chat-composer textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  max-height: 120px;
  min-height: 42px;
}

.chat-send {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 0 16px;
  min-height: 42px;
  font-weight: 600;
  font-size: 14px;
}

.chat-send:disabled { opacity: 0.6; }

.chat-mic {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  min-width: 42px;
  min-height: 42px;
  font-size: 18px;
}

.chat-record-status {
  margin: 0;
  padding: 0 max(12px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-right));
  font-size: 13px;
  color: var(--muted);
}

/* Kontextuális push-engedély kérés — az első elküldött üzenet után jelenik meg
   a cset-panelben, ott, ahol a usernek épp érdeke, hogy értesüljön a válaszról. */
.chat-push-prompt {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--card);
  font-size: 13px;
}

.chat-push-prompt[hidden] { display: none; }

.chat-push-prompt-text { flex: 1; min-width: 160px; }

.chat-push-dismiss {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  padding: 6px 8px;
}

/* ─── Egységes, kompakt hangüzenet-lejátszó ──────────────────────────────── */
/* Szándékosan NEM a natív `<audio controls>` — az böngészőnként (Chrome/Safari/
   Firefox) máshogy néz ki, és alig stílusozható. Ez a sima, saját gomb+sáv
   megjelenés MINDEN böngészőben pontosan ugyanúgy fest. Közös az olvasói cset
   és a szerzői admin szál-nézete között (lásd `media/audio-bubble.js`). */
.audio-player {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
}

.audio-player-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.audio-player-track {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--text) 15%, transparent);
  overflow: hidden;
}

.audio-player-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
}

.audio-player-time {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--muted);
  min-width: 30px;
  text-align: right;
}
