:root {
  --bg: #0f1419;
  --fg: #e8eef4;
  --muted: #8b9aab;
  --accent: #3ddc97;
  --surface: #1a222c;
  --font: "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, #1e3a2f 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, #1a2a3a 0%, transparent 50%),
    var(--bg);
  color: var(--fg);
  font-family: var(--font);
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.page {
  max-width: 28rem;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

.header {
  text-align: center;
  margin-bottom: 1.25rem;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  line-height: 1.1;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.game-wrap {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 18px 40px rgba(0, 0, 0, 0.45);
  background: #70c5ce;
  line-height: 0;
  cursor: pointer;
}

#game {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: top;
  touch-action: none;
}

.hud {
  position: absolute;
  top: 0.85rem;
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
  z-index: 2;
}

.hud span {
  display: inline-block;
  min-width: 2ch;
  font-size: 2.5rem;
  font-weight: 800;
  color: #fff;
  text-shadow:
    2px 2px 0 #333,
    -1px -1px 0 #333,
    1px -1px 0 #333,
    -1px 1px 0 #333;
  line-height: 1;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 1.5rem;
  background: rgba(15, 20, 25, 0.45);
  text-align: center;
  pointer-events: none;
  z-index: 3;
  transition: opacity 0.15s ease;
}

.overlay.hidden {
  opacity: 0;
}

.overlay-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  line-height: 1.2;
}

.overlay-sub {
  margin: 0;
  font-size: 0.95rem;
  color: #e8eef4;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  line-height: 1.35;
}

.player-bar {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.75rem;
  align-items: center;
  max-width: 400px;
  margin: 0 auto 1rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.player-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.player-input {
  width: 100%;
  margin: 0;
  padding: 0.45rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: #0f1419;
  color: var(--fg);
  font: inherit;
  font-size: 1rem;
  -webkit-user-select: text;
  user-select: text;
}

.player-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.player-hint {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.player-hint.error {
  color: #ff8f8f;
}

.board {
  max-width: 400px;
  margin: 1.25rem auto 0;
  padding: 1rem;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.board h2 {
  margin: 0;
  font-size: 1.05rem;
}

.board-refresh {
  margin: 0;
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.board-refresh:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.board-you {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.65rem;
  background: rgba(61, 220, 151, 0.1);
  border-left: 3px solid var(--accent);
  color: var(--fg);
  font-size: 0.9rem;
}

.board-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.board-list li {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.95rem;
}

.board-list li:last-child {
  border-bottom: none;
}

.board-list .rank {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.board-list .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-list .pts {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.board-list .board-empty,
.board-status {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.board-status {
  margin: 0.75rem 0 0;
}
