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

:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-card-hover: #222636;
  --text: #e4e6f0;
  --text-dim: #8b8fa3;
  --accent: #7c5cfc;
  --accent-hover: #9575fd;
  --accent-glow: rgba(124, 92, 252, 0.25);
  --green: #4ade80;
  --green-glow: rgba(74, 222, 128, 0.25);
  --red: #f87171;
  --yellow: #fbbf24;
  --border: #2a2d3a;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --transition: 0.2s ease;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

/* === Header === */
.header {
  position: relative;
  background: linear-gradient(135deg, #1a1025 0%, #1a1d27 50%, #0f1624 100%);
  border-bottom: 1px solid var(--border);
  padding: 28px 0 20px;
  text-align: center;
}
.logo {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

/* Logo image — main branding */
.logo-main {
  width: 140px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 20px rgba(124,92,252,0.5)) drop-shadow(0 6px 16px rgba(0,0,0,0.7));
}
.logo .dot { color: var(--accent); }
.tagline {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-top: 6px;
}

/* === Header layout === */
.header-top {
  display: flex; justify-content: center; align-items: center;
  flex-wrap: wrap; gap: 12px; margin-bottom: 8px;
}
.lang-dropdown {
  position: absolute; top: 12px; right: 20px;
  display: flex; align-items: center; gap: 8px;
  color: var(--text-dim); font-size: 0.85rem;
}
#lang-label { white-space: nowrap; }

/* === Select === */
.select {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.85rem;
  cursor: pointer;
}
.select-sm { font-size: 0.8rem; padding: 4px 8px; }
.select:focus { border-color: var(--accent); outline: none; }

/* === Cards === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card-icon { font-size: 2.5rem; text-align: center; margin-bottom: 12px; }

/* === Buttons === */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 0 16px var(--accent-glow); }
.btn-secondary {
  background: var(--bg-card-hover);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn-outline {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border);
}
.btn-outline:hover { color: var(--text); border-color: var(--text-dim); }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-block { display: block; width: 100%; text-align: center; }

/* === Utility === */
.hidden { display: none !important; }
h2 { font-size: 1.3rem; margin-bottom: 16px; color: var(--text); }
h3 { font-size: 1rem; margin-bottom: 8px; color: var(--text-dim); }
p { margin-bottom: 12px; }
strong { color: var(--text); }

/* === Permission Gate === */
.permission-gate { text-align: center; }
.permission-gate p { max-width: 560px; margin: 0 auto 20px; color: var(--text-dim); }

/* === Device Selector === */
.device-selector {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.device-selector label { color: var(--text-dim); font-size: 0.9rem; white-space: nowrap; }
.device-selector .select { flex: 1; min-width: 180px; }

/* === Video === */
.video-container {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  aspect-ratio: 16/9;
  max-height: 480px;
}
.video-container video,
.video-container canvas {
  width: 100%; height: 100%; object-fit: contain;
}
.video-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.7);
  color: var(--text-dim);
  font-size: 1.1rem;
}
.camera-controls {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
}

/* === Snapshots === */
.snapshot-status {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-dim); font-size: 0.85rem;
  margin-bottom: 12px; flex-wrap: wrap;
}
.pulse {
  width: 8px; height: 8px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s infinite;
  box-shadow: 0 0 8px var(--green-glow);
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.snapshot-gallery { margin-top: 12px; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.gallery-grid img {
  width: 100%; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform var(--transition);
}
.gallery-grid img:hover { transform: scale(1.03); border-color: var(--accent); }

/* === Mic / VU Meter === */
.mic-section h2 { margin-bottom: 16px; }
.vu-meter-container { margin-bottom: 16px; }
.vu-meter {
  height: 12px;
  background: var(--bg);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 4px;
}
.vu-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green), var(--yellow), var(--red));
  transition: width 0.1s linear;
  border-radius: 6px;
}
.vu-labels {
  display: flex; justify-content: space-between;
  font-size: 0.7rem; color: var(--text-dim);
  margin-bottom: 4px;
}
.vu-value { font-size: 0.85rem; color: var(--text-dim); text-align: right; }
.mic-controls { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.mic-info { margin-top: 8px; color: var(--green); font-size: 0.9rem; }

/* === Diagnostics === */
.diag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.diag-block {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1px solid var(--border);
}
.diag-table { width: 100%; border-collapse: collapse; }
.diag-table td {
  padding: 4px 8px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}
.diag-table td:first-child { color: var(--text); font-weight: 500; width: 50%; }
#diag-codecs { font-size: 0.85rem; color: var(--text-dim); }

/* === Guide === */
#guide-section ol li { color: var(--text-dim); }

/* === FAQ === */
.faq-list { display: flex; flex-direction: column; gap: 8px; }
.faq-item { background: var(--bg); border-radius: var(--radius-sm); padding: 12px 16px; border: 1px solid var(--border); }
.faq-item summary { cursor: pointer; font-weight: 600; color: var(--text); font-size: 0.95rem; }
.faq-item p { margin-top: 8px; color: var(--text-dim); font-size: 0.9rem; }

/* === Affiliate === */
.hint { color: var(--text-dim); font-size: 0.8rem; margin-bottom: 16px; font-style: italic; }
.affiliate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.affiliate-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: all var(--transition);
}
.affiliate-card:hover { border-color: var(--accent); box-shadow: 0 0 16px var(--accent-glow); transform: translateY(-2px); }
.affiliate-img { font-size: 3rem; margin-bottom: 8px; }
.affiliate-card h4 { font-size: 0.95rem; margin-bottom: 4px; }
.affiliate-card p { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 8px; }
.price { font-size: 1.1rem; font-weight: 700; color: var(--accent); }

/* === Ad Banners === */
.ad-banner { text-align: center; padding: 12px 0; background: var(--bg-card); border-bottom: 1px solid var(--border); }
.ad-banner .container { min-height: 90px; display: flex; align-items: center; justify-content: center; }

/* === Footer === */
.footer {
  text-align: center;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.85rem;
}
.footer-links { margin-top: 4px; }
.footer-links a { color: var(--text-dim); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }

/* === Responsive === */
@media (max-width: 768px) {
  .logo { font-size: 1.3rem; }
  .logo-main { width: 110px; }
  .card { padding: 20px 14px; }
  h2 { font-size: 1.15rem; }
  .diag-grid { grid-template-columns: 1fr; }
  .affiliate-grid { grid-template-columns: 1fr; }
  .device-selector { flex-direction: column; align-items: stretch; }
}

@media (max-width: 480px) {
  .logo { font-size: 1.1rem; }
  .logo-main { width: 90px; }
  .btn { padding: 8px 14px; font-size: 0.85rem; }
  .header-top { justify-content: center; }
}

.footer-cache-note {
  font-size: 0.75rem;
  color: #6b7280;
  font-style: italic;
  margin-top: 4px;
}
