:root {
  --bg: #0e1013; --panel: #161a1f; --panel-2: #1d2229; --line: #2a3039;
  --text: #eef1f4; --muted: #8f99a6; --accent: #00c4a7; --green: #22C55E; --warn: #FBBF24; --err: #f87171;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: transparent; }
body { color: var(--text); font: 15px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
button, input { font: inherit; color: inherit; }

.dk-app {
  display: grid; grid-template-columns: 300px minmax(0, 1fr) 320px; gap: 20px;
  padding: 20px; background: var(--bg); border-radius: 20px; max-width: 1540px; margin: 0 auto;
}
.dk-col { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 14px; align-self: start; }
.dk-badge { align-self: flex-start; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); background: rgba(0, 196, 167, .12); border: 1px solid rgba(0, 196, 167, .35); padding: 3px 10px; border-radius: 99px; }
.dk-h { margin: -4px 0 0; font-size: 19px; }
.dk-label { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.dk-muted { color: var(--muted); font-size: 13px; }
.dk-block { display: flex; flex-direction: column; gap: 8px; }

.dk-drop { border: 2px dashed var(--line); border-radius: 14px; padding: 22px 12px; text-align: center; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: all .2s; }
.dk-drop:hover, .dk-drop.over { border-color: var(--accent); background: rgba(0, 196, 167, .06); }
.dk-drop-icon { font-size: 28px; }
.dk-drop-title { font-weight: 700; }
.dk-drop-sub { font-size: 12px; color: var(--muted); }
.dk-uploads { display: flex; flex-direction: column; gap: 6px; }
.dk-up { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.dk-up .bar { height: 4px; background: var(--panel-2); border-radius: 2px; overflow: hidden; }
.dk-up .bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.dk-up.err { color: var(--err); }

.dk-summary { background: #0f1216; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 14px; }
.dk-summary span { color: var(--muted); }
.dk-summary b { text-align: right; font-variant-numeric: tabular-nums; }
.dk-summary .free { grid-column: 1 / -1; color: var(--warn); font-size: 12.5px; margin-top: 4px; }

.dk-backs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dk-back-opt { border: 2px solid transparent; background: var(--panel-2); border-radius: 10px; padding: 4px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); text-align: center; }
.dk-back-opt img { width: 100%; aspect-ratio: 63.5 / 88; object-fit: cover; border-radius: 5px; display: block; }
.dk-back-opt.active { border-color: var(--accent); color: var(--text); }

.dk-btn { border: 1px solid var(--line); background: var(--panel-2); border-radius: 12px; padding: 10px 14px; cursor: pointer; font-weight: 700; text-align: center; transition: transform .15s, box-shadow .15s; }
.dk-btn:hover { transform: translateY(-1px); }
.dk-btn.small { padding: 7px 11px; font-size: 13px; }
.dk-btn.ghost { background: transparent; }
.dk-btn.danger { background: rgba(239, 68, 68, .12); border-color: rgba(239, 68, 68, .4); color: #fca5a5; }
.dk-btn.flip { align-self: center; background: linear-gradient(135deg, rgba(0, 196, 167, .3), rgba(124, 58, 237, .3)); border-color: rgba(255, 255, 255, .15); }
.dk-btn.cart { background: linear-gradient(135deg, #10B981, #059669); border: 0; color: #fff; font-size: 16px; font-weight: 800; padding: 15px; box-shadow: 0 4px 20px rgba(16, 185, 129, .4); }
.dk-btn:disabled { opacity: .5; cursor: progress; transform: none; }

/* Bühne */
.dk-stage { display: flex; flex-direction: column; gap: 12px; align-items: center; min-width: 0; }
.dk-stage-top { display: flex; justify-content: space-between; width: 100%; max-width: 440px; font-weight: 700; }
.dk-card-row { display: flex; align-items: center; gap: 10px; width: 100%; justify-content: center; }
.dk-arrow { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); font-size: 26px; line-height: 1; cursor: pointer; flex-shrink: 0; }
.dk-arrow:disabled { opacity: .3; cursor: default; }
.dk-card { width: min(100%, 380px); aspect-ratio: 63.5 / 88; perspective: 1400px; }
.dk-card-inner { position: relative; width: 100%; height: 100%; transition: transform .6s cubic-bezier(.4, 0, .2, 1); transform-style: preserve-3d; }
.dk-card-inner.flipped { transform: rotateY(180deg); }
.dk-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 4.7% / 3.4%; overflow: hidden; background: #0a0c10; box-shadow: 0 20px 45px rgba(0, 0, 0, .6); }
.dk-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dk-back { transform: rotateY(180deg); }
/* Safari (iOS): Seiten zur Hälfte der Drehung hart umschalten statt nur backface-visibility */
.dk-face { -webkit-backface-visibility: hidden; transition: visibility 0s linear .3s; }
.dk-back, .dk-card-inner.flipped .dk-front { visibility: hidden; }
.dk-card-inner.flipped .dk-back { visibility: visible; }
.dk-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--muted); border: 2px dashed var(--line); border-radius: inherit; }
.dk-card-warn { font-size: 13px; color: var(--warn); text-align: center; min-height: 1em; max-width: 440px; }

/* Rechts */
.dk-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.dk-field input { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.dk-field input:focus, .dk-qty input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.dk-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.dk-pill { border: 1px solid var(--line); background: var(--panel-2); border-radius: 99px; padding: 7px 13px; cursor: pointer; font-size: 14px; }
.dk-pill.active { border-color: var(--accent); background: rgba(0, 196, 167, .14); }
.dk-price { background: linear-gradient(135deg, rgba(34, 197, 94, .08), rgba(0, 196, 167, .06)); border: 1px solid rgba(34, 197, 94, .3); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 3px; }
.dk-price .lbl { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.dk-price .total { font-size: 30px; font-weight: 900; color: var(--green); font-variant-numeric: tabular-nums; }
.dk-price .per { font-size: 13px; color: var(--accent); font-weight: 700; }
.dk-price .meta { font-size: 12.5px; color: var(--muted); }
.dk-price .next { font-size: 12.5px; color: var(--warn); margin-top: 4px; }
.dk-info { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; background: #0f1216; border-radius: 10px; padding: 10px 12px; }
.dk-msg { border-radius: 10px; padding: 10px 12px; font-size: 14px; background: var(--panel-2); }
.dk-msg.err { background: rgba(248, 113, 113, .12); color: #fecaca; }
.dk-msg.ok { background: rgba(0, 196, 167, .12); color: #99f6e4; }

/* Galerie */
.dk-gallery-panel { grid-column: 1 / -1; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.dk-gallery-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.dk-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
.dk-thumb { background: var(--panel-2); border: 2px solid transparent; border-radius: 12px; padding: 6px; display: flex; flex-direction: column; gap: 6px; position: relative; cursor: pointer; }
.dk-thumb.active { border-color: var(--accent); }
.dk-thumb img { width: 100%; aspect-ratio: 63.5 / 88; object-fit: cover; border-radius: 6px; display: block; }
.dk-thumb .name { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-thumb .del { position: absolute; top: 3px; right: 3px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .7); color: #fff; cursor: pointer; }
.dk-thumb .lowres { position: absolute; top: 8px; left: 8px; background: rgba(251, 191, 36, .92); color: #231800; font-size: 10.5px; font-weight: 800; padding: 1px 6px; border-radius: 99px; }
.dk-qty { display: flex; align-items: center; justify-content: center; gap: 4px; }
.dk-qty button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; font-weight: 800; }
.dk-qty input { width: 44px; text-align: center; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 4px 2px; }
.dk-gallery .none { color: var(--muted); grid-column: 1 / -1; text-align: center; padding: 20px; }

@media (max-width: 1150px) {
  /* Tablet: Vorschau links über die ganze Höhe (bleibt beim Scrollen stehen), Einstellungen rechts untereinander */
  .dk-app { grid-template-columns: minmax(0, 1fr) 320px; }
  .dk-stage { grid-column: 1; grid-row: 1 / span 2; }
  .dk-left, .dk-right { grid-column: 2; }
}
@media (max-width: 700px) {
  .dk-stage, .dk-left, .dk-right { grid-column: auto; grid-row: auto; }
  .dk-app { grid-template-columns: 1fr; padding: 12px; gap: 14px; border-radius: 14px; }
  .dk-card { width: min(100%, 300px); }
  .dk-gallery { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

/* Section-Einstellung „Hintergrund: transparent“ – keine eigene Fläche, kein Rand, nahtlos in der Website */
.bg-transparent, .bg-transparent body { background: transparent !important; }
.bg-transparent .dk-app { background: transparent !important; border-radius: 0; box-shadow: none; padding-left: 0; padding-right: 0; }

/* Vorschau bleibt beim Scrollen stehen – direkt aufgerufen per CSS, im Shop-iframe per Scroll-Meldung (sticky-stage.js) */
@media (min-width: 701px) { .dk-stage { align-self: start; } .dk-stage.tss-sticky { position: sticky; top: 16px; } }
