:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e2e5ea;
  --text: #15181e;
  --muted: #69707d;
  --accent: #ff4d2e;
  --accent-text: #ffffff;
  --accent-soft: #ffe9e4;
  --ok: #17915a;
  --warn: #b7791f;
  --err: #d0342c;
  --bar-bg: #e7e9ee;
  --shadow: 0 1px 2px rgba(16, 20, 28, .05), 0 4px 16px rgba(16, 20, 28, .04);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --surface: #171a20;
    --surface-2: #1f232b;
    --border: #2a2f39;
    --text: #eceef2;
    --muted: #8e95a3;
    --accent: #ff5a3c;
    --accent-soft: #3a1f1a;
    --ok: #3ccf8e;
    --warn: #e6b04a;
    --err: #ff6b62;
    --bar-bg: #262a33;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
[hidden] { display: none !important; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 12.5px; margin: 8px 0 0; }
.spacer { flex: 1; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.tabs { display: flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 10px; }
.tabs button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 500;
  padding: 6px 14px; border-radius: 8px; cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.top-actions { margin-left: auto; display: flex; gap: 8px; }

main { width: 100%; max-width: 980px; margin: 0 auto; padding: 20px; flex: 1; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 16px 20px 24px; }

/* ---------------------------------------------------------------- Bausteine */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px;
}
button, .primary, .ghost {
  font: inherit; cursor: pointer; border-radius: 8px; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.primary {
  background: var(--accent); color: var(--accent-text); border: 0; font-weight: 600; padding: 8px 16px;
}
.primary:hover { filter: brightness(1.06); }
.primary:disabled { opacity: .5; cursor: default; }
.ghost {
  background: transparent; color: var(--text); border: 1px solid var(--border); padding: 7px 12px;
}
.ghost:hover { background: var(--surface-2); }
.small { padding: 4px 10px; font-size: 12.5px; }
select, input, textarea {
  font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px;
}
select:focus, input:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.field select { color: var(--text); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }

.segmented { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 2px; }
.segmented button { border: 0; background: transparent; color: var(--muted); padding: 5px 14px; border-radius: 6px; font-weight: 500; }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.options { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 10px; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 22px 2px 10px; }
.toolbar.tight { margin: 0 0 10px; }
.count { color: var(--muted); font-weight: 400; margin-left: 4px; }

.input-card textarea {
  width: 100%; resize: vertical; min-height: 72px; border: 0; background: transparent; padding: 4px;
  font-size: 14.5px;
}
.input-card textarea:focus { outline: none; }
.input-card { transition: border-color .15s; }
.input-card:focus-within { border-color: var(--accent); }

/* ---------------------------------------------------------------- Warteschlange */
.queue { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.empty { color: var(--muted); text-align: center; padding: 28px 0; margin: 0; }
.job {
  display: grid; grid-template-columns: 14px 64px 1fr auto; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; box-shadow: var(--shadow);
}
.job.dragging { opacity: .4; }
.job.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.job.drop-after { box-shadow: 0 3px 0 var(--accent); }
.handle { color: var(--muted); cursor: grab; user-select: none; letter-spacing: -3px; font-size: 13px; }
.thumb {
  width: 64px; height: 44px; border-radius: 6px; overflow: hidden; background: var(--surface-2);
  display: grid; place-items: center; color: var(--muted); font-size: 11px; font-weight: 600;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.job.audio .thumb { width: 44px; height: 44px; margin-left: 10px; }
.body { min-width: 0; }
.title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 4px; background: var(--bar-bg); border-radius: 4px; margin: 7px 0 4px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .4s; }
.job.done .bar i { background: var(--ok); }
.job.paused .bar i { background: var(--warn); }
.job.error .bar i { background: var(--err); }
.job.resolving .bar i, .job.processing .bar i.indet {
  width: 30% !important; animation: indet 1.2s ease-in-out infinite;
}
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
.status { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.job.error .status { color: var(--err); white-space: normal; }
.job.done .status { color: var(--ok); }
.actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; max-width: 260px; }
.icon {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 30px; height: 30px; padding: 0; border: 1px solid transparent; background: transparent;
  color: var(--muted); border-radius: 7px;
}
.icon:hover { background: var(--surface-2); color: var(--text); }
.icon svg { width: 16px; height: 16px; }
.icon.danger:hover { color: var(--err); }
.pill {
  font-size: 11px; font-weight: 600; letter-spacing: .02em; padding: 1px 6px; border-radius: 4px;
  background: var(--surface-2); color: var(--muted); margin-right: 6px; text-transform: uppercase;
}
.pill.meta { background: var(--accent-soft); color: var(--accent); text-transform: none; }

/* ---------------------------------------------------------------- Dropzones */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 130px; border-style: dashed; border-width: 1.5px; cursor: pointer; text-align: center;
  transition: border-color .15s, background .15s;
}
.dropzone strong { font-size: 15px; }
.dropzone span { color: var(--muted); font-size: 13px; }
.dropzone.over, .cover.over { border-color: var(--accent); background: var(--accent-soft); }

.filelist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.filelist li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; background: var(--surface-2); border-radius: 8px; }
.filelist .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filelist .size { color: var(--muted); font-size: 12px; }
.filelist .bad { color: var(--err); font-size: 12px; }

/* ---------------------------------------------------------------- Metadaten-Editor */
#tab-meta .dropzone { min-height: 100px; margin-bottom: 14px; }
.editor { display: grid; grid-template-columns: 220px 1fr; gap: 20px; }
.cover {
  width: 220px; height: 220px; border-radius: 10px; overflow: hidden; background: var(--surface-2);
  border: 1.5px dashed var(--border); display: grid; place-items: center; cursor: pointer; position: relative;
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover img:not([src]), .cover img[src=""] { display: none; }
.cover img[src]:not([src=""]) + .cover-empty { display: none; }
.cover-empty { color: var(--muted); }
.cover-col .row { margin-top: 8px; }
.file-head { display: flex; flex-direction: column; margin-bottom: 10px; }
.file-head strong { word-break: break-all; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.grid label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.grid label.wide { grid-column: 1 / -1; }
.grid input, .grid textarea { color: var(--text); width: 100%; }
.saved { margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.candidates { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 6px; }
.candidates li {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 6px;
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
}
.candidates li:hover { border-color: var(--accent); }
.candidates img { width: 44px; height: 44px; border-radius: 4px; object-fit: cover; background: var(--surface-2); }
.candidates .c-title { font-weight: 600; }
.candidates .c-sub { font-size: 12px; color: var(--muted); }

.app-box { margin-top: 24px; }
.app-box p { color: var(--muted); }

/* ---------------------------------------------------------------- Werbung */
.ad-slot { display: flex; justify-content: center; margin: 12px auto 0; max-width: 100%; }
.ad-slot:empty { display: none; }
.ad-slot iframe { border: 0; max-width: 100%; }

/* ---------------------------------------------------------------- Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 10px; font-size: 13px;
  transition: all .2s; pointer-events: none; max-width: calc(100% - 32px); z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--err); color: #fff; }

/* ---------------------------------------------------------------- Mobil */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .tabs { order: 3; width: 100%; }
  .tabs button { flex: 1; padding: 7px 4px; }
  main { padding: 16px; }
  .job { grid-template-columns: 48px 1fr; grid-template-rows: auto auto; }
  .handle { display: none; }
  .thumb, .job.audio .thumb { width: 48px; height: 48px; margin: 0; }
  .actions { grid-column: 1 / -1; justify-content: flex-start; max-width: none; }
  .editor { grid-template-columns: 1fr; }
  .cover { width: 100%; height: auto; aspect-ratio: 1; max-width: 280px; }
  .grid { grid-template-columns: 1fr; }
  .options .primary { width: 100%; }
}
.thumb:has(img[hidden])::after { content: attr(data-ext); text-transform: uppercase; }

/* ---------------------------------------------------------------- Zusatzpaket */
.lo-box { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.lo-box > div { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 2px; }
.lo-box .muted { font-size: 13px; }
dialog { max-width: 460px; width: calc(100% - 32px); color: var(--text); padding: 20px; }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog p { line-height: 1.5; }
.row.end { justify-content: flex-end; margin-top: 14px; }

/* ---------------------------------------------------------------- Zeilen-Einstellungen */
.job.ready .actions, .job.resolving .actions { max-width: none; flex-wrap: nowrap; gap: 6px; }
.segmented.mini { padding: 2px; }
.segmented.mini button { padding: 3px 9px; font-size: 12.5px; }
.actions select { padding: 4px 6px; font-size: 12.5px; }
.actions select:disabled { opacity: .5; }
.icon-btn { width: 32px; height: 30px; padding: 0; }
.icon-btn svg { width: 16px; height: 16px; }
.job.ready .bar, .job.resolving .bar { visibility: hidden; height: 0; margin: 4px 0 2px; }
.job.resolving .bar { visibility: visible; height: 3px; }
.job.missing .status { color: var(--warn); }
.toolbar .primary { padding: 6px 14px; }
@media (max-width: 720px) {
  .job.ready .actions, .job.resolving .actions { flex-wrap: wrap; }
}
@media (max-width: 720px) {
  .job.ready .actions, .job.resolving .actions { flex-wrap: nowrap; gap: 4px; }
  .segmented.mini button { padding: 3px 6px; }
  .actions select { padding: 4px 3px; max-width: 92px; }
  .toolbar #start-all { width: 100%; }
}

/* ---------------------------------------------------------------- Rechtsseiten */
.legal { max-width: 760px; margin: 0 auto; padding: 24px 20px 40px; line-height: 1.6; }
.legal h1 { font-size: 24px; margin: 8px 0 18px; }
.legal h2 { font-size: 16px; margin: 26px 0 8px; }
.legal p, .legal li { color: var(--text); }
.legal ul { padding-left: 20px; }
.legal a { color: var(--accent); }
.legal .back { display: inline-block; margin-bottom: 8px; color: var(--muted); text-decoration: none; }
.todo { background: #ffe066; color: #000; padding: 0 4px; border-radius: 3px; }
footer nav { display: flex; gap: 14px; justify-content: center; margin-bottom: 6px; flex-wrap: wrap; }
footer nav a, footer nav button { color: var(--muted); text-decoration: none; background: none; border: 0; font: inherit; padding: 0; cursor: pointer; }
footer nav a:hover, footer nav button:hover { color: var(--text); }

/* ---------------------------------------------------------------- Cookie-Hinweis */
.consent {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 60; max-width: 560px; margin: 0 auto;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
}
.consent p { margin: 0; font-size: 13.5px; line-height: 1.5; }
.consent a { color: var(--accent); }
.consent .row.end { margin-top: 10px; }
.consent .ghost { min-width: 110px; }

/* ---------------------------------------------------------------- Layout mit Seitenleiste (Website) */
.layout { width: 100%; max-width: 1320px; margin: 0 auto; display: flex; flex: 1; gap: 8px; align-items: flex-start; }
.layout > main { flex: 1; min-width: 0; margin: 0 auto; }
.side { width: 300px; flex: none; padding: 20px 20px 20px 0; display: flex; flex-direction: column; gap: 14px;
        position: sticky; top: 60px; }
.side-card h2 { font-size: 15px; margin-bottom: 6px; }
.side-card p { margin: 0 0 10px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.side-card .hint { margin: 8px 0 0; font-size: 12px; }
.side-buttons { display: flex; flex-direction: column; gap: 6px; }
.side-buttons a { padding: 8px 12px; }
.price-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.price-chips a, .price-chips button { padding: 8px 4px; font-weight: 600; }
.price-chips .custom { grid-column: 1 / -1; font-weight: 500; }
@media (max-width: 1100px) {
  .layout { flex-direction: column; align-items: stretch; }
  .side { width: auto; max-width: 980px; margin: 0 auto; padding: 0 20px 20px; position: static;
          display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
}
@media (max-width: 720px) {
  .side { grid-template-columns: 1fr; padding: 0 16px 16px; }
}

/* ---------------------------------------------------------------- Werbefrei-Dialog (Programm) */
#adfree-dialog { max-width: 480px; }
#adfree-dialog h3 { font-size: 14px; margin: 18px 0 8px; }
#adfree-dialog .row input { flex: 1; min-width: 0; }
#adfree-dialog details { margin-top: 10px; font-size: 13px; }
#adfree-dialog summary { cursor: pointer; color: var(--muted); }
#adfree-btn.on { color: var(--ok); border-color: var(--ok); }
footer p { margin: 4px auto; max-width: 760px; }

/* ---------------------------------------------------------------- Kauf- und Danke-Seite */
.buy .buy-card { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.price-chips .on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.custom-amount { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.custom-amount input { width: 110px; text-align: right; }
.waiver { align-items: flex-start; font-size: 13px; line-height: 1.5; }
.waiver input { margin-top: 3px; flex: none; }
.buy .primary { padding: 11px 16px; font-size: 15px; }
.notice { background: var(--accent-soft); color: var(--text); padding: 8px 12px; border-radius: 8px; }
.key-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.key-box code { font-size: 20px; font-weight: 700; letter-spacing: .04em; background: var(--surface-2); padding: 8px 12px; border-radius: 8px; }

/* ---------------------------------------------------------------- SEO-Texte (nur Website) */
.brand-link { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.seo-intro { margin: 0 2px 16px; }
.seo-intro h1 { font-size: 26px; line-height: 1.25; margin: 4px 0 6px; letter-spacing: -.01em; }
.seo-intro p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.5; max-width: 760px; }
.seo-content { margin: 40px 2px 10px; line-height: 1.65; max-width: 780px; }
.seo-content h2 { font-size: 19px; margin: 30px 0 10px; }
.seo-content p, .seo-content li { color: var(--text); font-size: 15px; }
.seo-content ol, .seo-content ul { padding-left: 22px; }
.seo-content li { margin: 4px 0; }
.seo-content details { border-bottom: 1px solid var(--border); padding: 10px 0; }
.seo-content summary { cursor: pointer; font-weight: 600; font-size: 15px; }
.seo-content details p { margin: 8px 0 2px; color: var(--muted); }
.tool-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin: 0 auto 14px;
              max-width: 900px; font-size: 13px; }
.tool-links a { color: var(--muted); text-decoration: none; }
.tool-links a:hover, .tool-links a[aria-current] { color: var(--text); }
@media (max-width: 720px) { .seo-intro h1 { font-size: 21px; } }
