:root {
  --color-ink: #0B1F1A;
  --color-ink-soft: #123B2E;
  --color-ink-deep: #061512;
  --color-gold: #F4B942;
  --color-cyan: #3FE8C8;
  --color-green: #6BCB6E;
  --color-coral: #FF8A72;
  --color-purple: #7B5CFF;
  --color-cream: #F2F7F0;
  --radius-card: 16px;
  --radius-control: 8px;
}

html, body {
  margin: 0;
  height: 100%;
}

/* A single fixed starfield+moons image, shared by every screen (login,
   account, lobby, reset-password) - see assets/bg-arena.png and the
   generator this was rendered from. "top right" anchors the crop so the
   moons (placed well inside that quadrant) survive a cover-crop at any
   viewport aspect ratio; only the left/bottom - all starfield - ever
   gets cut off. */
body {
  background-color: var(--color-ink);
  background-image: url('assets/bg-arena.png');
  background-size: cover;
  background-position: top right;
  background-repeat: no-repeat;
  background-attachment: fixed;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* --- Card shell, shared by every login/account/lobby screen --- */

#lobby {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 24px 12px;
  box-sizing: border-box;
}

.card {
  color: var(--color-cream);
  background: rgba(18, 59, 46, 0.88);
  border: 1px solid rgba(244, 185, 66, 0.35);
  border-radius: var(--radius-card);
  box-shadow: 0 20px 60px rgba(6, 21, 18, 0.6), 0 0 40px rgba(63, 232, 200, 0.08);
  backdrop-filter: blur(6px);
  padding: 32px;
  width: min(420px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  box-sizing: border-box;
  font-size: 1.5rem;
}

.card--wide {
  width: min(640px, 94vw);
}

/* Above phone width, the card shrinks to a fraction of the viewport
   instead of a near-fixed px cap, so it never sprawls across a tablet
   or desktop window - capped again on very wide screens so it doesn't
   keep growing forever. */
@media (min-width: 640px) {
  .card {
    width: clamp(420px, 34vw, 560px);
  }
  .card--wide {
    width: clamp(480px, 46vw, 760px);
  }
}

.brand-title {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  color: var(--color-gold);
  text-shadow: 0 0 18px rgba(244, 185, 66, 0.5);
  margin: 0 0 4px;
}

.brand-subtitle {
  text-align: center;
  color: rgba(242, 247, 240, 0.6);
  font-size: 1.5rem;
  margin: 0 0 24px;
}

.screen-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.screen-header h2 {
  margin: 0;
  font-size: 2rem;
  color: var(--color-gold);
}

.btn-back {
  background: none;
  border: 1px solid rgba(242, 247, 240, 0.3);
  color: var(--color-cream);
  border-radius: var(--radius-control);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  padding: 6px 10px;
}
.btn-back:hover {
  border-color: var(--color-cyan);
  color: var(--color-cyan);
}

/* --- Form fields --- */

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.field label {
  font-size: 1.5rem;
  color: rgba(242, 247, 240, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input {
  background: rgba(6, 21, 18, 0.6);
  border: 1px solid rgba(242, 247, 240, 0.15);
  border-radius: var(--radius-control);
  padding: 12px 14px;
  color: var(--color-cream);
  font-size: 1.5rem;
  font-family: inherit;
  box-sizing: border-box;
}

.field input:focus {
  outline: none;
  border-color: var(--color-cyan);
  box-shadow: 0 0 0 3px rgba(63, 232, 200, 0.15);
}

/* --- Buttons --- */

.btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 14px 18px;
  border-radius: var(--radius-control);
  border: none;
  font-weight: 700;
  font-size: 1.5rem;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 10px;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--color-gold);
  color: var(--color-ink-deep);
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-secondary {
  background: transparent;
  color: var(--color-cream);
  border: 1px solid rgba(242, 247, 240, 0.35);
}
.btn-secondary:hover {
  border-color: var(--color-cyan);
  color: var(--color-cyan);
}

.btn-danger {
  background: transparent;
  color: var(--color-coral);
  border: 1px solid var(--color-coral);
}

.btn-sm {
  width: auto;
  display: inline-block;
  padding: 6px 12px;
  font-size: 1.5rem;
  margin: 0;
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.link-muted {
  background: none;
  border: none;
  color: rgba(242, 247, 240, 0.65);
  text-decoration: underline;
  cursor: pointer;
  font-size: 1.5rem;
  padding: 0;
  font-family: inherit;
  display: block;
  margin: 0 auto 10px;
}
.link-muted:hover { color: var(--color-cyan); }

.card-footer {
  text-align: center;
  margin-top: 4px;
  font-size: 1.5rem;
  color: rgba(242, 247, 240, 0.6);
}
.card-footer button {
  background: none;
  border: none;
  color: var(--color-cyan);
  cursor: pointer;
  font-weight: 600;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
}

/* --- Race picker --- */

.race-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.race-chip {
  border: 1.5px solid var(--chip-color, #888);
  border-radius: var(--radius-control);
  padding: 10px;
  text-align: center;
  cursor: pointer;
  color: var(--color-cream);
  background: rgba(6, 21, 18, 0.4);
  font-size: 1.5rem;
}
.race-chip.active {
  background: var(--chip-color, #888);
  color: var(--color-ink-deep);
  font-weight: 700;
}

/* --- Messages --- */

.form-message {
  font-size: 1.5rem;
  margin-bottom: 14px;
  padding: 8px 10px;
  border-radius: 8px;
}
.form-message.error {
  background: rgba(255, 138, 114, 0.15);
  color: var(--color-coral);
  border: 1px solid var(--color-coral);
}
.form-message.success {
  background: rgba(107, 203, 110, 0.15);
  color: var(--color-green);
  border: 1px solid var(--color-green);
}

/* --- Badges --- */

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 1.5rem;
  font-weight: 700;
}
.badge-verified {
  background: rgba(107, 203, 110, 0.2);
  color: var(--color-green);
  border: 1px solid var(--color-green);
}
.badge-unverified {
  background: rgba(255, 138, 114, 0.15);
  color: var(--color-coral);
  border: 1px solid var(--color-coral);
}

/* --- Account summary --- */

.account-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(242, 247, 240, 0.08);
  font-size: 1.5rem;
}
.account-row:last-child { border-bottom: none; }

.account-section {
  margin-bottom: 20px;
}

h3.section-title {
  font-size: 1.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(242, 247, 240, 0.55);
  margin: 0 0 10px;
}

/* --- Player / challenge lists (launch-game screen) --- */

.player-list {
  max-height: 320px;
  overflow-y: auto;
  margin-bottom: 14px;
  padding-right: 2px;
}

.player-row, .challenge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(6, 21, 18, 0.4);
  margin-bottom: 8px;
}

.avatar-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.player-name {
  flex: 1;
  min-width: 0;
}

.player-level {
  color: rgba(242, 247, 240, 0.6);
  font-size: 1.5rem;
}

.muted {
  color: rgba(242, 247, 240, 0.5);
  font-style: italic;
  font-size: 1.5rem;
}

/* --- Game canvas (unchanged) --- */

#game {
  background: #222;
  /* Internal drawing resolution is larger than most viewports (margin
     around the arena so drifted discs stay visible); scale the
     *displayed* size down to fit without scrolling or zooming, while
     keeping the canvas's own aspect ratio. */
  max-width: 95vw;
  max-height: 90vh;
  width: auto;
  height: auto;
}

#forfeitBtn {
  display: none;
  position: fixed;
  top: 12px;
  right: 12px;
  padding: 8px 14px;
  background: #6b1f1f;
  color: #eee;
  border: 1px solid #ff6b6b;
  border-radius: 6px;
  cursor: pointer;
}
