/* Content Studio: Übersichten und Editor. */

.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; }
.btn.is-on { background: var(--primary-100); border-color: var(--primary-600); color: var(--primary-800); }

/* ---------- Startseite ---------- */
.big-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.big-action { display: grid; gap: 6px; justify-items: start; text-align: left; padding: 30px 28px; border: 0; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); color: var(--ink); transition: transform .2s ease, box-shadow .2s ease; }
.big-action:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(61, 78, 78, .14); }
.big-action strong { font-size: 23px; font-weight: 300; margin-top: 14px; color: inherit; }
.big-action span { color: var(--ink-soft); }
.big-action.is-primary { background: var(--primary); color: #fff; }
.big-action.is-primary span { color: rgba(255, 255, 255, .92); }
.recent { display: grid; gap: 12px; margin-top: 12px; }
.recent-row { display: flex; flex-wrap: wrap; gap: 16px; }
.recent-item { display: flex; align-items: center; gap: 14px; padding: 10px 20px 10px 10px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 240px; }
.recent-item > span:last-child { display: grid; }
.recent-thumb { flex: none; width: 58px; height: 58px; border-radius: 10px; overflow: hidden; background: var(--sand-200); color: var(--sand-700); display: grid; place-items: center; }
.recent-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Projektübersicht ---------- */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 36px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--sand-600); background: none; font-size: 14px; }
.chip:hover { background: var(--sand-200); }
.chip.is-active { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 24px 20px; align-items: start; }
.project-grid > .empty { grid-column: 1 / -1; }
.project-card { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 8px 4px; align-items: start; }
.project-thumb { grid-column: 1 / -1; position: relative; display: grid; place-items: center; border-radius: 12px; overflow: hidden; background: var(--sand-200); color: var(--sand-700); box-shadow: var(--shadow); max-height: 300px; transition: transform .2s ease; }
.project-thumb:hover { transform: translateY(-2px); }
.project-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.project-count { position: absolute; top: 8px; right: 8px; min-width: 24px; padding: 1px 7px; border-radius: 999px; background: rgba(38, 44, 44, .7); color: #fff; font-size: 12px; text-align: center; }
.project-info { display: grid; gap: 1px; min-width: 0; padding-top: 2px; }
.project-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.export-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; }
.export-main { display: flex; align-items: center; gap: 14px; min-width: 0; }

/* ---------- Neues Projekt ---------- */
.new-project { display: grid; gap: 12px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--sand-50); color: var(--ink); text-align: center; }
.choice:hover { border-color: var(--sand-600); }
.choice.is-active { border-color: var(--primary-600); background: var(--primary-100); color: var(--primary-800); }
.choice-format { display: grid; justify-items: center; gap: 4px; min-width: 120px; }
.choice-format small { color: var(--ink-soft); font-size: 12px; }
.format-shape { height: 44px; background: var(--primary-200); border-radius: 4px; margin-bottom: 4px; }
/* Kleine Vorschau im Dialog „Bild hinzufügen“: Bildraster und leerer Bildrahmen */
.pick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick-shape { height: 84px; display: grid; gap: 3px; padding: 3px; background: #FFFFFF; border: 1px solid var(--line); border-radius: 4px; margin-bottom: 6px; }
.pick-shape i { background: var(--primary-200); border-radius: 1px; }
.pick-list { display: grid; gap: 6px; max-height: 320px; overflow-y: auto; }
.pick-couple { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; text-align: left; padding: 10px 14px; }
.pick-couple small { color: var(--ink-soft); font-size: 12px; white-space: nowrap; }
.pick-shape.is-grid { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); }

/* ---------- Bildbibliothek ---------- */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.lib-item { position: relative; aspect-ratio: 1; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: var(--sand-200); }
button.lib-item:hover { outline: 2px solid var(--primary-600); }
.lib-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-item.is-sticker { background: repeating-conic-gradient(var(--sand-200) 0 25%, var(--sand-50) 0 50%) 0 0 / 20px 20px; }
.lib-item.is-sticker img { object-fit: contain; padding: 12px; }
.lib-remove { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(38, 44, 44, .65); color: #fff; display: grid; place-items: center; }
.lib-remove:hover { background: var(--ink); }

/* ---------- Editor ---------- */
.shell.is-full .content { padding: 0; overflow: hidden; }
.editor { display: grid; height: 100%; grid-template-columns: 290px minmax(0, 1fr) 292px; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "top top top" "left stage right" "left strip right"; background: var(--sand-200); }
.ed-top { grid-area: top; display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--line); position: relative; z-index: 6; }
.ed-name { display: grid; flex: 1; min-width: 120px; }
.ed-name-input { border: 0; outline: 0; background: none; font-size: 18px; padding: 2px 6px; margin-left: -6px; border-radius: 6px; width: 100%; max-width: 420px; }
.ed-name-input:hover, .ed-name-input:focus { background: var(--sand-100); }
.ed-name .field-hint { font-size: 12.5px; }
.ed-top-actions { display: flex; align-items: center; gap: 8px; }
.ed-top .savebar { gap: 10px; }
.ed-top .savebar .btn { height: 36px; padding: 0 16px; font-size: 14px; }
.ed-top .account-name { display: none; }
.ed-top .account-btn { padding-right: 5px; }

/* Nur hoch und runter scrollen: Der Inhalt passt sich der Breite an, statt seitlich überzustehen. */
.ed-left, .ed-right { background: var(--surface); overflow-x: hidden; overflow-y: auto; padding: 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; }
.ed-left { grid-area: left; border-right: 1px solid var(--line); }
.ed-right { grid-area: right; border-left: 1px solid var(--line); }
.ed-left h3, .insp-group h3 { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--primary-700); }
.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tool { display: flex; align-items: center; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--sand-50); font-size: 14px; color: var(--ink); }
.tool:hover { border-color: var(--primary); background: var(--primary-50); }
.caption-toggle { display: none; }
.caption-block { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.caption-block h3 + .input { margin-top: -2px; }
.caption-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }

/* „safe center“: Ist die Fläche hineingezoomt größer als der Platz, lässt sie sich bis an alle Ränder scrollen. */
.ed-stage { grid-area: stage; position: relative; display: grid; place-items: safe center; overflow: auto; min-height: 0; touch-action: manipulation; }
.zoom-ctl { display: flex; align-items: center; gap: 2px; padding: 0 4px; border: 1px solid var(--line); border-radius: 999px; }
.zoom-ctl .icon-btn { width: 30px; height: 30px; font-size: 18px; line-height: 1; }
.zoom-value { min-width: 54px; border: 0; background: none; padding: 4px 2px; font-size: 13.5px; color: var(--ink-soft); }
.zoom-value:hover { color: var(--ink); }
.zoom-ctl .btn-sm { height: 28px; padding: 0 10px; border: 0; }
.stage-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; padding: 0; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: rgba(255, 255, 255, .6); color: var(--primary-700); z-index: 5; }
/* Klein und dezent, aber mit großzügiger Fläche zum Treffen. */
.stage-nav::after { content: ""; position: absolute; inset: -10px; }
.stage-nav:hover { background: #fff; border-color: var(--primary-600); color: var(--primary-800); }
.stage-nav.is-prev { left: 14px; }
.stage-nav.is-next { right: 14px; }
.stage-nav[hidden] { display: none; }
/* Panorama-Karussell: Die lange Fläche füllt die Höhe und wird seitwärts gescrollt. */
.ed-stage.is-pano { display: flex; align-items: safe center; overflow: auto; padding: 0 20px; }
.ed-stage.is-pano .canvas-wrap { flex: none; margin: 0 auto; }
.ed-stage.is-pano .stage-hint { position: absolute; left: 20px; width: min(420px, 60%); }
.pano-page { position: absolute; top: 0; bottom: 0; border-left: 1.5px dashed rgba(255, 255, 255, .95); box-shadow: -1px 0 0 rgba(38, 44, 44, .4); }
.pano-page:first-child { border-left: 0; box-shadow: none; }
.pano-page span { position: absolute; left: 8px; top: 6px; padding: 1px 7px; border-radius: 4px; background: rgba(38, 44, 44, .7); color: #fff; font-size: 11px; }
/* Magnetische Kante beim Verschieben: kurz sichtbare Linie in Kupfer */
.snap-line { position: absolute; z-index: 6; pointer-events: none; background: #C89F7E; box-shadow: 0 0 0 1px rgba(255, 255, 255, .7); }
.snap-line.is-v { top: 0; bottom: 0; width: 2px; margin-left: -1px; }
.snap-line.is-h { left: 0; right: 0; height: 2px; margin-top: -1px; }
.snap-line[hidden] { display: none; }
.pano-count { display: grid; gap: 8px; }
.pano-count[hidden] { display: none; }
.choice-count { min-width: 46px; padding: 9px 0; }
.ed-stage.is-drop { outline: 3px dashed var(--primary-600); outline-offset: -10px; }
.canvas-wrap { position: relative; box-shadow: 0 10px 40px rgba(38, 44, 44, .2); background: #fff; }
.ed-canvas { display: block; width: 100%; height: 100%; touch-action: manipulation; }
.phone-icon { display: none; }
.stage-hint { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--sand-700); pointer-events: none; font-size: 15px; }

.sel { position: absolute; border: 1.5px solid var(--primary-600); pointer-events: none; box-sizing: border-box; }
.sel.is-hand { border-style: dashed; }
.sel-multi .sel { border-width: 1px; opacity: .7; }
.handle { position: absolute; width: 14px; height: 14px; margin: -7px; border-radius: 50%; background: #fff; border: 1.5px solid var(--primary-700); pointer-events: auto; touch-action: none; }
.handle::after { content: ""; position: absolute; inset: -10px; }
.h-nw { left: 0; top: 0; cursor: nwse-resize; }
.h-ne { left: 100%; top: 0; cursor: nesw-resize; }
.h-sw { left: 0; top: 100%; cursor: nesw-resize; }
.h-se { left: 100%; top: 100%; cursor: nwse-resize; }
.h-rot { left: 50%; top: -30px; cursor: grab; background: var(--primary-600); border-color: #fff; }
/* Bogen mit zwei Pfeilspitzen über dem Drehgriff – zeigt, dass sich das Objekt hier drehen lässt */
.h-rot::before { content: ""; position: absolute; left: 50%; top: 50%; width: 44px; height: 24px; transform: translate(-50%, -20px); background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 24' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg id='a'%3E%3Cpath d='M6 20A16 16 0 0 1 38 20'/%3E%3Cpath d='M2 15.5l4 5 4-5M34 15.5l4 5 4-5'/%3E%3C/g%3E%3Cuse href='%23a' stroke='%23fff' stroke-width='5'/%3E%3Cuse href='%23a' stroke='%23516666' stroke-width='2'/%3E%3C/svg%3E") center / contain no-repeat; }
.sel.is-hand .handle { display: none; }

.safe { position: absolute; inset: 0; pointer-events: none; }
.safe-zone { position: absolute; left: 0; right: 0; border-block: 1.5px dashed rgba(255, 255, 255, .95); box-shadow: 0 0 0 1px rgba(38, 44, 44, .35); }
.safe-zone span { position: absolute; left: 6px; top: 4px; padding: 1px 7px; border-radius: 4px; background: rgba(38, 44, 44, .7); color: #fff; font-size: 11px; }
/* Äußerer Bereich (3:4): Beschriftung über der oberen Linie. Innerer Bereich (4:5): Beschriftung innen unten. */
.safe-zone.is-outer span { top: auto; bottom: calc(100% + 5px); }
.safe-zone.is-inner span { top: auto; bottom: 5px; }
.safe-zone.is-blocked { background: rgba(38, 44, 44, .28); border: 0; }

.ed-strip { grid-area: strip; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border-top: 1px solid var(--line); overflow-x: auto; min-height: 96px; }
.thumb { position: relative; flex: none; height: 74px; border-radius: 7px; overflow: hidden; outline: 2px solid transparent; outline-offset: 2px; cursor: pointer; box-shadow: 0 1px 4px rgba(38, 44, 44, .2); }
.thumb canvas { height: 100%; width: auto; display: block; }
.thumb.is-active { outline-color: var(--primary-600); }
.thumb-num { position: absolute; left: 4px; bottom: 4px; min-width: 18px; padding: 0 5px; border-radius: 999px; background: rgba(38, 44, 44, .7); color: #fff; font-size: 11px; text-align: center; }
.strip-actions { display: flex; align-items: center; gap: 2px; margin-left: 8px; padding-left: 12px; border-left: 1px solid var(--line); flex: none; }
.strip-actions .btn { margin: 0 8px; }
.icon-btn:disabled { opacity: .35; cursor: default; }

/* ---------- Inspector ---------- */
.insp-group { display: grid; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.insp-group:last-child { border-bottom: 0; }
.insp-row { display: grid; gap: 6px; }
/* Leiste für markierte Wörter im Text */
.insp-mark { display: grid; gap: 12px; }
.insp-mark.is-open { padding: 12px 7px; border: 1px solid var(--primary-200); border-radius: 12px; background: var(--primary-50); }
.insp-mark-head { display: grid; gap: 2px; }
.insp-mark-head strong { overflow-wrap: anywhere; }
/* Hook-Vorlagen im Dialog „Text hinzufügen“ */
.text-plain { display: flex; align-items: center; gap: 16px; width: 100%; padding: 18px 22px; border: 0; border-radius: 14px; background: var(--primary-600); color: #fff; text-align: left; }
.text-plain:hover { background: var(--primary-700); }
.text-plain span { display: grid; gap: 2px; }
.text-plain strong { color: #fff; font-size: 18px; }
.text-plain small { font-size: 13.5px; opacity: .9; }
.hook-head { display: grid; gap: 4px; margin-top: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.hook-head h3 { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--primary-700); }
.hook-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hook-tile { display: grid; gap: 8px; padding: 8px 8px 10px; }
.hook-tile canvas { width: 100%; height: 140px; object-fit: contain; background: var(--primary-800); border-radius: 8px; }
.insp-slider { display: grid; grid-template-columns: 1fr 70px; gap: 10px; align-items: center; }
.insp-slider input[type="range"] { width: 100%; accent-color: var(--primary-600); }
.insp-num { min-height: 34px; padding: 4px 8px; }
.insp-color { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.insp-color input[type="color"] { width: 36px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; }
/* Plus-Kreis: merkt die aktuelle Farbe als eigenen Farbkreis */
.swatch-btn.swatch-add { display: inline-grid; place-items: center; background: none; border-style: dashed; color: var(--ink-soft); font-size: 15px; line-height: 1; }
.swatch-btn.swatch-add:hover { border-color: var(--primary-600); color: var(--primary-800); }
.swatch-btn { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--sand-600); padding: 0; }
.segment { display: flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.segment-btn { flex: 1; padding: 7px 6px; border: 0; background: var(--sand-50); font-size: 13.5px; color: var(--ink); }
.segment-btn + .segment-btn { border-left: 1px solid var(--line); }
.segment-btn.is-active { background: var(--primary-600); color: #fff; }
.insp-action { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 8px; background: none; text-align: left; color: var(--ink); font-size: 14.5px; }
.insp-action:hover { background: var(--sand-100); }
.insp-action.is-danger { color: var(--warn); }
.insp-action.is-on { background: var(--primary-100); color: var(--primary-800); }
.export-slides { display: flex; flex-wrap: wrap; gap: 4px 18px; }

/* ---------- Kleinere Bildschirme: gleiche Logik, kompaktere Anordnung ---------- */
@media (max-width: 1100px) {
  .editor { grid-template-columns: 76px minmax(0, 1fr) 250px; }
  .ed-left { padding: 10px 8px; }
  .ed-left h3 { display: none; }
  .tool-grid { grid-template-columns: 1fr; }
  .tool { flex-direction: column; gap: 3px; padding: 7px 2px; font-size: 11px; }
  .caption-block { position: fixed; left: 164px; bottom: 12px; z-index: 20; width: min(320px, 70vw); padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); display: none; }
  .ed-left.caption-open .caption-block { display: grid; }
  .ed-left.caption-open .caption-toggle { border-color: var(--primary-600); background: var(--primary-100); }
  .caption-toggle { display: flex; }
  .caption-block h3 { display: block; }
  .ed-top .save-status.is-dirty, .ed-top .btn-soft { display: none; }
}
@media (max-width: 640px) and (orientation: portrait) {
  .editor { height: auto; min-height: 100%; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 56vh auto auto; grid-template-areas: "top" "left" "stage" "strip" "right"; }
  .shell.is-full .content { overflow-y: auto; }
  .ed-top { flex-wrap: wrap; }
  /* Kopfzeile ohne seitliches Scrollen: Knöpfe nur als Symbol, die Bedeutung steht im Titel. */
  .phone-hide { display: none; }
  .phone-icon { display: inline-flex; }
  .ed-top-actions { flex-wrap: wrap; gap: 4px; }
  .zoom-value { min-width: 42px; font-size: 12.5px; }
  /* Werkzeuge als seitlich wischbare Reihe; die Caption klappt über die ganze Breite auf */
  .ed-left { grid-template-columns: minmax(0, 1fr); }
  .tool-grid { display: flex; overflow-x: auto; }
  .tool-grid .tool { flex: none; width: 64px; }
  .caption-toggle { justify-self: start; flex-direction: row; padding: 7px 14px; }
  .caption-block { left: 8px; right: 8px; width: auto; bottom: 8px; max-height: 80vh; overflow-y: auto; }
  .ed-left, .ed-right { border: 0; }
}

/* Smartphone im Editor: keine Leiste – der Platz gehört dem Bild, zurück geht es über den Pfeil oben. */
@media (max-width: 760px), (max-height: 520px) {
  .shell.is-full { grid-template-columns: minmax(0, 1fr); }
  .shell.is-full .sidebar { display: none; }
}
/* Finger: Der Rahmen des gewählten Objekts lässt sich greifen und verschieben; überall sonst scrollt das Wischen. */
@media (pointer: coarse) {
  .canvas-wrap > .sel { pointer-events: auto; touch-action: none; }
  .sel-multi .sel { pointer-events: none; }
}