*, *::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));
  --bg-white: #ffffff;
  --amethyst-light: #c4a8ff;
  --purple-accent: #ba9aff;
  --twilight-150: #eaeafb;
  --twilight-400: #090830;
  --button-twilight-active: #5A56B3;
  --volt-400: #e6ffa1;
  --user-text: #07074b;
  --text-dark: #333333;
  --text-gray: #747171;
  --soft-black: #221a05;
  --silver-100: #f2f5f7;
  --silver-150: #e4eaec;
  --silver-300: #C5D1D4;
  --silver-500: #455c63;
  --hot-persimmon: #ff4f2b;
  --card-shadow: rgba(150, 102, 255, 0.2);
  --input-shadow: rgba(90, 86, 179, 0.12);
}

body {
  font-family: 'Lato', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #f0f0f0;
  overflow: hidden;
  overflow-x: 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: 0px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
  flex-shrink: 0;
}

.scene {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 140px;
  opacity: 0;
  will-change: opacity, transform;
  overflow: hidden;
}

.scene-bg-amethyst {
  background: var(--amethyst-light);
}

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

.mouse-cursor svg {
  position: absolute;
  top: 0;
  left: 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));
}

/* ── SCENE 1 + SHARED: GRANT CARD ── */
.collab-container {
  width: 720px;
}

.grant-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.grant-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.grant-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.3;
}

.grant-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--volt-400);
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  color: var(--soft-black);
  white-space: nowrap;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6abf40;
  flex-shrink: 0;
}

/* ── TIMELINE BAR ── */
.grant-timeline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.timeline-bar-wrap {
  position: relative;
  height: 82px;
  display: flex;
  align-items: flex-end;
  padding-bottom: 0;
}

.timeline-bar-bg {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 15px;
  background: #f1f1f9;
  border-radius: 887px;
}

.timeline-bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 13.3%;
  height: 15px;
  background: var(--soft-black);
  border-radius: 887px;
  z-index: 1;
}

.timeline-marker {
  position: absolute;
  left: 15%;
  bottom: 15px;
  z-index: 2;
}

.marker-line {
  position: absolute;
  left: 0;
  bottom: -20px;
  width: 2px;
  height: 54px;
  border-left: 2px dashed var(--button-twilight-active);
  opacity: 0.5;
}

.marker-label {
  position: absolute;
  left: 8px;
  bottom: 24px;
  font-size: 16px;
  line-height: 1;
  font-weight: 400;
  color: var(--text-dark);
  white-space: nowrap;
  margin: 0;
}

.timeline-dates {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
}

.timeline-date {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.timeline-date-end {
  align-items: flex-end;
}

.date-label {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-dark);
}

.date-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-dark);
}

/* ── AVATARS ── */
.avatars-row {
  display: flex;
  align-items: center;
  padding: 6px 22px 6px 6px;
}

.scene-avatars {
  position: absolute;
  top: 40px;
  right: 60px;
  z-index: 10;
}

.avatar {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 6px solid var(--hot-persimmon);
  flex-shrink: 0;
  overflow: hidden;
  background: #ddd;
  margin-right: -16px;
}

.avatar:last-child {
  margin-right: 0;
}

.avatar-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* ── SCENE 2: TASKS ── */
.collab-layout-full {
  width: 720px;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.scene2-avatars {
  align-self: flex-end;
  margin-bottom: 12px;
}

.tasks-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  margin-top: 16px;
}

.task-row {
  background: #fff;
  border: 1px solid var(--silver-150);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
}

.task-left {
  display: flex;
  align-items: center;
  gap: 17px;
  flex: 1;
  min-width: 0;
}

.task-checkbox {
  width: 27px;
  height: 27px;
  border-radius: 6px;
  border: 1.35px solid var(--silver-300);
  background: #fff;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-checkbox.checked {
  background: var(--soft-black);
  border-color: var(--soft-black);
}

.task-checkbox .check-icon {
  width: 16px;
  height: 16px;
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.15s, transform 0.15s;
}

.task-checkbox.checked .check-icon {
  opacity: 1;
  transform: scale(1);
}

.task-text {
  font-family: 'Source Sans 3', 'Lato', sans-serif;
  font-size: 21px;
  font-weight: 400;
  color: var(--text-dark);
  line-height: 1.2;
}

.task-right {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-shrink: 0;
}

.task-tag {
  font-family: 'Source Sans 3', 'Lato', sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: var(--silver-500);
  background: var(--silver-100);
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
}

.task-date {
  font-family: 'Source Sans 3', 'Lato', sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: var(--text-dark);
  min-width: 50px;
  white-space: nowrap;
}

/* ── CONTROLS ── */
.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-play:hover {
  background: #3a2e10;
}

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

.btn-restart:hover {
  background: #ddd;
}

.controls .time-display {
  font-size: 13px;
  color: var(--text-gray);
  font-variant-numeric: tabular-nums;
  min-width: 90px;
  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;
  pointer-events: none;
}

.btn-download {
  background: var(--twilight-400);
  color: #fff;
  margin-left: auto;
}

.btn-download:hover {
  background: #120f50;
}

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

.format-select {
  font-family: 'Lato', sans-serif;
  font-size: 14px;
  font-weight: 500;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  padding: 7px 14px;
  background: #fff;
  color: var(--text-dark);
  cursor: pointer;
  outline: none;
}
.format-select:focus { border-color: var(--purple-accent); }

.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: var(--text-gray);
}

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;
}
