/* Vertriebstrainer: eigenes Kamerabild mit Mimik-Leiste (tk-) und Tafel für die Skizze (tt-).
   Hell wie die Zentrale, Türkis nur als Akzent, Farben ausschließlich über die Tokens aus
   styles.css. Beide Module hängen diese Datei selbst ein, die Seite muss nichts tun. */

/* ---------------------------------------------------------------- Kamera */

/* Das eigene Bild gespiegelt, so kennt man sich aus dem Spiegel und Bewegungen fühlen sich
   richtig an. Gemessen und als Schnappschuss verschickt wird das ungespiegelte Bild. */
.tk-spiegel {
  transform: scaleX(-1);
}

.tk-kachel {
  display: grid;
  min-width: 0;
  padding: 6px;
  border-radius: var(--radius-l);
  background: var(--flaeche);
  box-shadow: var(--schatten-1);
}

.tk-bild {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: calc(var(--radius-l) - 6px);
  background: var(--nacht);
}

.tk-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tk-hinweis {
  position: absolute;
  bottom: 10px;
  left: 10px;
  max-width: calc(100% - 20px);
  margin: 0;
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in oklch, var(--nacht) 72%, transparent);
  color: var(--flaeche);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.tk-hinweis[hidden] {
  display: none;
}

.tk-leiste {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 10px 8px 6px;
}

.tk-wert {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.tk-name {
  overflow: hidden;
  color: var(--tinte-2);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tk-bahn {
  position: relative;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--flaeche-3);
}

.tk-fuellung {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--marke-tief);
  transform: scaleX(var(--tk-wert, 0));
  transform-origin: left center;
  transition: transform 420ms var(--ease-out);
}

/* Solange nichts gemessen wird, bleiben die Balken blass: kein Wert heißt nicht „schlecht“. */
.tk-kachel:not([data-zustand='laeuft']) .tk-fuellung {
  opacity: 0.35;
}

/* ---------------------------------------------------------------- Tafel */

.tt-tafel {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.tt-leiste {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 5px;
  border-radius: var(--radius-m);
  background: var(--flaeche);
  box-shadow: var(--schatten-1);
}

.tt-titel {
  margin-right: auto;
  padding: 0 8px;
  overflow: hidden;
  color: var(--tinte);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tt-gruppe {
  display: flex;
  align-items: center;
  gap: 2px;
}

.tt-knopf {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--tinte-2);
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    background-color 140ms ease,
    color 140ms ease;
}

.tt-knopf svg {
  width: 20px;
  height: 20px;
}

@media (hover: hover) {
  .tt-knopf:hover:not(:disabled) {
    background: var(--flaeche-3);
    color: var(--tinte);
  }
}

.tt-knopf[aria-pressed='true'] {
  background: var(--marke-zart);
  color: var(--marke-tief);
}

.tt-knopf:disabled {
  opacity: 0.35;
  cursor: default;
}

.tt-knopf:focus-visible {
  outline: 2px solid var(--marke-tief);
  outline-offset: 1px;
}

.tt-tupfer {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--tt-farbe);
  box-shadow: inset 0 0 0 1px var(--haarlinie);
}

.tt-farbe-tinte {
  --tt-farbe: var(--tinte);
}

.tt-farbe-tuerkis {
  --tt-farbe: var(--marke-tief);
}

.tt-farbe-rot {
  --tt-farbe: var(--rot);
}

/* Strichstärke als Punkt in passender Größe */
.tt-punkt {
  width: var(--tt-groesse);
  height: var(--tt-groesse);
  border-radius: 50%;
  background: currentColor;
}

.tt-fein {
  --tt-groesse: 4px;
}

.tt-kraeftig {
  --tt-groesse: 10px;
}

/* Radierer als kleine Form aus CSS: ein schräger Block mit gefülltem Ende */
.tt-radierer {
  width: 17px;
  height: 10px;
  border: 1.8px solid currentColor;
  border-radius: 3px;
  background: linear-gradient(90deg, currentColor 0 36%, transparent 36%);
  transform: rotate(-35deg);
}

.tt-flaeche {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius-m);
  background: var(--flaeche);
  box-shadow: var(--schatten-1);
}

.tt-leinwand {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.tt-tafel[data-werkzeug='radierer'] .tt-leinwand {
  cursor: cell;
}

.tt-leinwand:focus-visible {
  outline: 2px solid var(--marke-tief);
  outline-offset: -2px;
}

.tt-leerhinweis {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 16px;
  color: var(--tinte-3);
  font-size: 14px;
  text-align: center;
  pointer-events: none;
}

.tt-leerhinweis[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .tk-fuellung,
  .tt-knopf {
    transition: none;
  }
}
