/* ==========================================================================
   Home + lobby screens
   ========================================================================== */

.home-wrap {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: clamp(28px, 7vh, 72px) 20px 64px;
  display: grid;
  gap: 26px;
}

/* ---------------------------------------------------------------- brand --- */

.brand { text-align: center; display: grid; justify-items: center; gap: 10px; }

.brand-mark {
  font-size: 3.2rem;
  line-height: 1;
  filter: drop-shadow(0 12px 22px rgb(255 122 89 / 0.4));
  animation: bob 4s ease-in-out infinite;
}

.brand-name {
  font-size: clamp(2.4rem, 9vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1;
}
.brand-name span {
  background: linear-gradient(120deg, var(--brand), var(--brand-2) 60%, var(--rose));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-tag {
  /* Wide enough that the longer German tagline still balances onto two lines. */
  max-width: 42ch;
  color: var(--text-dim);
  font-size: 0.98rem;
  text-wrap: balance;
}

/* ------------------------------------------------------------ home card --- */

.home-card { display: grid; gap: 18px; }

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

.avatar-preview {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 1.6rem;
  line-height: 1;
}

/* The public room is the headline action, so it gets a live dot. */
#public-btn:not(:disabled) > span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: #14532d;
  box-shadow: 0 0 0 3px rgb(20 83 45 / 0.25);
  animation: live-pulse 2.4s ease-in-out infinite;
  vertical-align: middle;
}
#public-btn[hidden], #invite-btn[hidden] { display: none; }

@keyframes live-pulse {
  50% { box-shadow: 0 0 0 6px rgb(20 83 45 / 0); }
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-faint);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-soft);
}

.join-row { display: flex; gap: 10px; }
.join-row #code-input {
  flex: 1;
  font-family: var(--mono);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-align: center;
  text-transform: uppercase;
  padding-left: 0.35em; /* balance the trailing letter-spacing */
}
.join-row .btn { flex: none; min-width: 104px; }

.form-error {
  min-height: 1.2em;
  margin: -6px 0 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: #ff9aa4;
}

/* ---------------------------------------------------------------- rules --- */

.rules { display: grid; gap: 14px; }
.rules h2 {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: center;
}

.rule-list { display: grid; gap: 10px; }
.rule-list li {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  background: rgb(255 255 255 / 0.025);
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.rule-list strong { display: block; color: var(--text); font-weight: 700; }
.rule-list em {
  font-style: normal;
  font-weight: 800;
  color: var(--brand-2);
}

.rule-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #23150f;
  font-size: 0.82rem;
  font-weight: 800;
}

/* ================================  LOBBY  ================================= */

.lobby-wrap {
  width: min(940px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 5vh, 46px) 20px 56px;
  display: grid;
  gap: 22px;
}

.lobby-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.code-row { display: flex; align-items: center; gap: 12px; margin-top: 4px; flex-wrap: wrap; }

.lobby-head-actions { display: flex; align-items: center; gap: 8px; }

.badge-public {
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--mint), var(--sky));
  color: #06241a;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.badge-public[hidden] { display: none; }
/* A native select: keyboard-accessible, and a real picker wheel on mobile. */
.lang-select {
  height: 34px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2) no-repeat right 11px center / 9px 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 6'%3E%3Cpath d='M0 0h9L4.5 6z' fill='%23b3a9c9'/%3E%3C/svg%3E");
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  appearance: none;
  cursor: pointer;
  transition: filter var(--dur) var(--ease);
}
.lang-select:hover { filter: brightness(1.15); }
.lang-select option { background: var(--surface-1); color: var(--text); }

.lang-select-compact {
  height: 30px;
  padding: 0 25px 0 9px;
  font-size: 0.75rem;
  max-width: 138px;
  background-color: rgb(255 255 255 / 0.05);
}

.room-code {
  font-family: var(--mono);
  font-size: clamp(2rem, 7vw, 2.8rem);
  font-weight: 800;
  letter-spacing: 0.18em;
  line-height: 1;
  background: linear-gradient(120deg, var(--brand-2), var(--rose));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lobby-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1.1fr 1fr;
  align-items: start;
}

.player-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.player-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  background: rgb(255 255 255 / 0.04);
  border: 1px solid var(--line-soft);
  animation: pop-in 260ms var(--ease);
}
.player-chip .who {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-chip .badge {
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-dim);
}
.player-chip.is-host .badge { background: linear-gradient(120deg, var(--brand), var(--brand-2)); color: #23150f; }
.player-chip.is-you { border-color: color-mix(in srgb, var(--sky) 45%, transparent); }

/* --------------------------------------------------------------- settings - */

.settings { display: grid; gap: 16px; }

.setting { display: grid; gap: 8px; }
.setting-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.setting-head label { font-size: 0.88rem; font-weight: 700; }
.setting-value {
  font-family: var(--mono);
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--brand-2);
}

.setting input[type="range"] {
  width: 100%;
  height: 22px;
  appearance: none;
  background: none;
  cursor: pointer;
}
.setting input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
}
.setting input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
}
.setting input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.4);
}
.setting input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}
.setting input[type="range"]:disabled { opacity: 0.4; cursor: not-allowed; }

.toggle-row { display: flex; flex-wrap: wrap; gap: 7px; }

.toggle {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgb(255 255 255 / 0.03);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dim);
  transition: all var(--dur) var(--ease);
}
.toggle:hover:not(:disabled) { border-color: var(--text-faint); color: var(--text); }
.toggle[aria-pressed="true"] {
  background: linear-gradient(120deg, var(--brand), var(--brand-2));
  border-color: transparent;
  color: #23150f;
}
.toggle:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-start { width: 100%; }

@media (max-width: 760px) {
  .lobby-grid { grid-template-columns: 1fr; }
}
