/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-input: #242736;
  --text: #e4e6ef;
  --text-muted: #8b8fa3;
  --accent: #7c5cfc;
  --accent-glow: rgba(124, 92, 252, 0.3);
  --success: #34d399;
  --error: #f87171;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* === Screens === */
.screen {
  display: none;
  height: 100%;
}
.screen.active {
  display: flex;
}

/* === Pairing Screen === */
#pairing-screen {
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.pairing-container {
  text-align: center;
  max-width: 380px;
  width: 100%;
}

.logo {
  font-size: 64px;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 20px var(--accent-glow));
}

h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 32px;
}

/* === Pairing States === */
.pairing-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.pairing-state.hidden {
  display: none;
}

.instruction {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.code-box {
  background: var(--bg-input);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 32px;
  margin: 8px 0;
}

#pairing-code-value {
  font-size: 32px;
  font-weight: 700;
  font-family: 'SF Mono', 'Fira Code', monospace;
  letter-spacing: 4px;
  color: var(--accent);
}

.hint {
  color: var(--text-muted);
  font-size: 13px;
}
.hint code {
  background: var(--bg-input);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--accent);
}

.waiting {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 8px;
}

.error-icon, .success-icon {
  font-size: 48px;
}

#pairing-error-msg {
  color: var(--error);
  font-size: 14px;
}

.redirecting {
  color: var(--text-muted);
  font-size: 13px;
}

/* === Buttons === */
.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  font-family: var(--font);
}
.btn:hover {
  background: #9178ff;
}
.btn:active {
  background: #6a4ae8;
}

/* === Spinner === */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--bg-input);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner.small {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

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

/* === Chat Screen (Fase 2 placeholder) === */
#chat-screen {
  align-items: center;
  justify-content: center;
}

.chat-placeholder {
  text-align: center;
}
.chat-placeholder p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 8px;
}

/* === Responsive === */
@media (max-width: 480px) {
  .pairing-container {
    padding: 0 8px;
  }
  .logo {
    font-size: 48px;
  }
  h1 {
    font-size: 24px;
  }
  #pairing-code-value {
    font-size: 26px;
    letter-spacing: 3px;
  }
}
