/* --- Lobby --------------------------------------- */
.lobby-card {
  padding: 16px;
  background: linear-gradient(145deg, #ffffff, #f3fff9);
  border: 1px solid #cde8d8;
  border-radius: 18px;
  box-shadow: 0 16px 34px rgba(20, 35, 55, 0.1);
}
.join-card {
  display: grid;
  gap: 12px;
  background:
    radial-gradient(1200px 180px at 20% -10%, rgba(57, 191, 118, 0.28), transparent 56%),
    radial-gradient(1200px 180px at 90% 110%, rgba(58, 129, 255, 0.24), transparent 52%),
    linear-gradient(145deg, #ffffff, #f2fff7);
}
.join-hero {
  display: grid;
  gap: 5px;
}
.join-hero h2 {
  font-size: clamp(1.28rem, 2.7vw, 1.9rem);
  color: #0f3f66;
}
.join-kicker {
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #166534;
}
.join-copy {
  color: var(--muted);
  max-width: 66ch;
  font-size: 0.97rem;
}

.mode-card {
  background:
    radial-gradient(760px 200px at 4% 0%, rgba(14,165,233,.14), transparent 64%),
    radial-gradient(760px 180px at 95% 100%, rgba(245,158,11,.14), transparent 58%),
    linear-gradient(145deg, #ffffff, #f6fff8);
}

.start-logo-showcase {
  margin: 4px auto 16px;
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(211,228,239,.22);
  background:
    radial-gradient(500px 180px at 12% 20%, rgba(32,133,255,.22), transparent 68%),
    radial-gradient(500px 180px at 88% 20%, rgba(239,68,68,.22), transparent 68%),
    linear-gradient(165deg, #0a1425, #040b17);
  padding: 8px;
  box-shadow: 0 8px 18px rgba(8,20,36,.14);
}

.start-logo-image {
  display: block;
  width: min(720px, 100%);
  margin: 0 auto;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 4px 12px rgba(0,0,0,.16);
}

.mode-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.mode-pane {
  position: relative;
  overflow: hidden;
  border-width: 1.5px;
}

.mode-pane::after {
  content: "";
  position: absolute;
  inset: -35% auto auto -20%;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: rgba(255,255,255,.28);
  pointer-events: none;
}

.mode-pane-quick {
  background:
    radial-gradient(320px 140px at 100% 0%, rgba(14,165,233,.22), transparent 62%),
    linear-gradient(155deg, #eff8ff, #e7f4ff 42%, #f3fbff);
  border-color: #9ed9f6;
}

.mode-pane-friends {
  background: linear-gradient(155deg, #fbfff2, #f7ffea 42%, #fdfff7);
  border-color: #d6e7af;
}

.mode-pane-quick h3 {
  color: #0a4a6a;
  font-size: 1.12rem;
}

.mode-pane-quick .hint {
  color: #2f5e79;
  font-size: 0.94rem;
  margin-bottom: 10px;
}

.mode-pane-quick .actions-row {
  margin-top: 4px;
}

.mode-pane-quick #quickMatchBtn {
  min-height: 46px;
  width: 100%;
  padding: 10px 16px;
  font-size: 1.02rem;
  border-radius: 12px;
  background: linear-gradient(125deg, #45a7ff, #2262d9);
  box-shadow: 0 10px 18px rgba(34,98,217,.25);
}

.mode-pane-quick #quickMatchBtn.searching {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(125deg, #37b66f, #1f8c57);
  box-shadow: 0 10px 18px rgba(31, 140, 87, 0.28);
  cursor: default;
}

.mode-pane-quick #quickMatchBtn.searching:disabled {
  opacity: 1;
  pointer-events: none;
}

.mode-pane-quick .actions-row {
  flex-wrap: nowrap;
}

.quick-match-btn-label {
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-match-btn-time {
  font-variant-numeric: tabular-nums;
  min-width: 44px;
  text-align: right;
  margin-left: 10px;
}

.quick-match-cancel-search {
  width: 22px;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.45);
  background: linear-gradient(130deg, #ff6b78, #d90429);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(217,4,41,.34);
}

.quick-match-cancel-search:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(217,4,41,.4);
}

.friends-actions {
  margin-top: 8px;
  display: grid;
  gap: 10px;
}

.friends-actions #createRoomBtn {
  width: 100%;
  min-height: 44px;
  border-color: #a9d59a;
  background: linear-gradient(130deg, #ffffff, #f3ffe8);
}

.friends-join-divider {
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.72rem;
  font-weight: 900;
  color: #4f6b2f;
  text-align: center;
  position: relative;
}

.friends-join-divider::before,
.friends-join-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 28%;
  height: 1px;
  background: #c6dbb1;
}

.friends-join-divider::before { left: 0; }
.friends-join-divider::after { right: 0; }

.friends-join-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.friends-join-row #joinCodeInput {
  width: 100%;
  letter-spacing: 0.24em;
  font-weight: 900;
  text-align: center;
  border-color: #bed89d;
}

.friends-join-row #joinCodeBtn {
  width: 100%;
  min-height: 44px;
}

.lobby-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.lobby-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.lobby-top h2 {
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
}

.lobby-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.lobby-pane {
  border: 1px solid #d6e8df;
  border-radius: 14px;
  background: linear-gradient(160deg, #ffffff, #f9fffb);
  padding: 12px;
  box-shadow: 0 4px 12px rgba(20, 35, 55, 0.05);
}
.lobby-pane h3 {
  font-size: 0.95rem;
  margin-bottom: 9px;
  color: #12422e;
}

.lobby-players { display: grid; gap: 8px; }
.player-chip {
  border: 1px solid #d7e8df;
  border-radius: 11px;
  padding: 8px 10px;
  background: #f8fcfa;
  font-weight: 700;
}
.player-chip.host {
  border-color: #7dc9ff;
  background: linear-gradient(120deg, #eef7ff, #e8fff7);
}

.custom-config {
  display: grid;
  gap: 8px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed #cfe1d8;
}
.settings-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px;
  align-items: center;
}
.settings-row label {
  font-size: 0.84rem;
  font-weight: 800;
  color: #194a34;
}

.phase-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
  max-height: 300px;
  overflow: auto;
  padding-right: 4px;
  align-items: start;
}

.phase-selected-summary {
  grid-column: 1 / -1;
  border: 1px dashed #9dcfb7;
  border-radius: 12px;
  padding: 9px;
  background: linear-gradient(160deg, #f7fff9, #eefcf4);
}

.phase-selected-title {
  margin: 0;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #1c5d41;
}

.phase-selected-list {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.phase-selected-empty {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: #4f6f61;
  font-weight: 700;
}

.manual-phase-pill {
  border: 1px solid #9bcdb4;
  border-radius: 999px;
  background: linear-gradient(145deg, #ecfff5, #ddf8e9);
  color: #194a34;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 5px 9px;
  cursor: pointer;
  transition: transform 90ms, box-shadow 120ms;
}

.manual-phase-pill:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(20, 35, 55, 0.11);
}

.manual-phase-pill:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.phase-picker-column {
  border: 1px solid #d7e8df;
  border-radius: 12px;
  padding: 8px;
  background: linear-gradient(160deg, #ffffff, #f8fcfa);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 8px;
}

.phase-picker-title {
  margin: 0;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #245543;
}

.phase-picker-items {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 6px;
}

.manual-phase-card {
  width: 100%;
  border: 1px solid #cddfd6;
  border-radius: 10px;
  background: #f8fcfa;
  padding: 8px;
  text-align: left;
  font-size: 0.82rem;
  font-weight: 700;
  color: #194a34;
  cursor: pointer;
  transition: transform 90ms, box-shadow 120ms, border-color 120ms, background 120ms;
}

.manual-phase-card:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(20, 35, 55, 0.1);
}

.manual-phase-card.active {
  border-color: #45b37e;
  background: linear-gradient(145deg, #ecfff5, #ddf8e9);
  box-shadow: 0 0 0 2px rgba(69, 179, 126, 0.2);
}

.manual-phase-card:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.hint {
  color: var(--muted);
  margin: 7px 0 0;
  font-size: 0.86rem;
}
.settings-auto-status {
  color: #165b3e;
  font-weight: 800;
}

.phase-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 5px;
}

.join-row, .actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.join-row {
  justify-content: center;
}
.join-row input {
  min-width: 230px;
  flex: 1 1 auto;
  max-width: 360px;
  min-height: 34px;
  height: 34px;
  padding: 6px 10px;
  line-height: 1.1;
  text-align: center;
  font-weight: 800;
}

/* --- Premium Lobby Redesign ---------------------- */
#lobbySection {
  background:
    radial-gradient(920px 260px at 0% 0%, rgba(34,197,94,.16), transparent 62%),
    radial-gradient(980px 320px at 100% 0%, rgba(14,165,233,.14), transparent 64%),
    linear-gradient(150deg, #ffffff, #f2fff8 45%, #effcf7);
  border-color: #b9e6cf;
  overflow-x: clip;
  box-shadow:
    0 18px 36px rgba(18, 64, 48, 0.15),
    inset 0 1px 0 rgba(255,255,255,.75);
}

#lobbySection .lobby-top {
  display: grid;
  grid-template-columns: 1fr;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid #bde4d0;
  background:
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(237,255,247,.86));
  box-shadow: 0 10px 22px rgba(18,64,48,.12);
  align-items: stretch;
}

#lobbySection .lobby-title-block {
  display: grid;
  gap: 3px;
}

#lobbySection .lobby-title-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#lobbySection .lobby-title-block h2 {
  font-size: clamp(1.4rem, 2.7vw, 2rem);
  letter-spacing: 0.01em;
  color: #093b2d;
}

#lobbySection #lobbyInfo {
  color: #1c4f3b;
  font-size: 1.1rem;
  font-weight: 800;
  max-width: 48ch;
}

#lobbySection #roomInfo {
  margin-top: 0;
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 11px;
  border: 1px solid #9fd6ee;
  background: linear-gradient(120deg, #e8f8ff, #ecfff7);
  color: #0e4d66;
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
}

#lobbySection .lobby-top-actions {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  justify-content: center;
  min-width: 0;
  width: 100%;
}

#lobbySection .lobby-top-actions .btn {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.01em;
}

#lobbySection .lobby-top-actions #startBtn {
  background: linear-gradient(125deg, #4eb6ff, #2262d9);
  box-shadow: 0 12px 22px rgba(34,98,217,.24);
}

#lobbySection .lobby-top-actions .btn-lobby-invite {
  background: linear-gradient(125deg, #ffffff, #f2fff7);
  border: 1px solid #9fd7b6;
  color: #11573a;
  box-shadow: 0 10px 18px rgba(17,87,58,.12);
}

#lobbySection .lobby-top-actions #leaveBtn {
  background: linear-gradient(125deg, #ff6f7f, #e63946);
  box-shadow: 0 10px 18px rgba(230,57,70,.24);
}

#lobbySection .lobby-grid {
  margin-top: 14px;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
  min-height: 0;
}

#lobbySection .lobby-pane {
  min-width: 0;
  min-height: 0;
  border-radius: 16px;
  border: 1px solid #bde3d2;
  padding: 14px;
  background: linear-gradient(160deg, #ffffff, #f8fff9);
  box-shadow:
    0 8px 16px rgba(19, 76, 52, 0.08),
    inset 0 1px 0 rgba(255,255,255,.9);
}

#lobbySection .lobby-pane h3 {
  font-size: 1.24rem;
  color: #0f4b35;
  margin-bottom: 10px;
}

#lobbySection .lobby-pane-players {
  background:
    radial-gradient(220px 90px at 100% 0%, rgba(14,165,233,.14), transparent 64%),
    linear-gradient(160deg, #ffffff, #f5fcff);
  border-color: #b9ddf2;
}

#lobbySection .lobby-players {
  gap: 7px;
}

#lobbySection .player-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#lobbySection .player-chip-name {
  min-width: 0;
}

#lobbySection .player-kick-btn {
  width: 28px;
  height: 28px;
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid #ef9aa2;
  background: linear-gradient(120deg, #ff8089, #e63946);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 900;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 12px rgba(230,57,70,.22);
}

#lobbySection .player-kick-btn:hover {
  transform: translateY(-1px) scale(1.04);
}

#lobbySection .lobby-config-pane {
  background:
    radial-gradient(240px 100px at 100% 0%, rgba(34,197,94,.15), transparent 66%),
    linear-gradient(160deg, #ffffff, #f3fff5);
  border-color: #bce5c8;
}

#lobbySection .lobby-pane-phases {
  background:
    radial-gradient(220px 90px at 100% 0%, rgba(245,158,11,.14), transparent 64%),
    linear-gradient(160deg, #ffffff, #fffdf3);
  border-color: #ecdba5;
}

#lobbySection.non-host-view .lobby-config-pane {
  display: none;
}

#lobbySection.non-host-view .lobby-grid {
  grid-template-columns: 1fr;
}

#lobbySection .player-chip {
  border-radius: 12px;
  padding: 10px 12px;
  border-color: #90cff4;
  background: linear-gradient(120deg, #f6fbff, #edf8ff);
  font-size: 1.22rem;
  color: #083a58;
}

#lobbySection .player-chip.host {
  border-color: #5ab4f2;
  background:
    linear-gradient(120deg, #eaf7ff, #e8fff7);
  box-shadow: 0 6px 12px rgba(40,100,216,.12);
}

#lobbySection .settings-row {
  grid-template-columns: 1fr;
  gap: 10px;
}

#lobbySection .hidden-control {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

#lobbySection .choice-cards {
  display: grid;
  gap: 8px;
}

#lobbySection .mode-choice-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#lobbySection .count-choice-cards {
  grid-template-columns: repeat(10, minmax(0, 1fr));
}

#lobbySection .phase-mode-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#lobbySection .choice-card {
  border: 1px solid #beddcc;
  border-radius: 11px;
  background: linear-gradient(150deg, #ffffff, #f3fff8);
  color: #163d30;
  min-height: 42px;
  padding: 8px;
  display: grid;
  align-content: center;
  gap: 2px;
  text-align: left;
  cursor: pointer;
  transition: transform 90ms, box-shadow 120ms, border-color 120ms, background 120ms;
}

#lobbySection .choice-card:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(18,64,48,.12);
}

#lobbySection .choice-card.active {
  border-color: #45b37e;
  background: linear-gradient(150deg, #ecfff5, #defbe8);
  box-shadow: 0 0 0 2px rgba(69,179,126,.2);
}

#lobbySection .choice-card:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

#lobbySection .choice-card-title {
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.1;
}

#lobbySection .choice-card-subtitle {
  font-size: 0.72rem;
  font-weight: 700;
  color: #386252;
  line-height: 1.12;
}

#lobbySection .count-choice-cards .choice-card {
  min-height: 38px;
  padding: 6px;
  place-items: center;
  text-align: center;
}

#lobbySection .lobby-config-pane .phase-picker {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-height: 260px;
}

#lobbySection .lobby-config-pane .phase-picker-column.phase-einfach {
  border-color: #aee5c3;
  background: linear-gradient(150deg, #f6fff8, #effff4);
}

#lobbySection .lobby-config-pane .phase-picker-column.phase-mittel {
  border-color: #b6dff5;
  background: linear-gradient(150deg, #f6fcff, #eff8ff);
}

#lobbySection .lobby-config-pane .phase-picker-column.phase-schwer {
  border-color: #f2c8a0;
  background: linear-gradient(150deg, #fffaf2, #fff6ea);
}

#lobbySection .lobby-pane-phases .phase-list {
  max-height: 410px;
  overflow: auto;
  padding-right: 6px;
}

#lobbySection .phase-list-grouped {
  display: grid;
  gap: 9px;
}

#lobbySection .phase-difficulty-group {
  border: 1px solid #d5e7dc;
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(255,255,255,.55);
}

#lobbySection .phase-einfach {
  border-color: #aee5c3;
  background: linear-gradient(150deg, #f6fff8, #effff4);
}

#lobbySection .phase-mittel {
  border-color: #b6dff5;
  background: linear-gradient(150deg, #f6fcff, #eff8ff);
}

#lobbySection .phase-schwer {
  border-color: #f2c8a0;
  background: linear-gradient(150deg, #fffaf2, #fff6ea);
}

#lobbySection .phase-difficulty-title {
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #245543;
  margin-bottom: 6px;
}

#lobbySection .phase-difficulty-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 4px;
}

#lobbySection .phase-difficulty-list li {
  font-size: 0.95rem;
  line-height: 1.28;
}

.mode-pane-quick .actions-row {
  width: 100%;
}

.mode-pane-quick #quickMatchBtn {
  width: 100%;
}

#lobbySection .settings-row label {
  font-size: 0.95rem;
  color: #0f4b35;
}

#lobbySection select,
#lobbySection input {
  border-color: #a9d3bf;
  border-width: 1.5px;
  border-radius: 12px;
  font-weight: 800;
  background: linear-gradient(145deg, #ffffff, #f7fff9);
}

#lobbySection .phase-list {
  padding-left: 22px;
  gap: 7px;
}

#lobbySection .phase-list li {
  color: #254039;
  font-weight: 700;
  line-height: 1.3;
}

#lobbySection .phase-active-order {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 7px;
}

#lobbySection .phase-active-missing {
  margin-top: 6px;
  font-size: 0.88rem;
  font-weight: 800;
  color: #1f6b49;
}

#lobbySection #settingsAutoStatus {
  font-size: 0.92rem;
  color: #13553a;
}

#lobbySection #settingsHint {
  font-size: 0.92rem;
  color: #2f6251;
}

@media (max-width: 1220px) {
  #lobbySection .lobby-grid {
    grid-template-columns: minmax(200px, 0.9fr) minmax(0, 1.2fr);
  }

  #lobbySection .lobby-pane-phases {
    grid-column: 1 / -1;
  }
}

body.lobby-active {
  overflow: auto;
}

body.lobby-active .app-shell {
  height: auto;
  grid-template-rows: auto auto;
}

body.lobby-active #lobbySection {
  height: auto;
  display: block;
}
