:root {
  --bg: #17131f;
  --surface: #221a30;
  --surface-2: #2b2140;
  --border: rgba(255, 255, 255, 0.09);
  --fg: #f7f1ec;
  --muted: #a89bb5;
  --coral: #ff6f61;
  --apricot: #ffb457;
  --teal: #63e6cf;
  --accent-grad: linear-gradient(135deg, #ff6f61 0%, #ffb457 100%);
  --glow-coral: rgba(255, 111, 97, 0.4);
  --radius: 0.9rem;
  --pill: 999px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  color: var(--fg);
  background:
    radial-gradient(55rem 55rem at 12% -12%, rgba(255, 111, 97, 0.16), transparent 60%),
    radial-gradient(45rem 45rem at 105% 112%, rgba(99, 230, 207, 0.12), transparent 55%),
    var(--bg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.stage {
  width: 100%;
  max-width: 30rem;
  text-align: center;
  animation: rise 0.7s var(--ease) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.signal {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
}

.node {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  flex: none;
}

.node--you {
  background: var(--accent-grad);
  box-shadow:
    0 0 0 0.35rem rgba(255, 111, 97, 0.14),
    0 0 1.4rem var(--glow-coral);
}

.node--peer {
  background: var(--teal);
  box-shadow:
    0 0 0 0.35rem rgba(99, 230, 207, 0.12),
    0 0 1.2rem rgba(99, 230, 207, 0.4);
}

.node--peer.is-waiting {
  background: transparent;
  border: 2px dashed rgba(99, 230, 207, 0.65);
  box-shadow: none;
  animation: breathe 1.9s ease-in-out infinite;
}

.wire {
  position: relative;
  width: 5rem;
  height: 2px;
  overflow: hidden;
  background: linear-gradient(90deg, var(--coral), var(--teal));
  opacity: 0.5;
}

.pulse {
  position: absolute;
  inset: 0 auto 0 0;
  width: 1.4rem;
  background: linear-gradient(90deg, transparent, #fff, transparent);
  animation: travel 2.2s var(--ease) infinite;
}

@keyframes travel {
  0% {
    transform: translateX(-1.6rem);
    opacity: 0;
  }
  25%,
  75% {
    opacity: 1;
  }
  100% {
    transform: translateX(5.2rem);
    opacity: 0;
  }
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

.wordmark {
  margin: 0;
  font-size: clamp(2.75rem, 9vw, 4.25rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
  background: linear-gradient(180deg, var(--fg), #d6c6e0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand {
  margin: 0 0 2rem;
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--muted);
}

.tagline {
  margin: 1rem auto 0;
  max-width: 24rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.room-title {
  margin: 0;
  font-size: clamp(1.6rem, 5vw, 2.1rem);
  font-weight: 750;
  letter-spacing: -0.02em;
}

.cta {
  display: inline-flex;
  align-items: center;
  margin-top: 2rem;
  padding: 0.9rem 1.9rem;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 650;
  color: #2a1410;
  background: var(--accent-grad);
  border: none;
  border-radius: var(--pill);
  cursor: pointer;
  box-shadow: 0 0.6rem 1.6rem var(--glow-coral);
  transition:
    transform 0.18s var(--ease),
    box-shadow 0.18s var(--ease),
    filter 0.18s var(--ease);
}

.cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.9rem 2.2rem var(--glow-coral);
  filter: saturate(1.06);
}

.cta:active {
  transform: translateY(0);
}

.hint {
  margin: 1.1rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.link-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.75rem;
}

.link-input {
  flex: 1;
  min-width: 0;
  padding: 0.8rem 0.95rem;
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, monospace;
  font-size: 0.9rem;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Copy button: quieter than the primary CTA, sits beside the link field. */
.cta--soft {
  margin-top: 0;
  padding: 0.8rem 1.25rem;
  font-size: 0.95rem;
  color: var(--fg);
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: none;
  white-space: nowrap;
}

.cta--soft:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.28);
  filter: none;
}

.cta--soft.is-copied {
  color: var(--teal);
  border-color: rgba(99, 230, 207, 0.5);
}

.ghost-link {
  display: inline-block;
  margin-top: 1.75rem;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition:
    color 0.15s,
    border-color 0.15s;
}

.ghost-link:hover {
  color: var(--fg);
  border-color: var(--muted);
}

/* Site footer: quiet copyright + Impressum link, pinned bottom-center
   so it doesn't disturb the vertically centered .stage. */
.site-footer {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.site-footer .ghost-link {
  margin-top: 0;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Impressum section heading (e.g. "Angaben gemäß § 5 DDG"). */
.section-title {
  margin: 2rem 0 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Impressum contact block. */
.contact {
  margin-top: 0.75rem;
  font-style: normal;
  color: var(--muted);
  line-height: 1.7;
}

.contact a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--muted);
  transition: color 0.15s;
}

.contact a:hover {
  color: var(--coral);
}

:where(a, button, input):focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 3px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .stage {
    animation: none;
  }
  .pulse {
    animation: none;
    opacity: 0;
  }
  .node--peer.is-waiting {
    animation: none;
  }
}

/* --- Video call --- */

/* The video/canvas nodes live in one persistent .webrtc-root so the ML
   pipeline's element references survive state changes. .call-root wraps it
   together with the state-driven .stage so the two can be laid out as one. */
.call-root {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* Waiting / connecting: the preview sits between the intro text (order 0)
   and the link/settings actions (order 3), in flow. */
.webrtc-root {
  order: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.stage--actions {
  order: 3;
  margin-top: 1.75rem;
}

.webrtc-root--call {
  order: 0;
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(60rem, calc(100vw - 3rem));
  aspect-ratio: 16 / 9;
  display: grid;
  align-items: stretch;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  gap: 0.75rem;
  pointer-events: none;
  z-index: 5;
}

.webrtc-root--strip {
  grid-template-columns: 1fr minmax(8rem, 18%);
  grid-template-rows: repeat(3, 1fr);
}

.tile {
  position: relative;
  overflow: hidden;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  color: inherit;
  background: #000;
  appearance: none;
  pointer-events: auto;
  cursor: pointer;
}

.tile:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.tile-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tile--screen .tile-media {
  object-fit: contain;
}

.tile--mirror .tile-media {
  transform: scaleX(-1);
}

.tile--focus {
  grid-column: 1;
  grid-row: 1 / -1;
}

.tile--strip {
  grid-column: 2;
  grid-row: var(--slot);
  border-radius: calc(var(--radius) * 0.7);
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.45);
}

.webrtc-root--call:not(.webrtc-root--strip) .tile--strip {
  position: absolute;
  grid-area: auto;
  right: 1rem;
  bottom: 1rem;
  width: 22%;
  min-width: 8rem;
  aspect-ratio: 4 / 3;
  z-index: 2;
}

.tile--preview {
  width: 100%;
  max-width: 22rem;
  margin-top: 1.75rem;
  aspect-ratio: 4 / 3;
  cursor: default;
}

.tile--preview .tile-media {
  transform: scaleX(-1);
}

@media (max-width: 40rem) {
  .webrtc-root--strip {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 1fr minmax(4rem, 22%);
  }

  .webrtc-root--strip .tile--focus {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .webrtc-root--strip .tile--strip {
    grid-column: var(--slot);
    grid-row: 2;
  }
}

.stage--call {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(60rem, calc(100vw - 3rem));
  max-width: none;
  aspect-ratio: 16 / 9;
  z-index: 10;
  pointer-events: none;
}

.call-frame {
  position: relative;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.tile-camera-off {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--muted);
  pointer-events: none;
  z-index: 1;
}

.tile-camera-off svg {
  width: 2rem;
  height: 2rem;
}

.cta--leave {
  margin-top: 1.25rem;
}

/* Control bar over the call frame. */
.controls {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  display: flex;
  gap: 0.85rem;
  padding: 0.6rem;
  background: rgba(23, 19, 31, 0.55);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--pill);
  pointer-events: auto;
}

.control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  color: var(--fg);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition:
    transform 0.18s var(--ease),
    background 0.18s var(--ease),
    color 0.18s var(--ease);
}

.control-btn svg {
  width: 1.3rem;
  height: 1.3rem;
}

.control-btn:hover {
  transform: translateY(-2px);
}

/* Muted / camera-off state: dimmed, clearly "disabled". */
.control-btn--off {
  color: var(--muted);
  background: var(--surface);
}

.control-btn--active {
  background: var(--accent-grad);
  color: #2a1410;
  border-color: transparent;
}

.control-btn--end {
  color: #2a1410;
  background: var(--accent-grad);
  border-color: transparent;
  box-shadow: 0 0.4rem 1.2rem var(--glow-coral);
}

.call-frame .controls {
  opacity: 1;
  transition: opacity 0.25s var(--ease);
}

.call-root.controls-hidden .webrtc-root--call .tile {
  cursor: none;
}

.call-frame.controls-hidden .controls {
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .call-frame .controls {
    transition: none;
  }
}

.settings-panel {
  position: absolute;
  right: 1rem;
  bottom: 5.2rem;
  width: min(20rem, calc(100% - 2rem));
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: rgba(23, 19, 31, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 0.8rem 2rem rgba(0, 0, 0, 0.35);
  animation: rise 0.25s var(--ease) both;
  pointer-events: auto;
  z-index: 5;
}

/* Waiting screen: the panel lives in the centered column, so it flows below
   the toggle instead of floating (that anchoring only fits the call frame). */
.settings-panel--inline {
  position: static;
  width: 100%;
  margin: 1rem auto 0;
  text-align: left;
}

/* Standalone toggle under the link row wants deliberate breathing room. */
.settings-toggle {
  margin-top: 1.5rem;
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-title {
  font-weight: 600;
  color: var(--fg);
}

.settings-close {
  width: 1.8rem;
  height: 1.8rem;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.settings-close:hover {
  color: var(--fg);
  background: var(--surface-2);
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.settings-label {
  font-size: 0.82rem;
  color: var(--muted);
}

.settings-select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  color: var(--fg);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.settings-empty {
  font-size: 0.85rem;
  color: var(--muted);
}

.settings-field--toggle {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.settings-toggle-input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--fg);
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.blur-banner {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(30rem, calc(100vw - 2rem));
  margin: 0;
  padding: 0.5rem 0.9rem;
  font-size: 0.82rem;
  line-height: 1.35;
  text-align: center;
  color: var(--fg);
  background: rgba(23, 19, 31, 0.72);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 11;
  pointer-events: none;
}

.reconnect-pill {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  font-size: 0.9rem;
  color: var(--fg);
  background: rgba(23, 19, 31, 0.55);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--pill);
  pointer-events: none;
  z-index: 4;
}

.reconnect-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--apricot);
  animation: reconnect-pulse 1.2s var(--ease) infinite;
}

@keyframes reconnect-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reconnect-dot {
    animation: none;
  }
}

/* Impressum-Link: fest unten links, stört kein Layout */
a.legal{position:fixed;left:10px;bottom:6px;z-index:5;font:12px system-ui,sans-serif;color:inherit;opacity:.55;text-decoration:none}
a.legal:hover{opacity:1;text-decoration:underline}
