/* Praxis Remote-Support – gemeinsames Stylesheet
   Im ComService Corporate Design (Logo: Blau #055da9, Orange #e94e1d, Dunkel #1d1d1b).
   Praxis-Seite: hell, ruhig, große Bedienelemente (Nutzung unter Stress).
   Supporter-Konsole: dunkel, Bild im Mittelpunkt.
   Signalfarbe der Marker: CI-Orange – auf Live-Video maximal sichtbar. */

:root {
  /* ComService Corporate Design */
  --blue: #055da9;        /* Primärfarbe (Logo) */
  --blue-dark: #04487f;   /* gedrückt/aktiv */
  --orange: #e94e1d;      /* Akzent & Signalfarbe (Marker, Hinweise) */
  --ink: #1d1d1b;         /* Text */
  --paper: #f0f5f9;       /* heller Hintergrund (Website) */
  --line: #d3dde3;
  --red: #d64545;         /* Beenden/Fehler – bewusst von Orange abgesetzt */
  --console-bg: #0e1621;
  --console-panel: #18222e;
  --console-line: #2a3a4a;
  --console-text: #dce6ea;
}

@font-face {
  /* Hausschrift Inter – lokal gehostet, keine externen Requests (Datenschutz) */
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter.woff2") format("woff2");
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  padding: 0.7rem 1.1rem;
}
button:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.btn-primary { background: var(--blue); color: #fff; font-weight: 600; }
.btn-primary:active { background: var(--blue-dark); }
.btn-ghost { background: transparent; color: inherit; border: 1.5px solid currentColor; }
.btn-danger { background: var(--red); color: #fff; }
button:disabled { opacity: 0.45; cursor: default; }

/* ---------------- Praxis: Start / Code-Eingabe ---------------- */

.praxis-start {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  padding: 1.5rem;
  text-align: center;
}
.praxis-start h1 { font-size: 1.5rem; margin: 0; letter-spacing: -0.01em; }
.praxis-start p { margin: 0; color: #4a5d63; max-width: 26rem; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-sub {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blue);
}
.console .brand-logo { height: 30px; }
.console .brand-sub { color: #8da3ad; }
#codeInput {
  font: inherit;
  font-size: 2.2rem;
  letter-spacing: 0.5em;
  text-align: center;
  width: 11ch;
  padding: 0.5rem 0 0.5rem 0.5em; /* gleicht letter-spacing aus */
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
#codeInput:focus { border-color: var(--blue); outline: none; }
.praxis-start .btn-primary { font-size: 1.15rem; padding: 1rem 2rem; width: 100%; max-width: 22rem; }
.hint { font-size: 0.85rem; color: #6b7d83; }
.permhint {
  background: #e7f0f8;
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  font-size: 0.98rem;
  line-height: 1.4;
  color: #23323a;
  max-width: 24rem;
  margin: 0;
  text-align: left;
}
.permhint strong { color: var(--blue); }
.error { color: var(--red); font-weight: 600; min-height: 1.3em; margin: 0; }

/* ---------------- Live-Ansicht (beide Seiten) ---------------- */

.stage-wrap {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #000;
}
.stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  touch-action: manipulation;
}
.stage video, .stage canvas.freeze {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
canvas.freeze { display: none; }
.stage.frozen canvas.freeze { display: block; }

.overlay { position: absolute; inset: 0; pointer-events: none; }

.marker {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
}
.marker-ring {
  position: absolute;
  inset: 0;
  border: 4px solid var(--orange);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.55), inset 0 0 0 2px rgba(0,0,0,0.55);
  animation: pulse 1.4s ease-out infinite;
}
.marker-n {
  background: var(--orange);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
@keyframes pulse {
  0%   { transform: scale(0.75); opacity: 1; }
  100% { transform: scale(1.25); opacity: 0.25; }
}
@media (prefers-reduced-motion: reduce) {
  .marker-ring { animation: none; }
}

/* Statuszeile + Anweisungsbanner */
.statusbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 0.5rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff;
  font-size: 0.85rem;
  background: linear-gradient(rgba(0,0,0,0.55), transparent);
  pointer-events: none;
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--orange); flex: none; }
.dot.live { background: #3ddc84; }

.instruction {
  position: absolute;
  left: 50%;
  bottom: 5.5rem;
  transform: translateX(-50%);
  max-width: min(92%, 34rem);
  background: rgba(17, 24, 29, 0.92);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.35;
  padding: 0.8rem 1.1rem;
  border-left: 5px solid var(--orange);
  border-radius: 10px;
  display: none;
}
.instruction.show { display: block; }

.freeze-badge {
  position: absolute;
  top: 2.6rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--orange);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  display: none;
}
.stage.frozen ~ .freeze-badge, .stage.frozen .freeze-badge { display: block; }

/* Bedienleiste unten */
.toolbar {
  flex: none;
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem;
  padding-bottom: calc(0.6rem + env(safe-area-inset-bottom));
  background: var(--console-bg);
  color: var(--console-text);
  align-items: center;
}
.toolbar button { flex: 1; min-height: 52px; font-weight: 600; }
.toolbar .btn-ghost { border-color: var(--console-line); color: var(--console-text); }
.toolbar .btn-ghost.active { background: var(--orange); border-color: var(--orange); color: #fff; }

/* ---------------- Supporter-Konsole ---------------- */

body.console { background: var(--console-bg); color: var(--console-text); }
.console .stage { cursor: crosshair; }

.console-side {
  flex: none;
  background: var(--console-panel);
  border-top: 1px solid var(--console-line);
  padding: 0.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.console-side input[type="text"] {
  flex: 1 1 16rem;
  font: inherit;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--console-line);
  background: var(--console-bg);
  color: var(--console-text);
}
.console-side input:focus { border-color: var(--blue); outline: none; }

.session-card {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
  padding: 2rem;
}
.session-code {
  font-size: 3.4rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--orange);
  font-variant-numeric: tabular-nums;
}
.session-card .link {
  color: var(--console-text);
  background: var(--console-panel);
  border: 1px solid var(--console-line);
  border-radius: 10px;
  padding: 0.6rem 1rem;
  word-break: break-all;
  font-size: 0.9rem;
}
.session-card p { color: #8da3ad; margin: 0; max-width: 30rem; }

/* Fix: hidden-Attribut darf nicht von display:flex überschrieben werden */
[hidden] { display: none !important; }

/* Marker im „verloren“-Zustand (Tracking-Ziel nicht im Bild) */
.marker.lost { opacity: 0.35; }
.marker.lost .marker-ring { animation: none; border-style: dashed; }
