:root {
  --bg: #0b0b0c;
  --panel: #141417;
  --panel2: #1b1b20;
  --line: #2a2a31;
  --text: #ececf1;
  --muted: #9a9aa6;
  --a1: #7fe3ff;
  --a2: #8a86ff;
  --grad: linear-gradient(90deg, var(--a1), var(--a2));
  --ok: #6fdc9a;
  --warn: #ffcf6b;
  --err: #ff7b86;
  --r: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif; }
a { color: var(--a1); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0 0 .5em; font-weight: 650; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

header.top {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; background: rgba(11,11,12,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
header.top .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
header.top .brand img { width: 30px; height: 30px; border-radius: 8px; }
nav.tabs { display: flex; gap: 4px; margin-left: 8px; overflow-x: auto; }
nav.tabs button {
  background: none; border: 0; padding: 7px 12px; border-radius: 8px; color: var(--muted); cursor: pointer; white-space: nowrap;
}
nav.tabs button.on { background: var(--panel2); color: var(--text); }
.spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: var(--panel2); font-size: 13px; white-space: nowrap; cursor: pointer; border: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.err { background: var(--err); }

main { max-width: 1180px; margin: 0 auto; padding: 18px 16px 60px; }
section.view { display: none; } section.view.on { display: block; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } header.top .brand span { display: none; } }

.seg { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.seg button { border: 1px solid var(--line); background: var(--panel2); padding: 7px 12px; border-radius: 99px; cursor: pointer; color: var(--muted); }
.seg button.on { color: #0b0b0c; background: var(--grad); border-color: transparent; font-weight: 600; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.wide { grid-column: 1 / -1; }
.field > span { font-size: 12px; color: var(--muted); }
input, select, textarea {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0;
}
textarea { min-height: 84px; resize: vertical; }
textarea.tall { min-height: 200px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--a2) 60%, transparent); border-color: transparent; }

.btn { border: 1px solid var(--line); background: var(--panel2); padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #3a3a44; }
.btn.primary { background: var(--grad); color: #0b0b0c; border: 0; font-weight: 650; }
.btn.danger { color: var(--err); }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }

.jobs { display: flex; flex-direction: column; gap: 10px; }
.job { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.job .head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.job .title { font-weight: 600; }
.job .prompt { color: var(--muted); font-size: 13px; margin: 6px 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.job .err { color: var(--err); font-size: 13px; margin-top: 6px; white-space: pre-wrap; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--panel2); color: var(--muted); }
.badge.running { color: var(--a1); } .badge.done { color: var(--ok); } .badge.error { color: var(--err); } .badge.queued { color: var(--warn); }
.outs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.outs img { height: 140px; border-radius: 8px; cursor: zoom-in; display: block; }
.outs audio, .file audio { width: 100%; max-width: 420px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.file { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; }
.file img { width: 100%; aspect-ratio: 1; object-fit: cover; cursor: zoom-in; display: block; background: #000; }
.file .meta { padding: 8px 10px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.file .meta b { color: var(--text); font-weight: 600; font-size: 13px; word-break: break-all; }
.file .wave { height: 90px; display: grid; place-items: center; background: linear-gradient(135deg, #12141c, #1a1830); }
.file .wave img { width: 60%; height: auto; aspect-ratio: auto; object-fit: contain; background: none; cursor: default; }

.mac .inst { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.mac .inst:first-of-type { border-top: 0; }
.mac .inst .name { min-width: 120px; font-weight: 600; }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); display: none; place-items: center; z-index: 50; cursor: zoom-out; }
.lightbox.on { display: grid; }
.lightbox img { max-width: 96vw; max-height: 94vh; border-radius: 6px; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; z-index: 60; display: none; }
.toast.on { display: block; }

/* Login */
.login { max-width: 360px; margin: 12vh auto; padding: 0 16px; text-align: center; }
.login form { text-align: left; display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.login .btn { margin-top: 6px; padding: 10px; }
.login-icon { width: 72px; height: 72px; border-radius: 16px; }
.error { color: var(--err); }
.empty { color: var(--muted); padding: 20px; text-align: center; }

/* Icons */
.ico { width: 1.05em; height: 1.05em; vertical-align: -0.17em; margin-right: 6px; flex: none; }
.seg button { display: inline-flex; align-items: center; }
.job .title { display: inline-flex; align-items: center; }
.job .title .ico { color: var(--a1); }
.wfline .ico { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; color: var(--a1); }

/* Labels einzeilig, Felder bündig */
.field > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fields { align-items: end; }

/* Fortschrittsbalken */
.bar { height: 6px; border-radius: 99px; background: var(--panel2); overflow: hidden; margin-top: 8px; }
.bar span { display: block; height: 100%; background: var(--grad); border-radius: 99px; transition: width .6s ease; }
.hint { color: var(--warn); min-height: 0; }
.hint:empty { display: none; }
.macpath { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); cursor: copy; word-break: break-all; margin-top: 4px; }
.macpath:hover { color: var(--a1); }
.aout { display: flex; flex-direction: column; }
.lyr-actions { margin-top: -4px; }
.lyr-actions .btn { display: inline-flex; align-items: center; }

/* Eigener Player */
.player { display: flex; align-items: center; gap: 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; width: 100%; max-width: 560px; }
.player .pp { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--grad); color: #0b0b0c; display: grid; place-items: center; cursor: pointer; flex: none; }
.player .pp .ico { margin: 0; width: 16px; height: 16px; }
.player .wavebars { flex: 1; height: 38px; display: flex; align-items: center; gap: 1px; cursor: pointer; min-width: 0; }
.player .wavebars i { flex: 1; min-width: 1px; background: #3a3a46; border-radius: 2px; transition: background .15s; }
.player .wavebars i.on { background: var(--a1); }
.player.active .wavebars i.on:nth-child(n+40) { background: color-mix(in srgb, var(--a1) 50%, var(--a2)); }
.player.active .wavebars i.on:nth-child(n+80) { background: var(--a2); }
.player .ptime { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); white-space: nowrap; flex: none; }
.player .pdl { color: var(--muted); display: grid; place-items: center; flex: none; }
.player .pdl:hover { color: var(--a1); }
.player .pdl .ico { margin: 0; }
.file .player { max-width: none; padding: 6px 8px; gap: 6px; }
.file .player .wavebars { height: 30px; }

/* Wesentliche Felder groß, Rest unter "Settings" */
.field.main > span { font-size: 13px; color: var(--text); font-weight: 600; }
.field.main textarea { font-size: 15px; line-height: 1.5; }
textarea.mid { min-height: 120px; }
textarea.tall { min-height: 340px; font-size: 14px; }
details.adv { border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: color-mix(in srgb, var(--panel2) 50%, transparent); }
details.adv > summary { cursor: pointer; padding: 10px 0; font-weight: 600; list-style: none; display: flex; gap: 10px; align-items: baseline; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary::before { content: ''; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; flex: none; align-self: center; }
details.adv[open] > summary::before { transform: rotate(45deg); }
details.adv > .fields { padding-bottom: 12px; }

/* ================= Studio (Create-Tab) ================= */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left;
  padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; color: var(--muted);
  transition: border-color .15s, background .15s, color .15s;
}
.tile:hover { border-color: #3a3a46; color: var(--text); }
.tile-ico { grid-row: 1 / 3; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--panel2); }
.tile-ico .ico { margin: 0; width: 22px; height: 22px; }
.tile-name { font-size: 17px; font-weight: 700; color: inherit; }
.tile-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.on { color: var(--text); background: linear-gradient(var(--panel), var(--panel)) padding-box, var(--grad) border-box; border: 1px solid transparent; }
.tile.on .tile-ico { background: var(--grad); color: #0b0b0c; }
@media (max-width: 640px) { .tile-sub { display: none; } .tile { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 12px 8px; } .tile-ico { grid-row: auto; } }

.studio { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: clip; }
.studio-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.small-seg { margin: 0; align-items: center; gap: 6px; }
.small-seg button { padding: 4px 12px; font-size: 13px; }
.preset-sel { width: auto; min-width: 140px; padding: 5px 8px; font-size: 13px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--line); }

.studio-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.lead-col { padding: 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.side-col { padding: 18px; display: flex; flex-direction: column; gap: 12px; border-left: 1px solid var(--line); background: color-mix(in srgb, var(--panel2) 35%, transparent); min-width: 0; }
@media (max-width: 860px) { .studio-grid { grid-template-columns: 1fr; } .side-col { border-left: 0; border-top: 1px solid var(--line); } }
.lead-col .field > span { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.lead-col textarea { background: #101013; border-color: #26262d; font-size: 15px; line-height: 1.6; padding: 14px 16px; min-height: 260px; resize: vertical; }
.lead-col textarea.tall { min-height: 460px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; }
.side-col .field > span { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.side-col textarea.mid { min-height: 90px; }
.side-col .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.summary { display: flex; flex-wrap: wrap; gap: 6px; }
.summary span { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); color: var(--text); }
details.adv { border-radius: 10px; }

.genbar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(8px); }
.btn.big { flex: 1; padding: 13px 18px; font-size: 16px; border-radius: 12px; letter-spacing: .01em; }
.repeat { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }
.repeat input { width: 56px; padding: 6px 8px; }

/* leise Warteschlange */
.strip { margin-top: 18px; display: flex; flex-direction: column; gap: 6px; }
.strip-title { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 8px 2px 2px; }
.srow { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--panel) 70%, transparent); border: 1px solid var(--line); font-size: 13px; }
.srow .sico .ico { margin: 0; color: var(--a1); }
.srow .sname { font-weight: 600; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; }
.srow .sstep { color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow .sbar { width: 120px; height: 5px; border-radius: 99px; background: var(--panel2); overflow: hidden; flex: none; }
.srow .sbar span { display: block; height: 100%; background: var(--grad); }
.srow.queued .sstep { color: var(--warn); }
.latest { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.job.lite { padding: 10px 12px; background: color-mix(in srgb, var(--panel) 70%, transparent); }
.lite-head { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.lite-head .ico { color: var(--a1); }
.job.lite .outs img { height: 110px; }
.player .pp svg, .player .pp * { pointer-events: none; }
[hidden] { display: none !important; }
.job.lite .outs, .job.lite .aout { width: 100%; min-width: 0; }
.job.lite .player { max-width: none; }
.job.lite .macpath { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-break: normal; }
.fmt-seg { margin: 0; }

/* ================= Ebenen klar trennen ================= */
/* 1) Tabs oben präsenter */
header.top { padding: 10px 20px; gap: 18px; }
nav.tabs { gap: 6px; margin-left: 14px; }
nav.tabs button { position: relative; padding: 9px 16px; font-size: 15px; font-weight: 600; border-radius: 10px; }
nav.tabs button:hover { color: var(--text); background: color-mix(in srgb, var(--panel2) 60%, transparent); }
nav.tabs button.on { background: var(--panel2); color: var(--text); }
nav.tabs button.on::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: -11px; height: 3px; border-radius: 3px; background: var(--grad); }

/* 2) Haupt-Konfiguration als hervorgehobene Karte */
.studio {
  background: #16161b;
  border: 1px solid transparent;
  background: linear-gradient(#16161b, #16161b) padding-box,
              linear-gradient(135deg, color-mix(in srgb, var(--a1) 55%, transparent), #2a2a31 40%, #2a2a31 60%, color-mix(in srgb, var(--a2) 55%, transparent)) border-box;
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .02) inset;
  border-radius: 18px;
}
.studio-head { background: rgba(255, 255, 255, .015); }
.side-col { background: rgba(255, 255, 255, .02); }
.tiles { margin-bottom: 14px; }

/* 3) Warteschlange: eigenes Panel */
.strip { margin-top: 26px; gap: 18px; }
.queue-panel {
  border-radius: 16px; padding: 14px 16px 16px;
  border: 1px solid color-mix(in srgb, var(--a2) 28%, var(--line));
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--a1) 9%, transparent), transparent 60%),
    radial-gradient(120% 140% at 100% 100%, color-mix(in srgb, var(--a2) 10%, transparent), transparent 60%),
    #111116;
  display: flex; flex-direction: column; gap: 8px;
}
.queue-panel.busy { animation: qpGlow 3.2s ease-in-out infinite; }
@keyframes qpGlow {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--a2) 0%, transparent); }
  50% { box-shadow: 0 0 34px -6px color-mix(in srgb, var(--a2) 45%, transparent); }
}
.qp-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 2px; }
.qp-title { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; font-weight: 800; }
.qp-count { font-size: 12px; color: var(--muted); }
.qp-empty { color: var(--muted); font-size: 13px; padding: 6px 2px; }
.queue-panel .srow { background: rgba(255, 255, 255, .025); border-color: rgba(255, 255, 255, .06); }
.queue-panel .srow.running { background: rgba(255, 255, 255, .045); border-color: color-mix(in srgb, var(--a1) 35%, transparent); }

/* laufender Job: Icon mit drehendem Ring (statt EQ-Balken) */
.run-ico { position: relative; display: inline-grid; place-items: center; width: 26px; height: 26px; color: var(--a1); }
.run-ico > svg { width: 14px; height: 14px; }
.run-ico::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 25%, var(--a2) 60%, var(--a1));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
  animation: runSpin .9s linear infinite;
}
@keyframes runSpin { to { transform: rotate(360deg); } }
/* alt: EQ-Balken */
.eq { display: inline-flex; align-items: flex-end; gap: 2px; width: 18px; height: 16px; }
.eq i { flex: 1; border-radius: 1px; background: var(--grad); height: 30%; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(1) { animation-delay: -.9s; } .eq i:nth-child(2) { animation-delay: -.6s; }
.eq i:nth-child(3) { animation-delay: -.3s; } .eq i:nth-child(4) { animation-delay: -.75s; } .eq i:nth-child(5) { animation-delay: -.45s; }
@keyframes eq { 0%, 100% { height: 25%; } 50% { height: 100%; } }

/* schimmernder Fortschrittsbalken */
.srow .sbar { width: 160px; height: 6px; position: relative; }
.srow .sbar span { position: relative; overflow: hidden; transition: width .8s ease; }
.srow.running .sbar span::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: translateX(-100%); animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.srow.running .sstep { color: var(--text); }
@media (prefers-reduced-motion: reduce) { .run-ico, .eq i, .srow.running .sbar span::after, .queue-panel.busy { animation: none; } }

/* 4) Latest im Hintergrund */
.latest-wrap { opacity: .55; transition: opacity .2s; }
.latest-wrap:hover { opacity: 1; }
.latest-wrap .strip-title { font-size: 11px; }
.latest-wrap .job.lite { background: transparent; border-color: rgba(255, 255, 255, .05); }

/* ================= Mobil ================= */
nav.tabs button .ico { display: none; }
.job .outs .aout { flex: 1 1 100%; min-width: 0; }
.outs > * { max-width: 100%; }
.latest { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }

@media (max-width: 640px) {
  :root { --tabbar: 62px; }
  html, body { overflow-x: clip; }
  /* iOS zoomt bei Eingabefeldern unter 16px */
  input, select, textarea, .lead-col textarea, .lead-col textarea.tall, .field.main textarea { font-size: 16px; }

  header.top { padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); gap: 10px; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  header.top .brand span { display: inline; }

  /* Tab-Leiste unten */
  nav.tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0; gap: 0;
    display: grid; grid-template-columns: repeat(4, 1fr); overflow: visible;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: rgba(14, 14, 16, .92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  nav.tabs button {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 4px; font-size: 11px; font-weight: 600; border-radius: 10px; min-height: 50px; justify-content: center;
  }
  nav.tabs button .ico { display: block; margin: 0; width: 22px; height: 22px; }
  nav.tabs button.on { background: none; color: var(--text); }
  nav.tabs button.on .ico { color: var(--a1); }
  nav.tabs button.on::after { left: 30%; right: 30%; top: -7px; bottom: auto; height: 2px; }
  nav.tabs button:hover { background: none; }

  main { padding: 14px 12px calc(var(--tabbar) + 28px + env(safe-area-inset-bottom)); }

  /* Studio */
  .tiles { gap: 8px; margin-bottom: 12px; }
  .tile { border-radius: 12px; }
  .tile-ico { width: 38px; height: 38px; }
  .tile-name { font-size: 15px; }
  .studio { border-radius: 14px; overflow: visible; }
  .studio-head { padding: 10px 12px; gap: 6px; }
  .studio-head .spacer { display: none; }
  .small-seg { flex: 1 1 100%; }
  .preset-sel { flex: 1; min-width: 0; padding: 8px 10px; }
  .studio-head .btn.sm { padding: 8px 10px; }
  .lead-col, .side-col { padding: 14px 12px; }
  .lead-col textarea { min-height: 180px; padding: 12px; }
  .lead-col textarea.tall { min-height: 280px; }
  .side-col .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .btn.sm { padding: 7px 11px; }
  .lyr-actions { flex-wrap: wrap; }

  /* Generate-Leiste klebt über der Tab-Leiste */
  .genbar {
    bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); z-index: 20; padding: 10px 12px; gap: 8px;
    border-radius: 0 0 14px 14px; background: rgba(22, 22, 27, .94); -webkit-backdrop-filter: blur(8px);
  }
  .btn.big { padding: 13px 12px; font-size: 16px; }
  .repeat input { width: 48px; }
  #resetBtn { padding: 8px 6px; }

  /* Warteschlange */
  .strip { margin-top: 18px; }
  .queue-panel { padding: 12px; }
  .srow { flex-wrap: wrap; row-gap: 6px; }
  .srow .sstep { flex: 1 1 60%; }
  .srow .sbar { width: 100%; flex: 1 1 100%; }
  .latest-wrap { opacity: 1; }

  /* Verlauf, Dateien */
  .job { padding: 12px; }
  .job .head { gap: 6px 8px; }
  .player { padding: 8px 10px; gap: 8px; }
  .player .pp { width: 40px; height: 40px; }
  .actions .btn { flex: 1; text-align: center; }
  .outs img { height: 120px; }
  .files { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .file .player .ptime, .file .player .pdl { display: none; }
  .mac .inst .name { min-width: 0; flex: 1 1 100%; }

  .toast { bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); }
}

/* Pull-to-refresh (Homescreen-App) */
.ptr {
  position: fixed; left: 50%; top: env(safe-area-inset-top, 0px); z-index: 100;
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--panel2); border: 1px solid var(--line); color: var(--muted);
  box-shadow: 0 6px 20px rgba(0,0,0,.45); opacity: 0; pointer-events: none;
  transform: translate(-50%, -50px);
}
.ptr:not(.active) { transition: transform .2s ease, opacity .2s ease; }
.ptr.ready { color: var(--a1); border-color: var(--a1); }
.ptr.spin svg { animation: ptr-spin .7s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* Lyrics-Badge + Vorschau */
.lyr-badge {
  display: inline-flex; align-items: center; padding: 1px 7px; margin-left: 4px; border-radius: 99px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; line-height: 1.6;
  color: var(--a1); background: color-mix(in srgb, var(--a1) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--a1) 35%, transparent); cursor: pointer; vertical-align: 1px;
}
.lyr-badge:hover { background: color-mix(in srgb, var(--a1) 22%, transparent); }
.lyr-badge:focus-visible { outline: 2px solid var(--a1); outline-offset: 2px; }
.lyr-modal {
  position: fixed; inset: 0; z-index: 55; display: none; place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, .7); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.lyr-modal.on { display: grid; }
.lyr-panel {
  width: min(560px, 100%); max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 32px); min-height: 0; display: flex; flex-direction: column; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 18px 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
}
.lyr-head { display: flex; align-items: flex-start; gap: 12px; }
.lyr-meta { flex: 1; min-width: 0; }
.lyr-title { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.lyr-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.lyr-cap { flex: none; max-height: 30vh; overflow-y: auto; font-size: 12.5px; color: var(--muted); background: var(--panel2); border-radius: 10px; padding: 8px 10px; line-height: 1.5; }
.lyr-text { flex: 1 1 auto; min-height: 0; overscroll-behavior: contain; touch-action: pan-y; overflow-y: auto; white-space: pre-wrap; font-size: 15px; line-height: 1.6; padding: 4px 2px 12px; -webkit-overflow-scrolling: touch; }
.lyr-sec { display: inline-block; margin-top: 10px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--a2); }
.lyr-close-foot { display: none; }
@media (max-width: 640px) {
  /* Handy: Bottom-Sheet, Schliessen unten in Daumennaehe */
  .lyr-modal { place-items: end stretch; padding: max(16px, env(safe-area-inset-top)) 0 0; }
  .lyr-panel {
    width: 100%; border-radius: 18px 18px 0 0; border-bottom: 0;
    max-height: calc(100dvh - env(safe-area-inset-top) - 24px);
    padding: 16px 16px calc(12px + env(safe-area-inset-bottom));
  }
  .lyr-head .lyr-close { display: none; }
  .lyr-close-foot { display: block; flex: none; width: 100%; padding: 14px; font-size: 16px; font-weight: 600; border-radius: 12px; }
}

/* Lyrics-Badge: nie aus dem Container */
.lyr-badge { flex: none; }
.job .head .lyr-badge { margin-left: auto; }
.lite-head { min-width: 0; }
.lite-head b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lite-head .lyr-badge { margin-left: auto; }

/* Warteschlange: Zeile 1 Icon + Titel + Cancel, Zeile 2 Status + Lyrics, Zeile 3 Balken */
.srow {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto;
  grid-template-areas: "ico name name act" ". lyr step step" ". bar bar bar";
  column-gap: 10px; row-gap: 4px; align-items: center;
}
.srow .sico { grid-area: ico; align-self: center; display: inline-flex; align-items: center; line-height: 1; }
.srow .sname { grid-area: name; line-height: 1.3; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow [data-act="cancel"] { grid-area: act; justify-self: end; }
.srow .sstep { grid-area: step; min-width: 0; line-height: 1.3; }
.srow .lyr-badge { grid-area: lyr; justify-self: start; align-self: center; margin: 0; vertical-align: baseline; }
.srow .sbar { grid-area: bar; width: 100%; margin-top: 6px; }
@media (max-width: 640px) {
  .srow { flex-wrap: initial; }
  .srow .sstep, .srow .sbar { flex: initial; }
}

/* Formularfelder duerfen ihre Spalte nie sprengen (lange Optionen/Hinweise) */
.fields > * { min-width: 0; }
.field input, .field select, .field textarea { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
.field .hint, .field small { overflow-wrap: anywhere; }
