/* Layout and components shared by the multiplayer games (home, lobby, scores). */

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.room-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  font-weight: 800;
  letter-spacing: 0.12em;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.grow {
  flex: 1 1 auto;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 16px;
  align-items: start;
}

@media (max-width: 760px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Home ---------- */

.home {
  max-width: 460px;
  margin: 24px auto 0;
}

.home h1 {
  font-size: 2.2rem;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.join-form {
  display: flex;
  gap: 8px;
}

.join-form input {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 800;
  text-align: center;
}

.error {
  color: var(--bad);
  font-weight: 600;
  min-height: 1.5em;
  margin: 0;
}

.rules {
  font-size: 0.95rem;
}

.rules ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

details summary {
  cursor: pointer;
  font-weight: 700;
}

/* ---------- Lobby ---------- */

.code-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.code-big {
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  line-height: 1;
}

.players {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2);
}

.player.me {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.player.offline {
  opacity: 0.5;
}

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
}

.player-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.player-meta {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.section-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 10px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.sticky-actions {
  position: sticky;
  bottom: 12px;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

/* ---------- Scores ---------- */

.scoreboard {
  width: 100%;
  border-collapse: collapse;
}

.scoreboard th,
.scoreboard td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.scoreboard th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.scoreboard td.num,
.scoreboard th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.scoreboard .gain {
  color: var(--ok);
  font-weight: 800;
}

.scoreboard tr.me td {
  background: var(--accent-soft);
}

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  padding-top: 12px;
}

.podium-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 30%;
  max-width: 160px;
}

.podium-block {
  display: grid;
  place-items: center;
  width: 100%;
  border-radius: 12px 12px 0 0;
  background: var(--accent-soft);
  font-size: 1.8rem;
  font-weight: 900;
}

.podium-step:nth-child(1) .podium-block { height: 90px; }
.podium-step:nth-child(2) .podium-block { height: 130px; background: var(--accent); color: var(--accent-text); }
.podium-step:nth-child(3) .podium-block { height: 64px; }

.podium-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

/* ---------- Misc ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  box-shadow: var(--shadow);
  z-index: 10;
}

.connection {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 6px;
  background: var(--warn);
  color: #fff;
  text-align: center;
  font-weight: 700;
  z-index: 10;
}

@keyframes pop {
  0% { transform: scale(0.4) rotate(-12deg); }
  70% { transform: scale(1.1) rotate(3deg); }
  100% { transform: scale(1) rotate(0); }
}

@media (max-width: 520px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .code-big {
    font-size: 2rem;
  }
}
