/*
 * Probierseite "Ziehen in 3D" - WEGWERF-OPTIK wie style.css, aber ein
 * anderes Geruest: EINE Spalte, die Buehne fuellt den Schirm, unten eine
 * Leiste. Dasselbe Layout am Handy und am Rechner - kein zweiter Weg.
 */

:root {
  --bg: #edeae4;
  --surface: #ffffff;
  --ink: #23211e;
  --muted: #6d675f;
  --line: #d9d4cc;
  --accent: #2e4a73;
  --danger: #b3312a;
  --radius: 12px;
  --tipp: 44px;           /* kleinstes Tippziel */
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

button { font: inherit; color: inherit; }

.knopf {
  min-height: 38px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  white-space: nowrap;
}
.knopf:hover:not(:disabled) { border-color: var(--accent); }
.knopf:disabled { opacity: .4; cursor: not-allowed; }
.knopf.haupt { background: var(--accent); border-color: var(--accent); color: #fff; }

.klein { font-size: 12.5px; color: var(--muted); }

/* ---------------------------------------------------------------- Kopf */

.kopf {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.marke { display: flex; align-items: baseline; gap: 8px; }
.marke b { letter-spacing: .08em; }
.summe { font-variant-numeric: tabular-nums; color: var(--muted); }
.kopf-knoepfe { margin-left: auto; display: flex; gap: 6px; }
/* Shop (poc/shop-bruecke.js): Pflichtangaben und Versandschwelle neben der
   Summe, Warenkorb und Schliessen rechts. Ohne Shop alles verborgen. */
.versand a { color: inherit; }
.versand .frei { color: #2f6b3a; }
.knopf.schliessen { min-width: 38px; padding: 6px 0; font-size: 20px; line-height: 1; }
.knopf.haupt:disabled { opacity: .45; }

@media (max-width: 560px) {
  .kopf { gap: 6px 8px; }
  .summe { order: 3; width: 100%; font-size: 13px; }
  .versand { order: 4; width: 100%; margin-top: -6px; }
  .kopf-knoepfe .knopf { padding: 6px 9px; }
}

/* -------------------------------------------------------------- Buehne */

/* Anordnen und Leeren im Bild (03.10.2026, bis dahin Text-Knoepfe im
   Kopf): runde Symbole uebereinander, halbdurchsichtig weiss wie ein
   Bedienelement auf einem Foto. Unten rechts, denn dort ist nur freier
   Tisch - die Module stehen hinten, also oben im Bild. Mit Text daneben
   war auch im Rennen (Tobias: nur Symbole). */
.aktionen {
  position: absolute; right: 10px; bottom: 12px; z-index: 2;
  display: flex; flex-direction: column; gap: 8px;
}
.aktion {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--tipp);
  height: var(--tipp);
  padding: 0;
  border: 1px solid rgba(0, 0, 0, .12);
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
  cursor: pointer;
}
.aktion:hover { border-color: var(--accent); }
.aktion svg { width: 20px; height: 20px; flex: none; }
/* Nur fuer Vorleser: der Text bleibt der Name des Knopfs. */
.aktion span {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* Rueckgaengig nach Leeren und Anordnen: wie die Meldung, aber mit Knopf
   und laenger sichtbar. */
.rueck {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 5px 5px 14px;
  border-radius: 999px;
  background: rgba(35, 33, 30, .92);
  color: #fff;
  font-size: 13.5px;
  white-space: nowrap;
  z-index: 3;
}
.rueck button {
  min-height: 34px;
  padding: 4px 14px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}

.buehne {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #f4f2ee;
}
.buehne canvas { touch-action: none; }

.leer-hinweis {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  pointer-events: none;
  line-height: 1.5;
}

.meldung {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  background: rgba(35, 33, 30, .88);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  pointer-events: none;
  white-space: nowrap;
}

.probe {
  position: absolute;
  top: 10px;
  right: 10px;
  width: min(360px, calc(100% - 20px));
  max-height: calc(100% - 20px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .12);
  user-select: text;
}
.probe h2 { font-size: 15px; margin: 0 0 4px; }
.probe-feld { margin: 10px 0; }
.probe-feld > div:first-child { font-size: 13px; margin-bottom: 4px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg button {
  flex: 1 1 auto;
  min-height: 34px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
  cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------------------------------------------------------------- Dock */

.dock {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 8px 10px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  touch-action: none;
  min-height: 92px;
}

.leiste {
  display: flex;
  gap: 8px;
  justify-content: center;
  max-width: 720px;
  margin: 0 auto;
  /* Ohne Name und Preis haben die Kacheln keine Breite aus dem Inhalt mehr
     (die Silhouette passt sich an) - die Leiste muss sie vorgeben, sonst
     fallen sie im Raster von .setzen zu leeren Streifen zusammen. */
  width: 100%;
}
.kachel {
  flex: 1 1 0;
  max-width: 130px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: grab;
  touch-action: none;
}
.kachel:hover:not(:disabled) { border-color: var(--accent); }
.kachel:disabled { opacity: .35; cursor: not-allowed; }
.kachel .bild { width: 100%; height: 42px; display: grid; place-items: center; pointer-events: none; }
.kachel .bild svg { max-width: 100%; max-height: 42px; }

/* Farbe fuer das NAECHSTE Modul, unter den Kacheln: Farbe und Modul sind
   gewaehlt, bevor gezogen wird - so geht ein Modul nach dem anderen, ohne
   nach jedem Setzen eine Auswahl wegzuklicken. Unter, nicht ueber den
   Kacheln: die Kacheln bleiben naeher an der Buehne (kuerzerer Zug), die
   Punkte im Daumenbereich. Am Rechner alle dreizehn in einer Zeile. Am
   Handy reicht die Breite dafuer nur mit 22-px-Punkten - seit 02.10.2026
   (Kacheln ohne Name und Preis, also Hoehe frei) stattdessen zwei Reihen
   zu 7 + 6 Punkten mit 34 px. */
.setzen { display: grid; gap: 8px; }
.farbleiste {
  display: flex;
  gap: 6px;
  justify-content: center;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}
.farbleiste .farbe {
  flex: 0 1 30px;
  width: auto;
  height: auto;
  min-width: 0;
  aspect-ratio: 1;
}
.farbleiste .farbe::after { inset: -3px; }
.farbleiste .farbe[aria-checked="true"] { outline-width: 2px; }

.farbe {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, .18);
  cursor: pointer;
  padding: 0;
  position: relative;
}
/* Das Tippziel ist groesser als der Punkt - sonst trifft am Handy keiner
   die Farbe, die er meint. */
.farbe::after { content: ""; position: absolute; inset: -5px; }
.farbe[aria-checked="true"] { outline: 3px solid var(--accent); outline-offset: 2px; }

.farbname { text-align: center; margin-bottom: -2px; min-height: 1.2em; }

/* Am gewaehlten Modul: zwei lange, gebogene Drehpfeile um die Endzellen
   (02.10.2026), als SVG ueber der 3D-Ansicht, je Bild nachgefuehrt. Leise:
   eine duenne Linie in der Akzentfarbe mit hellem Saum. Getippt wird auf
   einen breiten, unsichtbaren Streifen entlang des Bogens (`.fang`). */
.dreh-ebene { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.dreh-pfeil { cursor: pointer; }
.dreh-pfeil path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.dreh-pfeil .saum { stroke: rgba(255, 255, 255, .85); stroke-width: 6; }
.dreh-pfeil .linie { stroke: var(--accent); stroke-width: 2.5; }
.dreh-pfeil .spitze { fill: var(--accent); stroke: rgba(255, 255, 255, .85); stroke-width: 1.5; }
.dreh-pfeil .fang { stroke: transparent; stroke-width: 34; pointer-events: stroke; }
.dreh-pfeil:hover .linie { stroke-width: 3.5; }

/* Trenner am gewaehlten Modul: ueber der 3D-Ansicht, an den Engstellen.
   Die Ebene selbst laesst jeden Zeiger durch, nur die Griffe nicht - sonst
   waere die Buehne darunter tot.

   Die Zahl der Trenner ist fest, nur die Lage waehlbar. Darum EIN kleines
   Symbol fuer "steckt hier" und "kann hier stecken" (Tobias, 02.10.2026):
   es soll nur andeuten, dass das Teil auch woanders sein kann. Welcher
   steckt, sieht man am Trenner selbst. Nur die gesteckten nehmen den
   Finger an, mit unsichtbar grosser Tippflaeche; beim Ziehen leuchten die
   freien als Ziel auf. */
.fugen { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.fuge {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: rgba(255, 255, 255, .85);
  padding: 0;
  pointer-events: none;
  touch-action: none;
  /* heller Saum, damit die Marke auch auf dunklen Modulen lesbar ist */
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .7);
  transition: width .12s, height .12s, margin .12s, background .12s;
}
.fuge.besetzt { pointer-events: auto; cursor: grab; }
.fuge.besetzt::after { content: ""; position: absolute; inset: -15px; }   /* 44 px Tippziel */
.fuge.geist { z-index: 2; width: 20px; height: 20px; margin: -10px 0 0 -10px; background: var(--accent); box-shadow: 0 0 0 2px rgba(255, 255, 255, .8), 0 3px 10px rgba(0, 0, 0, .25); }
.fuge.quelle { opacity: .3; }
.steckt-um .fuge.frei { width: 24px; height: 24px; margin: -12px 0 0 -12px; }
.steckt-um .fuge.frei.ziel { width: 30px; height: 30px; margin: -15px 0 0 -15px; background: rgba(46, 74, 115, .45); }

.ablage {
  max-width: 720px;
  margin: 0 auto;
  min-height: 72px;
  display: grid;
  place-items: center;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}
.ablage.aktiv { border-color: var(--danger); color: var(--danger); background: #fbeceb; }

/* Das gehaltene Modul ueber dem Dock (zeigeTraeger in konfigurator.js). */
.traeger { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; overflow: visible; }
.traeger .schatten { fill: rgba(0, 0, 0, .3); transform: translate(2px, 4px); }
.traeger .rand { fill: var(--danger); }

@media (max-width: 560px) {
  .farbe { width: 30px; height: 30px; }
  /* 7 Punkte zu 34 px + 6 Luecken zu 10 px = 298 px je Reihe */
  .farbleiste { flex-wrap: wrap; gap: 8px 10px; max-width: 300px; }
  .farbleiste .farbe { flex: 0 0 34px; }
  .farbleiste .farbe::after { inset: -4px; }
}
