*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Apple Intelligence animated gradient ── */
@property --ai-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@keyframes ai-spin { to { --ai-angle: 360deg; } }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-6px); opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

:root {
  --color-bg: #f2f2f7;
  --color-surface: #ffffff;
  --color-border: #e0e0e5;
  --color-text: #1d1d1f;
  --color-muted: #545458;
  --color-accent-from: #7a00df;
  --color-accent-to: #0693e3;
  --color-confirmed: #1a7a35;
  --color-video-based: #7a4500;
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Shared Header ── */
.header {
  border-bottom: 1px solid var(--color-border);
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-pill {
  background: linear-gradient(135deg, var(--color-accent-from), var(--color-accent-to));
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.logo-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--color-text);
}
.logo-name span { color: var(--color-accent-from); }
.header-back {
  font-size: 13px;
  color: var(--color-accent-from);
  text-decoration: none;
  font-weight: 600;
  opacity: 0.85;
  transition: opacity 0.15s;
}
.header-back:hover { opacity: 1; }
.header-tag {
  font-size: 12px;
  color: var(--color-muted);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 4px 12px;
}

/* ── Page Wrapper ── */
.page-wrapper {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 16px;
}

/* ── Product Header ── */
.product-header { margin-bottom: 20px; }
.product-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--color-accent-from), var(--color-accent-to));
  color: white;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
}
.product-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}
.product-subtitle { font-size: 14px; color: var(--color-muted); }

/* ── Player Shell ── */
.player-shell {
  display: flex;
  align-items: stretch;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  background: #000;
  aspect-ratio: 16/9;
}

/* ── Player Wrapper ── */
.player-wrapper {
  position: relative;
  background: #000;
  flex: 1;
  height: 100%;
  transition: flex-basis 0.35s ease;
}
.player-shell.qa-open .player-wrapper {
  flex: 0 0 62%;
}
#video { width: 100%; height: 100%; display: block; }

/* ── Ask AI Button – rainbow ring ── */
.ask-ai-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: #1d1d1f;
  border: none;
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.2s, transform 0.15s;
  isolation: isolate;
}
.ask-ai-btn::before {
  content: '';
  position: absolute; inset: -6px; border-radius: 26px;
  background: conic-gradient(from var(--ai-angle), #bf5af2, #0a84ff, #30d158, #ff9f0a, #ff375f, #bf5af2);
  z-index: -1;
  animation: ai-spin 8s linear infinite;
  filter: blur(8px);
  opacity: 0.9;
}
.ask-ai-btn:hover { filter: brightness(0.97); transform: scale(1.02); }
.ask-ai-btn:active { transform: scale(0.98); }

/* ── QA Section — side panel ── */
.qa-section {
  flex: 0 0 0;
  width: 0;
  opacity: 0;
  overflow: hidden;
  transition: flex-basis 0.35s ease, opacity 0.3s ease;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  max-height: none;
  margin-top: 0;
  border-radius: 0;
  border-top: none;
  border-right: none;
  border-bottom: none;
  box-shadow: none;
}
.player-shell.qa-open .qa-section {
  flex: 0 0 38%;
  opacity: 1;
}
.qa-inner {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  overflow-y: auto;
}

.qa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.qa-title { font-size: 15px; font-weight: 700; color: var(--color-text); }
.qa-close {
  background: none;
  border: none;
  color: var(--color-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s;
}
.qa-close:hover { color: var(--color-text); }

/* ── Suggested Questions ── */
.suggested-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.suggested-chip {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.suggested-chip:hover {
  background: #ece8f5;
  border-color: var(--color-accent-from);
  color: var(--color-accent-from);
}

/* ── Input Row ── */
.question-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.question-input {
  flex: 1;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s;
}
.question-input:focus { border-color: var(--color-accent-from); }
.question-input::placeholder { color: var(--color-muted); }
.send-button {
  background: linear-gradient(135deg, var(--color-accent-from), var(--color-accent-to));
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  padding: 10px 14px;
  transition: opacity 0.15s;
  display: flex;
  align-items: center;
}
.send-button:hover { opacity: 0.85; }
.send-button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Answer Area ── */
.answer-area { min-height: 0; }
.answer-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-muted);
  font-size: 14px;
  padding: 12px 0;
}
.loading-dots { display: flex; gap: 4px; }
.loading-dots span {
  width: 6px; height: 6px;
  background: var(--color-accent-from);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.loading-dots span:nth-child(3) { animation-delay: 0.3s; }

.answer-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  animation: fadeIn 0.2s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.answer-source-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
  padding: 3px 8px;
  border-radius: 20px;
}
.answer-source-label.confirmed {
  background: rgba(26,122,53,0.1);
  color: var(--color-confirmed);
}
.answer-source-label.video-based {
  background: rgba(122,69,0,0.1);
  color: var(--color-video-based);
}
.answer-text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text);
}
.timestamp-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--color-accent-from);
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
}
.timestamp-link:hover { text-decoration: underline; }

.fallback-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.fallback-card p { font-size: 14px; color: var(--color-muted); margin-bottom: 10px; }
.fallback-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--color-accent-from), var(--color-accent-to));
  color: white;
  text-decoration: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
}

/* ── Teaser Bubble ── */
@keyframes bubblePop {
  from { opacity: 0; transform: translateY(-8px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.teaser-bubble {
  position: absolute;
  top: 58px;
  right: 14px;
  z-index: 20;
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2), 0 2px 8px rgba(0,0,0,0.12);
  max-width: 220px;
  border: 1px solid rgba(0,0,0,0.06);
  opacity: 0;
  transform: translateY(-8px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  user-select: none;
}
.teaser-bubble.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  animation: bubblePop 0.3s ease forwards;
}
/* Triangle pointing UP toward the Ask AI button */
.teaser-bubble::after {
  content: '';
  position: absolute;
  top: -7px;
  right: 22px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-left: 1px solid rgba(0,0,0,0.06);
  border-top: 1px solid rgba(0,0,0,0.06);
  transform: rotate(45deg);
}
.teaser-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--color-accent-from);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.teaser-question {
  font-size: 13px;
  line-height: 1.4;
  color: var(--color-text);
  display: block;
  margin-bottom: 10px;
  font-weight: 500;
}
.teaser-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-accent-from);
  background: rgba(122,0,223,0.08);
  border: none;
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.teaser-cta:hover { background: rgba(122,0,223,0.15); }

/* ── Cart CTA ── */
.cart-cta-wrapper {
  flex-shrink: 0;
  margin-top: 4px;
}
.cart-cta-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--color-accent-from), var(--color-accent-to));
  border: none;
  border-radius: 10px;
  color: white;
  font-size: 13px;
  font-weight: 700;
  padding: 11px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
  letter-spacing: -0.01em;
  font-family: inherit;
}
.cart-cta-btn:hover { filter: brightness(1.08); }
.cart-cta-btn:active { transform: scale(0.98); }
.cart-cta-btn.added {
  background: linear-gradient(135deg, #1a7a35, #22a64a);
  transition: background 0.2s ease;
}
