:root {
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --card-bg: rgba(30, 41, 59, 0.7);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-glow: 0 0 35px -5px rgba(99, 102, 241, 0.25);
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(217, 70, 239, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  padding-top: env(safe-area-inset-top);
  padding-bottom: calc(env(safe-area-inset-bottom) + 32px);
}

.app-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 16px;
}

/* Header & Identity */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  backdrop-filter: blur(12px);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
}

.status-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 10px var(--danger);
}

/* Identity Banner */
.identity-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.4);
}

.identity-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}

.identity-name {
  font-size: 0.95rem;
  font-weight: 600;
}

.identity-email {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Install Prompt Banner */
.install-banner {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.15) 100%);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 24px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-glow);
}

.install-banner.visible {
  display: flex;
}

.install-text h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.install-text p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Showcase Grid */
.features-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.feature-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(16px);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.feature-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
}

.feature-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.feature-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.feature-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.feature-title {
  font-size: 1rem;
  font-weight: 600;
}

.api-pill {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.api-pill.supported {
  background: var(--success-bg);
  color: var(--success);
}

.api-pill.unsupported {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.feature-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Controls & Buttons */
.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Live Viewfinder / Outputs */
.video-preview-wrapper {
  position: relative;
  width: 100%;
  height: 240px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  margin-bottom: 12px;
  display: none;
}

.video-preview-wrapper.active {
  display: block;
}

video#camera-feed {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

canvas#snapshot-canvas {
  display: none;
}

.output-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  color: #38bdf8;
  margin-top: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
}

/* Footer */
.footer {
  text-align: center;
  margin-top: 36px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}
