:root {
  color-scheme: dark;
  --bg: #10151d;
  --panel: #1a222d;
  --panel-2: #202b38;
  --text: #f5f7fb;
  --muted: #aab4c2;
  --line: #344153;
  --accent: #f6d365;
  --danger: #ff5079;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  min-height: 36px;
  border: 1px solid #536073;
  border-radius: 6px;
  background: #2a3544;
  color: var(--text);
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

input {
  width: 92px;
  height: 36px;
  border: 1px solid #536073;
  border-radius: 6px;
  background: #111821;
  color: var(--text);
  padding: 0 10px;
  text-transform: uppercase;
}

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

.topbar,
.lobby-head,
.hud,
.player-row,
.room-tools {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  letter-spacing: 0;
}

p,
label,
.player-row,
.hud {
  color: var(--muted);
  font-size: 14px;
}

label {
  display: grid;
  gap: 5px;
}

.room-tools {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  margin-bottom: 16px;
  padding: 14px;
}

.lobby-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

#readyButton {
  min-width: 104px;
  background: #433b26;
  border-color: #7c6840;
}

.players-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.player-row {
  min-height: 48px;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

.player-row.self {
  border-color: var(--accent);
}

.player-row strong {
  color: var(--text);
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.36);
  flex: 0 0 auto;
}

.swatch.empty {
  background: transparent;
  border-color: #536073;
}

.game-wrap {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #0b0f16;
}

canvas {
  display: block;
  width: 100%;
  max-height: calc(100vh - 250px);
  aspect-ratio: 16 / 9;
  image-rendering: pixelated;
}

.hud {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(8, 12, 18, 0.72);
  color: #edf2f7;
}

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

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

  .room-tools {
    justify-content: flex-start;
  }

  .players-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hud {
    flex-wrap: wrap;
  }
}
