.game-shell {
  min-height: 100vh;
}

.race-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.lobby-panel,
.stage-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 23, 34, 0.88);
  box-shadow: var(--shadow);
}

.lobby-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
}

.connection-row,
.room-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.connection-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 18px rgba(255, 200, 87, 0.55);
}

.connection-dot.online {
  background: var(--lime);
  box-shadow: 0 0 18px rgba(184, 255, 92, 0.55);
}

.connection-dot.error {
  background: var(--danger);
  box-shadow: 0 0 18px rgba(255, 102, 117, 0.55);
}

.field-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #090d15;
  color: var(--text);
  outline: none;
}

input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(39, 225, 242, 0.12);
}

.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

button {
  min-height: 44px;
  border: 1px solid rgba(39, 225, 242, 0.25);
  border-radius: 8px;
  background: #142130;
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
}

button:hover:not(:disabled) {
  border-color: var(--cyan);
  background: #193044;
}

button:disabled {
  color: #687489;
  cursor: not-allowed;
  opacity: 0.7;
}

.room-strip {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d121b;
}

.room-strip strong {
  color: var(--cyan);
  letter-spacing: 0;
}

.race-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.race-stats div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d121b;
}

.race-stats span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.race-stats strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(0.95rem, 2vw, 1.15rem);
}

.scoreboard {
  display: grid;
  gap: 8px;
  min-height: 92px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.scoreboard li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.86rem;
}

.scoreboard b {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.65;
}

.stage-panel {
  position: relative;
  min-height: min(68vh, 620px);
  overflow: hidden;
  background: #070b12;
}

#gameRoot,
#gameRoot canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.race-overlay {
  position: absolute;
  inset: auto 16px 16px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(7, 11, 18, 0.78);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.race-overlay strong {
  color: var(--lime);
}

.race-overlay span {
  color: var(--muted);
}

@media (max-width: 880px) {
  .race-layout {
    grid-template-columns: 1fr;
  }

  .stage-panel {
    min-height: 58vh;
  }
}

@media (max-width: 520px) {
  .race-stats {
    grid-template-columns: 1fr;
  }

  .race-overlay {
    align-items: flex-start;
    flex-direction: column;
  }
}
