/*
 * VoyXR — Master Stylesheet
 *
 * CONTENTS:
 *   1. RESET & BASE          (body, canvas, utilities)
 *   2. CAMERA PANEL           (toggle, dropdown, select, buttons)
 *   3. PRIVACY CONSENT        (modal, list, legal text)
 *   4. CONTACT FORM           (email, message, submit)
 *   5. METRICS OVERLAY        (panel, header, grid, rows)
 *   6. INACTIVE FEATURES      (chat, settings, controls, audio — commented out in HTML)
 *   7. ANIMATIONS             (keyframes)
 *   8. MOBILE                 (responsive overrides)
 *
 * Tweakable values are marked with ← arrows.
 */


/* ═══════════════════════════════════════════════
 * 1. RESET & BASE
 * ═══════════════════════════════════════════════ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'JetBrains Mono', 'Menlo', 'Consolas', monospace;
  background: #ffffff;
  color: #1a1a2e;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

#particle-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
  -webkit-backface-visibility: hidden;
}

/* WebGPU fallback banner */
#webgpu-fallback {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  background: rgba(255, 149, 0, 0.95);
  color: #fff;
  padding: 12px 24px;
  border-radius: 12px;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 4px 16px rgba(255, 149, 0, 0.3);
  max-width: 90vw;
}

#webgpu-fallback p { margin: 0 0 4px 0; }
#webgpu-fallback p:first-child { font-weight: 600; }

.hidden { display: none !important; }


/* ═══════════════════════════════════════════════
 * 2. CAMERA PANEL (right-aligned hamburger menu)
 * ═══════════════════════════════════════════════ */

#camera-panel {
  position: fixed;
  top: 20px;
  right: 20px;                    /* ← moved to right */
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: flex-end;          /* ← button hugs right edge */
  font-family: inherit;
}

/* Toggle button (hamburger) */
#camera-toggle {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: rgba(0, 0, 0, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
}

#camera-toggle:hover {
  color: #007aff;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
}

#camera-toggle.active {
  color: #007aff;
  background: rgba(0, 122, 255, 0.1);
  box-shadow: 0 0 0 2px #007aff;
}

/* Dropdown panel */
#camera-controls {
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: none;
  border-radius: 16px;
  padding: 16px;
  width: 260px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
}

/* Camera select dropdown */
#camera-select {
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.04);
  color: #1d1d1f;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  margin-bottom: 10px;
  transition: background 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

#camera-select:focus {
  background: rgba(0, 0, 0, 0.06);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.25);
}

/* Start button */
#camera-start-btn {
  width: 100%;
  padding: 10px 16px;
  background: #007aff;
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: -0.01em;
  transition: all 0.2s ease;
}

#camera-start-btn:hover   { background: #0066d6; }
#camera-start-btn:active  { transform: scale(0.98); }

/* Stop button */
#camera-stop-btn {
  width: 100%;
  padding: 10px 16px;
  background: rgba(255, 59, 48, 0.1);
  color: #ff3b30;
  border: 1px solid rgba(255, 59, 48, 0.2);
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: -0.01em;
  margin-top: 8px;
  transition: all 0.2s ease;
}

#camera-stop-btn:hover {
  background: rgba(255, 59, 48, 0.15);
  border-color: rgba(255, 59, 48, 0.3);
}

/* Status text */
#camera-status {
  font-size: 11px;
  color: rgba(0, 0, 0, 0.4);
  margin-top: 6px;
  letter-spacing: -0.01em;
  text-align: center;
}

/* ── Tab section (single row: score left, buttons right) ── */
#panel-tabs {
  margin-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Score (left side) */
.tabs-score {
  display: flex;
  align-items: center;
  gap: 4px;
}

#metrics-total {
  font-size: 12px;
  font-weight: 700;
  color: #30D158;
}

#metrics-time {
  font-size: 12px;
  font-weight: 400;
  opacity: 0.5;
}

/* Buttons (right side) */
.tabs-buttons {
  display: flex;
  gap: 6px;
}

/* Circle buttons — LOCKED 32px visual, 44px touch target */
.panel-tab {
  position: relative;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid rgba(0, 0, 0, 0.15);
  border-radius: 50%;
  background: #fff;
  color: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: all 0.2s;
}

.panel-tab::after {
  content: '';
  position: absolute;
  inset: -6px;
}

.panel-tab svg {
  width: 14px;
  height: 14px;
}

.panel-tab:hover {
  color: rgba(0, 0, 0, 0.6);
  border-color: rgba(0, 0, 0, 0.3);
}

.panel-tab.active {
  color: #007aff;
  border-color: #007aff;
  background: #fff;
}

/* ── Tab content ── */
.tab-content { margin-top: 10px; }
.tab-content.hidden { display: none; }

/* Metric list rows — 2-column grid, tight fit */
#metrics-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.ml-row {
  display: flex;
  align-items: center;
  padding: 4px 2px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  gap: 4px;
  overflow: hidden;
}

.ml-row:nth-child(odd) { border-right: 1px solid rgba(0, 0, 0, 0.04); padding-right: 4px; }
.ml-row:nth-child(even) { padding-left: 4px; }
.ml-row:nth-last-child(-n+2) { border-bottom: none; }

.ml-bar {
  width: 2px;
  height: 14px;
  border-radius: 1px;
  flex-shrink: 0;
}

.ml-lbl {
  flex: 1;
  font-size: 11px;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ml-score {
  font-size: 11px;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.ml-unit {
  font-size: 9px;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.45);
  white-space: nowrap;
  min-width: 44px;
  text-align: right;
}

/* About / VoyXR tab — row style */
.about-row {
  font-size: 11px;
  line-height: 1.4;
  color: rgba(0, 0, 0, 0.6);
  padding: 4px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
.about-row:last-child { border-bottom: none; }
.about-row strong { color: rgba(0, 0, 0, 0.8); }

.about-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.about-btn {
  flex: 1;
  padding: 7px 0;
  border: 1.5px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  background: #fff;
  color: rgba(0, 0, 0, 0.6);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.about-btn:hover {
  border-color: #007aff;
  color: #007aff;
}


/* ═══════════════════════════════════════════════
 * 2b. DOCUMENT MODAL (full-screen research explainer)
 *     Monospace, monochrome, tight leading
 * ═══════════════════════════════════════════════ */

.doc-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: docFadeIn 0.2s ease-out;
}

.doc-modal.hidden { display: none; }

.doc-modal-sheet {
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  background: #fff;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
  animation: docSlideUp 0.3s ease-out;
}

.doc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.doc-modal-header h2 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #1d1d1f;
  margin: 0;
}

#doc-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

#doc-modal-close:hover { background: rgba(0, 0, 0, 0.1); color: rgba(0, 0, 0, 0.7); }

.doc-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}

.doc-modal-body::-webkit-scrollbar { width: 3px; }
.doc-modal-body::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.1); border-radius: 2px; }

/* Section headings */
.doc-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.35);
  margin: 7px 0 6px;
  padding: 7px 0 10px;
}

.doc-section-title:first-child { margin-top: 0; }

/* Collapsible sections */
.doc-collapse { border-bottom: 1px solid rgba(0, 0, 0, 0.06); }
.doc-collapse summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.35);
  margin: 0;
  padding: 12px 0;
}
.doc-collapse summary::-webkit-details-marker { display: none; }
.doc-collapse summary::after {
  content: '\25BE';
  float: right;
  font-size: 18px;
  line-height: 1;
  color: rgba(0, 0, 0, 0.35);
  padding: 4px 8px;
}
.doc-collapse[open] summary::after { content: '\25B4'; }
.doc-collapse > :not(summary) { padding-left: 0; }
.doc-collapse + .doc-collapse { margin-top: 3px; }

/* Privacy hint in consent popup */
.privacy-hint { font-size: 11px; color: rgba(0, 0, 0, 0.35); margin-bottom: 0; }

/* Paragraphs */
.doc-paragraph {
  font-size: 12px;
  line-height: 1.4;
  color: rgba(0, 0, 0, 0.65);
  margin-bottom: 8px;
}

/* Metric definition rows */
.doc-metric {
  padding: 5px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.doc-metric:last-child { border-bottom: none; }

.doc-metric-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.doc-metric-value {
  font-size: 11px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.4);
  font-variant-numeric: tabular-nums;
  min-width: 32px;
}

.doc-metric-label {
  font-size: 11px;
  font-weight: 600;
  color: #1d1d1f;
}

.doc-metric-text {
  font-size: 11px;
  line-height: 1.35;
  color: rgba(0, 0, 0, 0.5);
  margin-top: 1px;
}

/* Notice boxes (warning, privacy) — monochrome, no color accents */
.doc-notice {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 12px 0;
}

.doc-notice-title {
  font-size: 10px;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.doc-notice-text {
  font-size: 11px;
  line-height: 1.35;
  color: rgba(0, 0, 0, 0.5);
  margin-bottom: 2px;
}

.doc-notice-text:last-child { margin-bottom: 0; }

/* References */
.doc-reference {
  font-size: 10px;
  line-height: 1.35;
  color: rgba(0, 0, 0, 0.45);
  margin-bottom: 6px;
  padding-left: 0;
  text-indent: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Footer with export/print */
.doc-modal-footer {
  display: flex;
  gap: 8px;
  padding: 10px 20px 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.doc-footer-btn {
  flex: 1;
  padding: 8px 0;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  background: #fff;
  color: rgba(0, 0, 0, 0.5);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  transition: all 0.2s;
}

.doc-footer-btn:hover { border-color: rgba(0, 0, 0, 0.3); color: rgba(0, 0, 0, 0.7); }

@keyframes docFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes docSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }


/* ═══════════════════════════════════════════════
 * 3. PRIVACY CONSENT MODAL
 * ═══════════════════════════════════════════════ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
}

.modal.hidden { display: none; }

.modal-content {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 16px;
  padding: 28px;
  width: min(400px, 90vw);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
}

.modal-content h3 { font-size: 18px; margin-bottom: 16px; color: #1a1a2e; }
.modal-content label { font-size: 13px; color: rgba(0, 0, 0, 0.5); display: block; margin-bottom: 6px; }

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  justify-content: flex-end;
}

.modal-actions button {
  padding: 8px 20px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

#privacy-consent .modal-content {
  max-width: 340px;
  border-radius: 14px;
  padding: 24px;
  text-align: left;
}

#privacy-consent .modal-content h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

#privacy-consent .modal-content p {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(0, 0, 0, 0.6);
  margin-bottom: 12px;
}

.privacy-list { list-style: none; padding: 0; margin: 0 0 12px 0; }

.privacy-list li {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(0, 0, 0, 0.55);
  padding-left: 16px;
  position: relative;
  margin-bottom: 2px;
}

.privacy-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  width: 6px;
  height: 6px;
  background: #34c759;
  border-radius: 50%;
}

.privacy-legal { font-size: 11px !important; color: rgba(0, 0, 0, 0.35) !important; margin-bottom: 0 !important; }

#privacy-consent .modal-actions { margin-top: 16px; gap: 8px; }
#privacy-decline-btn { background: rgba(0, 0, 0, 0.05); color: rgba(0, 0, 0, 0.55); font-weight: 400; }
#privacy-decline-btn:hover { background: rgba(0, 0, 0, 0.08); }
#privacy-accept-btn { background: #007aff; color: #fff; font-weight: 600; }
#privacy-accept-btn:hover { background: #0066d6; }


/* ═══════════════════════════════════════════════
 * 4. CONTACT FORM
 * ═══════════════════════════════════════════════ */

#contact-section { margin-top: 14px; }

.contact-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.06);
  margin-bottom: 14px;
}

#contact-email,
#contact-message {
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.04);
  color: #1d1d1f;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: background 0.2s;
  margin-bottom: 8px;
}

#contact-email:focus,
#contact-message:focus {
  background: rgba(0, 0, 0, 0.06);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.25);
}

#contact-message { resize: vertical; min-height: 60px; }

#contact-submit {
  width: 100%;
  padding: 10px 16px;
  background: #1d1d1f;
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: -0.01em;
  transition: all 0.2s ease;
}

#contact-submit:hover    { background: #333; }
#contact-submit:active   { transform: scale(0.98); }
#contact-submit:disabled { opacity: 0.5; cursor: default; transform: none; }

#contact-status { font-size: 12px; margin-top: 6px; letter-spacing: -0.01em; }
#contact-status.success { color: #34c759; }
#contact-status.error   { color: #ff3b30; }


/* ═══════════════════════════════════════════════
 * 5. METRICS OVERLAY (legacy — kept for createOverlay compat)
 * ═══════════════════════════════════════════════ */

#metrics-overlay { display: none !important; }


/* ═══════════════════════════════════════════════
 * 6. INACTIVE FEATURES
 * (chat, settings modal, controls panel, audio panel)
 * Commented out in index.html. Keep styles for re-enabling.
 * ═══════════════════════════════════════════════ */

/* Chat container */
#chat-container {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: min(600px, 90vw);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  z-index: 10;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

#chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.logo {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1.5px;
  background: linear-gradient(135deg, #6366f1, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#settings-btn {
  background: none;
  border: none;
  color: rgba(0, 0, 0, 0.4);
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

#settings-btn:hover { color: #6366f1; background: rgba(99, 102, 241, 0.08); }

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 50vh;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}

#messages::-webkit-scrollbar { width: 4px; }
#messages::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.1); border-radius: 2px; }

.message {
  max-width: 80%;
  padding: 10px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  animation: fadeSlideIn 0.3s ease-out;
}

.message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message.bot {
  align-self: flex-start;
  background: rgba(0, 0, 0, 0.05);
  color: #333;
  border-bottom-left-radius: 4px;
}

.message.bot.speaking { box-shadow: 0 0 12px rgba(99, 102, 241, 0.2); }

.typing-indicator {
  align-self: flex-start;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  display: flex;
  gap: 4px;
  animation: fadeSlideIn 0.3s ease-out;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

#input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

#user-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 10px 16px;
  color: #1a1a2e;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

#user-input::placeholder { color: rgba(0, 0, 0, 0.35); }
#user-input:focus { border-color: rgba(99, 102, 241, 0.5); }

#send-btn, #mic-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

#send-btn { background: linear-gradient(135deg, #6366f1, #818cf8); color: #fff; }
#send-btn:hover { transform: scale(1.05); box-shadow: 0 0 16px rgba(99, 102, 241, 0.3); }

#mic-btn { background: rgba(0, 0, 0, 0.04); color: rgba(0, 0, 0, 0.4); border: 1px solid rgba(0, 0, 0, 0.1); }
#mic-btn:hover { color: #333; background: rgba(0, 0, 0, 0.08); }
#mic-btn.recording { background: rgba(239, 68, 68, 0.1); color: #ef4444; border-color: rgba(239, 68, 68, 0.3); animation: micPulse 1.5s infinite; }

/* Settings modal */
.modal-content input {
  width: 100%;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  padding: 10px 14px;
  color: #1a1a2e;
  font-size: 14px;
  outline: none;
}

.modal-content input:focus { border-color: rgba(99, 102, 241, 0.5); }

.hint { font-size: 11px; color: rgba(0, 0, 0, 0.35); margin-top: 6px; }

#save-key-btn { background: linear-gradient(135deg, #6366f1, #818cf8); color: #fff; }
#save-key-btn:hover { box-shadow: 0 0 12px rgba(99, 102, 241, 0.3); }
#close-modal-btn { background: rgba(0, 0, 0, 0.05); color: rgba(0, 0, 0, 0.6); }
#close-modal-btn:hover { background: rgba(0, 0, 0, 0.1); }

/* Controls panel */
#controls-panel { position: fixed; top: 20px; left: 20px; z-index: 20; }

#controls-toggle {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: rgba(0, 0, 0, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

#controls-toggle:hover { color: #6366f1; border-color: rgba(99, 102, 241, 0.3); }

#controls-sliders {
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  padding: 16px;
  width: 260px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transition: opacity 0.25s, transform 0.25s;
}

.controls-closed #controls-sliders { opacity: 0; transform: translateY(-8px); pointer-events: none; }
.controls-open #controls-sliders   { opacity: 1; transform: translateY(0); }

.ctrl-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ctrl-row:last-child { margin-bottom: 0; }
.ctrl-row label { font-size: 11px; color: rgba(0, 0, 0, 0.5); width: 90px; flex-shrink: 0; }

.ctrl-row input[type="range"] {
  flex: 1; height: 4px;
  -webkit-appearance: none; appearance: none;
  background: rgba(0, 0, 0, 0.1); border-radius: 2px; outline: none;
}

.ctrl-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: #6366f1; cursor: pointer;
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.ctrl-row input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: #6366f1; cursor: pointer;
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.ctrl-val { font-size: 11px; color: rgba(0, 0, 0, 0.4); width: 36px; text-align: right; font-variant-numeric: tabular-nums; }

/* Audio panel */
#audio-panel { position: fixed; top: 20px; right: 20px; z-index: 20; }

#audio-toggle {
  width: 40px; height: 40px;
  border: 1px solid rgba(0, 0, 0, 0.1); border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  color: rgba(0, 0, 0, 0.4); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}

#audio-toggle:hover { color: #6366f1; border-color: rgba(99, 102, 241, 0.3); }

#audio-controls {
  display: none; margin-top: 10px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px); border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px; padding: 16px; width: 220px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

#audio-upload-label {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: #fff; border-radius: 10px; cursor: pointer;
  font-size: 13px; font-weight: 600; transition: opacity 0.2s;
}

#audio-upload-label:hover { opacity: 0.85; }

#audio-now-playing { font-size: 11px; color: rgba(0,0,0,0.5); margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#audio-btns { display: flex; align-items: center; gap: 8px; margin-top: 8px; }

#audio-play {
  width: 32px; height: 32px; border: none; border-radius: 50%;
  background: rgba(0,0,0,0.06); color: rgba(0,0,0,0.5);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}

#audio-volume {
  flex: 1; height: 4px;
  -webkit-appearance: none; appearance: none;
  background: rgba(0,0,0,0.1); border-radius: 2px;
}


/* ═══════════════════════════════════════════════
 * 7. ANIMATIONS
 * ═══════════════════════════════════════════════ */

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

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-4px); }
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
  50%      { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}


/* ═══════════════════════════════════════════════
 * 8. MOBILE
 * ═══════════════════════════════════════════════ */

@media (max-width: 640px) {
  #camera-panel { top: 12px; right: 12px; }
  #camera-controls {
    width: calc(100vw - 24px);   /* ← full width minus gutters */
    max-width: 320px;
    padding: 12px;
  }
  #metrics-total, #metrics-head .m-sep, #metrics-time { font-size: 16px; }

  /* Document modal — fit within visible mobile viewport */
  .doc-modal {
    align-items: stretch;
    padding: 10px;
  }
  .doc-modal-sheet {
    max-height: 100%;
    max-width: 100%;
    border-radius: 12px;
  }
  .doc-modal-header {
    padding: 14px 16px 10px;
  }
  .doc-modal-body {
    padding: 14px 16px;
  }
  .doc-modal-footer {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  #doc-modal-close {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }

  /* Inactive features */
  #chat-container { bottom: 20px; border-radius: 16px; }
  .message { max-width: 90%; }
  #mic-btn, #send-btn { width: 44px; height: 44px; }
  #controls-panel { top: 12px; left: 12px; }
  #controls-sliders { width: 220px; }
  #audio-panel { top: 12px; right: 12px; }
}
