:root {
  --ink: #0d2a4a;
  --panel: rgba(255, 255, 255, 0.82);
  --text: #223;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #bcd7ee;
  font: 500 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}

#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 0;
}

.scoreboard {
  list-style: none;
  margin: 0;
  padding: 6px 8px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
  border-radius: 14px;
  background: var(--panel);
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 16px rgba(13, 42, 74, 0.15);
}
.scoreboard:empty { display: none; }
.scoreboard li {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 6px;
  border-radius: 999px;
  border: 2px solid transparent;
  background: #fff;
  font-size: 14px;
  white-space: nowrap;
}
.scoreboard li.me { border-color: var(--ink); font-weight: 700; }
.scoreboard li.out { opacity: 0.45; }
.scoreboard li.out .name { text-decoration: line-through; }
.scoreboard li .chip {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}
.scoreboard li .name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.scoreboard li .lives { letter-spacing: 2px; font-size: 13px; }
.scoreboard li .lives.none { letter-spacing: 0; font-size: 11px; text-transform: uppercase; opacity: 0.8; }

.queue {
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(13, 42, 74, 0.08);
  color: var(--ink);
  font-size: 13px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue:empty { display: none; }
.queue .me { font-weight: 700; }

.banner {
  padding: 8px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(13, 42, 74, 0.25);
  transition: opacity 0.25s;
}
.banner:empty { opacity: 0; }

.start {
  pointer-events: auto;
  margin-top: 4px;
  padding: 12px 34px;
  border: 0;
  border-radius: 999px;
  background: #43a047;
  color: #fff;
  font: 700 20px/1.2 inherit;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(13, 42, 74, 0.25);
  transition: transform 0.1s, background 0.2s;
}
.start:hover { transform: scale(1.04); }
.start:active { transform: scale(0.98); }
.start:disabled {
  background: #8a97a6;
  cursor: default;
  transform: none;
}
.start[hidden] { display: none; }

.status {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 10px;
  background: var(--panel);
  font-size: 14px;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(13, 42, 74, 0.15);
}
.status kbd {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid #99a;
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #fff;
  font: 600 12px/1.5 inherit;
}
.status .me { font-weight: 700; color: var(--ink); }

.join {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(13, 42, 74, 0.35);
  backdrop-filter: blur(3px);
  pointer-events: auto;
}
.join[hidden] { display: none; }
.join form {
  display: grid;
  gap: 10px;
  width: min(360px, 90vw);
  padding: 26px 28px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(13, 42, 74, 0.35);
  text-align: center;
}
.join h1 { margin: 0; font-size: 26px; color: var(--ink); }
.join p { margin: 0; }
.join input {
  padding: 12px 14px;
  border: 2px solid #c5d3e0;
  border-radius: 10px;
  font: inherit;
  font-size: 18px;
  text-align: center;
}
.join input:focus { outline: none; border-color: var(--ink); }
.join button {
  padding: 12px;
  border: 0;
  border-radius: 999px;
  background: #43a047;
  color: #fff;
  font: 700 18px/1.2 inherit;
  cursor: pointer;
}
.join-error { min-height: 1.2em; color: #c62828; font-size: 14px; }
.join-error:empty { display: none; }

@media (max-width: 800px) {
  .scoreboard li { font-size: 12px; padding: 2px 8px 2px 5px; }
  .scoreboard li .name { max-width: 90px; }
  .banner { font-size: 16px; }
  .status { font-size: 12px; white-space: normal; max-width: 92vw; }
}
