@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap');

:root {
  --bg-deep: #0a0e12;
  --bg-surface: #12181e;
  --bg-card: #1a2129;
  --bg-input: #111619;
  --border: #1e2a34;
  --border-focus: #2d8a5e;
  --text: #e8ecf0;
  --text-muted: #6b7d8e;
  --text-dim: #3e4f5e;
  --accent: #2ecc71;
  --accent-hover: #27ae60;
  --accent-glow: rgba(46, 204, 113, 0.15);
  --danger: #e74c3c;
  --warning: #f39c12;
  --radius: 10px;
  --font: 'Outfit', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Lobby layout ─────────────────────────── */

.lobby {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  position: relative;
  overflow: hidden;
}

.lobby::before {
  content: '';
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── Logo / brand ─────────────────────────── */

.brand {
  text-align: center;
  margin-bottom: 32px;
  position: relative;
  z-index: 1;
}

.brand h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}

.brand h1 span {
  color: var(--accent);
}

.brand p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
  font-weight: 400;
}

/* ── Card ─────────────────────────────────── */

.card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  position: relative;
  z-index: 1;
}

/* ── Room info ────────────────────────────── */

.room-info {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.room-name {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin-bottom: 8px;
  word-break: break-word;
}

.room-meta {
  display: flex;
  gap: 16px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.room-meta .dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.room-meta .dot.full {
  background: var(--danger);
}

/* ── Form ─────────────────────────────────── */

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.field input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s;
}

.field input[type="text"]::placeholder {
  color: var(--text-dim);
}

.field input[type="text"]:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ── Buttons ──────────────────────────────── */

.btn {
  width: 100%;
  padding: 13px 20px;
  border: none;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.2px;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #0a0e12;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  background: var(--text-dim);
  color: var(--bg-card);
  cursor: not-allowed;
  transform: none;
}

.btn-back {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  margin-top: 10px;
}

.btn-back:hover {
  background: var(--bg-surface);
  color: var(--text);
}

/* ── States ───────────────────────────────── */

.state-loading,
.state-error,
.state-not-found {
  text-align: center;
  padding: 24px 0;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.state-loading p {
  color: var(--text-muted);
  font-size: 14px;
}

.state-error p,
.state-not-found p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 8px;
}

.state-error .icon,
.state-not-found .icon {
  font-size: 36px;
  margin-bottom: 8px;
  opacity: 0.6;
}

.state-not-found h2,
.state-error h2 {
  font-size: 18px;
  font-weight: 600;
}

/* ── Game page header ─────────────────────── */

.game-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  font-size: 13px;
}

.game-header .room-title {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

.game-header .btn-leave {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 6px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.game-header .btn-leave:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* ── Connection status ────────────────────── */

.connection-status {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 200;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 40px;
}

.connection-status p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 12px;
}

/* ── Responsive ───────────────────────────── */

@media (max-width: 480px) {
  .card {
    padding: 24px 18px;
  }

  .brand h1 {
    font-size: 24px;
  }

  .room-name {
    font-size: 18px;
  }
}
