/* =====================================================================
   Party und „Als Nächstes" — gemeinsame Oberfläche für Hub und Spiele
   =====================================================================

   Gehört zu js/party.js und js/weiter.js. Läuft auch in Spielen, deren
   eigene Stylesheets hier nichts zu sagen haben: Alles trägt den
   Vorsatz `pp2p-`, setzt seine Farben selbst und liegt über dem Spiel.
   ===================================================================== */

.pp2p, .pp2p * { box-sizing: border-box; }

.pp2p {
  --p-bg: #272522;
  --p-bg2: #33302b;
  --p-text: #f3efe7;
  --p-mute: #a7a195;
  --p-rand: rgba(243, 239, 231, 0.18);
  --p-taste: #f6c400;
  --p-tinte: #1c1b19;
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--p-text);
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
}

.pp2p button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-shadow: none;
  box-shadow: none;
  text-transform: none;
  letter-spacing: normal;
  transform: none;
  margin: 0;
}

.pp2p [hidden] { display: none !important; }

/* --- Tasten ------------------------------------------------------- */

.pp2p-knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--p-rand);
  border-radius: 10px;
  background: var(--p-bg2);
  font-weight: 600;
  line-height: 1.1;
}
.pp2p-knopf:hover { background: #3d3a34; }
.pp2p-knopf:focus-visible { outline: 2px solid var(--p-taste); outline-offset: 2px; }
.pp2p-knopf.pp2p-primaer {
  background: var(--p-taste);
  border-color: #9a7b00;
  color: var(--p-tinte);
}
.pp2p-knopf.pp2p-primaer:hover { background: #ffd31f; }
.pp2p-knopf:disabled { opacity: 0.5; cursor: default; }
.pp2p-knopf.pp2p-gross { width: 100%; min-height: 48px; justify-content: space-between; padding: 10px 16px; font-size: 16px; }
.pp2p-knopf svg { width: 18px; height: 18px; flex: none; }
.pp2p-knopf.pp2p-klein { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.pp2p-knopf.pp2p-leise { background: transparent; color: var(--p-mute); }

/* --- Pille (in Spielen) ---------------------------------------------- */

.pp2p-pille {
  position: fixed;
  left: max(10px, env(safe-area-inset-left));
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 99990;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 5px 12px 5px 10px;
  border: 1px solid var(--p-rand);
  border-radius: 999px;
  background: rgba(39, 37, 34, 0.88);
  backdrop-filter: blur(6px);
  color: var(--p-text);
  font-size: 13px;
  font-weight: 700;
}
.pp2p-pille:hover { background: rgba(51, 48, 43, 0.95); }
.pp2p-pille svg { width: 16px; height: 16px; flex: none; }
.pp2p-pille b { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 0.08em; }
.pp2p-pille span { color: var(--p-mute); font-weight: 600; }

/* --- Hub-Knopf ------------------------------------------------------- */

.party-knopf {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.party-knopf svg { width: 18px; height: 18px; flex: none; }
.party-knopf[data-drin="1"] { border-color: var(--taste, #f6c400); }
.party-knopf .party-code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.08em;
}
.party-knopf .party-code[data-n]:not([data-n=""])::after { content: " · " attr(data-n); }

/* Schmale Kopfzeile: nur das Symbol und der Code, ohne Zahl, damit die Sprachwahl in der Zeile bleibt. */
@media (max-width: 480px) {
  .party-knopf { padding-inline: 10px; gap: 6px; }
  .party-knopf .party-code::after { content: none !important; }
}

/* --- Fenster --------------------------------------------------------- */

.pp2p-fenster {
  position: fixed;
  z-index: 99995;
  width: min(360px, calc(100vw - 20px));
  max-height: calc(100vh - 20px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--p-rand);
  border-radius: 16px;
  background: var(--p-bg);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}
.pp2p-fenster.pp2p-hub { top: 70px; right: 14px; }
.pp2p-fenster.pp2p-spiel { left: 10px; bottom: 56px; }

.pp2p-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
}
.pp2p-kopf h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}
.pp2p-zu {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--p-mute);
  font-size: 18px;
  line-height: 1;
}
.pp2p-zu:hover { background: var(--p-bg2); color: var(--p-text); }

.pp2p-fenster p { margin: 0 0 10px; color: var(--p-mute); }
.pp2p-fenster label { display: block; margin: 0 0 4px; font-size: 12px; font-weight: 700; color: var(--p-mute); }

.pp2p-feld {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--p-rand);
  border-radius: 10px;
  background: #141312;
  color: var(--p-text);
  font: inherit;
}
.pp2p-feld:focus-visible { outline: 2px solid var(--p-taste); outline-offset: 1px; }
.pp2p-feld.pp2p-code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 18px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-align: center;
}

.pp2p-zeile { display: flex; gap: 8px; margin: 0 0 12px; }
.pp2p-zeile > .pp2p-feld { flex: 1; min-width: 0; }
.pp2p-block { margin: 0 0 14px; }
.pp2p-trenner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  color: var(--p-mute);
  font-size: 12px;
}
.pp2p-trenner::before, .pp2p-trenner::after { content: ""; flex: 1; height: 1px; background: var(--p-rand); }

.pp2p-fehler { min-height: 1.2em; margin: 0 0 8px !important; color: #ff8a7a !important; font-size: 13px; }

.pp2p-code-gross {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px dashed var(--p-rand);
  border-radius: 12px;
  background: #141312;
}
.pp2p-code-gross b {
  font: 800 24px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.22em;
  color: var(--p-taste);
}

.pp2p-leute {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}
.pp2p-leute li {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--p-bg2);
  font-size: 13px;
  font-weight: 600;
}
.pp2p-leute li.pp2p-ich { outline: 1px solid var(--p-taste); }

.pp2p-jetzt {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--p-bg2);
}
.pp2p-jetzt small { display: block; color: var(--p-mute); font-size: 12px; }
.pp2p-jetzt strong { display: block; margin: 1px 0 8px; font-size: 16px; }

.pp2p-unten { display: flex; flex-wrap: wrap; gap: 8px; }

/* --- Hinweis auf der Startseite --------------------------------------- */

.pp2p-hinweis {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--p-rand);
  border-radius: 12px;
  background: var(--p-bg);
}
.pp2p-hinweis p { margin: 0; flex: 1 1 220px; }
.pp2p-hinweis strong { color: var(--p-taste); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 0.08em; }

/* --- Meldung unten ------------------------------------------------------ */

.pp2p-meldung {
  position: fixed;
  left: 50%;
  bottom: max(56px, env(safe-area-inset-bottom));
  z-index: 99996;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(560px, calc(100vw - 20px));
  padding: 10px 10px 10px 16px;
  border: 1px solid var(--p-taste);
  border-radius: 14px;
  background: var(--p-bg);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  transform: translateX(-50%);
  animation: pp2p-hoch 0.28s ease-out;
}
.pp2p-meldung span { flex: 1; font-weight: 600; }

/* --- Als Nächstes (js/weiter.js) ----------------------------------------- */

.pp2p-weiter {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 99980;
  width: min(760px, calc(100vw - 20px));
  padding: 10px 12px 12px;
  border: 1px solid var(--p-rand);
  border-radius: 16px;
  background: rgba(28, 27, 25, 0.94);
  backdrop-filter: blur(8px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  transform: translateX(-50%);
  animation: pp2p-hoch 0.35s ease-out;
}
.pp2p-weiter .pp2p-kopf { margin-bottom: 8px; }
.pp2p-weiter .pp2p-kopf h2 { font-size: 14px; }
.pp2p-weiter-liste {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pp2p-karte {
  display: block;
  overflow: hidden;
  border: 1px solid var(--p-rand);
  border-radius: 12px;
  background: var(--p-bg2);
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s, border-color 0.15s;
}
.pp2p-karte:hover, .pp2p-karte:focus-visible { transform: translateY(-2px); border-color: var(--akzent, var(--p-taste)); outline: none; }
.pp2p-karte .pp2p-bild { display: block; aspect-ratio: 16 / 10; background: #141312; overflow: hidden; }
.pp2p-karte .pp2p-bild svg { display: block; width: 100%; height: 100%; }
.pp2p-karte .pp2p-text { display: block; padding: 6px 9px 8px; }
.pp2p-karte .pp2p-titel { display: block; font-weight: 800; font-size: 13px; line-height: 1.2; }
.pp2p-karte .pp2p-art { display: block; margin-top: 1px; color: var(--p-mute); font-size: 11px; }

@keyframes pp2p-hoch {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@media (max-width: 640px) {
  .pp2p-weiter-liste { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pp2p-weiter-liste > li:nth-child(n+4) { display: none; }
  .pp2p-karte .pp2p-art { display: none; }
  .pp2p-fenster.pp2p-hub { top: 64px; right: 10px; left: 10px; width: auto; }
}

@media (max-height: 460px) {
  .pp2p-karte .pp2p-bild { display: none; }
  .pp2p-karte .pp2p-text { padding: 8px 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .pp2p-meldung, .pp2p-weiter { animation: none; }
  .pp2p-karte { transition: none; }
}

/* --- Code wie in den Spielen: fünf Felder / fünf Kästchen -------------------- */

.pp2p-beitreten { display: flex; gap: 8px; margin: 0 0 10px; }
.pp2p-code-felder { display: flex; flex: 1; gap: 6px; min-width: 0; }
.pp2p-code-felder input {
  flex: 1;
  width: 0;
  min-width: 0;
  height: 48px;
  padding: 0;
  border: 2px solid var(--p-rand);
  border-radius: 10px;
  background: #141312;
  color: var(--p-text);
  font: 800 20px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  text-align: center;
  text-transform: uppercase;
}
.pp2p-code-felder input:focus-visible { outline: 2px solid var(--p-taste); outline-offset: 1px; border-color: var(--p-taste); }

.pp2p-kicker { margin: 0 0 6px !important; color: var(--p-mute); font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.pp2p-notiz { margin: 0 !important; font-size: 12.5px; line-height: 1.45; }
.pp2p-fenster .pp2p-code-gross {
  display: flex;
  justify-content: flex-start;
  gap: 6px;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  background: transparent;
}
.pp2p-code-gross span {
  display: grid;
  place-items: center;
  flex: 1;
  max-width: 54px;
  height: 58px;
  border: 2px solid var(--p-rand);
  border-radius: 10px;
  background: #141312;
  color: var(--p-taste);
  font: 800 26px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.pp2p-notiz + .pp2p-leute { margin-top: 12px; }

/* --- Teilen (js/teilen.js) ------------------------------------------- */

/* Grün für WhatsApp — auch an den Knöpfen der Spiele, die ihre eigene Klasse behalten. */
.pp2p-teilen-wa svg { color: #25d366; }
.pp2p-teilen-wa, .pp2p-teilen-ergebnis { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.pp2p-teilen-wa svg, .pp2p-teilen-ergebnis svg { width: 1.15em; height: 1.15em; flex: none; }
.pp2p-teilen-wa svg { stroke: none; }
.pp2p-teilen-ergebnis svg, .pp2p-teilen-ergebnis svg path { fill: none; stroke: currentColor; stroke-width: 2; }
.pp2p-teilen-wa[hidden], .pp2p-teilen-ergebnis[hidden] { display: none !important; }

.pp2p-teilen {
  position: fixed;
  inset: 0;
  z-index: 99996;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  background: rgba(10, 9, 8, 0.72);
  backdrop-filter: blur(4px);
}
.pp2p-teilen-karte {
  display: flex;
  flex-direction: column;
  width: min(420px, 100%);
  max-height: 100%;
  padding: 16px;
  border: 1px solid var(--p-rand);
  border-radius: 18px;
  background: var(--p-bg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.pp2p-teilen-bild {
  display: grid;
  place-items: center;
  flex: 1 1 auto;
  min-height: 0;
  aspect-ratio: 4 / 5;
  max-height: 62vh;
  margin: 0 auto 12px;
  border-radius: 12px;
  background: #141312;
  overflow: hidden;
}
.pp2p-teilen-canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
.pp2p-teilen-warten { color: var(--p-mute); font-size: 13px; }
.pp2p-teilen-hinweis { margin: 0 0 12px; color: var(--p-mute); font-size: 13px; text-align: center; }
.pp2p-teilen-knoepfe { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pp2p-teilen-knoepfe .pp2p-primaer { grid-column: 1 / -1; }

.pp2p-teilen-meldung {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 99997;
  padding: 9px 16px;
  border: 1px solid var(--p-rand);
  border-radius: 999px;
  background: var(--p-bg2);
  font-weight: 700;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.pp2p-teilen-meldung.an { opacity: 1; transform: translate(-50%, 0); }

/* Herausforderung aus einem geteilten Link */
.pp2p-teilen-band {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  z-index: 99994;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 20px);
  padding: 8px 8px 8px 16px;
  border: 1px solid var(--p-taste);
  border-radius: 14px;
  background: rgba(39, 37, 34, 0.94);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
  transform: translateX(-50%);
  transition: opacity 0.5s;
}
.pp2p-teilen-band.weg { opacity: 0; }
.pp2p-teilen-band-text { display: grid; min-width: 0; }
.pp2p-teilen-band small { color: var(--p-mute); font-size: 12px; font-weight: 700; }
.pp2p-teilen-band strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp2p-teilen-band b { color: var(--p-taste); }
