/* ---------- Grundlegende Styles (Lobby + Spiel) ---------- */

/* Einheitliche Skalierung */
:root {
  --btn-h: clamp(48px, 6.5vh, 56px);
  --gap: 16px;
  --font-size-btn: 1.08rem;
  --font-size-input: 1.08rem;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}



/* Keine mobile Textvergrößerung (iOS/Android) */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #191b22;
  color: #eee;
  font-family: "Segoe UI", Arial, sans-serif;
  min-height: 100svh; /* statt 100vh: sicher mit Browserleisten */
  max-width: 100vw;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
}

body.invite-join #main-menu {
  display: none !important;
}

h1 {
  margin-top: clamp(24px, 6svh, 80px);
  font-size: clamp(1.8rem, 4.2vw, 2.8rem);
  letter-spacing: 2px;
  color: #f25c54;
  text-shadow: 0 1px 12px #111a;
  text-align: center;
}

/* ---------- Start / Lobby ---------- */
.start-box {
  background: #23242a;
  border-radius: 18px;
  padding: 24px clamp(14px, 4vw, 24px);
  box-shadow: 0 2px 16px #0003;
  margin: clamp(16px, 5svh, 40px) 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: min(92vw, var(--card-min-w));
  max-width: min(98vw, var(--card-max-w));
  gap: var(--gap);
}

/* Buttons – einheitliche Höhe/Typo auf allen Geräten */
.btn {
  height: var(--btn-h);
  padding: 0 18px;
  border-radius: 10px;
  border: none;
  background: #282a36;
  color: #fafcff;
  font-size: 1.08rem;          /* fix: gleiche Schriftgröße wie Desktop */
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.12s, transform 0.1s;
  box-shadow: 0 2px 8px #0007;
  margin-top: 6px;
  letter-spacing: 0.02em;
  width: 100%;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn.big-btn { height: var(--btn-h); }

.btn:hover,
.btn:focus-visible {
  background: #444857;
  color: #6fbaf8;
  transform: translateY(-2px) scale(1.025);
  box-shadow: 0 3px 20px #172b3a44;
}
.btn:focus { outline: none; }
.btn:focus-visible { outline: 2px solid #6fbaf8; outline-offset: 2px; }

/* Join-Zeile: immer nebeneinander, wie am PC */
.join-row {
  display: grid;
  grid-template-columns: minmax(9ch, 160px) 1fr; /* kompaktes Feld + breiter Button */
  align-items: stretch;
  width: 100%;
  gap: 0;
  margin-top: 0;
}

/* Input – gleiche Höhe/Typo, linke Rundung, keine Doppelkante */
input[type="text"],
#join-id {
  -webkit-appearance: none;
  appearance: none;
  height: var(--btn-h);
  border-radius: 10px 0 0 10px;
  border: 1.5px solid #2c2e36;
  border-right: 0;
  padding: 0 16px;               /* vertikal über height zentriert */
  font-size: 1.08rem;            /* fix: wie Buttons */
  font-family: inherit;
  line-height: 1;
  background: #191a1f;
  color: #6fbaf8;
  box-shadow: 0 1px 4px #0003;
  margin-bottom: 0;
  min-width: 0;
  text-align: center;            /* 4 Ziffern wirken so sauber */
  letter-spacing: 0.06em;
  transition: border-color 0.2s, box-shadow 0.16s, background 0.16s;
}
input:focus { outline: none; }
input:focus-visible {
  border-color: #6fbaf8;
  background: #23242a;
  box-shadow: 0 0 0 2px #263648aa;
}

/* Join-Button – rechte Rundung, an Input andocken */
#join-btn {
  -webkit-appearance: none;
  appearance: none;
  height: var(--btn-h);
  border-radius: 0 10px 10px 0;
  border: 1.5px solid #2c2e36;
  border-left: 0;
  margin-top: 0;
  padding: 0 18px;
  background: #282a36;
  color: #fff;
  font-size: 1.08rem;   /* fix: wie Desktop */
  font-weight: 750;
  white-space: nowrap;
  box-shadow: 0 2px 8px #0007;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.12s, transform 0.1s, box-shadow 0.12s;
}
#join-btn:hover,
#join-btn:focus-visible {
  background: #444857;
  color: #6fbaf8;
  transform: translateY(-2px) scale(1.025);
  box-shadow: 0 3px 20px #172b3a44;
}

#nickname {
  border-radius: 10px; /* gleiche Rundung wie Buttons */
  border: 1.5px solid #2c2e36;
  height: var(--btn-h);
  font-size: var(--font-size-input);
  font-family: inherit;
  line-height: 1;
  padding: 0 16px;
  background: #17181c;
  color: #f6f6f6;
  box-shadow: 0 1px 4px #0003;
}

/* Keine Spalten-Umschaltung mehr auf Mobile – überall gleich wie PC */
/* (Den alten @media (max-width: 720px) Block entfernen!) */

/* Weniger Bewegung, falls System das wünscht */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

#player-list li.draggable { cursor: grab; }
#player-list li.dragging  { opacity: 0.6; }

/* Playerliste: sauberes Flex-Layout */
#player-list { list-style: none; padding: 0; margin: 0; }
#player-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
}
#player-list li .wins { margin-left: auto; }      /* Pokale nach rechts schieben */
#player-list li .remove-bot-btn {                 /* Buttons klar klickbar */
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

/* ---------- Passwort-Dialog ---------- */
#pw-dialog { gap: var(--gap); }

/* Passwortfeld wie #nickname/#join-id, aber ohne rechts Andocken */
#pw {
  -webkit-appearance: none;
  appearance: none;
  height: var(--btn-h);
  border-radius: 10px;
  border: 1.5px solid #2c2e36;
  padding: 0 16px;
  font-size: var(--font-size-input);
  font-family: inherit;
  line-height: 1;
  background: #17181c;
  color: #f6f6f6;
  box-shadow: 0 1px 4px #0003;
  letter-spacing: 0.06em;
  transition: border-color 0.2s, box-shadow 0.16s, background 0.16s;
}
#pw::placeholder { color: #8aa0b5aa; }
#pw:focus { outline: none; }
#pw:focus-visible {
  border-color: #6fbaf8;
  background: #23242a;
  box-shadow: 0 0 0 2px #263648aa;
}

/* Button wie .btn/#join-btn */
#pw-ok {
  height: var(--btn-h);
  border-radius: 10px;
  border: 1.5px solid #2c2e36;
  padding: 0 18px;
  background: #282a36;
  color: #fff;
  font-size: var(--font-size-btn);
  font-weight: 750;
  box-shadow: 0 2px 8px #0007;
  cursor: pointer;
  transition: background 0.15s, color 0.12s, transform 0.1s, box-shadow 0.12s;
}
#pw-ok:hover,
#pw-ok:focus-visible {
  background: #444857;
  color: #6fbaf8;
  transform: translateY(-2px) scale(1.025);
  box-shadow: 0 3px 20px #172b3a44;
}
#pw-ok:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
  box-shadow: 0 2px 8px #0007;
}

/* ---------- Preload ---------- */
#preload-box { gap: 12px; text-align: center; }
#preload-title { font-weight: 700; letter-spacing: 0.02em; }
.preload-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #14151a;
  border: 1px solid #2c2e36;
  overflow: hidden;
  box-shadow: inset 0 1px 3px #0007;
}
#preload-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6fbaf8, #f25c54);
  transition: width 0.2s ease;
}
#preload-text { font-size: 0.98rem; color: #cfd7ff; }

/* Optional: Fehlversuch kurz „wackeln“ lassen (ruf .shake auf #pw-dialog auf) */
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}
#pw-dialog.shake { animation: shake 350ms ease-in-out; }

/* ---------- Inline-Notices unterhalb der Box ---------- */
.notice {
  margin-top: 10px;
  margin-bottom: 8px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #2c2e36;
  background: #1b1d24;
  box-shadow: 0 1px 10px #0004;
  font-size: 0.98rem;
  line-height: 1.25;
}
.notice-info    { border-color: #3a5577; color: #b8d7ff; background: #16202b; }
.notice-success { border-color: #2e6a4f; color: #b7ffd3; background: #13231b; }
.notice-warn    { border-color: #7a6a2e; color: #ffe9aa; background: #231e12; }
.notice-error   { border-color: #7a2e2e; color: #ffc6c6; background: #251416; }

/* Abstand zum folgenden Element etwas erhöhen */
.notice + .start-box { margin-top: 16px; }
