/* ── Tokens ─────────────────────────────────────────── */
:root {
  --grey-50:  #fafafa;
  --grey-100: #f4f4f5;
  --grey-200: #e4e4e7;
  --grey-300: #d1d1d6;
  --grey-400: #a1a1aa;
  --grey-500: #71717a;
  --grey-600: #52525b;
  --grey-700: #3f3f46;
  --grey-800: #27272a;
  --grey-900: #18181b;

  --bg:       var(--grey-50);
  --surface:  #ffffff;
  --border:   var(--grey-200);
  --text:     var(--grey-900);
  --text-muted: var(--grey-500);
  --radius:   6px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

a { color: inherit; text-decoration: none; }

/* ── Auth page ──────────────────────────────────────── */
.auth-page {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--grey-100);
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

.auth-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
}

.auth-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

/* ── Nav ────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 900px;
  margin-inline: auto;
  padding: 0.85rem 1.5rem;
}

.nav__logo {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
}

.nav__right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav__points { font-size: 0.9rem; color: var(--text-muted); }
.nav__points strong { color: var(--text); }
.nav__user { font-size: 0.85rem; color: var(--text-muted); }

/* ── Game layout ────────────────────────────────────── */
.game-page { min-height: 100svh; }

.game-main {
  max-width: 900px;
  margin-inline: auto;
  padding: 2rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

/* ── Silhouette ─────────────────────────────────────── */
.silhouette-wrap {
  position: relative;
  width: 100%;
  max-width: 520px;
}

.silhouette {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--grey-900);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.silhouette svg {
  width: 100%;
  height: 100%;
}

.silhouette__loading {
  color: var(--grey-600);
  font-size: 0.9rem;
}

.guesses-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(255,255,255,0.12);
  color: var(--grey-300);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(4px);
}

/* ── Game panel ─────────────────────────────────────── */
.game-panel {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Autocomplete ───────────────────────────────────── */
#guess-form {
  display: flex;
  gap: 0.75rem;
}

.autocomplete-wrap {
  position: relative;
  flex: 1;
}

.guess-input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.guess-input:focus {
  outline: none;
  border-color: var(--grey-500);
  box-shadow: 0 0 0 3px rgba(113,113,122,0.15);
}

.guess-input:disabled { opacity: 0.5; cursor: not-allowed; }

.autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.autocomplete-list li {
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.1s;
}

.autocomplete-list li:hover,
.autocomplete-list li.is-active {
  background: var(--grey-100);
}

/* ── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
  white-space: nowrap;
}

.btn--primary {
  background: var(--grey-900);
  color: #fff;
  border-color: var(--grey-900);
}

.btn--primary:hover { background: var(--grey-700); border-color: var(--grey-700); }
.btn--primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}

.btn--ghost:hover { border-color: var(--grey-400); color: var(--text); }

.btn--sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }
.btn--full { width: 100%; justify-content: center; margin-top: 0.5rem; }

/* ── Guess list ─────────────────────────────────────── */
.guess-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.guess-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  animation: slide-in 0.2s var(--ease);
}

.guess-item--correct {
  border-color: #22c55e;
  background: #f0fdf4;
}

.guess-item--wrong { border-color: var(--border); }

@keyframes slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.guess-item__name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.guess-item__dist {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: right;
}

.guess-item__arrow {
  font-size: 1.2rem;
  width: 1.5rem;
  text-align: center;
}

/* ── Game over ──────────────────────────────────────── */
.game-over-msg {
  padding: 1.25rem 1rem;
  border-radius: var(--radius);
  text-align: center;
  font-weight: 600;
  font-size: 1rem;
}

.game-over-msg.won {
  background: #f0fdf4;
  border: 1px solid #22c55e;
  color: #15803d;
}

.game-over-msg.lost {
  background: var(--grey-100);
  border: 1px solid var(--border);
  color: var(--text);
}

/* ── Form ───────────────────────────────────────────── */
.form__group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.form__group label {
  font-size: 0.85rem;
  font-weight: 500;
}

.form__group input {
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form__group input:focus {
  outline: none;
  border-color: var(--grey-500);
  box-shadow: 0 0 0 3px rgba(113,113,122,0.15);
}

/* ── Capital phase ──────────────────────────────────── */
.capital-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--grey-100);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}

.capital-prompt p {
  color: var(--text);
  font-size: 0.95rem;
}

.capital-prompt strong { color: var(--text); }

.capital-dots {
  display: flex;
  gap: 0.5rem;
}

.cap-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--grey-300);
  transition: background 0.2s;
}

.cap-dot.used-correct { background: #22c55e; }
.cap-dot.used-wrong   { background: #ef4444; }

#capital-form {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

/* ── Utility ────────────────────────────────────────── */
.error-msg {
  color: #dc2626;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

@media (max-width: 480px) {
  #guess-form { flex-direction: column; }
  .btn--full { margin-top: 0; }
}
