* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #0a0a1a;
  color: #d0d8e8;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- video background --- */
#bg-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
  pointer-events: none;
}

/* dim layer over the video so foreground content stays readable */
#bg-dim {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(10,10,26,0.55) 0%, rgba(10,10,26,0.75) 100%);
  z-index: -1;
  pointer-events: none;
}

/* --- layout --- */
#app {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

/* --- header --- */
header {
  text-align: center;
  padding: 40px 0 30px;
  position: relative;
  z-index: 1;
}
header h1 {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #e0e8ff;
  text-shadow:
    0 0 10px rgba(100, 140, 255, 0.5),
    0 0 30px rgba(100, 140, 255, 0.2);
}
header p {
  color: #6a7a9a;
  margin-top: 6px;
  font-size: 0.9rem;
  letter-spacing: 0.15em;
}

/* --- nick bar --- */
#nick-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  align-items: center;
  justify-content: center;
}
#nick-bar label {
  font-size: 0.85rem;
  color: #6a7a9a;
  white-space: nowrap;
}

/* --- inputs --- */
input {
  background: rgba(10,15,30,0.65);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(140,170,255,0.35);
  border-radius: 6px;
  padding: 10px 14px;
  color: #e8edff;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
input:focus {
  border-color: rgba(140,170,255,0.8);
  background: rgba(10,15,30,0.8);
}
input::placeholder {
  color: #6a7a9a;
}

#nick-input {
  flex: 0 0 50%;   /* half the row width */
  max-width: 50%;
}

/* --- buttons --- */
button {
  background: rgba(20,30,60,0.7);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(140,170,255,0.4);
  border-radius: 6px;
  padding: 10px 20px;
  color: #d8e0ff;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.05em;
}
button:hover {
  background: rgba(60,90,160,0.7);
  border-color: rgba(160,190,255,0.8);
  color: #ffffff;
  box-shadow: 0 0 16px rgba(100,140,255,0.35);
}
button:active {
  transform: scale(0.97);
}
button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-primary {
  background: rgba(100,140,255,0.2);
  border-color: rgba(100,140,255,0.5);
  color: #c8d8ff;
  font-weight: 600;
}
.btn-primary:hover {
  background: rgba(100,140,255,0.35);
  box-shadow: 0 0 20px rgba(100,140,255,0.2);
}

.btn-danger {
  border-color: rgba(255,80,80,0.3);
  color: #e08888;
}
.btn-danger:hover {
  background: rgba(255,80,80,0.15);
  border-color: rgba(255,80,80,0.6);
}

.btn-small {
  padding: 5px 12px;
  font-size: 0.8rem;
}

/* --- room list --- */
#room-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.room-card {
  background: rgba(10,15,30,0.7);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(140,170,255,0.25);
  border-radius: 8px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: border-color 0.2s, background 0.2s;
}
.room-card:hover {
  border-color: rgba(140,170,255,0.55);
  background: rgba(15,22,42,0.78);
}

.room-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.room-info {
  flex: 1;
}
.room-name {
  font-weight: 600;
  font-size: 1.05rem;
  color: #e0e8ff;
}
.room-meta {
  font-size: 0.8rem;
  color: #8a9ab8;
  margin-top: 4px;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 10px;
}
.status-waiting {
  background: rgba(80,200,120,0.15);
  color: #60c878;
  border: 1px solid rgba(80,200,120,0.3);
}
.status-playing {
  background: rgba(255,180,60,0.15);
  color: #dda030;
  border: 1px solid rgba(255,180,60,0.3);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #4a5a7a;
  font-size: 0.95rem;
}

/* --- room view --- */
#room-view {
  display: none;
}

#room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
#room-header h2 {
  font-size: 1.5rem;
  color: #e8edff;
  text-shadow: 0 0 14px rgba(100,140,255,0.4);
}

#invite-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}
#invite-link {
  flex: 1;
  font-size: 0.85rem;
  color: #a0b0d0;
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(80,200,120,0.2);
  border: 1px solid rgba(80,200,120,0.5);
  color: #60c878;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 0.85rem;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  z-index: 100;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- teams --- */
#teams-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.team-column {
  background: rgba(10,15,30,0.7);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(140,170,255,0.25);
  border-radius: 8px;
  padding: 20px;
  min-height: 200px;
}
.team-column h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(140,170,255,0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.team-column h3 .count {
  font-size: 0.8rem;
  color: #8a9ab8;
  font-weight: 400;
}

.team-a h3 { color: #ff7a7a; text-shadow: 0 0 12px rgba(255,100,100,0.4); }
.team-b h3 { color: #7ab8ff; text-shadow: 0 0 12px rgba(100,160,255,0.4); }
.team-a { border-color: rgba(255,100,100,0.4); }
.team-b { border-color: rgba(100,160,255,0.4); }

.team-list {
  list-style: none;
  margin-bottom: 14px;
}
.team-list li {
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.team-list li:hover {
  background: rgba(255,255,255,0.03);
}
.team-list .host-badge {
  font-size: 0.7rem;
  color: #dda030;
  margin-left: 6px;
}

.join-team-btn {
  width: 100%;
  margin-top: auto;
}
.team-a .join-team-btn {
  border-color: rgba(255,100,100,0.3);
  color: #ff8888;
}
.team-a .join-team-btn:hover {
  background: rgba(255,100,100,0.15);
  border-color: rgba(255,100,100,0.6);
}
.team-b .join-team-btn {
  border-color: rgba(100,160,255,0.3);
  color: #88b8ff;
}
.team-b .join-team-btn:hover {
  background: rgba(100,160,255,0.15);
  border-color: rgba(100,160,255,0.6);
}

/* --- room actions --- */
#room-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* --- modals (create room, train team picker) --- */
#create-modal,
#train-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 50;
  justify-content: center;
  align-items: center;
}
#create-modal.open,
#train-modal.open {
  display: flex;
}

/* When a modal is open, dim and disable background buttons inside #app
   so the user understands they're not actionable until the modal closes. */
body.modal-open #app button {
  opacity: 0.4;
  pointer-events: none;
}
.modal-content {
  background: #12142a;
  border: 1px solid rgba(100,140,255,0.2);
  border-radius: 10px;
  padding: 30px;
  width: 360px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-content h3 {
  color: #c8d8ff;
  font-size: 1.1rem;
}
.modal-content input {
  width: 100%;
}
.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
