/* ── Lakeshore Design System ─────────────────────────────────────────────── */

:root {
  --sand:        #e8d5a0;
  --sand-light:  #f5edd5;
  --sand-dark:   #c4a86e;
  --cypress:     #2d6a2d;
  --cypress-light: #4a9a4a;
  --spring:      #4db8d4;
  --spring-deep: #1a6fa8;
  --citrus:      #f4a228;
  --citrus-dark: #c07a10;
  --limestone:   #b0a898;
  --lake:        #1a6fa8;

  --sunset:      #e05c2a;
  --sunset-light:#f0844a;

  --bg:          #fdf6e3;
  --bg-panel:    #fffbf0;
  --border:      #d4c8a8;
  --text:        #3d2e1a;
  --text-muted:  #7a6a50;
  --shadow:      rgba(61,46,26,0.15);

  --radius:      12px;
  --radius-sm:   6px;
  --font:        Georgia, 'Times New Roman', serif;
  --font-ui:     -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
}

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

.lobby-bg {
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, #1a6fa8 0%, #2d6a2d 40%, #e8d5a0 100%);
  opacity: 0.18;
  z-index: 0;
}

.lobby-container {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem 4rem;
}

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

.game-title {
  font-family: var(--font);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--spring-deep);
  text-shadow: 2px 3px 0 var(--sand-dark), 3px 5px 12px rgba(0,0,0,0.2);
}

.game-subtitle {
  font-family: var(--font);
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  font-style: italic;
}

.game-tagline {
  font-size: 0.9rem;
  color: var(--cypress);
  margin-top: 0.3rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.lobby-panels {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  width: 100%;
  max-width: 820px;
  flex-wrap: wrap;
  justify-content: center;
}

.lobby-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem 2rem;
  flex: 1 1 320px;
  box-shadow: 0 4px 24px var(--shadow);
}

.lobby-panel h2 {
  font-family: var(--font);
  font-size: 1.4rem;
  color: var(--spring-deep);
  margin-bottom: 1.2rem;
  border-bottom: 2px solid var(--sand);
  padding-bottom: 0.5rem;
}

.lobby-divider {
  display: flex;
  align-items: center;
  font-size: 1.1rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 1rem 0;
  align-self: center;
}

/* ── Forms ────────────────────────────────────────────────────────────────── */

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}

.field .hint {
  font-size: 0.78rem;
  color: var(--limestone);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.field input,
.field select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: white;
  color: var(--text);
  transition: border-color 0.2s;
  font-family: var(--font-ui);
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--spring-deep);
  box-shadow: 0 0 0 3px rgba(29,111,168,0.12);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, filter 0.15s;
  letter-spacing: 0.03em;
  font-family: var(--font-ui);
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(135deg, var(--spring-deep), var(--spring));
  color: white;
  box-shadow: 0 3px 10px rgba(29,111,168,0.3);
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.85rem;
  font-size: 1rem;
}

.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }

.btn-secondary {
  background: linear-gradient(135deg, var(--cypress), var(--cypress-light));
  color: white;
  box-shadow: 0 3px 10px rgba(45,106,45,0.3);
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.85rem;
  font-size: 1rem;
}

.btn-secondary:hover { filter: brightness(1.08); }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }

.btn-danger {
  background: #c0392b;
  color: white;
}

.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  width: auto;
  margin-top: 0;
}

/* ── Lobby Status & Footer ──────────────────────────────────────────────── */

.lobby-status {
  margin-top: 1.5rem;
  padding: 1rem 1.5rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  text-align: center;
}

.lobby-footer {
  margin-top: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

/* ── Toast ────────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 2rem;
  font-size: 0.9rem;
  z-index: 9999;
  pointer-events: none;
  transition: opacity 0.3s;
  max-width: 90vw;
  text-align: center;
}

.toast.hidden { opacity: 0; }

/* ── Utilities ────────────────────────────────────────────────────────────── */

.hidden { display: none !important; }

.chip {
  display: inline-block;
  background: var(--sand);
  border-radius: 1rem;
  padding: 0.1rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.hint { color: var(--text-muted); font-size: 0.82rem; }

/* ── Modals ───────────────────────────────────────────────────────────────── */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: var(--bg-panel);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
  position: relative;
}

.modal-content h2 {
  font-family: var(--font);
  color: var(--spring-deep);
  margin-bottom: 1rem;
  font-size: 1.4rem;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.modal-close:hover { background: var(--sand); }

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.2rem;
  justify-content: flex-end;
}

/* ── Rules ────────────────────────────────────────────────────────────────── */

.rules-content { max-width: 560px; }
.rules-body { max-height: 60vh; overflow-y: auto; padding-right: 0.5rem; }
.rules-body h3 { color: var(--cypress); margin: 1rem 0 0.4rem; font-size: 1rem; }
.rules-body p, .rules-body li { line-height: 1.6; color: var(--text); margin-bottom: 0.25rem; }
.rules-body ul { padding-left: 1.2rem; }

/* ── Loading Overlay ──────────────────────────────────────────────────────── */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  gap: 1rem;
}

.loading-overlay p { color: var(--text-muted); font-size: 1rem; }

.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--spring-deep);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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