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

:root {
  --preview-size: 1000px;
  --preview-scale: min(1, calc((100vw - 32px) / 1000px), calc((100vh - 190px) / 1000px));
  --soft-black: #221a05;
  --purple-accent: #ba9aff;
  --purple-deep: #7b68ee;
  --lavender-bg: #c4a8ff;
  --card-shadow: rgba(123, 104, 238, 0.16);
  --text-dark: #2b2520;
  --text-muted: #5f5750;
  --green-bubble: #e6ff84;
  --panel-border: #eadcff;
  --insight-bg: #f0ebff;
}

body {
  font-family: 'Lato', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #f0f0f0;
  overflow: hidden;
  gap: 14px;
  padding: 16px;
}

.viewport-shell {
  width: calc(var(--preview-size) * var(--preview-scale));
  height: calc(var(--preview-size) * var(--preview-scale));
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-shrink: 0;
}

.viewport-stage {
  width: var(--preview-size);
  height: var(--preview-size);
  transform: scale(var(--preview-scale));
  transform-origin: top center;
}

.viewport {
  width: 1000px;
  height: 1000px;
  position: relative;
  overflow: hidden;
  border-radius: 0;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
}

.scene {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.scene-lavender {
  background:
    radial-gradient(ellipse 720px 420px at 50% 50%, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0) 70%),
    var(--lavender-bg);
}

.chat-stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 108px;
}

.chat-copy {
  width: 720px;
  margin-bottom: 22px;
}

.chat-greeting {
  font-size: 22px;
  line-height: 1.3;
  color: #444;
  margin-bottom: 6px;
}

.chat-heading {
  font-size: 24px;
  line-height: 1.25;
  color: var(--text-dark);
  font-weight: 700;
}

.chat-card {
  width: 720px;
  background: #fff;
  border: 1.5px solid rgba(255,255,255,0.5);
  border-radius: 22px;
  box-shadow: 0 12px 32px rgba(89, 67, 155, 0.18);
  padding: 28px 40px 20px;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.chat-bubble {
  background: var(--green-bubble);
  color: var(--text-dark);
  border-radius: 18px;
  padding: 18px 22px;
  font-size: 15px;
  line-height: 1.45;
  box-shadow: inset 0 0 0 1px rgba(170, 194, 55, 0.08);
}

.chat-bubble.user {
  align-self: flex-end;
}

.chat-bubble.user.wide {
  width: 510px;
}

.chat-bubble.user.narrow {
  width: 458px;
}

.chat-question {
  width: 560px;
  font-size: 16px;
  line-height: 1.45;
  color: var(--text-muted);
}

.chat-complete {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.4;
}

.chat-complete-star {
  color: var(--purple-deep);
  font-size: 18px;
}

.chat-input {
  width: 100%;
  min-height: 66px;
  border: 2px solid rgba(186,154,255,0.82);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 3px 16px rgba(123, 104, 238, 0.08);
  padding: 0 18px 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.chat-input-label {
  font-size: 16px;
  color: rgba(43, 37, 32, 0.5);
}

.send-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transform-origin: center center;
}

.send-btn svg {
  width: 30px;
  height: 30px;
  position: relative;
  z-index: 2;
}

.send-btn-bg {
  fill: var(--soft-black);
}

.send-btn-arrow {
  fill: #fff;
}

.send-click-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 79, 43, 0.45);
  background: radial-gradient(circle, rgba(255, 79, 43, 0.2) 0%, rgba(255, 79, 43, 0.08) 58%, rgba(255, 79, 43, 0) 100%);
  transform: scale(0.45);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

.mouse-cursor {
  position: absolute;
  width: 24px;
  height: 24px;
  pointer-events: none;
  z-index: 200;
  opacity: 0;
  overflow: visible;
}

.mouse-cursor svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
}

.mouse-cursor .cursor-arrow {
  display: block;
  width: 128px !important;
  height: 136px !important;
  left: -40px;
  top: -42px;
}

.cursor-ripple {
  opacity: 0;
  stroke-width: 2.8px;
  filter: drop-shadow(0 0 8px rgba(255, 79, 43, 0.4));
}

.results-stage {
  position: absolute;
  inset: 0;
}

.result-stack-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 640px;
  background: rgba(255, 255, 255, 0.98);
  border: 1.5px solid var(--panel-border);
  border-radius: 14px;
  box-shadow: 0 10px 28px var(--card-shadow);
  padding: 24px 24px 26px;
  transform: translate(-50%, -50%);
}

.result-card-muted {
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.result-card-front {
  background: #fff;
}

.result-card-title {
  font-size: 18px;
  line-height: 1.35;
  color: var(--text-dark);
  margin-bottom: 18px;
}

.result-insight-box {
  background: var(--insight-bg);
  border-radius: 18px;
  padding: 24px 24px 22px;
}

.result-insight-title {
  font-size: 16px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 14px;
}

.result-insight-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.result-insight-list li {
  position: relative;
  padding-left: 18px;
  font-size: 15px;
  line-height: 1.4;
  color: #4f4a46;
}

.result-insight-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--purple-deep);
}

.result-insight-foot {
  font-size: 13px;
  line-height: 1.4;
  color: #7a7480;
}

.results-summary {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 760px;
  transform: translate(-50%, -50%);
  background: #fff;
  border: 2px solid rgba(186,154,255,0.92);
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(123, 104, 238, 0.24);
  padding: 28px 30px 22px;
  z-index: 20;
}

.results-summary-title {
  font-size: 24px;
  line-height: 1.2;
  color: var(--text-dark);
  font-weight: 700;
  margin-bottom: 18px;
}

.results-summary-tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.summary-tag {
  background: var(--green-bubble);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 15px;
  line-height: 1;
  color: var(--text-dark);
  white-space: nowrap;
}

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  width: min(calc(var(--preview-size) * var(--preview-scale)), calc(100vw - 32px));
  flex-wrap: wrap;
  justify-content: center;
  position: relative;
  z-index: 20;
  padding-bottom: 24px;
}

.controls button {
  font-family: 'Lato', sans-serif;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, transform 0.1s;
}

.controls button:active {
  transform: scale(0.96);
}

.btn-play {
  background: var(--soft-black);
  color: #fff;
}

.btn-restart {
  background: #e8e8e8;
  color: var(--text-dark);
}

.btn-download {
  background: #090830;
  color: #fff;
  margin-left: auto;
}

.btn-download:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.time-display {
  font-size: 13px;
  color: #747171;
  font-variant-numeric: tabular-nums;
  min-width: 96px;
  text-align: center;
}

.progress-bar-wrap {
  width: min(300px, 100%);
  height: 6px;
  background: #ddd;
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  flex: 1 1 220px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--purple-accent);
  border-radius: 3px;
}

.recording-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.recording-modal {
  background: #fff;
  border-radius: 16px;
  padding: 32px 40px;
  text-align: center;
  box-shadow: 0 12px 48px rgba(0,0,0,0.2);
  min-width: 320px;
}

.recording-modal h3 {
  margin-bottom: 16px;
  font-size: 18px;
  color: var(--text-dark);
}

.recording-bar {
  width: 100%;
  height: 8px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.recording-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--purple-accent);
  border-radius: 4px;
  transition: width 0.15s;
}

.recording-status {
  font-size: 13px;
  color: #747171;
}

html.embedded {
  --preview-scale: min(1, calc(100vw / 1000px), calc(100vh / 1000px));
}

html.embedded body {
  min-height: 100vh;
  background: transparent;
  padding: 0;
  gap: 0;
  justify-content: center;
}

html.embedded .viewport {
  box-shadow: none;
}

html.embedded .controls {
  display: none;
}
