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

:root {
  --preview-size: 1000px;
  --preview-scale: min(1, calc((100vw - 32px) / 1000px), calc((100vh - 220px) / 1000px));
  --twilight-400: #090830;
  --purple-active: #5A56B3;
  --purple-soft: #c4b5fd;
  --lavender-bg: #c4a8ff;
  --text-dark: #1f2937;
  --text-muted: #64748b;
  --silver-150: #e2e8f0;
  --soft-black: #221a05;
  --purple-accent: #ba9aff;
  --lime-row: #ebf7c9;
  --lime-highlight: rgba(190, 242, 100, 0.5);
}

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;
  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);
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
}

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

.browser-chrome {
  height: 44px;
  background: #e5e5e5;
  display: flex;
  align-items: flex-end;
  padding: 0 14px;
  gap: 8px;
}

.chrome-dots {
  display: flex;
  gap: 7px;
  margin-right: 12px;
  margin-bottom: 16px;
}

.dot { width: 12px; height: 12px; border-radius: 999px; }
.dot-red { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green { background: #28c840; }

.chrome-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f5f5f5;
  border-radius: 8px 8px 0 0;
  padding: 7px 14px;
  min-width: 140px;
  height: 32px;
}

.chrome-tab.is-active { background: #fff; }
.tab-sk { width: 80px; height: 8px; border-radius: 4px; background: #c8c8c8; }
.tab-sk-wide { width: 110px; background: #b8b8e0; }
.tab-x { font-size: 13px; color: #999; line-height: 1; }

.table-area {
  height: calc(100% - 44px);
  background: #fff;
}

.sk-table { width: 100%; }
.sk-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1.2fr 1fr;
  border-bottom: 1px solid #edf1f4;
}
.sk-row.sk-head { background: #fafafa; border-top: 1px solid #dde3e8; }
.sk-cell { padding: 18px 20px; display: flex; align-items: center; }
.sk-head .sk-cell { padding: 14px 20px; }
.sk {
  height: 10px;
  border-radius: 5px;
  background: #e1e3e7;
}
.sk-head .sk { height: 9px; background: #ced1d7; }
.sk.w40 { width: 40%; }
.sk.w45 { width: 45%; }
.sk.w50 { width: 50%; }
.sk.w55 { width: 55%; }
.sk.w60 { width: 60%; }
.sk.w70 { width: 70%; }
.sk.w75 { width: 75%; }
.sk.w78 { width: 78%; }
.sk.w84 { width: 84%; }
.sk.w85 { width: 85%; }
.sk.w92 { width: 92%; }
.sk-row.is-selected { background: var(--lime-row); }
.sk-row.is-selected .sk { background: var(--purple-soft); }

.apply-zoomable {
  width: 100%;
  height: 100%;
  background: #fff;
  transform-origin: top center;
  will-change: transform;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(89, 67, 155, 0.18);
}

#v2ApplyLayer { background: transparent; }

.apply-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--silver-150);
  background: #fff;
  position: relative;
  z-index: 2;
}

.apply-nav-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.apply-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 10px;
  height: 12px;
  color: var(--purple-active);
  flex-shrink: 0;
}

.apply-back svg {
  display: block;
  width: 100%;
  height: 100%;
}

.apply-nav-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--purple-active);
  line-height: 1.2;
}

.apply-nav-dl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.2;
  flex-shrink: 0;
}

.apply-nav-dl svg {
  display: block;
  width: 12px;
  height: 12px;
}

.apply-content {
  position: relative;
  display: flex;
  height: calc(100% - 49px);
  background: #fff;
  overflow: hidden;
}

.form-col {
  width: 952px;
  flex: 0 0 auto;
  padding: 38px 28px 0 28px;
  background: #fff;
  position: relative;
  z-index: 1;
}

.org-heading {
  font-size: 24px;
  font-weight: 700;
  color: #47479f;
  margin-bottom: 8px;
}

.section-heading {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 16px;
}

.field-group { margin-bottom: 16px; }
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 5px;
}

.field-input {
  width: 100%;
  border: 1.5px solid var(--silver-150);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--text-dark);
  background: #fff;
  font-family: inherit;
  outline: none;
}

.field-textarea { min-height: 110px; resize: none; line-height: 1.5; }

.field-select {
  width: 100%;
  border: 1.5px solid var(--silver-150);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  color: #94a3b8;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.field-select-sm { justify-content: flex-end; }
.sel-caret { color: #94a3b8; font-size: 12px; }
.field-row-3 {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.9fr;
  gap: 14px;
}

.ai-action-btn {
  position: absolute;
  bottom: 30px;
  right: 30px;
  width: 64px;
  height: 64px;
  background: #FF4F2B;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(255, 79, 43, 0.3);
  z-index: 10;
}

.ai-action-btn svg {
  width: 32px;
  height: 32px;
}

.ai-ripple {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  border-radius: 16px;
  border: 2px solid #FF4F2B;
  opacity: 0;
  pointer-events: none;
}

.rail-shell {
  width: 0;
  flex: 0 0 auto;
  position: relative;
  border-left: 1px solid transparent;
  background: linear-gradient(180deg, #fcfcff 0%, #f5f3ff 62%, #edf0ff 100%);
  opacity: 0;
  overflow: hidden;
}

.snippet-rail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px 0;
  opacity: 0;
}

.apply-ai-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
}

.spark-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transform: translateY(0.5px);
}

.spark-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.manage-btn {
  padding: 6px 14px;
  border: 1.5px solid var(--silver-150);
  border-radius: 8px;
  background: rgba(255,255,255,0.92);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  font-family: inherit;
}

.cards-layer {
  position: absolute;
  inset: 49px 0 0 0;
  z-index: 3;
  pointer-events: none;
}

.snippet-card, #v2FocusPanel {
  pointer-events: none;
}

.snippet-card {
  position: absolute;
  width: 304px;
  background: #fff;
  border-radius: 16px;
  padding: 16px 18px 14px;
  border: 1px solid #eceef8;
  box-shadow: 0 10px 28px rgba(15,23,42,0.08);
  transform-origin: center center;
}

.card-featured { width: 304px; }
.card-secondary { width: 304px; }
.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}

.card-title {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
}

.card-badge {
  display: none;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--purple-active);
  color: #fff;
}

.card-body {
  font-size: 12.5px;
  line-height: 1.55;
  color: #475569;
  margin-bottom: 10px;
}

.card-skeleton {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.card-skeleton .sk { height: 10px; background: #D1FF52; }
.card-src {
  font-size: 11px;
  color: var(--purple-active);
  text-align: right;
}

#v2FocusPanel {
  position: absolute;
  width: 304px;
  opacity: 0;
}

.focus-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #eceef8;
  box-shadow: 0 10px 28px rgba(15,23,42,0.12);
  padding: 16px 18px 16px;
}

.focus-top-card { margin-bottom: 14px; }
.focus-body {
  font-size: 12.8px;
  line-height: 1.58;
  color: #475569;
  margin-bottom: 12px;
}
.focus-source-row { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.focus-source {
  font-size: 11px;
  color: var(--purple-active);
}
.btn-revise-wide,
.btn-insert-primary {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
}
.btn-revise-wide {
  background: #eef0ff;
  color: #3949ab;
}
.btn-insert-primary {
  background: var(--purple-active);
  color: #fff;
}
.focus-kicker {
  font-size: 12px;
  font-weight: 700;
  color: #3949ab;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.focus-card-revision {
  opacity: 0;
  transform: translateY(8px);
}
.focus-revised {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-dark);
  background: #faf5ff;
  border: 1px solid #e9d5ff;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}
.focus-revised .v2-lime {
  background: var(--lime-highlight);
  padding: 1px 3px;
  border-radius: 3px;
}

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

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

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

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(calc(var(--preview-size) * var(--preview-scale)), calc(100vw - 32px));
  flex-wrap: wrap;
  justify-content: center;
  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;
}
.btn-play { background: var(--soft-black); color: #fff; }
.btn-restart { background: #e8e8e8; color: var(--text-dark); }
.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;
}
.time-display {
  font-size: 13px;
  color: #747171;
  font-variant-numeric: tabular-nums;
  min-width: 96px;
  text-align: center;
}
.btn-download { background: var(--twilight-400); color: #fff; margin-left: auto; }
.btn-download:disabled { opacity: 0.5; cursor: not-allowed; }

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