/* Stage 4 — game screens, lobby, match UI */

.lobby-screen {
  text-align: center;
}

.lobby-welcome {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.lobby-username {
  color: var(--color-text-muted);
  font-size: 0.9375rem;
  margin-bottom: 1.25rem;
}

.lobby-actions {
  margin-top: 0.5rem;
}

.game-screen__subtitle {
  margin-bottom: 1rem;
  text-align: center;
}

.game-mode-badge {
  display: inline-block;
  align-self: center;
  margin: 0 auto 0.75rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: rgba(89, 194, 255, 0.12);
  color: var(--color-accent);
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
}

.mode-cards {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  width: 100%;
  padding: 1rem 1.1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg-alt);
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.mode-card--active {
  border-color: var(--color-primary);
  background: rgba(124, 108, 240, 0.12);
  box-shadow: 0 0 0 1px rgba(124, 108, 240, 0.35);
}

.mode-card__title {
  font-size: 1.125rem;
  font-weight: 800;
}

.mode-card__desc {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.btn--xl {
  min-height: 3.5rem;
  font-size: 1.0625rem;
}

.match-code-block {
  text-align: center;
  margin: 1rem 0 1.25rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--color-bg-alt);
  border: 1px dashed var(--color-border);
}

.match-code-block__label {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: 0.35rem;
}

.match-code-block__value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: var(--color-accent);
}

.waiting-screen__title {
  text-align: center;
}

.waiting-opponent-note {
  text-align: center;
  color: var(--color-success);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.waiting-opponent-note--hidden,
.loading--hidden {
  display: none;
}

.waiting-conn {
  text-align: center;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.match-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.match-players {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.match-players__name {
  font-weight: 700;
  font-size: 0.9375rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-players__name--you {
  text-align: left;
  color: var(--color-accent);
}

.match-players__name--opponent {
  text-align: right;
}

.match-players__vs {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 700;
}

.scoreboard--game {
  grid-template-columns: 1fr auto 1fr;
  margin-bottom: 1rem;
}

.scoreboard__sep {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-text-muted);
}

.match-timer--game {
  font-size: 2.25rem;
  margin-bottom: 0.5rem;
}

.match-timer--urgent {
  color: var(--color-warning);
}

.choice-grid--game {
  gap: 0.85rem;
}

.choice-grid--hidden {
  display: none;
}

.choice-btn--game {
  min-height: 4rem;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
}

.choice-btn--selected {
  box-shadow: 0 0 0 2px rgba(89, 194, 255, 0.5);
}

.match-waiting-note {
  text-align: center;
  color: var(--color-warning);
  font-weight: 700;
  font-size: 0.9375rem;
  margin: 0.5rem 0 1rem;
}

.match-waiting-note--hidden {
  display: none;
}

.round-result {
  margin: 1rem 0;
  padding: 1rem;
  border-radius: var(--radius);
  background: rgba(124, 108, 240, 0.1);
  border: 1px solid rgba(124, 108, 240, 0.25);
}

.round-result--hidden {
  display: none;
}

.round-result__title {
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
}

.round-result__choices {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.round-result__choice {
  text-align: center;
}

.round-result__label {
  display: block;
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

.round-result__move {
  display: block;
  font-size: 2rem;
}

.round-result__vs {
  font-weight: 700;
  color: var(--color-text-muted);
}

.round-result__outcome {
  text-align: center;
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--color-primary-hover);
}

.match-footer--hidden {
  display: none;
}

.match-footer {
  margin-top: 1rem;
}

.tg-webapp .shell {
  padding-bottom: env(safe-area-inset-bottom, 0);
}
