/*
  Meta´s Spiele Tasche: die helle Hülle (Startseite, Raumwahl, Lobby).
  Fast alles weiß, Pink als Hauptfarbe, dazu Mint und Butter als Gegenspieler.
  Gilt nur, solange <body> die Klasse "home" trägt. Die Spieltische behalten ihr dunkles Aussehen.
*/

body.home {
  --pink: #cf3374;
  --pink-soft: #f27aa8;
  --blush: #fff0f5;
  --blush-2: #fde0eb;
  --mint: #3fbfa5;
  --mint-soft: #d9f4ec;
  --butter: #ffd36b;
  --butter-soft: #fff0c7;

  /* Die gemeinsamen Bausteine (Knöpfe, Eingaben, Meldungen) lesen diese Werte. */
  --ink: #34203d;
  --ink-dim: #7a6685;
  --line: rgba(52, 32, 61, 0.14);
  --panel: #ffffff;
  --rose: #cf3374;
  --rose-line: rgba(207, 51, 116, 0.4);
  --rose-soft: rgba(207, 51, 116, 0.1);

  --av-line: rgba(52, 32, 61, 0.85);
  --felt-0: #fff; /* Zählmarken an Stapeln */

  --home-font: ui-rounded, "SF Pro Rounded", "Avenir Next Rounded", "Nunito", "Varela Round", system-ui, sans-serif;

  --card-font: var(--home-font);

  font-family: var(--home-font);
  background:
    radial-gradient(70% 40% at 50% -8%, var(--blush-2), transparent 70%),
    radial-gradient(circle at 1px 1px, rgba(207, 51, 116, 0.16) 1px, transparent 1.4px) 0 0 / 26px 26px,
    #fffdfc;
}

body.home :focus-visible {
  outline-color: var(--pink);
}

/* ------------------------------------------------- gemeinsame Bausteine, hell */

.home .btn {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
  font-family: var(--home-font);
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(52, 32, 61, 0.05);
}

.home .btn:hover {
  border-color: var(--rose-line);
}

.home .btn.primary {
  background: var(--pink);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 22px -10px rgba(207, 51, 116, 0.7);
}

.home .btn.primary:hover {
  box-shadow: 0 0 0 4px var(--rose-soft), 0 10px 22px -10px rgba(207, 51, 116, 0.7);
}

.home .btn.quiet {
  background: none;
  border-color: transparent;
  box-shadow: none;
  color: var(--ink-dim);
  font-weight: 500;
}

.home .btn:disabled {
  box-shadow: none;
}

.home .input {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
  font-family: var(--home-font);
}

.home .input::placeholder {
  color: #a898ad;
}

.home .input:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 4px var(--rose-soft);
}

.home .toast {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
  box-shadow: 0 12px 30px rgba(52, 32, 61, 0.18);
}

.home .toast.warn {
  border-color: var(--pink);
}

.home .banner {
  color: var(--ink);
  background: var(--blush-2);
  border-bottom-color: var(--rose-line);
}

/* ------------------------------------------------------------ Seitenrahmen */

.home-screen {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 22px max(28px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.home-screen .lede {
  color: var(--ink-dim);
}

.who strong {
  color: var(--ink);
  font-weight: 700;
}

/* -------------------------------------------------------------- Kopf: Tasche */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.bag {
  width: clamp(170px, 56vw, 230px);
  height: auto;
  overflow: visible;
  animation: bag-bob 6s ease-in-out infinite;
}

.hero.compact .bag {
  width: clamp(104px, 30vw, 136px);
}

.wordmark {
  margin: 0;
  max-width: 11em;
  font-family: var(--home-font);
  font-size: clamp(32px, 9.4vw, 44px);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-align: center;
  text-wrap: balance;
}

.hero.compact .wordmark {
  font-size: clamp(24px, 7vw, 30px);
}

/* Die Spielsachen schauen beim ersten Laden aus der Tasche, danach wiegen sie sich leicht. */
.bag .peek {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: sway var(--s, 6s) ease-in-out infinite alternate;
}

.bag.intro .peek {
  animation:
    rise 0.9s var(--d, 0s) cubic-bezier(0.2, 0.9, 0.25, 1.15) backwards,
    sway var(--s, 6s) calc(var(--d, 0s) + 0.9s) ease-in-out infinite alternate;
}

@keyframes rise {
  from {
    transform: translateY(58px);
    opacity: 0;
  }
}

@keyframes sway {
  from {
    transform: rotate(-2.2deg) translateY(0);
  }
  to {
    transform: rotate(2.2deg) translateY(-3px);
  }
}

@keyframes bag-bob {
  50% {
    transform: translateY(-3px);
  }
}

/* ---------------------------------------------------- Hintergrund-Figuren */

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

body:not(.home) .ambient {
  display: none;
}

.fl {
  position: absolute;
  width: var(--z, 46px);
  height: var(--z, 46px);
  color: var(--c, var(--pink-soft));
  opacity: 0.42;
  animation: drift var(--t, 11s) var(--o, 0s) ease-in-out infinite alternate;
}

@keyframes drift {
  from {
    transform: translate(0, 0) rotate(var(--r0, -8deg));
  }
  to {
    transform: translate(var(--dx, 8px), var(--dy, -14px)) rotate(var(--r1, 8deg));
  }
}

/* ------------------------------------------------------- Anmeldung, Formular */

.form {
  width: 100%;
  display: grid;
  gap: 12px;
}

.form.card-box {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 40px -22px rgba(207, 51, 116, 0.45);
}

.form .btn.quiet {
  justify-self: center;
}

.or {
  margin: 2px 0 0;
  text-align: center;
  color: var(--ink-dim);
  font-size: 14px;
}

.join {
  display: flex;
  gap: 10px;
}

.join .input {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  text-transform: uppercase;
}

.join .input::placeholder {
  letter-spacing: normal;
  text-indent: 0;
  font-size: 16px;
  font-weight: 400;
  text-transform: none;
}

/* --------------------------------------------------------- Spielauswahl */

.picker {
  width: 100%;
  display: grid;
  gap: 10px;
}

.picker h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.tile {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 14px 10px 14px;
  border-radius: 22px;
  border: 2px solid transparent;
  background: var(--tile-bg, var(--blush));
  color: var(--ink);
  font-family: var(--home-font);
  text-align: center;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.tint-pink {
  --tile-bg: var(--blush-2);
}

.tint-mint {
  --tile-bg: var(--mint-soft);
}

.tint-butter {
  --tile-bg: var(--butter-soft);
}

.tint-lilac {
  --tile-bg: #ece4fb;
}

.tint-sky {
  --tile-bg: #dcecfb;
}

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

.tile.on {
  border-color: var(--pink);
  box-shadow: 0 14px 28px -16px rgba(207, 51, 116, 0.65);
}

.tile-art {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.7);
}

.tile-art svg {
  width: 58px;
  height: 58px;
}

.tile-name {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.tile-meta {
  color: var(--ink-dim);
  font-size: 13px;
  line-height: 1.3;
}

.tile-check {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--pink);
  color: #fff;
  transform: scale(0);
  transition: transform 0.2s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.tile-check svg {
  width: 14px;
  height: 14px;
}

.tile.on .tile-check {
  transform: scale(1);
}

/* ------------------------------------------------------------------- Lobby */

.lobby-game {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 18px 6px 8px;
  border-radius: 999px;
  background: var(--tile-bg, var(--blush-2));
}

.lobby-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
}

.lobby-icon svg {
  width: 30px;
  height: 30px;
}

.game-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

/* Der Raumcode sieht aus wie eine Eintrittskarte. */
.code {
  min-width: min(100%, 300px);
  padding: 10px 14px 10px calc(14px + 0.14em);
  border: 2px dashed var(--rose-line);
  border-radius: 22px;
  background: #fff;
  cursor: pointer;
  font-family: var(--home-font);
  font-size: clamp(52px, 19vw, 78px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.14em;
  color: var(--pink);
  box-shadow: 0 18px 36px -24px rgba(207, 51, 116, 0.7);
  transition: transform 0.15s ease;
}

.code:hover {
  transform: rotate(-1deg);
}

.players {
  width: 100%;
  margin: 4px 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.players li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
}

.players .name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #cfc4d3;
}

.dot.on {
  background: var(--mint);
  box-shadow: 0 0 0 4px var(--mint-soft);
}

.tag {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--blush-2);
  color: var(--pink);
  font-size: 12px;
  font-weight: 700;
}

/* Link zum Admin-Bereich, ganz unten */
.site-foot {
  margin-top: 10px;
  font-size: 0.8rem;
}

.site-foot a {
  color: var(--ink-dim);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 999px;
}

.site-foot a:hover,
.site-foot a:focus-visible {
  color: var(--pink);
  background: var(--blush);
}

@media (min-width: 720px) {
  .home-screen {
    max-width: 520px;
  }
}

/* ------------------------------------------------------------ Konto und Avatar */

.page-title {
  margin: 0;
  font-size: clamp(26px, 7vw, 32px);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
}

.btn.small {
  min-height: 34px;
  padding: 0.3em 1em;
  font-size: 14px;
}

.profile {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 12px;
  width: 100%;
}

.profile .who {
  margin: 0;
  color: var(--ink-dim);
}

.profile .btn {
  flex-basis: 100%;
  justify-self: center;
}

.avatar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-row .hint {
  margin-left: auto;
}

/* Editor */

.editor,
.scores {
  justify-content: flex-start;
}

.ed-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.ed-tabs,
.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.ed-tab,
.chip {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.ed-tab.on,
.chip.on {
  background: var(--pink);
  border-color: transparent;
  color: #fff;
}

.ed-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 8px;
}

.ed-opt {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.ed-opt:hover {
  transform: translateY(-2px);
}

.ed-opt.on {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px var(--rose-soft);
}

.ed-opt svg {
  display: block;
  width: 100%;
  height: 100%;
}

.ed-opt.swatch {
  background: var(--sw);
  border-color: var(--av-line);
}

.ed-opt.swatch.on {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px var(--pink-soft);
}

.ed-actions {
  display: grid;
  justify-items: center;
  gap: 6px;
  width: 100%;
}

.ed-actions .btn.primary {
  min-width: min(100%, 260px);
}

/* Bestenliste */

.score-head,
.score-list li {
  display: grid;
  grid-template-columns: 28px 44px minmax(0, 1fr) 54px 76px;
  align-items: center;
  gap: 8px;
}

.score-head {
  width: 100%;
  padding: 0 14px;
  color: var(--ink-dim);
  font-size: 12px;
  font-weight: 600;
}

.score-head span:nth-child(n + 4) {
  text-align: center;
}

.score-list {
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.score-list li {
  padding: 8px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
}

.score-list li.me {
  border-color: var(--rose-line);
  background: var(--blush);
}

.score-list .rank {
  font-size: 18px;
  font-weight: 800;
  color: var(--pink);
  text-align: center;
}

.score-list .who-name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.score-list .num {
  font-size: 22px;
  font-weight: 800;
  text-align: center;
}

.score-list .wins {
  color: #1f9d86;
}

.score-list .losses {
  color: var(--ink-dim);
}

.home .players .av {
  --av: 32px;
}

/* ------------------------------------------- Spieltisch im hellen Design (2-3-10) */

/* Die schwebenden Spielsachen bleiben, aber ganz leise hinter dem Tisch. */
body.home:has(#app[data-screen="game"]) .ambient {
  opacity: 0.22;
}

.home .room-chip,
.home .status,
.home .exit-btn,
.home .react-btn {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
  font-family: var(--home-font);
  box-shadow: 0 2px 0 rgba(52, 32, 61, 0.07);
}

.home .room-chip b {
  color: var(--pink);
}

.home .status.mine {
  background: var(--pink);
  border-color: var(--pink);
  color: #fff;
  font-weight: 700;
}

.home .react-btn:hover,
.home .exit-btn:hover {
  border-color: var(--pink);
  color: var(--pink);
}

.home .overlay {
  background: rgba(52, 32, 61, 0.38);
}

.home .panel {
  background: #fff;
  border: 1.5px solid var(--line);
  box-shadow: 0 30px 70px -20px rgba(52, 32, 61, 0.55);
  animation: panel-up 0.35s cubic-bezier(0.2, 1.2, 0.4, 1);
}

@keyframes panel-up {
  from {
    transform: translateY(18px) scale(0.95);
    opacity: 0;
  }
}

.home .panel h2 {
  color: var(--ink);
  font-weight: 800;
  font-size: 28px;
}

.home .ranking li {
  background: #fff;
}

.home .ranking li::before {
  border-color: var(--rose-line);
  color: var(--pink);
  font-weight: 800;
}

.home .ranking li:first-child {
  background: var(--blush);
  border-color: var(--pink);
}

.home .ranking .loser {
  color: var(--pink);
  font-weight: 600;
}

/* ------------------------------------------------ Party, Partyliste, Lobby-Spielwahl */

.party-cta {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px 14px 14px;
  border: 0;
  border-radius: 24px;
  background: var(--pink);
  color: #fff;
  font-family: var(--home-font);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 16px 30px -16px rgba(207, 51, 116, 0.8);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.party-cta:hover {
  transform: translateY(-2px) rotate(-0.4deg);
  box-shadow: 0 20px 34px -16px rgba(207, 51, 116, 0.9);
}

.pc-art {
  display: grid;
  place-items: center;
  flex: none;
  width: 66px;
  height: 66px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
}

.pc-art svg {
  width: 52px;
  height: 52px;
}

.pc-text {
  display: grid;
  gap: 3px;
}

.pc-text b {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
}

.pc-text small {
  font-size: 13px;
  line-height: 1.3;
  opacity: 0.92;
}

.my-parties {
  width: 100%;
  display: grid;
  gap: 8px;
}

.my-parties h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.party-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px 10px 10px;
  border-radius: 18px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-family: var(--home-font);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.party-card:hover {
  border-color: var(--pink);
  transform: translateY(-1px);
}

.pc-code {
  display: grid;
  place-items: center;
  flex: none;
  min-width: 64px;
  height: 46px;
  padding-left: 0.12em;
  border: 2px dashed var(--rose-line);
  border-radius: 12px;
  color: var(--pink);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.pc-body {
  display: grid;
  min-width: 0;
  flex: 1;
}

.pc-body b {
  font-size: 15px;
}

.pc-body small {
  overflow: hidden;
  color: var(--ink-dim);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pc-side {
  display: grid;
  justify-items: end;
  gap: 4px;
  flex: none;
}

.pc-online {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-dim);
  font-size: 12px;
}

.pc-online .dot {
  width: 8px;
  height: 8px;
}

/* Kacheln, die gerade nicht gehen: blass, mit Grund. Kacheln nur zum Ansehen (kein Gastgeber) bleiben farbig. */
.tile.off {
  background: #f3eff5;
  color: #8c7a95;
  cursor: not-allowed;
}

.tile.off .tile-art {
  opacity: 0.45;
  filter: grayscale(1);
}

.tile.off:hover,
.tile.view-only:hover {
  transform: none;
}

.tile.view-only {
  cursor: default;
}

.tile-why {
  margin-top: 2px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #fff;
  color: var(--pink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.mode-tag {
  padding: 3px 14px;
  border-radius: 999px;
  background: var(--blush-2);
  color: var(--pink);
  font-size: 13px;
  font-weight: 800;
}

.lobby-picker {
  margin-top: 4px;
}

.away {
  color: var(--ink-dim);
  font-size: 12px;
}

.hint.wait {
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--butter-soft);
  color: var(--ink);
}

/* ------------------------------------------------------- Computergegner (Bots) */

.picker-actions {
  display: grid;
  gap: 8px;
}

.btn.solo svg,
.btn.add-bot svg {
  flex: none;
}

.btn.solo,
.btn.add-bot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn.solo {
  background: var(--mint-soft);
  border-color: rgba(63, 191, 165, 0.5);
}

.btn.add-bot {
  justify-self: center;
  margin: 2px 0 6px;
}

.players li.bot-row {
  flex-wrap: wrap;
  row-gap: 10px;
}

.bot-tag {
  background: var(--mint-soft);
  color: #1f7d6a;
}

.bot-remove {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink-dim);
  cursor: pointer;
}

.bot-remove:hover {
  background: var(--blush-2);
  color: var(--pink);
}

.bot-remove svg {
  width: 18px;
  height: 18px;
}

/* Der Regler: drei Stufen, die Schrift darunter zeigt die gewählte. */
.bot-skill {
  flex-basis: 100%;
  display: grid;
  gap: 2px;
  padding: 0 4px 2px;
}

.skill-range {
  width: 100%;
  height: 28px;
  margin: 0;
  background: none;
  accent-color: var(--pink);
  cursor: pointer;
  touch-action: pan-y;
}

.skill-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-style: normal;
  color: var(--ink-dim);
}

.skill-labels i {
  font-style: normal;
  flex: 1;
  text-align: center;
}

.skill-labels i:first-child {
  text-align: left;
}

.skill-labels i:last-child {
  text-align: right;
}

.skill-labels i.on {
  color: var(--pink);
  font-weight: 700;
}
