/* Fix #1: Standalone teach toggle in lobby (when score bar is hidden) */
.lobby-teach-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
}

/* ========== LOBBY ========== */
.lobby {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  flex: 1;
  min-height: calc(100vh - 60px);
  min-height: calc(100dvh - 60px);
  position: relative; /* for absolute-positioned teach toggle */
}

.lobby h1 {
  font-size: 2rem;
  color: var(--gold);
}

.lobby-fact {
  max-width: 420px;
  margin: 0 auto 0.75rem;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  background: rgba(218, 165, 32, 0.08);
  border: 1px solid rgba(218, 165, 32, 0.2);
  color: rgba(230, 220, 190, 0.85);
  font-size: 0.8rem;
  font-style: italic;
  line-height: 1.4;
  text-align: center;
}

.version-badge {
  font-size: 0.55rem;
  color: var(--gold);
  vertical-align: super;
  font-weight: normal;
}

.quick-start-row {
  text-align: center;
  margin: 0.5rem 0 1rem 0;
}

.quick-start-btn {
  padding: 0.6rem 1.8rem;
  font-size: 0.95rem;
}

.name-input {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.name-input input {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 2px solid var(--gold);
  background: rgba(0,0,0,0.3);
  color: var(--text);
  font-size: 1rem;
  min-width: 200px;
}

.player-list {
  list-style: none;
  padding: 0;
  width: 100%;
  max-width: 300px;
}

.player-list li {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

/* Room code display */
.room-code-display {
  text-align: center;
  padding: 16px;
  margin: 12px 0;
  background: rgba(0,0,0,0.3);
  border: 2px solid var(--gold);
  border-radius: 8px;
}

.room-code-label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gold);
  margin-bottom: 4px;
}

.room-code-value {
  display: block;
  font-family: 'Courier New', monospace;
  font-size: 2rem;
  font-weight: bold;
  letter-spacing: 8px;
  color: white;
  margin: 8px 0;
  user-select: all;
}

.room-code-copy {
  margin-top: 8px;
}

.room-code-input {
  font-family: 'Courier New', monospace;
  font-size: 1.2rem;
  letter-spacing: 4px;
  text-align: center;
  width: 120px;
  padding: 8px;
}

/* ========== TEAM SELECTION — Click-to-Seat Table ========== */
.table-team-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 380px;
  margin: 0.5rem auto;
}

.table-team-heading {
  text-align: center;
  color: var(--gold);
  font-size: 0.85rem;
  margin: 0 0 0.5rem 0;
}

/* Bench — row of player chips */
.table-bench {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 1rem;
}

.table-chip {
  padding: 0.4rem 1rem;
  border-radius: 20px;
  border: 2px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.4);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  min-height: 44px;
  min-width: 44px;
  white-space: nowrap;
}

.table-chip:hover {
  transform: scale(1.05);
  border-color: var(--gold);
}

.table-chip.selected {
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(218,165,32,0.6);
  transform: scale(1.08);
  background: rgba(218,165,32,0.2);
}

.table-chip.seated {
  opacity: 0.35;
  pointer-events: none;
  border-color: rgba(255,255,255,0.1);
}

/* Table surface — grid */
.table-surface {
  display: grid;
  grid-template-areas:
    ".    top    ."
    "left felt right"
    ".    bottom .";
  grid-template-columns: auto 100px auto;
  grid-template-rows: auto auto auto;
  gap: 8px;
  justify-content: center;
  align-items: center;
  max-width: 360px;
  width: 100%;
}

.table-pos-top    { grid-area: top; }
.table-pos-right  { grid-area: right; }
.table-pos-bottom { grid-area: bottom; }
.table-pos-left   { grid-area: left; }

.table-seat {
  min-height: 60px;
  min-width: 104px;
  border-radius: 10px;
  border: 2px dashed rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);
  padding: 0.45rem 0.65rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.18rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text);
  font-family: inherit;
}

.table-seat:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.table-seat:active {
  transform: scale(0.97);
}

/* Team colors on seats */
.table-seat.team-ns {
  border-color: rgba(218,165,32,0.5);
  box-shadow: 0 0 8px rgba(218,165,32,0.18);
}

.table-seat.team-ew {
  border-color: rgba(91,206,200,0.45);
  box-shadow: 0 0 8px rgba(91,206,200,0.18);
}

/* Filled seat gets solid border instead of dashed */
.table-seat:has(.table-seat-occupant) {
  border-style: solid;
  border-width: 2px;
}

.table-seat:has(.table-seat-occupant).team-ns {
  border-color: rgba(218,165,32,0.75);
  box-shadow: 0 0 12px rgba(218,165,32,0.3);
  background: rgba(218,165,32,0.08);
}

.table-seat:has(.table-seat-occupant).team-ew {
  border-color: rgba(91,206,200,0.7);
  box-shadow: 0 0 12px rgba(91,206,200,0.3);
  background: rgba(91,206,200,0.08);
}

/* Selected seat state for host reordering */
.table-seat.table-seat-selected {
  border-color: #ffffff !important;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.95), inset 0 0 12px rgba(255, 215, 0, 0.45) !important;
  transform: scale(1.06);
  animation: pulse-seat 1.2s infinite alternate ease-in-out;
}

@keyframes pulse-seat {
  0% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.6), inset 0 0 6px rgba(255, 215, 0, 0.3); }
  100% { box-shadow: 0 0 24px rgba(255, 215, 0, 1), inset 0 0 16px rgba(255, 215, 0, 0.6); }
}

.table-seat.table-seat-selected .table-seat-label {
  color: #fff;
  font-weight: bold;
}

.table-swap-hint {
  font-size: 0.78rem;
  color: var(--gold);
  text-align: center;
  margin: 4px 0 6px 0;
  animation: prompt-pulse 2s ease-in-out infinite;
}

.table-seat-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  opacity: 0.75;
  font-weight: 600;
}

.table-seat-occupant {
  font-size: 0.88rem;
  font-weight: bold;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Center felt — the table medallion */
.table-felt {
  grid-area: felt;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle, #2d6b43 0%, #153b23 100%);
  border: 2px solid rgba(218, 165, 32, 0.4);
  box-shadow: inset 0 3px 10px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.4);
  margin: 0 auto;
  pointer-events: none;
}

.table-felt-inner {
  font-size: 1.8rem;
  opacity: 0.6;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

/* Partnerships strip */
.table-partnerships {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0.75rem 0 0.25rem 0;
  flex-wrap: wrap;
}

.team-pill {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 16px;
  font-size: 0.82rem;
  font-weight: bold;
  white-space: nowrap;
}

.team-pill.team-ns {
  background: rgba(218,165,32,0.2);
  color: var(--team-ns);
  border: 1px solid rgba(218,165,32,0.35);
}

.team-pill.team-ew {
  background: rgba(91,206,200,0.15);
  color: var(--team-ew);
  border: 1px solid rgba(91,206,200,0.3);
}

.vs {
  font-size: 0.75rem;
  opacity: 0.5;
  font-style: italic;
}


/* ========== FIX #4: LANDING PAGE ========== */
.landing-options {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
  max-width: 400px;
  align-items: center;
}

.landing-card {
  background: rgba(0,0,0,0.3);
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 1.5rem;
  width: 100%;
  text-align: center;
}

.landing-card h3 {
  color: var(--gold);
  margin-bottom: 0.5rem;
  font-size: 1.15rem;
}

.landing-card p {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.landing-card .btn {
  margin: 0.25rem;
}

.landing-join-form {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
  align-items: center;
}

.landing-join-form.visible {
  display: flex;
}

.landing-join-form input {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 2px solid var(--gold);
  background: rgba(0,0,0,0.3);
  color: var(--text);
  font-size: 1rem;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}

/* Fix #2: Room-code input same width as name input in join form */
.landing-join-form input.room-code-input {
  padding: 8px;
  width: 100%;
  font-size: 1.2rem;
  letter-spacing: 4px;
}

/* ========== QR CODE ========== */
.qr-section {
  text-align: center;
  margin: 0.75rem 0;
}

.qr-label {
  font-size: 0.75rem;
  color: var(--gold);
  opacity: 0.7;
  margin-bottom: 0.4rem;
}

.qr-code {
  border-radius: 8px;
  background: #fff;
  padding: 4px;
  display: inline-block;
}

/* ========== LOBBY PULSE INDICATORS ========== */
.online-pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4caf50;
  box-shadow: 0 0 6px #4caf50;
  flex-shrink: 0;
}

.offline-pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f44336;
  flex-shrink: 0;
}

.empty-pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

/* ========== SPECTATOR LIST ========== */
.spectator-list-lobby {
  font-size: 0.8rem;
  color: #90caf9;
  background: rgba(33, 150, 243, 0.1);
  border: 1px dashed rgba(33, 150, 243, 0.4);
  border-radius: 6px;
  padding: 6px 10px;
  margin-top: 8px;
  text-align: center;
  width: 100%;
}

/* Always-visible spectator roster chip (score bar) — 4a.6 */
.spectator-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(33, 150, 243, 0.15);
  border: 1px solid rgba(33, 150, 243, 0.4);
  color: #90caf9;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  margin-left: 4px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Spectator waiting view in a lobby — 4a.4 */
.spectator-lobby-view {
  margin-top: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  color: #90caf9;
  background: rgba(33, 150, 243, 0.1);
  border: 1px dashed rgba(33, 150, 243, 0.4);
  border-radius: 8px;
}

/* ========== LEAVE BUTTON IN LOBBY ========== */
.btn-leave-lobby {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--text);
  opacity: 0.8;
  font-size: 0.85rem;
  padding: 4px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 10px;
}

.btn-leave-lobby:hover {
  background: rgba(200, 50, 50, 0.25);
  border-color: #e57373;
  color: #ffcdd2;
  opacity: 1;
}

/* ========== MOBILE RESPONSIVE (extracted per-component from the style.css mega-block) ========== */
@media (max-width: 768px), (min-width: 769px) and (max-width: 1024px) and (pointer: coarse) {
  .lobby h1 {
    font-size: 1.5rem;
  }
  /* Fix #2: Landing cards stack on mobile */
  .landing-options {
    flex-direction: column;
    gap: 16px;
  }

  .landing-card {
    width: 100%;
    max-width: none;
  }
}
