:root {
  --bg: #050505;
  --surface: #111113;
  --surface-2: #1a1a1e;
  --border: #2a2a2e;
  --text: #e4e4e7;
  --text-muted: #71717a;
  --accent: #25d366;
  --green: #25d366;
  --red: #ef4444;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.app {
  width: 100%;
  max-width: 480px;
  padding: 24px;
}

header {
  text-align: center;
  margin-bottom: 32px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--accent);
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 32px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.4;
}

.state { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.state.hidden { display: none; }

.state-icon { margin-bottom: 8px; }

.state h2 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.state p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 320px;
}

.hint {
  font-size: 0.8rem !important;
  color: var(--text-muted);
}

.hint strong { color: var(--text); font-weight: 500; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border: none;
  border-radius: 10px;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 8px;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #000;
}

.btn-primary:hover {
  background: #1fba59;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.3);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

/* QR code area */
#qr-box {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  display: inline-block;
  position: relative;
}

#qr-box canvas {
  display: block;
  border-radius: 4px;
}

.timer {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  min-height: 20px;
}

/* Spinner */
.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Success icon pulse */
.success-icon {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Footer */
footer {
  text-align: center;
  margin-top: 24px;
}

footer p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Fade-in animation */
.state:not(.hidden) {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 520px) {
  .app { padding: 16px; }
  .card { padding: 32px 20px; }
}
