/* ==========================================================================
   Cookie Clash – Lobby
   ========================================================================== */

.screen-lobby {
  align-items: flex-start;
  justify-content: center;
  padding: clamp(14px, 2.6vw, 32px);
}

.lobby-shell {
  width: min(1050px, 100%);
}

.sub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: clamp(16px, 3vw, 30px);
}

.sub-head-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sub-head-title h1 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.38rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.code-chip {
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-2);
  background: #f0dfc6;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.13em;
}

.lobby-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(14px, 2vw, 24px);
  align-items: stretch;
}

/* --------------------------------------------------------------------------
   Einladen
   -------------------------------------------------------------------------- */

.invite-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 520px;
  padding: clamp(24px, 3vw, 38px);
  overflow: hidden;
  border: 0;
  color: #fff3df;
  background:
    radial-gradient(500px 300px at 110% 110%, rgba(233, 162, 59, 0.28), transparent 60%),
    linear-gradient(155deg, #6d4729 0%, #54331b 58%, #432614 100%);
  box-shadow: 0 24px 50px rgba(65, 36, 16, 0.28);
}

.invite-panel .eyebrow {
  color: #f0bd6b;
}

.invite-panel h2 {
  position: relative;
  z-index: 1;
  margin: 11px 0 22px;
  color: #fff8eb;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 2.8vw, 2.3rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.05;
}

.big-code {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  width: min(330px, 100%);
  margin-bottom: 18px;
}

.big-code span {
  display: grid;
  place-items: center;
  aspect-ratio: 0.86;
  border: 1px solid rgba(255, 246, 229, 0.16);
  border-radius: 15px;
  color: #fff6e5;
  background: rgba(255, 246, 229, 0.09);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 10px 20px rgba(30, 14, 5, 0.14);
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3.4vw, 2.6rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.big-code span:nth-child(2) {
  animation: code-float 4.6s ease-in-out infinite;
}

.big-code span:nth-child(3) {
  animation: code-float 4.6s ease-in-out -2.3s infinite;
}

.invite-panel .muted {
  position: relative;
  z-index: 1;
  max-width: 33ch;
  margin: 0 0 22px;
  color: rgba(255, 243, 223, 0.62);
  font-size: 0.84rem;
  line-height: 1.55;
}

.invite-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: auto;
}

.invite-panel .btn {
  flex: 1 1 140px;
  min-height: 48px;
  font-size: 0.88rem;
}

.invite-panel .btn svg {
  width: 18px;
  height: 18px;
}

.invite-panel .btn-dark {
  color: #3d2713;
  background: linear-gradient(180deg, #f7cc74, #eab04d);
  box-shadow:
    0 10px 20px rgba(30, 14, 5, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.invite-panel .btn-dark:hover:not(:disabled) {
  background: linear-gradient(180deg, #ffd88a, #f0b858);
}

.invite-panel .btn-soft {
  color: #fff4e1;
  background: rgba(255, 246, 229, 0.11);
  box-shadow: inset 0 0 0 1px rgba(255, 246, 229, 0.2);
}

.invite-panel .btn-soft:hover:not(:disabled) {
  background: rgba(255, 246, 229, 0.17);
}

.invite-decoration {
  position: absolute;
  right: -34px;
  bottom: -36px;
  z-index: 0;
  width: 230px;
  height: 210px;
  pointer-events: none;
}

.deco-cookie {
  position: absolute;
  display: block;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, rgba(255, 226, 174, 0.42), rgba(255, 214, 150, 0.13) 58%, transparent 72%);
  border: 1px solid rgba(255, 235, 199, 0.13);
}

.deco-a {
  right: 26px;
  bottom: 32px;
  width: 118px;
  height: 118px;
  transform: rotate(14deg);
}

.deco-b {
  right: 126px;
  bottom: 106px;
  width: 52px;
  height: 52px;
  background: rgba(255, 226, 174, 0.12);
}

.deco-spark {
  position: absolute;
  right: 148px;
  bottom: 44px;
  color: rgba(255, 216, 138, 0.55);
  font-size: 21px;
}

/* --------------------------------------------------------------------------
   Mitspieler
   -------------------------------------------------------------------------- */

.players-panel {
  display: flex;
  flex-direction: column;
  min-height: 520px;
  padding: clamp(19px, 2.4vw, 30px);
}

.players-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.players-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.32rem;
  font-weight: 600;
}

.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--you-dark);
  background: var(--you-soft);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.live-chip i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--you);
  animation: pulse-dot 2.2s infinite;
}

.player-list {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: #fffaf1;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 7px 5px;
  animation: pop-in 0.25s ease both;
}

.player-row-empty {
  animation: none;
}

.avatar {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 16px;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.avatar-you {
  color: var(--you-dark);
  background: linear-gradient(160deg, #d9f6ef, #b9ebdf);
}

.avatar-rival {
  color: var(--rival-dark);
  background: linear-gradient(160deg, #ffe7df, #ffc9ba);
}

.avatar-empty {
  border: 1.5px dashed var(--line-strong);
  color: #b39c84;
  background: #f8efe1;
  box-shadow: none;
}

.player-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.player-name-line {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.player-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-name.muted {
  color: var(--ink-3);
  font-weight: 800;
}

.player-sub {
  overflow: hidden;
  color: var(--ink-3);
  font-size: 0.72rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag {
  flex: none;
  padding: 2px 7px;
  border-radius: 6px;
  color: var(--ink-2);
  background: #f0e2cd;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.online-dot {
  width: 9px;
  height: 9px;
  flex: none;
  margin-right: 5px;
  border-radius: 50%;
  background: #31b784;
  box-shadow: 0 0 0 4px rgba(49, 183, 132, 0.13);
}

.waiting-dots {
  display: flex;
  gap: 3px;
  align-items: center;
  margin-right: 8px;
}

.waiting-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #c0a98f;
  animation: waiting-bounce 1.2s ease-in-out infinite;
}

.waiting-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.waiting-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

.vs-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  color: var(--ink-3);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.2em;
}

.vs-divider::before,
.vs-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

/* --------------------------------------------------------------------------
   Ziel und Start
   -------------------------------------------------------------------------- */

.target-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.target-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.target-head .field-label {
  margin: 0;
}

.target-value {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  background: #f3e6d1;
  transition: opacity 0.2s ease;
}

.segmented button {
  height: 39px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  color: var(--ink-2);
  background: transparent;
  font-family: var(--font-display);
  font-size: 0.96rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.segmented button:hover:not(:disabled) {
  color: var(--ink);
  background: rgba(255, 253, 247, 0.55);
}

.segmented button.is-active {
  color: var(--choco-deep);
  background: var(--paper);
  box-shadow:
    0 2px 7px rgba(92, 58, 33, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.segmented button:disabled {
  cursor: default;
}

.segmented.is-locked {
  opacity: 0.72;
}

.target-block .muted {
  margin: 8px 0 0;
  font-size: 0.72rem;
}

.players-panel > .btn {
  margin-top: 20px;
}

.cta-hint {
  margin: 10px 0 0;
  color: var(--ink-3);
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}

.cta-hint.is-ready {
  color: var(--you-dark);
}

/* --------------------------------------------------------------------------
   Animationen
   -------------------------------------------------------------------------- */

@keyframes waiting-bounce {
  0%,
  60%,
  100% {
    opacity: 0.5;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

@keyframes code-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

/* --------------------------------------------------------------------------
   Responsiv
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .screen-lobby {
    padding: 16px;
  }

  .lobby-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .invite-panel,
  .players-panel {
    min-height: 0;
  }

  .invite-panel {
    padding: 26px;
  }

  .invite-panel h2 {
    margin-bottom: 16px;
  }

  .big-code {
    width: min(270px, 100%);
  }

  .big-code span {
    font-size: 2rem;
    border-radius: 12px;
  }

  .invite-actions {
    margin-top: 4px;
  }
}

@media (max-width: 560px) {
  .screen-lobby {
    padding: 12px 12px 26px;
  }

  .sub-head {
    margin-bottom: 15px;
  }

  .sub-head-title h1 {
    font-size: 1.18rem;
  }

  .code-chip {
    font-size: 0.82rem;
  }

  .mini-brand-cookie {
    width: 27px;
    height: 27px;
  }

  .invite-panel {
    padding: 21px;
    border-radius: 22px;
  }

  .invite-panel h2 {
    font-size: 1.65rem;
  }

  .big-code {
    gap: 7px;
    width: 100%;
  }

  .big-code span {
    aspect-ratio: 1.05;
    font-size: 1.8rem;
  }

  .invite-panel .muted {
    margin-bottom: 16px;
    font-size: 0.8rem;
  }

  .invite-actions .btn {
    min-height: 46px;
    flex-basis: 100%;
  }

  .invite-decoration {
    opacity: 0.6;
  }

  .players-panel {
    padding: 16px;
    border-radius: 22px;
  }

  .players-head h2 {
    font-size: 1.18rem;
  }

  .player-row {
    gap: 10px;
  }

  .avatar {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    font-size: 1.15rem;
  }

  .player-name {
    font-size: 0.92rem;
  }

  .tag {
    display: none;
  }

  .players-panel > .btn {
    margin-top: 16px;
  }
}
