:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0d1016;
  color: #f1f4f8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 209, 102, 0.08), transparent 34%),
    #0d1016;
}

button,
input {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid #566171;
  border-radius: 6px;
  padding: 0 14px;
  background: #202734;
  color: #f5f7fb;
  cursor: pointer;
}

button:hover {
  background: #2b3545;
}

input {
  width: 108px;
  height: 38px;
  border: 1px solid #566171;
  border-radius: 6px;
  padding: 0 10px;
  background: #111720;
  color: #ffffff;
  text-transform: uppercase;
}

.shell {
  width: min(960px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 24px 0;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
  color: #ffd166;
}

h2 {
  font-size: 18px;
}

#connectionLabel {
  margin-top: 8px;
  color: #aeb8c6;
}

.room-tools,
.lobby-actions {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

label {
  display: grid;
  gap: 5px;
  color: #aeb8c6;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.lobby {
  display: grid;
  place-items: start center;
}

.panel {
  width: min(520px, 100%);
  border: 1px solid #344050;
  border-radius: 8px;
  background: #171d27;
  padding: 18px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

#roomCodeLabel {
  color: #ffd166;
  font-weight: 800;
  letter-spacing: 0;
}

.slots {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.slot {
  display: grid;
  grid-template-columns: 24px 46px 1fr 72px;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid #2b3544;
  border-radius: 6px;
  padding: 8px 10px;
  background: #111720;
}

.slot span {
  color: #bac3d0;
}

.slot em {
  color: #68e17b;
  font-style: normal;
  text-align: right;
}

.bird {
  width: 18px;
  height: 18px;
  border-radius: 50% 50% 45% 45%;
  display: inline-block;
}

.bird.p1 {
  background: #ffd166;
}

.bird.p2 {
  background: #64d2ff;
}

.bird.p3 {
  background: #ef476f;
}

.bird.p4 {
  background: #8aff80;
}

.bird.empty {
  border: 1px dashed #697484;
}

.game-wrap {
  position: relative;
  width: min(100%, 960px);
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  image-rendering: pixelated;
  border: 1px solid #344050;
  border-radius: 8px;
  background: #11151d;
}

.hud {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hud span,
.overlay {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(11, 14, 20, 0.76);
  color: #f4f6fb;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 800;
}

.overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  min-width: 132px;
  text-align: center;
}

.hidden {
  display: none;
}

@media (max-width: 680px) {
  .shell {
    width: min(100vw - 16px, 960px);
    padding-top: 12px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .room-tools {
    align-items: end;
  }

  .slot {
    grid-template-columns: 22px 38px 1fr;
  }

  .slot em {
    grid-column: 3;
    text-align: left;
  }
}
