/* Poper Chat – Traubenlila Bühne, Kaugummi für Start, Zitrone für Weiter. */

@font-face {
  font-family: 'Bricolage';
  src: url(/fonts/bricolage-latin.woff2) format('woff2-variations');
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Bricolage';
  src: url(/fonts/bricolage-latin-ext.woff2) format('woff2-variations');
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --grape: #1A1029;
  --plum: #2A1B40;
  --plum-2: #3B2858;
  --gum: #FF4D94;
  --lemon: #FFD43B;
  --mint: #33E1A1;
  --cream: #FFF3E3;
  --lilac: #B7A6D6;
  --alert: #FF6B5E;

  --font: 'Bricolage', ui-rounded, system-ui, sans-serif;
  --step--1: .8125rem;   /* 13 */
  --step-0: 1rem;        /* 16 */
  --step-1: 1.25rem;     /* 20 */
  --step-2: 1.5625rem;   /* 25 */
  --step-3: 1.953rem;    /* 31 */
  --step-5: 3.05rem;     /* 49 */

  --r-stage: 28px;
  --r-pill: 999px;
  --controls-h: 92px;
  --bar-h: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease-pop: cubic-bezier(.34, 1.56, .64, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.45;
  font-weight: 420;
  color: var(--cream);
  background: var(--grape);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid var(--lemon); outline-offset: 3px; border-radius: 8px; }
a { color: var(--lemon); }

/* ─── Wortmarke ─── */
.wordmark {
  font-weight: 800;
  font-stretch: 78%;
  font-size: clamp(4rem, 18vw, 7.5rem);
  line-height: .85;
  letter-spacing: -.035em;
  display: inline-flex;
  align-items: flex-end;
  gap: .05em;
}
.wordmark .dot {
  width: .2em; height: .2em; border-radius: 50%;
  background: var(--gum);
  margin-bottom: .08em;
  box-shadow: .28em -.22em 0 -.05em var(--lemon), .5em -.5em 0 -.08em var(--mint);
}
.wordmark-sm { font-size: 1.75rem; }

/* ─── Allgemeine Bausteine ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: 0 1.4em;
  border-radius: var(--r-pill);
  font-weight: 650; font-size: var(--step-0);
  transition: transform .15s, filter .15s, background-color .15s;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.btn-wide { width: 100%; }
.btn-gum { background: var(--gum); color: #2A0716; }
.btn-lemon { background: var(--lemon); color: #2B2100; }
.btn-alert { background: var(--alert); color: #2B0703; }
.btn-ghost { background: var(--plum-2); color: var(--cream); }
.btn-gum:hover, .btn-lemon:hover, .btn-alert:hover { filter: brightness(1.08); }
.link { color: var(--lemon); text-decoration: underline; text-underline-offset: 3px; font-weight: 550; }
.error { color: var(--alert); font-size: var(--step--1); min-height: 1.2em; font-weight: 550; }

.field { display: flex; flex-direction: column; gap: 6px; border: 0; }
.field > span, .field > legend { font-size: var(--step--1); color: var(--lilac); font-weight: 550; margin-bottom: 6px; }
select, input[type=text], textarea {
  width: 100%;
  background: var(--grape);
  border: 2px solid var(--plum-2);
  border-radius: 14px;
  padding: 12px 14px;
  min-height: 48px;
  outline: none;
  transition: border-color .15s;
}
select:focus, input:focus, textarea:focus { border-color: var(--lemon); }
select option { background: var(--plum); }
textarea { resize: vertical; min-height: 64px; }

/* ─── Start-Bildschirme ─── */
.screen {
  min-height: 100dvh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 28px;
  padding: 40px 20px calc(32px + var(--safe-b));
}
.intro { text-align: center; max-width: 30ch; }
.lede { font-size: var(--step-1); color: var(--lilac); margin-top: 18px; font-weight: 450; }
.panel {
  width: min(100%, 420px);
  background: var(--plum);
  border-radius: var(--r-stage);
  padding: 24px;
  display: flex; flex-direction: column; gap: 18px;
}
.adult {
  font-weight: 700; font-size: var(--step-1);
  color: var(--lemon);
}
.dob { display: grid; grid-template-columns: 1fr 1.5fr 1.1fr; gap: 8px; }
.dob select, .dob input { padding-left: 12px; padding-right: 8px; min-width: 0; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: var(--step--1); color: var(--lilac); line-height: 1.5; }
.check input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--gum); flex-shrink: 0; }
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; font-size: var(--step--1); }
.legal-links .link { color: var(--lilac); }

.mirror {
  position: relative;
  width: min(78vw, 300px);
  aspect-ratio: 3 / 4;
  border-radius: var(--r-stage);
  overflow: hidden;
  background: var(--plum);
  border: 3px solid var(--gum);
}
.mirror video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.mirror-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--lilac); }
.ready-copy { width: min(100%, 420px); display: flex; flex-direction: column; gap: 12px; text-align: center; }
.ready-copy h2 { font-size: var(--step-3); font-weight: 800; font-stretch: 85%; line-height: 1.05; letter-spacing: -.01em; }
.ready-copy p { color: var(--lilac); }

/* ─── App ─── */
.app {
  height: 100dvh;
  display: grid;
  grid-template-rows: var(--bar-h) minmax(0, 1fr) calc(var(--controls-h) + var(--safe-b));
  grid-template-areas: "bar" "stage" "controls";
  position: relative;
  overflow: hidden;
}
.bar {
  grid-area: bar;
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px;
}
.bar .wordmark-sm { margin-right: auto; }
.online { display: inline-flex; align-items: center; gap: 8px; font-size: var(--step--1); font-weight: 600; color: var(--mint); font-variant-numeric: tabular-nums; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 0 rgba(51,225,161,.5); animation: pulse 2.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(51,225,161,0); } 100% { box-shadow: 0 0 0 0 rgba(51,225,161,0); } }
.shield { display: inline-flex; align-items: center; gap: 4px; font-size: var(--step--1); color: var(--lilac); font-weight: 550; }
.shield svg { width: 16px; height: 16px; }
.shield[data-mode=on] { color: var(--mint); }
.shield[data-mode=on] svg { fill: rgba(51,225,161,.25); }
.shield[data-mode=off] { color: var(--alert); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--cream); margin-right: -8px; }
.icon-btn svg { fill: currentColor; stroke: none; width: 20px; height: 20px; }

/* Bühne mit dem Video der anderen Person */
.stage {
  grid-area: stage;
  position: relative;
  margin: 0 8px;
  border-radius: var(--r-stage);
  overflow: hidden;
  background: var(--plum);
  isolation: isolate;
}
#remote {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background: var(--plum);
  opacity: 0;
  transition: opacity .3s, filter .3s;
}
.app[data-state=live] #remote { opacity: 1; }
#remote.veiled { filter: blur(48px) saturate(.4); transform: scale(1.15); }

.stage-msg {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  color: var(--lilac);
}
.stage-msg .big {
  font-size: var(--step-3);
  font-weight: 800; font-stretch: 82%;
  line-height: 1.02; letter-spacing: -.015em;
  color: var(--cream);
  max-width: 14ch;
}
.stage-msg p:not(.big) { max-width: 30ch; }
.app[data-state=idle] #msgIdle,
.app[data-state=searching] #msgSearch,
.app[data-state=connecting] #msgSearch,
.app[data-state=banned] #msgBanned { display: flex; }

/* Die eine Bewegung: Blasen, solange gesucht wird */
.rings { position: relative; width: 132px; height: 132px; margin-bottom: 8px; }
.rings span {
  position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid var(--gum);
  animation: ring 2.4s cubic-bezier(.2,.6,.3,1) infinite;
  opacity: 0;
}
.rings span:nth-child(2) { animation-delay: .8s; border-color: var(--lemon); }
.rings span:nth-child(3) { animation-delay: 1.6s; border-color: var(--mint); }
@keyframes ring { 0% { transform: scale(.2); opacity: 1; } 100% { transform: scale(1); opacity: 0; } }

.veil {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 24px; text-align: center;
  background: rgba(26,16,41,.55);
}
.veil .big { font-size: var(--step-3); font-weight: 800; font-stretch: 82%; line-height: 1; }
.veil p:not(.big) { color: var(--lilac); }
.veil-actions { display: flex; gap: 10px; margin-top: 8px; }

.tags { position: absolute; top: 12px; left: 12px; z-index: 2; display: flex; gap: 6px; }
.tag {
  background: rgba(26,16,41,.7);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-radius: var(--r-pill);
  padding: 4px 12px;
  font-size: var(--step--1); font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Eigenes Bild als kleines Fenster */
.self {
  position: absolute; z-index: 4;
  top: 12px; right: 12px;
  width: clamp(92px, 27vw, 150px);
  aspect-ratio: 3 / 4;
  border-radius: 18px;
  overflow: hidden;
  border: 2px solid var(--cream);
  background: var(--grape);
  box-shadow: 0 10px 30px rgba(10,4,20,.45);
}
.self video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.self.back video { transform: none; }

/* Leiste mit Aktionen am rechten Rand, wie man sie vom Handy kennt */
.rail {
  position: absolute; z-index: 2;
  right: 10px; bottom: 14px;
  display: none; flex-direction: column; gap: 14px;
}
.app[data-state=live] .rail, .app[data-state=connecting] .rail { display: flex; }
.rail-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: 58px;
  font-size: 11px; font-weight: 600; letter-spacing: .01em;
  color: var(--cream);
  text-shadow: 0 1px 6px rgba(0,0,0,.6);
}
.rail-btn svg {
  box-sizing: content-box;
  width: 22px; height: 22px; padding: 12px;
  border-radius: 50%;
  background: rgba(26,16,41,.62);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform .15s var(--ease-pop), background-color .15s;
}
.rail-btn:active svg { transform: scale(.88); }
#reportBtn svg { color: var(--alert); }
.rail-chat[aria-expanded=true] svg { background: var(--cream); color: var(--grape); }

.toast {
  position: absolute; z-index: 4;
  left: 50%; top: 14px; transform: translate(-50%, -8px);
  background: var(--cream); color: var(--grape);
  font-weight: 650; font-size: var(--step--1);
  padding: 8px 16px; border-radius: var(--r-pill);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Chat: auf dem Handy über dem Video, am Computer daneben */
.talk {
  position: absolute; z-index: 5;
  left: 20px; right: 84px;
  bottom: calc(var(--controls-h) + var(--safe-b) + 14px);
  max-height: 42%;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.log {
  list-style: none;
  display: flex; flex-direction: column; gap: 6px;
  overflow-y: auto;
  -webkit-mask-image: linear-gradient(transparent, #000 30%);
  mask-image: linear-gradient(transparent, #000 30%);
  pointer-events: auto;
  padding-top: 24px;
}
.log li {
  max-width: 85%;
  padding: 7px 13px;
  border-radius: 18px;
  font-size: .9375rem; line-height: 1.35;
  overflow-wrap: anywhere;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.log .them { align-self: flex-start; background: rgba(26,16,41,.72); border-bottom-left-radius: 6px; }
.log .me { align-self: flex-end; background: var(--gum); color: #2A0716; font-weight: 520; border-bottom-right-radius: 6px; }
.log .sys { align-self: center; background: none; backdrop-filter: none; color: var(--cream); opacity: .8; font-size: var(--step--1); text-shadow: 0 1px 6px rgba(0,0,0,.7); }
.composer { display: none; gap: 8px; pointer-events: auto; }
.app.chat-open .composer { display: flex; }
.composer input { flex: 1; border-radius: var(--r-pill); background: rgba(26,16,41,.86); border-color: transparent; }
.send { width: 48px; height: 48px; flex-shrink: 0; border-radius: 50%; background: var(--gum); color: #2A0716; display: grid; place-items: center; }
.send svg { width: 20px; height: 20px; }
.send:disabled { opacity: .35; }

/* Steuerung unten */
.controls {
  grid-area: controls;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 12px calc(14px + var(--safe-b));
}
.btn-stop {
  width: 64px; height: 64px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--plum-2); color: var(--cream);
  display: grid; place-items: center;
  transition: transform .15s, opacity .15s;
}
.btn-stop svg { fill: currentColor; stroke: none; }
.btn-stop:disabled { opacity: .3; }
.btn-stop:active:not(:disabled) { transform: scale(.92); }

/* Das Herzstück: die große Taste */
.btn-main {
  flex: 1; height: 64px;
  border-radius: var(--r-pill);
  background: var(--gum); color: #2A0716;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  font-weight: 800; font-stretch: 75%;
  font-size: 2rem; letter-spacing: -.01em; line-height: 1;
  transition: background-color .2s, transform .35s var(--ease-pop);
}
.btn-main:active { transform: scale(.94); transition-duration: .08s; }
.app[data-state=live] .btn-main,
.app[data-state=connecting] .btn-main,
.app[data-state=searching] .btn-main { background: var(--lemon); color: #2B2100; }
.app[data-state=searching] .btn-main { opacity: .55; }
.app[data-state=banned] .btn-main { background: var(--plum-2); color: var(--lilac); }
.btn-main:disabled { cursor: not-allowed; }
.hint {
  display: none;
  font: 600 12px/1 var(--font); font-stretch: 100%;
  padding: 4px 7px; border-radius: 6px;
  border: 1.5px solid currentColor; opacity: .65;
}
.btn-main.popped { animation: pop .45s var(--ease-pop); }
@keyframes pop { 0% { transform: scale(.9); } 100% { transform: scale(1); } }

/* ─── Dialoge ─── */
dialog { color: var(--cream); border: 0; }
dialog::backdrop { background: rgba(12,6,22,.7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sheet {
  margin: auto auto 0;
  width: 100%; max-width: 520px;
  background: var(--plum);
  border-radius: var(--r-stage) var(--r-stage) 0 0;
  padding: 0;
}
.sheet-inner { display: flex; flex-direction: column; gap: 16px; padding: 24px 20px calc(20px + var(--safe-b)); }
.sheet h2 { font-size: var(--step-2); font-weight: 800; font-stretch: 85%; line-height: 1.1; }
.sheet p { color: var(--lilac); }
.choices { display: flex; flex-direction: column; gap: 4px; }
.choices label { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; cursor: pointer; }
.choices label:hover { background: var(--plum-2); }
.choices input { width: 20px; height: 20px; accent-color: var(--alert); }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.menu-links { display: flex; flex-direction: column; }
.menu-link { text-align: left; padding: 14px 4px; border-bottom: 1px solid var(--plum-2); font-weight: 550; }

.doc {
  margin: auto;
  width: min(100% - 24px, 680px);
  max-height: min(100dvh - 24px, 900px);
  background: var(--cream); color: var(--grape);
  border-radius: var(--r-stage);
  padding: 0;
}
.doc article { padding: 32px 24px 36px; }
.doc h1 { font-size: var(--step-3); font-weight: 800; font-stretch: 82%; line-height: 1.05; margin-bottom: 20px; padding-right: 44px; }
.doc h2 { font-size: var(--step-0); font-weight: 750; margin: 22px 0 6px; }
.doc p, .doc li { line-height: 1.6; max-width: 68ch; }
.doc ul { padding-left: 20px; }
.doc a { color: #9A1A55; }
.doc-close {
  position: sticky; top: 12px; float: right;
  margin: 12px 12px 0 0;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--grape); color: var(--cream);
  font-size: 26px; line-height: 1;
}
html[lang=de] [data-only=en], html[lang=en] [data-only=de] { display: none; }

.noscript { padding: 40px; text-align: center; }

/* ─── Computer: Chat rechts, Bühne links ─── */
@media (min-width: 900px) {
  :root { --controls-h: 96px; }
  .app {
    grid-template-columns: minmax(0, 1fr) 360px;
    grid-template-rows: var(--bar-h) minmax(0, 1fr) var(--controls-h);
    grid-template-areas: "bar bar" "stage talk" "controls talk";
    column-gap: 12px;
    padding: 0 12px 0 0;
  }
  .stage { margin: 0 0 0 12px; }
  .self { width: 200px; top: auto; bottom: 16px; left: 16px; right: auto; }
  .talk {
    grid-area: talk;
    position: static;
    max-height: none;
    margin-bottom: 14px;
    background: var(--plum);
    border-radius: var(--r-stage);
    padding: 16px;
    pointer-events: auto;
  }
  .log { flex: 1; -webkit-mask-image: none; mask-image: none; padding-top: 0; }
  .log li { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .log .them { background: var(--plum-2); }
  .log .sys { color: var(--lilac); text-shadow: none; }
  .composer { display: flex; }
  .composer input { background: var(--grape); }
  .rail-chat { display: none; }
  .controls { padding: 12px 0 14px 12px; }
  .btn-main { height: 68px; font-size: 2.25rem; }
  .btn-stop { width: 68px; height: 68px; }
  .app[data-state=live] .hint, .app[data-state=connecting] .hint { display: inline-block; }
  .sheet { margin: auto; border-radius: var(--r-stage); }
}

/* Kleine Handys im Querformat */
@media (max-height: 520px) and (orientation: landscape) {
  :root { --controls-h: 72px; --bar-h: 44px; }
  .btn-main, .btn-stop { height: 52px; }
  .btn-stop { width: 52px; }
  .self { width: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .rings span { opacity: 1; transform: scale(calc(.4 + .3 * var(--i, 0))); }
}
