/* Layout: neutrale Archiv-Fläche, weiße Karten im 2er-Raster, Bearbeiten-Werkzeuge schweben darüber.
   Bewusst nur ein (helles) Theme: Kunden sollen die Präsentation überall gleich sehen. */
:root {
  --bg: #EEEEEC;
  --card: #FFFFFF;
  --ink: #141414;
  --muted: #8C8C88;
  --line: #D8D8D4;
  --focus: #2F5BFF;
  --danger: #D23F2A;
  --chrome: rgba(20, 20, 20, .9);
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: 16px;
  --radius: 6px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background-color .35s ease, color .35s ease;
}
body.is-editing { padding-bottom: 110px; }
img, video { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.wrap {
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.loading, .notice-page { padding: 80px var(--gutter); color: var(--muted); text-align: center; }
.notice-page h1 { color: var(--ink); font-weight: 400; font-size: 28px; margin: 0 0 8px; }

/* ---------- Kopfleiste ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-block: 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 500; text-decoration: none; letter-spacing: -.01em; }
.brand-mark { width: 14px; height: 14px; background: var(--ink); border-radius: 50% 50% 2px 50%; }
.top-actions { display: flex; align-items: center; gap: 14px; }
.tlink { color: var(--muted); text-decoration: none; font-size: 15px; background: none; border: 0; padding: 0; cursor: pointer; }
.tlink:hover { color: var(--ink); }
.pill {
  border: 0; border-radius: 999px; background: var(--ink); color: var(--card);
  padding: 7px 14px; font-size: 13px; cursor: pointer;
}

/* ---------- Kopfbereich der Präsentation ---------- */
.intro {
  display: grid; grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
  margin-inline: calc(-1 * max(var(--gutter), env(safe-area-inset-left, 0px))) calc(-1 * max(var(--gutter), env(safe-area-inset-right, 0px)));
}
.intro-title {
  padding: 14px max(var(--gutter), env(safe-area-inset-left, 0px)) 28px;
  border-right: 1px solid var(--line);
  min-width: 0;
}
.title { font-size: clamp(28px, 3.2vw, 40px); font-weight: 400; letter-spacing: -.02em; line-height: 1.1; margin: 0; text-wrap: balance; }
.rows.meta { min-width: 0; }
.rows.meta .row {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 12px;
  min-height: 72px; padding: 8px max(var(--gutter), env(safe-area-inset-right, 0px)) 10px 12px;
  border-bottom: 1px solid var(--line); position: relative;
}
.rows.meta .row:last-of-type { border-bottom: 0; }
.rows.meta .row-label { align-self: flex-start; font-size: 11px; letter-spacing: .02em; }
.rows.meta .row-value { font-size: clamp(20px, 2.2vw, 28px); letter-spacing: -.01em; text-align: right; line-height: 1.1; }

/* ---------- Abschnitte ---------- */
.sec { padding-block: 18px 28px; border-bottom: 1px solid var(--line); }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; margin-bottom: 14px; }
.sec-title { font-size: 22px; font-weight: 400; letter-spacing: -.01em; margin: 0; min-width: 40px; }
.sec-tools { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.grid { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 16px; }
.card {
  position: relative; background: var(--card); border-radius: var(--radius);
  padding: 22px; min-width: 0;
}
.card.wide { grid-column: 1 / -1; }

/* Medien */
.frame {
  position: relative; width: 100%; max-width: 100%; aspect-ratio: 16 / 10;
  display: grid; place-items: center; overflow: hidden; border-radius: 2px;
}
.frame { --pad: 0px; }
.frame.pad { --pad: 9%; }
.frame > .m { position: absolute; top: var(--pad); left: var(--pad); width: calc(100% - 2 * var(--pad)); height: calc(100% - 2 * var(--pad)); max-width: none; }
.frame > img.m, .frame > video.m { object-fit: contain; }
.frame > .fit-cover { object-fit: cover !important; }
.frame .lottie { overflow: hidden; }
.frame .lottie svg { display: block; width: 100% !important; height: 100% !important; }
.empty-hint { color: var(--muted); font-size: 13px; text-align: center; padding: 12px; mix-blend-mode: difference; filter: invert(1) grayscale(1); }
.caption { margin: 12px 0 0; font-size: 13px; color: var(--muted); }

/* Schrift */
.specimen {
  font-size: clamp(40px, 5.2vw, 68px); line-height: 1.12; letter-spacing: -.01em;
  padding: 18px 0 26px; overflow-wrap: anywhere; min-height: 1.2em;
}
.type-rows .row, .crows .row {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  border-top: 1px solid var(--line); padding: 6px 0; position: relative;
}
.row-label { font-size: 12px; color: var(--ink); min-width: 2ch; }
.row-value { font-size: 15px; text-align: right; min-width: 2ch; overflow-wrap: anywhere; }
.font-ctl {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 14px; padding: 10px; border: 1px dashed var(--line); border-radius: var(--radius);
  font-size: 12px; color: var(--muted);
}
.font-input { flex: 1 1 180px; min-width: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--card); font-size: 14px; color: var(--ink); }
.file-tag { font-family: var(--mono); font-size: 11px; color: var(--ink); }

/* Farbe */
.card.color { container-type: inline-size; }
.color-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.crows .row > :last-child { white-space: nowrap; }
.cval { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; min-width: 0; }
.cval-input {
  width: 14ch; min-width: 0; text-align: right; border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px;
  font: 11px var(--mono); background: var(--card); color: var(--ink);
}
.cval-input::placeholder { color: var(--muted); }
.crow-x {
  display: inline-grid; place-items: center; width: 16px; height: 16px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); font-size: 13px; line-height: 1; cursor: pointer;
  opacity: 0; transition: opacity .15s, background .15s, color .15s;
}
.crows .row:hover .crow-x, .crow-x:focus-visible { opacity: 1; }
.crow-x:hover { background: var(--ink); color: var(--card); }
@media (hover: none) { .crow-x { opacity: 1; } }
.crows .row-add { margin-top: 4px; font-size: 11px; }
/* Schmale Karten (3–4 Spalten): Farbfeld oben, Werte darunter in voller Breite */
@container (max-width: 400px) {
  .color-body { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  /* width ausdrücklich setzen: Mit aspect-ratio würde das Feld sonst nicht auf Spaltenbreite gedehnt. */
  .card.color .swatch { width: 100%; height: auto; aspect-ratio: 16 / 9; }
}
.swatch { position: relative; height: 96px; border-radius: 2px; }
.swatch.light { box-shadow: inset 0 0 0 1px var(--line); }
.swatch input[type=color] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.crows .row { font-family: var(--mono); font-size: 11px; border-top: 0; padding: 1px 0; }
.crows .row span { font-size: 11px; }
.crows .row:first-child { padding-top: 0; }
.cname { font-size: 13px; margin-bottom: 6px; font-family: var(--sans); }
.hex-input { width: 9ch; text-align: right; border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; font: 11px var(--mono); text-transform: uppercase; background: var(--card); color: var(--ink); }

/* Text */
.textcard .text-body { font-size: clamp(20px, 2.2vw, 28px); line-height: 1.3; letter-spacing: -.01em; max-width: 34em; white-space: pre-wrap; }
.text-body.rich > * { margin: 0 0 .55em; }
.text-body.rich > :last-child { margin-bottom: 0; }
.text-body.rich > * + :is(h1, h2, h3) { margin-top: .9em; }
.text-body.rich h1 { font-size: clamp(36px, 4.4vw, 56px); font-weight: 400; letter-spacing: -.025em; line-height: 1.05; text-wrap: balance; margin-bottom: .35em; }
.text-body.rich h2 { font-size: clamp(28px, 3.2vw, 40px); font-weight: 400; letter-spacing: -.02em; line-height: 1.1; text-wrap: balance; margin-bottom: .4em; }
.text-body.rich h3 { font-size: clamp(22px, 2.5vw, 30px); font-weight: 500; letter-spacing: -.015em; line-height: 1.15; margin-bottom: .4em; }
.text-body.rich :is(strong, b) { font-weight: 600; }
.text-body.rich :is(em, i) { font-style: italic; }

/* Werkzeugleiste des Text-Blocks (nur im Editor) */
.rt-bar {
  position: sticky; top: calc(58px + env(safe-area-inset-top, 0px)); z-index: 4;
  display: flex; flex-wrap: wrap; gap: 4px;
  margin: -6px 0 16px; padding: 6px 0; background: var(--card);
}
.rt-btn {
  height: 28px; min-width: 32px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--card); color: var(--ink); font-size: 12px; cursor: pointer;
}
.rt-btn:hover { border-color: var(--ink); }
.rt-btn.on { background: var(--ink); border-color: var(--ink); color: var(--card); }
.rt-btn.rt-b { font-weight: 600; }
.rt-btn.rt-i { font-style: italic; font-family: Georgia, serif; }
.rt-bar .rt-btn:nth-child(4) { margin-right: 8px; }

.foot { padding-block: 28px 40px; color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Bearbeiten ---------- */
.is-editing [contenteditable] { border-radius: 3px; cursor: text; }
.is-editing [contenteditable]:hover { box-shadow: 0 0 0 1px var(--line); }
.is-editing [contenteditable]:focus { outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: none; }
[data-ph]:empty::before { content: attr(data-ph); color: var(--muted); pointer-events: none; }
body:not(.is-editing) [data-ph]:empty::before { content: none; }

.tools {
  position: absolute; top: 8px; right: 8px; z-index: 5;
  display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: calc(100% - 16px);
  opacity: 0; transition: opacity .15s;
}
.card:hover > .tools, .card:focus-within > .tools, .card.dragover > .tools { opacity: 1; }
@media (hover: none) { .tools { opacity: 1; } }
.tbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 28px; min-width: 28px; padding: 0 8px; border: 0; border-radius: 6px;
  background: var(--chrome); color: #fff; font-size: 12px; cursor: pointer; white-space: nowrap;
  text-decoration: none;
}
.tbtn:hover { background: #000; }
.tbtn:disabled { opacity: .35; cursor: default; }
.tbtn.danger { background: var(--danger); }
.tbtn.light { background: #fff; color: #141414; box-shadow: inset 0 0 0 1px var(--line); }
.card-handle, .sec-handle { cursor: grab; touch-action: none; }
.tcolor { width: 28px; height: 28px; padding: 0; border: 2px solid var(--chrome); border-radius: 6px; cursor: pointer; background: var(--chrome); }
.tselect { height: 28px; border: 0; border-radius: 6px; background: var(--chrome); color: #fff; font-size: 12px; padding: 0 6px; cursor: pointer; }

.row .row-del {
  position: absolute; left: -26px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; min-width: 0; padding: 0; border-radius: 50%; font-size: 13px;
  opacity: 0;
}
.rows.meta .row .row-del { left: auto; right: 4px; top: 6px; transform: none; }
.row:hover .row-del, .row:focus-within .row-del { opacity: 1; }
@media (hover: none) { .row .row-del { opacity: 1; } }
.row-add { margin-top: 6px; border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 4px 0; }
.rows.meta .row-add { margin: 6px 12px 10px; }
.row-add:hover { color: var(--ink); }

.add-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 180px; border: 1.5px dashed var(--line); border-radius: var(--radius);
  color: var(--muted); font-size: 13px; text-align: center; padding: 20px;
}
.add-tile .btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }

.btn-ghost {
  border: 1px solid var(--line); background: var(--card); border-radius: 6px; padding: 6px 10px;
  font-size: 13px; cursor: pointer; color: var(--ink);
}
.btn-ghost:hover { border-color: var(--ink); }
.btn-primary { border: 0; background: var(--ink); color: #fff; border-radius: 6px; padding: 9px 14px; font-size: 14px; cursor: pointer; }
.btn-primary:disabled { opacity: .5; cursor: default; }

/* Einfügestelle zwischen Abschnitten: unsichtbar, bis man über die Trennlinie fährt */
.ins { position: relative; height: 0; z-index: 7; }
.ins::before { content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 24px; }
.ins::after {
  content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 1px;
  background: var(--ink); opacity: 0; transition: opacity .2s ease;
}
.ins:hover::after, .ins.open::after { opacity: .18; }
.ins-btn {
  position: absolute; left: 50%; top: 0; transform: translate(-50%, -50%) scale(.85);
  width: 24px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: 50%;
  background: var(--bg); color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer;
  opacity: 0; transition: opacity .2s ease, transform .2s ease, color .15s, border-color .15s;
}
.ins:hover .ins-btn, .ins.open .ins-btn, .ins-btn:focus-visible { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.ins-btn:hover, .ins.open .ins-btn { color: var(--ink); border-color: var(--ink); }
.ins.open .ins-btn { transform: translate(-50%, -50%) rotate(45deg); }
.ins-menu {
  display: none; position: absolute; left: 50%; top: 18px; transform: translateX(-50%);
  gap: 6px; padding: 6px; background: var(--card); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(20, 20, 20, .12); white-space: nowrap;
}
.ins.open .ins-menu { display: flex; }
@media (hover: none) { .ins-btn { opacity: .55; transform: translate(-50%, -50%) scale(1); } }
@media (max-width: 760px) { .ins-menu { flex-direction: column; } }

.add-sec { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-block: 24px; }
.mini-label { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }

.dragover { outline: 2px dashed var(--focus); outline-offset: -6px; }
.busy::after {
  content: "Lädt hoch …"; position: absolute; inset: 0; z-index: 6; display: grid; place-items: center;
  background: color-mix(in srgb, var(--card) 80%, transparent); border-radius: var(--radius); font-size: 13px; color: var(--ink);
}
.sortable-ghost { opacity: .35; }
.sortable-fallback { opacity: .9 !important; box-shadow: 0 12px 30px rgba(0,0,0,.18); }

.dock {
  position: fixed; z-index: 40;
  left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 4px; padding: 5px;
  background: var(--chrome); color: #fff; border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0,0,0,.2); max-width: calc(100vw - 32px); overflow-x: auto;
}
.dock .save-state { font-size: 12px; color: #bdbdb8; padding: 0 10px 0 12px; white-space: nowrap; min-width: 92px; }
.dock-btn { border: 0; background: transparent; color: #fff; padding: 8px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.dock-btn:hover { background: rgba(255,255,255,.12); }
.dock-btn.primary { background: #fff; color: #141414; }
.dock-color { position: relative; display: inline-flex; align-items: center; gap: 7px; }
.dock-color input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.dock-color:focus-within { outline: 2px solid #fff; outline-offset: -2px; }
.dock-dot { width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(255,255,255,.4); flex: none; }
.dock-reset { padding: 8px 9px; color: #bdbdb8; }

.toast {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
  top: calc(64px + env(safe-area-inset-top, 0px));
  background: #141414; color: #fff; padding: 9px 14px; border-radius: 8px; font-size: 13px;
  max-width: calc(100vw - 32px); overflow-wrap: anywhere; box-shadow: 0 8px 24px rgba(0,0,0,.18);
}

/* ---------- Übersicht / Backend ---------- */
.dash { max-width: 1100px; margin: 0 auto; padding-block: 28px 60px; }
.dash h1 { font-size: 34px; font-weight: 400; letter-spacing: -.02em; margin: 0 0 4px; }
.dash .sub { color: var(--muted); margin: 0 0 24px; }
.banner { background: #FFF6C9; border-radius: var(--radius); padding: 12px 14px; font-size: 13px; margin-bottom: 20px; }
.new-form { display: flex; gap: 8px; flex-wrap: wrap; background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 24px; }
.new-form input, .new-form select, .login input {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 14px; min-width: 0;
}
.new-form input { flex: 1 1 260px; }
.plist { display: grid; gap: 8px; }
.pitem {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr) auto auto; gap: 16px; align-items: center;
  background: var(--card); border-radius: var(--radius); padding: 14px 16px;
}
.pitem .ptitle { font-size: 18px; text-decoration: none; letter-spacing: -.01em; overflow-wrap: anywhere; }
.pitem .ptitle:hover { text-decoration: underline; }
.pitem .pdate { font-size: 12px; color: var(--muted); }
.slug-field { display: flex; align-items: center; gap: 2px; font: 12px var(--mono); color: var(--muted); min-width: 0; }
.slug-field input { font: 12px var(--mono); border: 1px solid transparent; border-radius: 4px; padding: 3px 4px; background: transparent; min-width: 0; width: 100%; color: var(--ink); }
.slug-field input:hover, .slug-field input:focus { border-color: var(--line); background: #fff; }
.pub { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.pactions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pactions .tbtn { height: 30px; }
.empty-list { background: var(--card); border-radius: var(--radius); padding: 40px 20px; text-align: center; color: var(--muted); }

.login { max-width: 360px; margin: 80px auto; display: grid; gap: 10px; background: var(--card); padding: 24px; border-radius: var(--radius); }
.login h1 { font-size: 24px; font-weight: 400; margin: 0 0 6px; }
.login .err { color: var(--danger); font-size: 13px; min-height: 1em; }

/* ---------- Schmal ---------- */
@media (max-width: 760px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .card.wide { grid-column: auto; }
  .card { padding: 14px; }
  .intro { grid-template-columns: minmax(0, 1fr); }
  .intro-title { border-right: 0; border-bottom: 1px solid var(--line); }
  .rows.meta .row { min-height: 56px; padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); }
  .pitem { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .pactions { justify-content: flex-start; }
  .color-body { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .row .row-del { left: auto; right: -6px; }
}

/* ---------- Abschnitt „Inhalt“ ---------- */
.sec { scroll-margin-top: calc(66px + env(safe-area-inset-top, 0px)); }
.toccard { padding-block: 8px; }
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-list.two { columns: 2; column-gap: 40px; }
.toc-list li { break-inside: avoid; border-bottom: 1px solid var(--line); }
.toc-list li:last-child { border-bottom: 0; }
.toc-list.two li:last-child { border-bottom: 1px solid var(--line); }
.toc-link {
  position: relative; display: grid; grid-template-columns: 3.2em minmax(0, 1fr) auto; align-items: baseline; gap: 12px;
  padding: 14px 0; text-decoration: none; color: var(--ink);
}
.toc-num { font: 12px var(--mono); color: var(--muted); letter-spacing: .04em; transition: color .25s ease; }
.toc-name {
  font-size: clamp(20px, 2.2vw, 28px); letter-spacing: -.01em; line-height: 1.15;
  overflow-wrap: anywhere; transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}
.toc-arrow {
  align-self: center; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line); font-size: 13px; color: var(--muted);
  opacity: 0; transform: translateY(-6px);
  transition: opacity .25s ease, transform .35s cubic-bezier(.2, .8, .2, 1), background .25s ease, color .25s ease, border-color .25s ease;
}
.toc-link::after {
  content: ""; position: absolute; left: 0; bottom: -1px; height: 1px; width: 100%;
  background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform .45s cubic-bezier(.2, .8, .2, 1);
}
.toc-link:hover .toc-name, .toc-link:focus-visible .toc-name { transform: translateX(6px); }
.toc-link:hover .toc-num, .toc-link:focus-visible .toc-num { color: var(--ink); }
.toc-link:hover .toc-arrow, .toc-link:focus-visible .toc-arrow { opacity: 1; transform: none; background: var(--ink); border-color: var(--ink); color: var(--card); }
.toc-link:hover::after, .toc-link:focus-visible::after { transform: scaleX(1); }
.toc-link:focus-visible { outline: none; }
.toc-empty { padding: 16px 0; color: var(--muted); font-size: 14px; }
@media (hover: none) { .toc-arrow { opacity: 1; transform: none; } }
@media (max-width: 900px) { .toc-list.two { columns: 1; } .toc-list.two li:last-child { border-bottom: 0; } }

/* ---------- Link-/Download-Button an Blöcken ---------- */
/* Unsichtbar, bis man über den Block fährt (oder per Tastatur hineinspringt). */
.link-btn {
  position: absolute; right: 14px; bottom: 14px; z-index: 4;
  display: inline-flex; align-items: center; gap: 8px; max-width: calc(100% - 28px);
  height: 36px; padding: 0 15px 0 6px; border-radius: 999px;
  background: var(--ink); color: var(--card); font-size: 13px; line-height: 1; text-decoration: none; white-space: nowrap;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .16);
  opacity: 0; transform: translateY(8px) scale(.96); pointer-events: none;
  transition: opacity .25s ease, transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .25s ease;
}
.link-btn > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.link-btn.at-top { top: 14px; bottom: auto; transform: translateY(-8px) scale(.96); }
.card:hover .link-btn, .card:focus-within .link-btn, .link-btn:focus-visible { opacity: 1; transform: none; pointer-events: auto; }
.link-btn:hover { box-shadow: 0 10px 28px rgba(0, 0, 0, .26); }
.link-ic {
  display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: color-mix(in srgb, var(--card) 18%, transparent); font-size: 12px;
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}
.link-btn:hover .link-ic { transform: translate(1px, -1px); }
.link-btn[download]:hover .link-ic { transform: translateY(2px); }
.link-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (hover: none) { .link-btn, .link-btn.at-top { opacity: 1; transform: none; pointer-events: auto; } }
.is-editing .link-btn.at-top { top: 44px; }
.tbtn.tbtn-on { background: var(--focus); }

/* Einstellungen des Buttons im Editor */
.link-panel {
  position: absolute; top: 44px; right: 8px; z-index: 9;
  width: min(340px, calc(100% - 16px)); display: grid; gap: 12px; padding: 14px;
  background: var(--card); color: var(--ink); border-radius: 10px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .18), 0 0 0 1px var(--line);
  font-size: 13px;
}
.sec .textcard .link-panel { top: 8px; }
.segs { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px; border-radius: 8px; background: var(--bg); }
.seg { border: 0; background: transparent; border-radius: 6px; padding: 7px 8px; font-size: 12px; color: var(--muted); cursor: pointer; }
.seg.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.lp-row { display: grid; gap: 5px; }
.lp-label { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.lp-in { width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); font-size: 14px; }
.lp-in:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
.lp-file { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 12px var(--mono); }
.lp-name.muted { color: var(--muted); font-family: var(--sans); }
.lp-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.lp-actions .btn-primary { padding: 7px 14px; font-size: 13px; background: var(--ink); color: var(--card); }
.lp-remove { margin-right: auto; border: 0; background: none; padding: 0; color: var(--danger); font-size: 12px; cursor: pointer; }
.lp-remove:hover { text-decoration: underline; }

/* ---------- Vollbildansicht ---------- */
.card.zoomable { cursor: zoom-in; }
.card.zoomable:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
html.lb-open, html.lb-open body { overflow: hidden; }

.lb { position: fixed; inset: 0; z-index: 100; color: #fff; -webkit-user-select: none; user-select: none; }
.lb-backdrop {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 50% 45%, rgba(40, 40, 40, .55), rgba(10, 10, 10, 0) 70%),
    rgba(12, 12, 12, .9);
  -webkit-backdrop-filter: blur(22px) saturate(1.15); backdrop-filter: blur(22px) saturate(1.15);
}
.lb-stage { position: absolute; inset: 0; cursor: zoom-out; }
.frame.lb-frame {
  position: absolute; aspect-ratio: auto; max-width: none; border-radius: 4px;
  transform-origin: 0 0; cursor: default; will-change: transform, opacity;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .06);
}

.lb-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(18px + env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) 0 max(24px, env(safe-area-inset-left, 0px));
  pointer-events: none;
}
.lb-top > * { pointer-events: auto; }
.lb-meta { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.lb-count { font: 12px/1 var(--mono); letter-spacing: .06em; color: rgba(255, 255, 255, .9); font-variant-numeric: tabular-nums; }
.lb-sec { font-size: 13px; color: rgba(255, 255, 255, .5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.lb-btn {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 1px solid rgba(255, 255, 255, .14); border-radius: 50%;
  background: rgba(255, 255, 255, .06); color: #fff; cursor: pointer;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: background .2s ease, border-color .2s ease, transform .25s cubic-bezier(.2, .8, .2, 1);
}
.lb-btn svg { width: 20px; height: 20px; }
.lb-btn:hover { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .3); }
.lb-btn:active { transform: scale(.94); }
.lb-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.lb-nav { position: absolute; top: 50%; margin-top: -22px; }
.lb-prev { left: max(24px, env(safe-area-inset-left, 0px)); }
.lb-next { right: max(24px, env(safe-area-inset-right, 0px)); }
.lb-prev:hover { transform: translateX(-3px); }
.lb-next:hover { transform: translateX(3px); }
.lb-close:hover { transform: rotate(90deg); }

.lb-bottom {
  position: absolute; left: 0; right: 0; bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  display: flex; justify-content: center; padding: 0 24px; pointer-events: none;
}
.lb-caption { margin: 0; max-width: 60ch; text-align: center; font-size: 13px; color: rgba(255, 255, 255, .7); }
.lb-hint {
  position: absolute; left: 50%; bottom: calc(56px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  padding: 7px 12px; border-radius: 999px; background: rgba(255, 255, 255, .08);
  font: 11px/1 var(--mono); letter-spacing: .04em; color: rgba(255, 255, 255, .65); white-space: pre; pointer-events: none;
  animation: lb-hint 3.2s ease .6s both;
}
@keyframes lb-hint { 0% { opacity: 0; transform: translate(-50%, 6px); } 12%, 75% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

@media (max-width: 760px) {
  .lb-nav { top: auto; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); margin-top: 0; }
  .lb-prev { left: 16px; } .lb-next { right: 16px; }
  .lb-bottom { bottom: calc(26px + env(safe-area-inset-bottom, 0px)); padding: 0 76px; }
  .lb-hint { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- Bewegung (nur Kundenansicht) ---------- */
/* Blöcke gleiten beim Scrollen sanft herein; app.js setzt .reveal und beim Sichtbarwerden .in. */
.reveal {
  opacity: 0; translate: 0 18px;
  transition: opacity .7s cubic-bezier(.2, .7, .2, 1) var(--d, 0ms), translate .7s cubic-bezier(.2, .7, .2, 1) var(--d, 0ms),
              transform .25s ease, box-shadow .25s ease;
}
.reveal.in { opacity: 1; translate: 0 0; }

@media (hover: hover) {
  body:not(.is-editing) .card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(20, 20, 20, .08); }
  body:not(.is-editing) .frame > .m { transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
  body:not(.is-editing) .card.media:hover .frame > .m { transform: scale(1.03); }
  body:not(.is-editing) .swatch { transition: transform .25s ease; }
  body:not(.is-editing) .card.color:hover .swatch { transform: scale(1.02); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; translate: none; }
  body:not(.is-editing) .card:hover, body:not(.is-editing) .card:hover .frame > .m, body:not(.is-editing) .card:hover .swatch { transform: none; }
}

/* ---------- Admins & Anmeldung ---------- */
.linkish { justify-self: center; border: 0; background: none; padding: 4px; color: var(--muted); font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkish:hover { color: var(--ink); }
.linkish:disabled { opacity: .5; cursor: default; }
.login-note { margin: -2px 0 6px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.dash-note { max-width: 60ch; margin: -12px 0 24px; color: var(--muted); font-size: 14px; }
.pitem.admin-item { grid-template-columns: minmax(0, 1fr) auto; }
.admin-item .ptitle { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; background: var(--ink); color: var(--card); font-size: 11px; letter-spacing: .02em; }
.badge.muted { background: var(--bg); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
@media (max-width: 760px) { .pitem.admin-item { grid-template-columns: minmax(0, 1fr); } }
.badge.off { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.admin-item.is-off .ptitle { color: var(--muted); }
.admin-item .pactions { align-items: center; }
.proj-all { font-size: 12px; color: var(--muted); padding: 0 6px; }

/* Ein/Aus-Schalter */
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12px; color: var(--muted); margin-right: 4px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 36px; height: 20px; border-radius: 999px; background: var(--line); transition: background .2s ease; }
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}
.switch input:checked + .switch-track { background: #1F9D55; }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: .5; }
.switch-label { min-width: 2ch; }

/* Projekte zuweisen */
.proj-panel {
  grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px 16px;
  padding-top: 12px; border-top: 1px solid var(--line);
}
.proj-item { display: flex; align-items: baseline; gap: 10px; padding: 7px 4px; border-radius: 6px; cursor: pointer; min-width: 0; }
.proj-item:hover { background: var(--bg); }
.proj-item input { flex: none; transform: translateY(1px); accent-color: var(--ink); }
.proj-title { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-slug { margin-left: auto; font: 11px var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.proj-empty { color: var(--muted); font-size: 13px; padding: 6px 4px; }

/* ---------- YouTube ---------- */
.frame.yt-frame { aspect-ratio: 16 / 9; background: #0E0E0E; border-radius: 2px; }
.yt-thumb { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; transition: transform .6s cubic-bezier(.2, .8, .2, 1), filter .4s ease; }
.yt-shade { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(0, 0, 0, .05) 0%, rgba(0, 0, 0, .35) 100%); transition: opacity .3s ease; pointer-events: none; }
.ytcard.has-video:not(.playing) .yt-frame { cursor: pointer; }
.yt-play {
  position: relative; z-index: 2; display: grid; place-items: center;
  width: clamp(56px, 9%, 84px); aspect-ratio: 1; padding: 0; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .35); background: rgba(16, 16, 16, .45); color: #fff; cursor: pointer;
  -webkit-backdrop-filter: blur(10px) saturate(1.3); backdrop-filter: blur(10px) saturate(1.3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), background .25s ease, border-color .25s ease;
}
.yt-play svg { width: 42%; height: 42%; margin-left: 6%; }
.yt-play::before {
  content: ""; position: absolute; inset: -1px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .5);
  opacity: 0; transform: scale(1); pointer-events: none;
}
.ytcard:hover .yt-play, .yt-play:focus-visible { transform: scale(1.08); background: rgba(16, 16, 16, .7); border-color: rgba(255, 255, 255, .6); }
.ytcard:hover .yt-play::before { animation: yt-pulse 1.4s cubic-bezier(.2, .8, .2, 1) infinite; }
.ytcard:hover .yt-thumb { transform: scale(1.03); }
.ytcard:hover .yt-shade { opacity: .7; }
.yt-play:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
@keyframes yt-pulse { 0% { opacity: .8; transform: scale(1); } 100% { opacity: 0; transform: scale(1.45); } }
.yt-iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-empty { display: grid; justify-items: center; gap: 10px; color: rgba(255, 255, 255, .45); font-size: 13px; }
.yt-empty svg { width: 34px; height: 34px; opacity: .6; }
.yt-field { display: grid; gap: 5px; margin-top: 12px; }
@media (prefers-reduced-motion: reduce) { .ytcard:hover .yt-play::before { animation: none; } }

/* Einfügen eines kopierten Abschnitts */
.paste-btn { border-style: dashed; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ins-menu .paste-btn { margin-left: 4px; }
