html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: #0a1a2a;
  color: #eaf6ff;
  font-family: system-ui, sans-serif;
}

header {
  padding: 32px 24px 16px;
  text-align: center;
}

header h1 {
  margin: 0 0 8px;
}

header p {
  margin: 0;
  opacity: 0.8;
}

#game-list {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  padding: 24px;
}

#game-list-status {
  opacity: 0.7;
}

.game-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 20px;
  width: 260px;
}

.game-card h2 {
  margin: 0 0 8px;
}

.game-card p {
  margin: 0 0 16px;
  font-size: 14px;
  opacity: 0.85;
  min-height: 3.5em;
}

.game-card .meta {
  margin: -12px 0 16px;
  font-size: 12px;
  opacity: 0.6;
  min-height: 0;
}

.host-button {
  display: inline-block;
  background: #3a7d6e;
  color: #eaf6ff;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-weight: 600;
}

.host-button:hover {
  background: #4a9d8a;
}

#lobby {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  gap: 12px;
  text-align: center;
}

#lobby[hidden] {
  display: none;
}

#host-start button,
#copy-link-button {
  background: #3a7d6e;
  color: #eaf6ff;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}

#host-start button:hover,
#copy-link-button:hover {
  background: #4a9d8a;
}

#host-start button:disabled,
#copy-link-button:disabled {
  opacity: 0.6;
  cursor: default;
}

#host-link-input {
  width: min(420px, 90vw);
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: #eaf6ff;
  font: 13px monospace;
}

.link-text {
  font: 12px monospace;
  word-break: break-all;
  max-width: 420px;
  opacity: 0.85;
}

#lobby .note {
  font-size: 12px;
  opacity: 0.7;
  max-width: 420px;
}

#game-canvas {
  display: block;
  position: fixed;
  inset: 0;
  /* Explicit size, not just inset:0 (W0.6): a <canvas> is a replaced element
     whose own width/height attributes can win the layout box over inset
     alone. Three.js's renderer.setSize() writes those attributes every
     resize; without this, that feeds back into the canvas's own layout
     size and compounds on every resize event (observed ballooning a
     1200x751 viewport to 76800x48064 over a handful of resizes, which
     silently broke rendering of small scene objects). The solo game entries
     (e.g. games/windward/index.html's #game) already pin size this way. */
  width: 100%;
  height: 100%;
}

#game-canvas[hidden] {
  display: none;
}

#waiting-overlay {
  position: fixed;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(10, 26, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  font-size: 13px;
}

#waiting-overlay p {
  margin: 0;
}

#waiting-overlay button {
  background: #3a7d6e;
  color: #eaf6ff;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

#waiting-overlay button:hover {
  background: #4a9d8a;
}

#waiting-overlay[hidden] {
  display: none;
}

#launch-error {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  background: #0a1a2a;
}

#launch-error[hidden] {
  display: none;
}

#launch-error-text {
  max-width: 480px;
  color: #ffb4b4;
  font: 14px monospace;
  white-space: pre-wrap;
}

#launch-error-back {
  background: #3a7d6e;
  color: #eaf6ff;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}

#launch-error-back:hover {
  background: #4a9d8a;
}
