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

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #10131b;
}

button,
input {
  font: inherit;
}

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

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

h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 52px);
  line-height: 0.95;
  letter-spacing: 0;
}

p {
  margin: 8px 0 0;
  color: #c7bca8;
}

.roomTools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.roomTools label {
  color: #c7bca8;
  font-size: 13px;
}

input {
  width: 96px;
  height: 38px;
  border: 1px solid #4c5366;
  border-radius: 6px;
  padding: 0 10px;
  background: #191e2a;
  color: #fff5dd;
  text-transform: uppercase;
}

button {
  height: 38px;
  border: 1px solid #6d5b3a;
  border-radius: 6px;
  padding: 0 13px;
  background: #f0ba4b;
  color: #18120b;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  background: #ffd26b;
}

.playArea {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 14px;
  align-items: start;
}

canvas {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 120px);
  image-rendering: pixelated;
  border: 2px solid #6f5d48;
  border-radius: 8px;
  background: #151923;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.38);
}

.panel {
  display: grid;
  gap: 10px;
}

.stat,
.players {
  border: 1px solid #333949;
  border-radius: 8px;
  background: #171c27;
}

.stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0 14px;
}

.stat span {
  color: #c7bca8;
}

.stat strong {
  font-size: 24px;
}

.players {
  min-height: 116px;
  padding: 8px;
}

.playerRow {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 32px;
  padding: 4px 6px;
  border-radius: 6px;
}

.playerRow.self {
  background: #232a38;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.playerName {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hp {
  color: #c7bca8;
  font-variant-numeric: tabular-nums;
}

#restartButton {
  width: 100%;
}

@media (max-width: 820px) {
  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .roomTools {
    justify-content: flex-start;
  }

  .playArea {
    grid-template-columns: 1fr;
  }

  canvas {
    max-height: none;
  }

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

  .players,
  #restartButton {
    grid-column: 1 / -1;
  }
}
