/* ===== Public URL Banner ===== */
.public-url-banner {
  background: linear-gradient(135deg, rgba(39,174,96,0.25), rgba(46,204,113,0.15));
  border: 2px solid rgba(39,174,96,0.5);
  border-radius: var(--radius);
  padding: 16px 20px;
  width: 100%;
  color: white;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: pulse-green 3s infinite;
}

@keyframes pulse-green {
  0%, 100% { border-color: rgba(39,174,96,0.5); }
  50%       { border-color: rgba(39,174,96,1); box-shadow: 0 0 16px rgba(39,174,96,0.4); }
}

.local-url-banner {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  padding: 12px 20px;
  width: 100%;
  color: white;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pub-label {
  font-size: 0.85rem;
  opacity: 0.85;
  font-weight: 600;
}

.pub-url-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pub-url {
  font-size: 1.1rem;
  font-weight: 800;
  color: #7DFFB3;
  text-decoration: none;
  word-break: break-all;
  font-family: monospace;
  letter-spacing: 0.5px;
}

.pub-url:hover { text-decoration: underline; }

.pub-hint {
  font-size: 0.78rem;
  opacity: 0.75;
}

/* ===== Lobby Layout ===== */
.lobby-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 16px 48px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

/* ===== Header ===== */
.lobby-header {
  text-align: center;
  color: white;
}

.logo {
  font-size: 5rem;
  animation: bounce 2s infinite;
  display: block;
  margin-bottom: 8px;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.lobby-header h1 {
  font-size: 2.4rem;
  font-weight: 800;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
  line-height: 1.1;
}

.lobby-header h1 span {
  font-size: 1.6rem;
  font-weight: 700;
  opacity: 0.9;
}

.subtitle {
  margin-top: 8px;
  font-size: 1.1rem;
  opacity: 0.9;
  font-style: italic;
}

/* ===== Mode Selector ===== */
.mode-selector {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  padding: 20px 24px;
  width: 100%;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.2);
}

.mode-selector h3 {
  color: white;
  margin-bottom: 14px;
  font-size: 1rem;
  opacity: 0.9;
}

.mode-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.mode-btn {
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: var(--radius);
  padding: 12px 18px;
  cursor: pointer;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 100px;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  background: rgba(255,255,255,0.3);
  transform: translateY(-2px);
}

.mode-btn.active {
  background: rgba(255,255,255,0.4);
  border-color: white;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.3);
}

.mode-icon { font-size: 1.6rem; }
.mode-name { font-weight: 700; font-size: 0.95rem; }
.mode-desc { font-size: 0.75rem; opacity: 0.8; }

/* ===== Cards ===== */
.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  width: 100%;
}

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

.card {
  background: white;
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card-icon {
  font-size: 2.5rem;
  text-align: center;
}

.card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  color: var(--gray-900);
}

.card p {
  font-size: 0.9rem;
  color: var(--gray-700);
  text-align: center;
  line-height: 1.5;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
}

.form-group input {
  padding: 10px 14px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font);
  transition: border-color 0.2s;
  outline: none;
}

.form-group input:focus {
  border-color: #667eea;
}

.card .btn {
  width: 100%;
  margin-top: 4px;
}

/* ===== Error Banner ===== */
.error-banner {
  background: #FEE2E2;
  border: 1px solid #FCA5A5;
  color: #DC2626;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  width: 100%;
  text-align: center;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* ===== Waiting Room ===== */
.waiting-room {
  background: white;
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.waiting-room h2 {
  font-size: 1.5rem;
  font-weight: 800;
}

.invite-code-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--gray-100);
  padding: 14px 20px;
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.invite-code-display span:first-child {
  font-weight: 600;
  color: var(--gray-700);
}

.invite-code-display .code {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: #667eea;
  font-family: monospace;
}

.copy-btn {
  background: none;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}

.copy-btn:hover {
  border-color: #667eea;
  background: var(--blue-light);
}

.waiting-hint {
  color: var(--gray-700);
  font-size: 0.9rem;
}

/* ===== Player List ===== */
.player-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--gray-100);
  transition: background 0.2s;
}

.player-color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  line-height: 1;
}

.player-item-name {
  font-weight: 600;
  flex: 1;
}

.player-item-tag {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--gray-200);
  color: var(--gray-700);
}

.player-item-tag.host {
  background: #667eea;
  color: white;
}

.player-item-tag.ready {
  background: #27AE60;
  color: white;
}

.waiting-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.start-hint {
  color: var(--gray-700);
  font-size: 0.9rem;
}

/* ===== Selection Panel ===== */
.selection-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.selection-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.selection-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-700);
  margin: 0;
}

/* ── Character Cards ── */
.char-cards {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.char-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--gray-200);
  background: var(--gray-100);
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 72px;
}

.char-card:hover:not(.confirmed-taken):not(:disabled) {
  border-color: #667eea;
  background: #EEF2FF;
  transform: translateY(-2px);
}

.char-card.selected {
  border-color: #667eea;
  background: #EEF2FF;
  box-shadow: 0 0 0 3px rgba(102,126,234,0.25);
}

.char-card.confirmed-taken {
  opacity: 0.35;
  cursor: not-allowed;
}

.char-card:disabled {
  cursor: default;
  opacity: 0.7;
}

.char-emoji {
  font-size: 1.8rem;
  line-height: 1;
}

.char-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-700);
}

/* ── Color Swatches ── */
.color-swatches {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.color-swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.color-swatch:hover:not(.confirmed-taken):not(:disabled) {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.color-swatch.selected {
  border-color: #222;
  transform: scale(1.15);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.15), 0 4px 12px rgba(0,0,0,0.3);
}

.color-swatch.selected::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
  font-weight: 900;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.color-swatch.confirmed-taken {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.color-swatch.confirmed-taken::after {
  content: '✕';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1rem;
  font-weight: 900;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.color-swatch:disabled {
  cursor: default;
}

/* ── Confirm Button ── */
.btn-confirm {
  background: linear-gradient(135deg, #27AE60, #2ECC71);
  color: white;
  border: none;
  padding: 12px 32px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 160px;
  justify-content: center;
}

.btn-confirm:hover:not(:disabled) {
  background: linear-gradient(135deg, #219A52, #27AE60);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(39,174,96,0.4);
}

.btn-confirm:disabled {
  background: var(--gray-200);
  color: var(--gray-500);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-confirm.confirmed {
  background: linear-gradient(135deg, #27AE60, #2ECC71);
  opacity: 0.7;
}

.selection-error {
  font-size: 0.85rem;
  color: #DC2626;
  font-weight: 500;
  margin: 0;
}

/* ── Confirmed tag ── */
.player-item-tag.confirmed {
  background: #27AE60;
  color: white;
}

/* ===== Sound Selector (host only) ===== */
.sound-selector {
  background: #F0F4FF;
  border: 2px solid #C5CAE9;
  border-radius: var(--radius);
  padding: 14px 18px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.sound-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.sound-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid #C5CAE9;
  background: white;
  color: #495057;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}

.sound-btn:hover {
  background: #EEF2FF;
  border-color: #667eea;
  color: #3730a3;
}

.sound-btn.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-color: transparent;
  color: white;
  box-shadow: 0 2px 8px rgba(102,126,234,0.5);
}

/* ===== Lives Mode Selector (host only) ===== */
.lives-selector {
  background: #FFF5F5;
  border: 2px solid #FECACA;
  border-radius: var(--radius);
  padding: 14px 18px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.lives-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.lives-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid #FECACA;
  background: white;
  color: #495057;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}

.lives-btn:hover {
  background: #FEF2F2;
  border-color: #EF4444;
  color: #991B1B;
}

.lives-btn.active {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  border-color: transparent;
  color: white;
  box-shadow: 0 2px 8px rgba(239,68,68,0.5);
}
