/* hangcikk - meleg, olvasásra hangolt felület. Világos és sötét séma. */

:root {
  --bg: #f7f4ef;
  --surface: #fffdfa;
  --surface-2: #f1ece4;
  --text: #1c1a17;
  --muted: #6d675e;
  --border: #e3ddd3;
  --accent: #b4531f;
  --accent-ink: #fff;
  --accent-soft: #fbeee4;
  --err: #a3311f;
  --err-soft: #fbe8e4;
  --warn-soft: #fdf4dd;
  --shadow: 0 1px 2px rgba(28, 26, 23, .05), 0 8px 24px -12px rgba(28, 26, 23, .18);
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14130f;
    --surface: #1d1b17;
    --surface-2: #24211c;
    --text: #ece8e0;
    --muted: #9b948a;
    --border: #322f29;
    --accent: #e8834a;
    --accent-ink: #1a1005;
    --accent-soft: #2b1e15;
    --err: #f08a72;
    --err-soft: #33201c;
    --warn-soft: #2e2717;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #14130f;
  --surface: #1d1b17;
  --surface-2: #24211c;
  --text: #ece8e0;
  --muted: #9b948a;
  --border: #322f29;
  --accent: #e8834a;
  --accent-ink: #1a1005;
  --accent-soft: #2b1e15;
  --err: #f08a72;
  --err-soft: #33201c;
  --warn-soft: #2e2717;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16.5px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-text-size-adjust: 100%;
  padding-bottom: 96px;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2 { line-height: 1.25; letter-spacing: -.015em; }
h1 { font-size: 1.9rem; margin: 0 0 .4em; }
h2 { font-size: 1.2rem; margin: 0; }

.wrap { max-width: 820px; margin: 0 auto; padding-inline: 20px; }

/* --- Fejléc --- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 820px; margin: 0 auto; padding: 18px 20px 8px;
}
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; letter-spacing: -.02em; white-space: nowrap; }
.brand-mark { margin-right: 4px; }
.top-nav { display: flex; align-items: center; gap: 18px; font-size: .95rem; }
.top-nav a { color: var(--muted); text-decoration: none; }
.top-nav a:hover { color: var(--accent); }
.theme-btn {
  background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; width: 30px; height: 30px; cursor: pointer; font-size: 15px; line-height: 1;
}
.theme-btn:hover { color: var(--accent); border-color: var(--accent); }

/* --- Üzenetek --- */
.flash {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius); padding: 12px 16px; margin: 12px 0;
}
.flash-err { background: var(--err-soft); border-color: transparent; color: var(--err); }
.flash-warn { background: var(--warn-soft); border-color: transparent; }

/* --- Bedobó mező --- */
.intake { padding: 28px 0 8px; }
.intake h1 { font-size: 2.1rem; }
.intake-form { display: flex; gap: 10px; flex-wrap: wrap; }
.intake-form input[type="url"] {
  flex: 1 1 320px; min-width: 0;
  padding: 14px 16px; font-size: 1.05rem; font-family: inherit;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.intake-form input[type="url"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.intake-alt { color: var(--muted); font-size: .95rem; margin: 10px 0 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px; font-size: 1rem; font-family: inherit; font-weight: 600;
  background: var(--surface); color: var(--text); text-decoration: none;
  border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.08); color: var(--accent-ink); }
.btn[disabled] { opacity: .55; cursor: default; filter: none; }

/* --- Könyvtár --- */
.empty { color: var(--muted); padding: 32px 0; }
.list { list-style: none; margin: 24px 0 0; padding: 0; }
.item {
  display: flex; gap: 14px; align-items: center;
  padding: 14px 16px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.item-plain { background: none; }
.play {
  flex: none; width: 42px; height: 42px; border-radius: 999px;
  display: grid; place-items: center; font-size: 15px;
  background: var(--accent); color: var(--accent-ink);
  border: none; cursor: pointer; padding-left: 3px;
}
.play:hover { filter: brightness(1.08); }
.play-off { background: var(--surface-2); color: var(--muted); cursor: default; padding: 0; }
.item-main { min-width: 0; flex: 1; }
.item-title { display: block; font-weight: 600; color: var(--text); text-decoration: none; }
.item-title:hover { color: var(--accent); }
.item-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px; color: var(--muted); font-size: .875rem; }
.item-meta > span::before { content: ""; }
.tag-error { color: var(--err); font-weight: 600; }
.tag-generating { color: var(--accent); font-weight: 600; }
.tag-cont { color: var(--accent); }
.tag-offline[hidden] { display: none; }

/* Sorba tevés a listában */
.qbtn {
  flex: none; width: 32px; height: 32px; border-radius: 999px;
  background: none; color: var(--muted); border: 1px solid var(--border);
  font: inherit; font-size: 15px; line-height: 1; cursor: pointer;
}
.qbtn:hover { border-color: var(--accent); color: var(--accent); }
.qbtn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* --- Cikk --- */
.page { padding: 20px 0 40px; }
.narrow { max-width: 460px; }
.crumb { margin: 0 0 16px; font-size: .95rem; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); }
.art-title { font-size: 2rem; }
.art-meta, .ready-meta {
  display: flex; flex-wrap: wrap; gap: 4px 14px;
  color: var(--muted); font-size: .9rem; margin: 0 0 24px;
}
.lead { color: var(--muted); max-width: 60ch; }

.ready {
  background: var(--accent-soft); border-radius: var(--radius);
  padding: 20px; margin-bottom: 28px;
}
.ready-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.ready-meta { margin: 12px 0 0; align-items: center; }
.btn-play { font-size: 1.05rem; }
.btn-queue.on, .btn-offline.on { border-color: var(--accent); color: var(--accent); }
.btn-offline[hidden] { display: none; }

/* --- Szövegkövetés --- */
.read { margin: 0 0 32px; }
.read[hidden] { display: none; }
.read-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 10px;
}
.follow { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .9rem; cursor: pointer; }
.follow input { accent-color: var(--accent); width: 16px; height: 16px; }
.read-body { font-size: 1.08rem; line-height: 1.85; max-width: 62ch; }
.read-body p { margin: 0 0 1.1em; }
.w { cursor: pointer; border-radius: 4px; padding: 1px 0; }
.read.live .w:hover { background: var(--surface-2); }
.w.on { background: var(--accent); color: var(--accent-ink); }
.read-hint { color: var(--muted); font-size: .875rem; margin: 4px 0 0; }
@media (prefers-reduced-motion: reduce) { .w { transition: none; } }

/* Kész cikknél a szerkesztő összecsukva ül, hogy az olvasás legyen elöl. */
.edit-fold { margin: 8px 0 0; }
.edit-fold > summary {
  cursor: pointer; color: var(--muted); font-size: .95rem;
  padding: 10px 0; list-style: none;
}
.edit-fold > summary::-webkit-details-marker { display: none; }
.edit-fold > summary::before { content: "▸ "; }
.edit-fold[open] > summary::before { content: "▾ "; }
.edit-fold > summary:hover { color: var(--accent); }
.note-boxed {
  background: var(--surface-2); border-radius: var(--radius);
  padding: 12px 16px; margin: 0 0 16px;
}

/* --- Szerkesztő --- */
.edit { margin: 0; }
.edit-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.lang-pick { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
.lang-opt {
  padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer; color: var(--text); background: var(--surface);
}
.lang-opt.on { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.lang-opt input { position: absolute; opacity: 0; pointer-events: none; }

.fld { display: block; margin-bottom: 16px; }
.fld > span { display: block; margin-bottom: 6px; font-size: .9rem; color: var(--muted); }
.fld > span em { font-style: normal; opacity: .8; }
.fld input, .fld textarea {
  width: 100%; padding: 12px 14px; font-size: 1rem; font-family: inherit;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.fld textarea { line-height: 1.7; resize: vertical; min-height: 220px; }
.fld input:focus-visible, .fld textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.est { color: var(--muted); font-size: .95rem; margin: 0 0 18px; }
.est strong { color: var(--text); font-weight: 600; }
.edit-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.gen-state { color: var(--muted); font-size: .95rem; }
.gen-state.err { color: var(--err); }

.danger { margin-top: 40px; }
.link-danger {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--muted); font: inherit; font-size: .9rem; text-decoration: underline;
}
.link-danger:hover { color: var(--err); }

/* --- Hangválasztó --- */
.voice-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; margin-bottom: 24px; }
.voice-col { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 14px 14px; margin: 0; min-width: 0; }
.voice-col legend { padding: 0 6px; font-size: .9rem; color: var(--muted); }
.voice {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  padding: 9px 12px; border-radius: 8px; cursor: pointer;
}
.voice:hover { background: var(--surface-2); }
.voice.on { background: var(--accent-soft); }
.voice input { position: absolute; opacity: 0; pointer-events: none; }
.voice-name { font-weight: 600; }
.voice.on .voice-name { color: var(--accent); }
.voice-desc { color: var(--muted); font-size: .875rem; }
.note { color: var(--muted); font-size: .9rem; }
.note code { background: var(--surface-2); padding: 2px 6px; border-radius: 5px; font-size: .95em; }

/* --- Lejátszó --- */
.player {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.player[hidden] { display: none; }
.player-in { display: flex; align-items: center; gap: 14px; max-width: 820px; margin: 0 auto; }
.pbtn {
  flex: none; height: 38px; min-width: 38px; padding: 0 10px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  font: inherit; font-size: .85rem; cursor: pointer;
}
.pbtn:hover { border-color: var(--accent); color: var(--accent); }
.pbtn-main {
  width: 46px; height: 46px; font-size: 16px; padding: 0;
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}
.pbtn-main:hover { color: var(--accent-ink); filter: brightness(1.08); }
.pbtn-rate { font-variant-numeric: tabular-nums; }
.p-mid { flex: 1; min-width: 0; }
.p-title { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-bar { display: flex; align-items: center; gap: 10px; }
.p-time { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; min-width: 42px; }
.p-time:last-child { text-align: right; }
.p-side { display: flex; align-items: center; gap: 6px; }
.pbtn-queue[hidden] { display: none; }
.qbadge {
  display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 5px;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 999px; font-size: .78rem; font-weight: 700;
}

/* --- Sor-panel --- */
.queue-panel {
  max-width: 820px; margin: 0 auto 10px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.queue-panel[hidden] { display: none; }
.queue-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; color: var(--muted); font-size: .875rem; padding: 4px 0 8px;
}
.queue-list { list-style: none; margin: 0; padding: 0; max-height: 34vh; overflow-y: auto; }
.queue-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 8px;
}
.queue-list li.on { background: var(--accent-soft); }
.q-play {
  flex: none; width: 28px; height: 28px; border-radius: 999px; padding: 0;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  font: inherit; font-size: 11px; cursor: pointer;
}
.q-play:hover { border-color: var(--accent); color: var(--accent); }
.q-title {
  flex: 1; min-width: 0; color: var(--text); text-decoration: none; font-size: .93rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.q-title:hover { color: var(--accent); }
.q-dur { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.q-del {
  flex: none; background: none; border: none; padding: 4px 6px; cursor: pointer;
  color: var(--muted); font: inherit; font-size: .85rem;
}
.q-del:hover { color: var(--err); }

/* A fogantyú nyeli az érintést: nélküle a mobil böngésző görgetni kezdene. */
.q-grip {
  flex: none; background: none; border: none; padding: 6px 2px; cursor: grab;
  color: var(--muted); font: inherit; font-size: .9rem; line-height: 1;
  touch-action: none; user-select: none;
}
.q-grip:hover { color: var(--text); }
.q-grip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.queue-list li.drag {
  position: relative; z-index: 2; cursor: grabbing;
  background: var(--surface-2); box-shadow: var(--shadow); border-radius: 8px;
}
.queue-list li.drag .q-grip { cursor: grabbing; }

#p-seek {
  flex: 1; min-width: 0; height: 20px; margin: 0;
  -webkit-appearance: none; appearance: none; background: none; cursor: pointer;
}
#p-seek::-webkit-slider-runnable-track { height: 4px; border-radius: 999px; background: var(--surface-2); }
#p-seek::-moz-range-track { height: 4px; border-radius: 999px; background: var(--surface-2); }
#p-seek::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; margin-top: -5px;
  width: 14px; height: 14px; border-radius: 999px; background: var(--accent); border: none;
}
#p-seek::-moz-range-thumb { width: 14px; height: 14px; border-radius: 999px; background: var(--accent); border: none; }
#p-seek:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* --- Kredit-kimutatás --- */
.stat-cards {
  display: grid; gap: 12px; margin: 24px 0 8px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.stat-card {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.stat-num { font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-lab { font-size: .9rem; }
.stat-sub { color: var(--muted); font-size: .85rem; }
.stat-warn .stat-num { color: var(--err); }

.tbl {
  width: 100%; border-collapse: collapse; margin: 8px 0 32px;
  font-size: .93rem; font-variant-numeric: tabular-nums;
}
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.tbl th { color: var(--muted); font-weight: 600; font-size: .85rem; white-space: nowrap; }
.tbl td.r, .tbl th.r { text-align: right; white-space: nowrap; }
.tbl tbody tr:hover { background: var(--surface); }
.tbl-title { max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl-title a { color: var(--text); text-decoration: none; }
.tbl-title a:hover { color: var(--accent); text-decoration: underline; }
.gone { color: var(--muted); }
.tag-gone {
  margin-left: 6px; font-size: .75rem; color: var(--muted);
  background: var(--surface-2); border-radius: 5px; padding: 1px 6px;
}
/* A sáv csak arányt mutat, számot nem: az a szomszéd oszlopban áll. */
.bar-h { width: 28%; }
.bar-c { padding-block: 12px; }
.bar { display: block; height: 6px; border-radius: 999px; background: var(--accent); opacity: .55; min-width: 2px; }

@media (max-width: 640px) {
  .stat-cards { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .stat-num { font-size: 1.3rem; }
  .tbl { font-size: .85rem; }
  .tbl th, .tbl td { padding: 7px 6px; }
  .tbl-title { max-width: 16ch; }
  .bar-h, .bar-c { display: none; }
  .top { padding-inline: 16px; gap: 10px; }
  .top-nav { gap: 12px; font-size: .875rem; }
  .wrap { padding-inline: 16px; }
  h1 { font-size: 1.6rem; }
  .intake h1 { font-size: 1.75rem; }
  .art-title { font-size: 1.6rem; }
  .player-in { flex-wrap: wrap; gap: 10px; }
  .p-mid { order: -1; flex-basis: 100%; }
  .p-side { margin-left: auto; }
  .item { padding: 12px; gap: 10px; }
  .read-body { font-size: 1.05rem; line-height: 1.8; }
  .queue-list { max-height: 40vh; }
  .ready-actions .btn { flex: 1 1 auto; }
}
