/* Praxis Remote-Support – gemeinsames Stylesheet
   Praxis-Seite: hell, ruhig, große Bedienelemente (Nutzung unter Stress).
   Supporter-Konsole: dunkel, Bild im Mittelpunkt.
   Signalfarbe der Marker: Amber – auf Live-Video maximal sichtbar. */

:root {
  --teal: #0f8f85;
  --teal-dark: #0a6b63;
  --ink: #15252b;
  --paper: #f6f8f8;
  --line: #d5dee0;
  --amber: #ffb020;
  --red: #d64545;
  --console-bg: #11181d;
  --console-panel: #1a242b;
  --console-line: #2b3a43;
  --console-text: #dce6ea;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 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(--amber); outline-offset: 2px; }
.btn-primary { background: var(--teal); color: #fff; font-weight: 600; }
.btn-primary:active { background: var(--teal-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 {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
}
#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(--teal); 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; }
.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(--amber);
  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(--amber);
  color: #20180a;
  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(--amber); 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(--amber);
  border-radius: 10px;
  display: none;
}
.instruction.show { display: block; }

.freeze-badge {
  position: absolute;
  top: 2.6rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--amber);
  color: #20180a;
  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(--amber); border-color: var(--amber); color: #20180a; }

/* ---------------- 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(--teal); 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(--amber);
  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; }
[hidden] { display: none !important; }
