.tg-scope {
  --tg-red: #e30613;
  --tg-dark: #1d1d1b;
  --tg-white: #ffffff;
  --tg-soft: #f6f2ea;
  --tg-border: rgba(29, 29, 27, .14);
  --tg-radius: 18px;
  --tg-shadow: 0 18px 45px rgba(0,0,0,.08);
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
  color: var(--tg-dark);
  font-family: inherit;
}
.tg-scope *, .tg-scope *::before, .tg-scope *::after { box-sizing: border-box; }
.tg-header { margin: 0 0 32px; max-width: 980px; }
.tg-title { margin: 0 0 10px; font-size: clamp(2.4rem, 5vw, 4.8rem); line-height: .98; letter-spacing: -.04em; }
.tg-lead { margin: 0; font-size: clamp(1rem, 1.6vw, 1.25rem); max-width: 72ch; }
.tg-builder { display: grid; grid-template-columns: minmax(300px, .95fr) minmax(360px, 1.05fr); gap: 28px; align-items: start; margin-bottom: 52px; }
.tg-card, .tg-preview-card { background: var(--tg-white); border: 1px solid var(--tg-border); border-radius: var(--tg-radius); box-shadow: var(--tg-shadow); padding: 24px; }
.tg-preview-card { position: sticky; top: 120px; }
.tg-preview-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-end; margin-bottom: 14px; }
.tg-preview-actions { display: flex; justify-content: center; margin-top: 16px; }
.tg-eyebrow { margin: 0; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; color: var(--tg-red); }
.tg-form-card { min-width: 0; }
.tg-form { display: grid; gap: 16px; }
.tg-step { display: grid; gap: 14px; padding: 18px; border: 1px solid var(--tg-border); border-radius: calc(var(--tg-radius) - 2px); background: linear-gradient(180deg, #fff, rgba(246,242,234,.72)); }
.tg-step-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: clamp(1.25rem, 2vw, 1.7rem); line-height: 1.05; letter-spacing: -.025em; }
.tg-step-title span { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 999px; background: var(--tg-red); color: #fff; font-size: .95rem; font-weight: 900; flex: 0 0 auto; }
.tg-step-text { margin: -4px 0 0; font-size: .95rem; color: rgba(29,29,27,.72); }
.tg-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tg-scope label { display: grid; gap: 7px; font-weight: 700; font-size: .95rem; }
.tg-scope input, .tg-scope select, .tg-scope textarea, .tg-scope button { font: inherit; }
.tg-scope input, .tg-scope select, .tg-scope textarea { width: 100%; border: 1px solid var(--tg-border); border-radius: 12px; padding: 12px 14px; background: #fff; color: var(--tg-dark); }
.tg-scope textarea { min-height: 118px; resize: vertical; }
.tg-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tg-final-actions { margin-top: 2px; }
.tg-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; border: 0; border-radius: 999px; padding: 12px 18px; cursor: pointer; font-weight: 800; background: var(--tg-dark); color: #fff; transition: transform .16s ease, opacity .16s ease; text-decoration: none; line-height: 1.2; appearance: none; -webkit-appearance: none; }
.tg-btn:hover { transform: translateY(-1px); }
.tg-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.tg-btn-primary { background: var(--tg-red); }
.tg-btn-secondary { background: #ece8df; color: var(--tg-dark); }
.tg-note { font-size: .88rem; color: rgba(29,29,27,.72); margin: 0; }
.tg-status { margin: 0; font-weight: 700; font-size: .95rem; }
.tg-status.is-success { color: #247a35; }
.tg-status.is-error { color: #b00020; }
.tg-success-panel { display: grid; gap: 14px; margin-top: 16px; padding: 20px; border-radius: calc(var(--tg-radius) - 2px); border: 1px solid rgba(36,122,53,.24); background: rgba(36,122,53,.08); }
.tg-success-panel[hidden] { display: none; }
.tg-success-title { margin: 0; font-weight: 900; font-size: 1.2rem; color: #247a35; }
.tg-success-text { margin: 0; font-weight: 600; color: var(--tg-dark); }
.tg-preview-shell { background: #ddd8cf; border-radius: calc(var(--tg-radius) - 4px); overflow: hidden; min-height: 520px; display: grid; place-items: center; position: relative; }
#tgPreviewCanvas {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 76vh;
  display: block;
  background: #fff;
  cursor: grab;
  touch-action: none;
  user-select: none;
  object-fit: contain;
}
#tgPreviewCanvas:active { cursor: grabbing; }
.tg-camera { display: none; gap: 12px; background: #111; border-radius: var(--tg-radius); overflow: hidden; padding: 12px; }
.tg-camera.is-open { display: grid; }
#tgVideo { width: 100%; max-height: 520px; border-radius: 14px; background: #000; object-fit: cover; }
.tg-consent { display: flex !important; align-items: flex-start; gap: 10px; font-weight: 500; font-size: .92rem; }
.tg-consent input { width: auto; margin-top: 4px; }
.tg-honeypot { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; }
.tg-gallery-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin: 36px 0 18px; }
.tg-gallery-title { font-size: clamp(1.7rem, 3vw, 2.8rem); margin: 0; letter-spacing: -.03em; }
.tg-masonry { column-count: 4; column-gap: 18px; }
.tg-masonry-item { break-inside: avoid; margin: 0 0 18px; border-radius: 18px; overflow: hidden; background: #fff; box-shadow: 0 12px 30px rgba(0,0,0,.08); }
.tg-masonry-item img { display: block; width: 100%; height: auto; }
.tg-lightbox-link { display: block; color: inherit; text-decoration: none; cursor: zoom-in; }
.tg-lightbox-link:focus-visible { outline: 3px solid var(--tg-red); outline-offset: 3px; }
.tg-masonry-caption { padding: 12px 14px; font-weight: 800; font-size: .95rem; }
.tg-load-wrap { display: flex; justify-content: center; margin-top: 18px; }
@media (max-width: 1100px) { .tg-builder { grid-template-columns: .95fr 1.05fr; gap: 22px; } .tg-preview-shell { min-height: 420px; } }
@media (max-width: 900px) { .tg-builder { grid-template-columns: 1fr; } .tg-preview-card { position: static; } .tg-preview-shell { min-height: 320px; } .tg-masonry { column-count: 3; } }
@media (max-width: 720px) { .tg-scope { width: min(100% - 22px, 1180px); padding-top: 18px; } .tg-header { margin-bottom: 22px; } .tg-card, .tg-preview-card { padding: 18px; } .tg-preview-head { display: grid; align-items: start; } .tg-step { padding: 16px; } .tg-grid-2 { grid-template-columns: 1fr; } .tg-actions { align-items: stretch; } .tg-btn { width: 100%; text-align: center; } .tg-gallery-head { align-items: start; flex-direction: column; } .tg-masonry { column-count: 2; column-gap: 12px; } .tg-masonry-item { margin-bottom: 12px; } }
@media (max-width: 460px) { .tg-masonry { column-count: 1; } }


/* V2.0.0: Galerie breiter als Generator */
.tg-scope .tg-gallery {
  width: min(1320px, calc(100vw - 32px));
  margin-left: 50%;
  transform: translateX(-50%);
}

/* V2.0.0: Captions nur in der Masonry-Ansicht ausblenden */
.tg-scope .tg-masonry-caption {
  display: none;
}


/* V2.0.1: Dropdowns optisch an Textfelder angleichen */
.tg-scope select {
  min-height: 48px;
  line-height: 1.35;
  padding-top: 12px;
  padding-bottom: 12px;
  appearance: auto;
  -webkit-appearance: menulist;
}

.tg-scope .tg-step select,
.tg-scope .tg-form select {
  height: auto;
  min-height: 48px;
}


/* V2.0.2: Canvas-Vorschau immer proportional skalieren */
.tg-scope #tgPreviewCanvas {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 76vh;
  object-fit: contain;
}

/* Auswahl des Zitat-Hintergrunds, sichtbar ab zwei hinterlegten Farben. */
.tg-scope .tg-bg-choice {
  margin-top: .35rem;
}

.tg-scope .tg-bg-choice-label {
  display: block;
  margin-bottom: .4rem;
  font-size: .85rem;
  font-weight: 600;
}

.tg-scope .tg-bg-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.tg-scope .tg-bg-swatch {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid rgba(0, 0, 0, .18);
  border-radius: 50%;
  overflow: hidden;
  background: none;
  cursor: pointer;
  line-height: 0;
  transition: transform .12s, border-color .12s;
}

.tg-scope .tg-bg-swatch canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.tg-scope .tg-bg-swatch:hover {
  transform: scale(1.08);
}

.tg-scope .tg-bg-swatch.is-active {
  border-color: #1d1d1b;
  box-shadow: 0 0 0 2px #fff inset;
}

.tg-scope .tg-bg-swatch:focus-visible {
  outline: 2px solid #2A7B9B;
  outline-offset: 2px;
}

/* Schritt 4: Format & Download (seit 4.5.0) */
.tg-format-done {
  margin: 0;
  font-size: .88rem;
  font-weight: 600;
  color: #247a35;
}
.tg-format-done[hidden] { display: none; }

.tg-more-format {
  display: grid;
  gap: 12px;
  margin-top: 4px;
  padding: 16px;
  border-radius: calc(var(--tg-radius) - 2px);
  border: 1px solid rgba(42,123,155,.28);
  background: rgba(42,123,155,.08);
}
.tg-more-format[hidden] { display: none; }
.tg-more-format-question { margin: 0; font-weight: 700; font-size: .95rem; }
