/*
 * gesten.css — Einblendungen der Gestensteuerung
 * Hand-Cursor, Statuszeile, Onboarding-Hinweis, Debug-Panel.
 *
 * Alles liegt über der Bühne und wird NICHT mitskaliert — die Maße stehen
 * daher in Viewport-Pixeln, nicht im 1920er Raster.
 *
 * Mirko Psak, MP Media
 */

.gesten {
    position: fixed;
    inset: 0;
    z-index: 1000;
    pointer-events: none;
    font-family: 'Reutlingen Sans', sans-serif;
}

/* Das Kamerabild selbst wird nie gezeigt — aber auch nie auf display:none
   gesetzt, sonst drosselt der Browser die Bildrate. */
.gesten__video {
    position: absolute;
    width: 2px;
    height: 2px;
    opacity: 0;
    pointer-events: none;
}

/* ---------------------------------------------
   HAND-CURSOR
--------------------------------------------- */

.gesten__cursor {
    position: absolute;
    top: 0;
    left: 0;
    width: 86px;
    height: 86px;
    will-change: transform;
    transition: width 0.25s ease, height 0.25s ease;
}

.gesten__cursor[hidden] { display: none; }

.gesten__ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);          /* Füllung beginnt oben */
    overflow: visible;
}

.gesten__ring circle {
    fill: none;
    stroke-linecap: round;
    stroke-width: 5;
}

.gesten__ring-bahn  { stroke: rgba(0, 0, 0, 0.22); }
.gesten__ring-fuell {
    stroke: #fff;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
    transition: stroke 0.2s ease;
}

.gesten__punkt {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease, background 0.2s ease;
}

/* Über einer Karte: Cursor wird kompakter und bekommt mehr Kontrast */
.gesten__cursor--auf-karte              { width: 70px; height: 70px; }
.gesten__cursor--auf-karte .gesten__punkt { transform: scale(0.6); }
.gesten__cursor--auf-karte .gesten__ring-bahn { stroke: rgba(0, 0, 0, 0.35); }

/* Offene Hand: der Ring füllt sich bis zum Zuklappen */
.gesten__cursor--hand .gesten__punkt { transform: scale(1.9); background: var(--rot, #FF0050); }
.gesten__cursor--hand .gesten__ring-fuell { stroke: var(--rot, #FF0050); }

/* Finger ist unten — direkte Rückmeldung beim Tippen */
.gesten__cursor--tippt .gesten__punkt { transform: scale(0.45); background: var(--gelb, #FFF000); }
.gesten__cursor--tippt .gesten__ring-bahn { stroke: var(--gelb, #FFF000); }

/* Auswahl gemerkt, während die Hand sich dreht */
.gesten__cursor--gehalten .gesten__punkt { background: var(--gelb, #FFF000); }

/* Ausgelöst: der Ring läuft als Impuls nach außen aus */
.gesten__cursor--ausgeloest .gesten__ring {
    animation: gesten-ring-puls 0.4s ease-out;
}

@keyframes gesten-ring-puls {
    0%   { transform: rotate(-90deg) scale(1);    opacity: 1; }
    100% { transform: rotate(-90deg) scale(1.75); opacity: 0; }
}

/* ---------------------------------------------
   STATUSZEILE
--------------------------------------------- */

.gesten__status {
    position: absolute;
    left: 24px;
    bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px 9px 13px;
    border-radius: 2rem;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 15px;
    line-height: 1;
    opacity: 0.85;
    transition: opacity 0.6s ease;
}

/* Nach ein paar Sekunden zurücknehmen — am Stand soll die Zeile nicht stören */
.gesten__status--ruhig { opacity: 0.18; }

.gesten__status--klickbar {
    pointer-events: auto;
    cursor: pointer;
    background: var(--rot, #FF0050);
    color: #000;
    opacity: 1 !important;
}

.gesten__lampe {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: currentColor;
}

.gesten__status[data-zustand="startet"] .gesten__lampe { background: var(--gelb, #FFF000);  animation: gesten-blinken 1s ease-in-out infinite; }
.gesten__status[data-zustand="bereit"]  .gesten__lampe { background: var(--gelb, #FFF000); }
.gesten__status[data-zustand="hand"]    .gesten__lampe { background: var(--gruen, #50C878); }
.gesten__status[data-zustand="fehler"]  .gesten__lampe { background: #000; }

@keyframes gesten-blinken {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.25; }
}

/* ---------------------------------------------
   ONBOARDING-HINWEIS
--------------------------------------------- */

.gesten__hinweis {
    position: absolute;
    left: 50%;
    bottom: 9vh;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 28px;
    background: #fff;
    color: #000;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.01em;
    animation: gesten-hinweis-rein 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.gesten__hinweis[hidden] { display: none; }

.gesten__hand {
    font-size: 32px;
    animation: gesten-winken 1.8s ease-in-out infinite;
    transform-origin: 50% 80%;
}

@keyframes gesten-winken {
    0%, 60%, 100% { transform: rotate(0deg); }
    15%           { transform: rotate(-16deg); }
    30%           { transform: rotate(14deg); }
    45%           { transform: rotate(-10deg); }
}

@keyframes gesten-hinweis-rein {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------------------------------------------
   DEBUG-PANEL (Taste D)
--------------------------------------------- */

.gesten__debug {
    position: absolute;
    right: 20px;
    bottom: 20px;
    display: flex;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
}

.gesten__debug[hidden] { display: none; }

.gesten__canvas {
    width: 320px;
    height: 240px;
    display: block;
    background: #000;
}

.gesten__werte {
    margin: 0;
    font-family: ui-monospace, Consolas, monospace;
    font-size: 12px;
    line-height: 1.55;
    white-space: pre;
    min-width: 230px;
}

@media (prefers-reduced-motion: reduce) {
    .gesten__hand,
    .gesten__status[data-zustand="startet"] .gesten__lampe,
    .gesten__cursor--ausgeloest .gesten__ring { animation: none; }
}
