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

:root {
  --bg: #0a0a12;
  --bg-glow-1: #1b1040;
  --bg-glow-2: #06222b;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-solid: #14141f;
  --border: rgba(255, 255, 255, 0.10);
  --text: #f2f3f8;
  --muted: #9a9cb0;
  --grad-a: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
  --grad-b: linear-gradient(135deg, #f472b6 0%, #fb923c 100%);
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --radius: 16px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
  overflow-x: hidden;
}

h1, h2, .card-title, .action-btn {
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.aurora-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.aurora-bg::before,
.aurora-bg::after {
  content: '';
  position: absolute;
  width: 60vw;
  height: 60vw;
  max-width: 480px;
  max-height: 480px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: drift 20s ease-in-out infinite alternate;
}

.aurora-bg::before {
  background: var(--bg-glow-1);
  top: -10%;
  left: -10%;
}

.aurora-bg::after {
  background: var(--bg-glow-2);
  top: 10%;
  right: -15%;
  animation-delay: -10s;
}

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(6%, 8%) scale(1.1); }
}

@media (prefers-reduced-motion: reduce) {
  .aurora-bg::before, .aurora-bg::after { animation: none; }
}

#app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
  padding-top: calc(16px + env(safe-area-inset-top));
}

.hdr { margin-bottom: 24px; }
.hdr h1 { margin: 0; font-size: 1.5rem; font-weight: 700; }
.hdr-sub { margin: 4px 0 0; color: var(--muted); font-size: 0.75rem; }

.section { margin-bottom: 24px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  animation: rise 200ms ease-out both;
  backdrop-filter: blur(12px);
}

@supports not (backdrop-filter: blur(1px)) {
  .card { background: var(--surface-solid); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-title { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.card-body { color: var(--muted); white-space: pre-wrap; font-size: 0.8125rem; }

.bento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.status-card { position: relative; padding-top: 20px; }

.ring {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #8b5cf6, #06b6d4, #8b5cf6);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-card.err .ring { background: var(--err); }

.status-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.status-value { font-size: 0.8125rem; margin-top: 4px; }

.skeleton {
  position: relative;
  color: transparent;
  background: linear-gradient(90deg, var(--surface) 25%, rgba(255,255,255,0.12) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.action-btn {
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: transform 150ms ease-out, opacity 150ms ease-out;
  border-image-slice: 1;
}

.action-btn.grad-a { border: 1px solid transparent; background: linear-gradient(var(--surface-solid), var(--surface-solid)) padding-box, var(--grad-a) border-box; }
.action-btn.grad-b { border: 1px solid transparent; background: linear-gradient(var(--surface-solid), var(--surface-solid)) padding-box, var(--grad-b) border-box; }

.action-btn:active { transform: scale(0.97); }
.action-btn:disabled { opacity: 0.5; cursor: default; }

.mc-link { width: 100%; }

.capture-section label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#capture-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  padding: 12px;
  resize: vertical;
  margin-bottom: 12px;
}

#capture-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px #8b5cf6;
}

.toast {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 0.8125rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease-out, transform 200ms ease-out;
  z-index: 10;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.unauthorized {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  font-size: 1.125rem;
}

.unauthorized.hidden { display: none; }

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 16px 0;
}

.retry-btn {
  display: block;
  margin: 8px auto 0;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.75rem;
  cursor: pointer;
}
