/* Custom Studio — sauberer, minimalistischer Configurator */

.cs { max-width: 1180px; margin: 0 auto; padding: 1rem 1rem 7.5rem; }

.cs-head { text-align: center; padding: 1rem 0 1.5rem; }
.cs-head h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); margin: 0 0 .35rem; letter-spacing: -.02em; }
.cs-sub { color: var(--muted, #8a8f98); margin: 0; font-size: .95rem; }

.cs-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 420px); gap: 1.5rem; align-items: start; }

/* --- Preview --- */
.cs-stage { position: sticky; top: 76px; }
.cs-stage-inner { position: relative; border-radius: 16px; overflow: hidden; background: #101013; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.cs-stage-inner.is-drag { outline: 3px dashed #22d3ee; outline-offset: -3px; }
#cs-canvas { display: block; width: 100%; height: auto; touch-action: none; cursor: grab; }
#cs-canvas:active { cursor: grabbing; }

/* kontextuelle Editor-Toolbar */
.cs-tools {
  position: absolute; top: 10px; left: 10px; right: 10px; z-index: 6;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  background: rgba(18,18,22,.92); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.10); border-radius: 12px; padding: 8px;
  animation: csFadeIn .18s ease;
}
.cs-tools[hidden] { display: none; }
@keyframes csFadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.cs-tool-input { flex: 1 1 120px; min-width: 90px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); color: #fff; border-radius: 8px; padding: 7px 10px; font-size: .85rem; }
.cs-tool-input:focus { outline: 2px solid #e8ff47; outline-offset: -1px; }
.cs-tool-select { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); color: #fff; border-radius: 8px; padding: 7px 8px; font-size: .8rem; max-width: 118px; }
.cs-tool-select option { color: #111; }
.cs-tool-color { width: 34px; height: 34px; padding: 2px; border: 1px solid rgba(255,255,255,.14); border-radius: 8px; background: rgba(255,255,255,.07); cursor: pointer; }
.cs-tool-btn { min-width: 34px; height: 34px; padding: 0 9px; border-radius: 8px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.07); color: #fff; font-weight: 700; font-size: .8rem; cursor: pointer; }
.cs-tool-btn:hover { background: rgba(255,255,255,.16); }
.cs-tool-danger:hover { background: rgba(255,59,59,.25); border-color: #ff3b3b; }

/* Text hinzufuegen */
.cs-text-add { display: flex; gap: 8px; }
.cs-text-add input { flex: 1; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); color: #fff; border-radius: 10px; padding: 10px 12px; font-size: .9rem; }
.cs-text-add input:focus { outline: 2px solid #e8ff47; outline-offset: -1px; }
.cs-add2 { background: #e8ff47; color: #111; border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 800; font-size: .85rem; cursor: pointer; white-space: nowrap; }
.cs-add2:hover { filter: brightness(1.06); }
.cs-opt { font-size: .72rem; font-weight: 500; color: var(--muted, #8a8f98); letter-spacing: .02em; }

.cs-dropzone {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .4rem; color: #cfd3da; cursor: pointer; text-align: center; padding: 1rem; background: rgba(16,16,19,.35);
}
.cs-dropzone svg { width: 42px; height: 42px; opacity: .8; }
.cs-dropzone strong { font-size: 1.05rem; }
.cs-dropzone span { font-size: .8rem; opacity: .65; }
.cs-dropzone:hover { background: rgba(16,16,19,.55); }

.cs-legend {
  position: absolute; left: 10px; bottom: 10px; display: flex; gap: .9rem;
  background: rgba(10,10,12,.72); backdrop-filter: blur(6px);
  padding: .45rem .7rem; border-radius: 10px; font-size: .72rem; color: #d5d9e0;
}
.cs-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .3rem; }
.cs-dot-kiss { background: #ff2fd6; }
.cs-dot-die { background: #22d3ee; }
.cs-stage-dim { text-align: center; color: var(--muted, #8a8f98); font-size: .85rem; margin: .6rem 0 0; font-variant-numeric: tabular-nums; }

/* --- Panel --- */
.cs-panel { display: flex; flex-direction: column; gap: .9rem; }
.cs-card {
  background: var(--card, #17181c); border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px; padding: 1rem 1.1rem;
}
.cs-card h2 { font-size: 1rem; margin: 0 0 .8rem; display: flex; align-items: center; gap: .55rem; }
.cs-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%; font-size: .8rem;
  background: var(--accent, #ff4d00); color: #111; flex: none;
}
.cs-hint { font-size: .78rem; color: var(--muted, #8a8f98); margin: .6rem 0 0; }
.cs-link { background: none; border: 0; color: var(--accent, #ff4d00); cursor: pointer; font-size: .82rem; padding: 0; }
.cs-link-danger { color: #ff5c5c; margin-left: .8rem; }

/* Upload-Row */
.cs-upload-row { display: flex; gap: .8rem; align-items: center; }
.cs-upload-row img { width: 64px; height: 64px; object-fit: contain; background: #0d0d10; border-radius: 10px; }
.cs-upload-row strong { display: block; font-size: .85rem; margin-bottom: .25rem; word-break: break-all; }

/* Tabs + DIN Grid */
.cs-tabs { display: flex; background: #101013; border-radius: 10px; padding: 4px; margin-bottom: .9rem; }
.cs-tab {
  flex: 1; border: 0; background: transparent; color: var(--muted, #8a8f98);
  padding: .5rem .4rem; border-radius: 8px; font-weight: 600; font-size: .85rem; cursor: pointer;
}
.cs-tab.is-active { background: var(--accent, #ff4d00); color: #111; }

.cs-din-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.cs-din {
  border: 1px solid rgba(255,255,255,.1); background: #101013; border-radius: 10px;
  padding: .6rem .3rem; cursor: pointer; color: inherit; text-align: center;
}
.cs-din strong { display: block; font-size: .95rem; }
.cs-din span { font-size: .68rem; color: var(--muted, #8a8f98); }
.cs-din.is-active { border-color: var(--accent, #ff4d00); background: rgba(232,255,71,.12); }

/* mm inputs */
.cs-mm-fields { display: flex; align-items: end; gap: .6rem; }
.cs-mm-fields label { font-size: .8rem; color: var(--muted, #8a8f98); flex: 1; }
.cs-input-mm {
  display: flex; align-items: center; gap: .3rem; margin-top: .3rem;
  background: #101013; border: 1px solid rgba(255,255,255,.1); border-radius: 10px; padding: .5rem .7rem;
}
.cs-input-mm input {
  width: 100%; border: 0; background: transparent; color: inherit;
  font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; outline: none;
}
.cs-input-mm i { font-style: normal; color: var(--muted, #8a8f98); font-size: .8rem; }
.cs-lock {
  border: 1px solid rgba(255,255,255,.1); background: #101013; color: var(--muted, #8a8f98);
  border-radius: 10px; padding: .55rem; cursor: pointer; flex: none; margin-bottom: 1px;
}
.cs-lock svg { width: 18px; height: 18px; display: block; }
.cs-lock.is-on { color: var(--accent, #ff4d00); border-color: var(--accent, #ff4d00); }
.cs-area { font-size: .78rem; color: var(--muted, #8a8f98); margin: .7rem 0 0; }

/* Shapes */
.cs-shape-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.cs-shape {
  border: 1px solid rgba(255,255,255,.1); background: #101013; border-radius: 12px;
  padding: .8rem .6rem; cursor: pointer; color: inherit; text-align: center;
}
.cs-shape svg { width: 34px; height: 34px; display: block; margin: 0 auto .4rem; }
.cs-shape strong { display: block; font-size: .85rem; }
.cs-shape span { font-size: .7rem; color: var(--muted, #8a8f98); }
.cs-shape.is-active { border-color: var(--accent, #ff4d00); background: rgba(232,255,71,.12); }

/* Qty */
.cs-select {
  width: 100%; background: #101013; border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px; color: inherit; padding: .7rem .8rem; font-size: .95rem;
}

/* Material + misc */
.cs-material p { margin: .3rem 0 0; font-size: .82rem; color: var(--muted, #8a8f98); }
.cs-details summary { cursor: pointer; font-size: .85rem; color: var(--muted, #8a8f98); }
.cs-details textarea, .cs-details input {
  width: 100%; margin-top: .6rem; background: #101013; border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px; color: inherit; padding: .6rem .7rem; font: inherit; font-size: .88rem;
}
.cs-two { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.cs-legal { font-size: .72rem; color: var(--muted, #8a8f98); text-align: center; margin: 0; }
/* Widerrufs-Checkbox */
.cs-check {
  display: flex; gap: .7rem; align-items: flex-start; cursor: pointer;
  background: rgba(232,255,71,.07); border: 1px solid rgba(232,255,71,.25);
  border-radius: 10px; padding: .75rem .9rem; margin: .4rem 0;
  font-size: .82rem; line-height: 1.45; color: #e6e9ef;
}
.cs-check input { margin-top: .15rem; width: 18px; height: 18px; accent-color: #e8ff47; flex: none; cursor: pointer; }
.cs-check strong { color: #e8ff47; }

.cs-error {
  background: rgba(255,60,60,.12); border: 1px solid rgba(255,60,60,.4);
  color: #ff8080; border-radius: 10px; padding: .7rem .9rem; font-size: .85rem;
}

/* Sticky Bottom Bar — prominent, gut sichtbar */
.cs-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: rgba(14,14,17,.97); backdrop-filter: blur(12px);
  border-top: 2px solid rgba(232,255,71,.4);
  box-shadow: 0 -8px 32px rgba(0,0,0,.55);
  padding: .9rem 1.4rem calc(.9rem + env(safe-area-inset-bottom));
}
.cs-bar::before {
  content: ""; position: absolute; top: -2px; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, #e8ff47 30%, #e8ff47 70%, transparent);
  opacity: .8;
}
.cs-bar-info { display: flex; flex-direction: column; line-height: 1.15; }
.cs-bar-info strong { font-size: 1.55rem; color: #e8ff47; font-weight: 800; }
.cs-bar-info span { font-size: .8rem; color: var(--muted, #8a8f98); }
.cs-bar-info small { font-size: .68rem; color: var(--muted, #8a8f98); }
.cs-add {
  background: #e8ff47; color: #111; border: 0; border-radius: 14px;
  font-weight: 800; font-size: 1.08rem; padding: 1rem 2.4rem; cursor: pointer;
  box-shadow: 0 4px 18px rgba(232,255,71,.35);
  white-space: nowrap;
}
.cs-add:hover { filter: brightness(1.07); transform: translateY(-1px); }
.cs-add:active { transform: translateY(0); }
.cs-add:disabled { opacity: .6; cursor: wait; transform: none; }

/* Freihand-Overlay */
.cs-draw {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.7); padding: 1rem;
}
.cs-draw[hidden] { display: none; }
.cs-draw-box {
  background: var(--card, #17181c); border-radius: 16px; padding: 1rem;
  width: min(640px, 100%);
}
.cs-draw-box header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .7rem; }
.cs-draw-box h2 { margin: 0; font-size: 1rem; }
#cs-draw-canvas { width: 100%; border-radius: 10px; touch-action: none; cursor: crosshair; }
.cs-draw-actions { display: flex; justify-content: space-between; margin-top: .8rem; }
.cs-draw-actions .cs-add { padding: .6rem 1.6rem; font-size: .9rem; }

/* --- Mobile --- */
@media (max-width: 900px) {
  .cs { padding-bottom: 6.5rem; }
  .cs-bar { padding: .7rem 1rem calc(.7rem + env(safe-area-inset-bottom)); gap: .7rem; }
  .cs-bar-info strong { font-size: 1.3rem; }
  .cs-bar-info span, .cs-bar-info small { font-size: .68rem; white-space: nowrap; }
  .cs-add { padding: .85rem 1.5rem; font-size: .95rem; }
  .cs-grid { grid-template-columns: 1fr; gap: 1rem; }
  /* Preview nicht sticky + volle Hoehe: Motiv bleibt gross & unverdeckt */
  .cs-stage { position: relative; top: auto; z-index: auto; }
  .cs-stage-inner { box-shadow: 0 8px 28px rgba(0,0,0,.35); }
  #cs-canvas { height: auto; }
  /* Legende unter der Vorschau statt Overlay darauf */
  .cs-legend { position: static; margin: 8px 10px 10px; display: inline-flex; }
  /* Editor-Toolbar unten verankern — der Peel-Tab oben rechts bleibt sichtbar */
  .cs-tools { top: auto; bottom: 10px; left: 8px; right: 8px; padding: 6px; gap: 5px; }
  .cs-tool-input { flex-basis: 100px; padding: 6px 8px; }
  .cs-tool-select { max-width: 96px; }
  .cs-din-grid { grid-template-columns: repeat(5, 1fr); gap: .4rem; }
  .cs-din { padding: .45rem .2rem; }
  .cs-din strong { font-size: .8rem; }
  .cs-din span { font-size: .6rem; }
}
