/* -------------------------------------------------------------------------
   PEEK — Moments brand: Citron + Soft Black + Purple + Off-white
   ------------------------------------------------------------------------- */

:root {
  /* primary */
  --ink:        #141414;  /* Moments Soft Black */
  --ink-2:      #1a1a1a;
  --citron:     #E4FF77;  /* Moments Citron */
  --purple:     #6342E8;  /* Moments Purple */
  --offwhite:   #F3F1EE;  /* Moments Off White */
  /* secondary */
  --lavender:   #ADAAFF;
  --red:        #FF4D6A;
  --orange:     #FF8934;
  --stone:      #D9CEC3;
  /* surfaces */
  --line:       rgba(243,241,238,.10);
  --line-soft:  rgba(243,241,238,.05);
  --glass:      rgba(20,20,20,.62);
  --glass-2:    rgba(28,26,38,.45);
  /* text */
  --text:       rgba(243,241,238,.95);
  --text-2:     rgba(243,241,238,.62);
  --text-3:     rgba(243,241,238,.42);
  --text-4:     rgba(243,241,238,.28);
}

html, body { background: var(--ink); color: var(--text); }
body { font-feature-settings: "ss01", "cv11"; }
[x-cloak] { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(243,241,238,.08); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(243,241,238,.16); }
::-webkit-scrollbar-track { background: transparent; }

::selection { background: rgba(228,255,119,.35); color: var(--ink); }

/* -------------------------------------------------------------------------
   gradient mesh — Purple primary, Lavender + Orange + Citron drifting
   ------------------------------------------------------------------------- */
.mesh {
  background:
    radial-gradient(at 50% -10%, rgba(99,66,232,.18), transparent 55%),
    var(--ink);
}
.mesh .blob {
  position: absolute;
  width: 62vmax;
  height: 62vmax;
  border-radius: 50%;
  filter: blur(110px) saturate(150%);
  opacity: .55;
  mix-blend-mode: screen;
  will-change: transform;
}
.mesh .blob-a { background: radial-gradient(circle at center, var(--purple),   transparent 60%); top: -22vmax; left: -16vmax; animation: drift-a 32s ease-in-out infinite alternate; opacity: .55; }
.mesh .blob-b { background: radial-gradient(circle at center, var(--lavender), transparent 60%); top: -6vmax;  right: -22vmax; animation: drift-b 38s ease-in-out infinite alternate; opacity: .45; }
.mesh .blob-c { background: radial-gradient(circle at center, var(--orange),   transparent 60%); bottom: -28vmax; left: 6vmax; animation: drift-c 44s ease-in-out infinite alternate; opacity: .32; }
.mesh .blob-d { background: radial-gradient(circle at center, var(--citron),   transparent 65%); bottom: -16vmax; right: -10vmax; animation: drift-d 50s ease-in-out infinite alternate; opacity: .25; }
@keyframes drift-a { from { transform: translate(0,0)     scale(1); } to { transform: translate( 12vmax,  8vmax) scale(1.15); } }
@keyframes drift-b { from { transform: translate(0,0)     scale(1.1); } to { transform: translate(-14vmax,  10vmax) scale(.9); } }
@keyframes drift-c { from { transform: translate(0,0)     scale(.95); } to { transform: translate( 10vmax, -12vmax) scale(1.1); } }
@keyframes drift-d { from { transform: translate(0,0)     scale(1); } to { transform: translate(-8vmax,  -6vmax) scale(1.2); } }
@media (prefers-reduced-motion: reduce) { .mesh .blob { animation: none; } }

.mesh .grain {
  position: absolute; inset: 0; pointer-events: none; opacity: .065; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* -------------------------------------------------------------------------
   cards
   ------------------------------------------------------------------------- */
.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, var(--glass), var(--glass-2));
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  padding: clamp(20px, 2.6vw, 30px);
  box-shadow:
    inset 0 1px 0 rgba(243,241,238,.06),
    0 24px 60px -28px rgba(0,0,0,.75),
    0 1px 0 rgba(0,0,0,.4);
  transition: opacity .35s ease, filter .35s ease, transform .35s ease;
  display: flex; flex-direction: column;
}
.card--locked { opacity: .55; filter: saturate(.6); }
.card--locked > *:not(.card-head) { pointer-events: none; }
.card--done { opacity: .98; }

.card-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 22px; }
.step-no {
  font-family: "Instrument Serif", serif;
  font-style: italic;
  font-size: 38px;
  line-height: 1;
  letter-spacing: -.02em;
  color: transparent;
  background: linear-gradient(135deg, var(--citron) 0%, var(--lavender) 55%, var(--purple) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
.step-title { font-size: 20px; font-weight: 500; letter-spacing: -0.01em; color: var(--text); }

.row-label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .22em;
  color: var(--text-3);
}
.row-hint { font-size: 12px; color: var(--text-3); line-height: 1.45; }

/* -------------------------------------------------------------------------
   step 1 — examples / drop / preview / slider / segmented / button
   ------------------------------------------------------------------------- */
.example-panel {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(228,255,119,.22);
  background:
    linear-gradient(135deg, rgba(228,255,119,.10), rgba(99,66,232,.08)),
    rgba(243,241,238,.025);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 16px 34px -26px rgba(228,255,119,.6);
}
.example-panel--hero { max-width: 520px; justify-self: end; width: 100%; }
.example-panel__copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.example-panel__copy p {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-2);
  text-align: right;
}
.example-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.example-tile {
  min-height: 58px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(243,241,238,.11);
  background: rgba(20,20,20,.44);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  text-align: left;
  transition: transform .16s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.example-tile span {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.example-tile small {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--text-3);
}
.example-tile:hover {
  transform: translateY(-1px);
  border-color: rgba(228,255,119,.42);
  background: rgba(228,255,119,.08);
  box-shadow: 0 12px 24px -18px rgba(228,255,119,.65);
}

.drop {
  position: relative;
  border: 1.5px dashed rgba(243,241,238,.18);
  border-radius: 16px;
  padding: 28px 18px;
  min-height: 180px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(243,241,238,.02);
  transition: border-color .25s ease, background .25s ease, box-shadow .25s ease;
}
.drop--hot {
  border-color: var(--citron);
  background: rgba(228,255,119,.06);
  box-shadow: 0 0 0 4px rgba(228,255,119,.10), inset 0 0 80px rgba(228,255,119,.06);
}
.drop--filled { padding: 0; border-style: solid; border-color: var(--line); background: rgba(0,0,0,.5); min-height: 0; }
.drop-empty { display: flex; flex-direction: column; align-items: center; text-align: center; width: 100%; }
.drop-preview { width: 100%; }
.preview-video { width: 100%; max-height: 240px; object-fit: contain; background: #000; border-radius: 15px 15px 0 0; display: block; }
.drop-meta { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; }
.browse-pill {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--ink);
  background: var(--citron);
  border-radius: 999px;
  padding: 7px 12px;
  box-shadow: 0 12px 22px -14px rgba(228,255,119,.75);
}

.chip {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(243,241,238,.025);
  color: var(--text-2);
  transition: all .18s ease;
}
.chip:hover {
  color: var(--citron);
  border-color: rgba(228,255,119,.45);
  background: rgba(228,255,119,.06);
}

.link-btn {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .18em;
  transition: color .15s ease;
}
.link-btn:hover { color: var(--text); }
.link-btn:disabled { opacity: .4; cursor: not-allowed; }

/* range slider — Citron→Purple fill, white thumb with Citron halo */
.slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 999px;
  background: linear-gradient(90deg,
    var(--citron) 0%,
    var(--purple) calc(var(--p, 50%)),
    rgba(243,241,238,.08) calc(var(--p, 50%)));
  outline: none; cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--offwhite);
  border: 1px solid rgba(0,0,0,.5);
  box-shadow:
    0 0 0 3px rgba(228,255,119,.30),
    0 8px 18px -4px rgba(228,255,119,.45),
    0 0 22px rgba(99,66,232,.35);
  transition: transform .15s ease;
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.08); }
.slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%; background: var(--offwhite);
  border: 1px solid rgba(0,0,0,.5);
  box-shadow: 0 0 0 3px rgba(228,255,119,.30), 0 8px 18px -4px rgba(228,255,119,.45);
}

/* segmented control */
.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  background: rgba(243,241,238,.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  width: 100%;
}
.segmented button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 14px;
  border-radius: 9px;
  font-size: 13px;
  color: var(--text-2);
  transition: all .2s ease;
}
.segmented button:hover { color: var(--text); }
.segmented button.is-active {
  background: linear-gradient(180deg, rgba(243,241,238,.08), rgba(243,241,238,.02));
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(243,241,238,.08), 0 6px 14px -6px rgba(0,0,0,.6);
}

.dot { width: 7px; height: 7px; border-radius: 999px; display: inline-block; flex: none; }
.dot-citron { background: var(--citron); box-shadow: 0 0 10px rgba(228,255,119,.65); }
.dot-purple { background: var(--purple); box-shadow: 0 0 10px rgba(99,66,232,.65); }
.dot-band   { background: rgba(243,241,238,.18); border-radius: 2px; height: 7px; width: 12px; }

/* primary action — solid Citron with Soft Black text. Brand-forward. */
.btn-primary {
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--citron);
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -.005em;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 14px 34px -10px rgba(228,255,119,.55),
    0 0 0 1px rgba(228,255,119,.4) inset,
    inset 0 1px 0 rgba(255,255,255,.4);
  transition: transform .12s ease, filter .2s ease, box-shadow .2s ease;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); box-shadow: 0 18px 38px -10px rgba(228,255,119,.7), inset 0 1px 0 rgba(255,255,255,.55); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }
.btn-primary::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%);
  transform: translateX(-100%); transition: transform .9s ease;
}
.btn-primary:hover:not(:disabled)::after { transform: translateX(100%); }

.run-status {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(228,255,119,.18);
  background: rgba(228,255,119,.055);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.4;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin-top: 4px;
  background: var(--citron);
  box-shadow: 0 0 0 0 rgba(228,255,119,.55);
  animation: status-pulse 1.35s ease-in-out infinite;
  flex: none;
}
@keyframes status-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(228,255,119,.45); opacity: 1; }
  50% { box-shadow: 0 0 0 8px rgba(228,255,119,0); opacity: .55; }
}

.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(20,20,20,.25);
  border-top-color: var(--ink);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* timings dl grid */
.timings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(243,241,238,.025);
  border: 1px solid var(--line-soft);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
}
.timings > div { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; min-width: 0; }
.timings dt { color: var(--text-3); text-transform: uppercase; letter-spacing: .15em; font-size: 10px; }
.timings dd { color: var(--text); font-variant-numeric: tabular-nums; }
.timings .span-2 { grid-column: span 2; }
.timings .total dd { color: var(--citron); font-weight: 500; }
.timings .cached { color: var(--orange); font-size: 10px; text-transform: uppercase; letter-spacing: .15em; }

/* -------------------------------------------------------------------------
   step 2 — frame rows, score plot
   ------------------------------------------------------------------------- */
.placeholder {
  flex: 1;
  border: 1px dashed var(--line);
  border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 24px;
  min-height: 240px;
  text-align: center;
}

.frame-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.frame {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  transition: transform .25s ease, box-shadow .25s ease;
}
.frame:hover { transform: translateY(-2px); }
.frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame--peek {
  box-shadow:
    0 0 0 1px rgba(228,255,119,.5),
    0 10px 28px -14px rgba(228,255,119,.55);
  border-color: rgba(228,255,119,.45);
}
.frame--peek:hover {
  box-shadow:
    0 0 0 1px rgba(228,255,119,.85),
    0 18px 32px -12px rgba(228,255,119,.7);
}
.frame--uniform { box-shadow: inset 0 0 0 1px rgba(99,66,232,.35); border-color: rgba(99,66,232,.25); }

.chip-idx, .chip-ts {
  position: absolute;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(20,20,20,.75);
  backdrop-filter: blur(8px);
  color: var(--text);
  border: 1px solid rgba(243,241,238,.10);
  font-variant-numeric: tabular-nums;
}
.chip-idx { top: 6px; left: 6px; }
.chip-ts { bottom: 6px; right: 6px; }

.score-bar {
  position: absolute;
  left: 6px; right: 6px; bottom: 6px;
  height: 3px;
  border-radius: 999px;
  background: rgba(243,241,238,.10);
  overflow: hidden;
}
.score-bar::after {
  content: "";
  position: absolute; inset: 0; right: auto;
  width: var(--w, 0%);
  background: linear-gradient(90deg, var(--citron), var(--purple));
  border-radius: 999px;
}

.reveal {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--text-2);
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(243,241,238,.025);
  transition: all .2s ease;
}
.reveal:hover { color: var(--text); border-color: rgba(243,241,238,.18); }
.reveal svg { transition: transform .25s ease; }
.reveal.is-open svg { transform: rotate(180deg); }

.plot-wrap {
  max-height: 0;
  overflow: hidden;
  transition: max-height .45s cubic-bezier(.4,0,.2,1), margin-top .35s ease;
  margin-top: 0;
}
.plot-wrap.is-open { max-height: 460px; margin-top: 14px; }
.plot {
  width: 100%; height: 320px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0,0,0,.32);
}
.plot-legend {
  display: flex; flex-wrap: wrap; gap: 14px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  color: var(--text-3);
  margin-top: 10px;
  text-transform: uppercase;
  letter-spacing: .15em;
}
.plot-legend span { display: inline-flex; align-items: center; gap: 6px; }

/* -------------------------------------------------------------------------
   step 3 — prompt + captions
   ------------------------------------------------------------------------- */
.prompt {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(0,0,0,.4);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: "Inter Tight", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  resize: vertical;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.prompt:focus { outline: none; border-color: rgba(228,255,119,.5); box-shadow: 0 0 0 4px rgba(228,255,119,.08); }
.prompt:disabled { opacity: .6; cursor: not-allowed; }

.caption-card {
  position: relative;
  border-radius: 16px;
  padding: 18px 18px 20px;
  background: linear-gradient(180deg, rgba(243,241,238,.035), rgba(243,241,238,.01));
  border: 1px solid var(--line);
  transition: border-color .3s ease, box-shadow .3s ease;
  min-height: 110px;
}
.caption-card--peek.is-streaming    { border-color: rgba(228,255,119,.45); box-shadow: 0 0 0 4px rgba(228,255,119,.06), 0 16px 36px -18px rgba(228,255,119,.45); }
.caption-card--uniform.is-streaming { border-color: rgba(99,66,232,.45);   box-shadow: 0 0 0 4px rgba(99,66,232,.06),   0 16px 36px -18px rgba(99,66,232,.45); }
.caption-card.is-empty .cap-body { color: var(--text-4); font-style: italic; }

.caption-card header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cap-title {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .22em;
  color: var(--text-2);
}
.cap-meta {
  margin-left: auto;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  color: var(--text-3);
}
.cap-body {
  font-family: "Instrument Serif", serif;
  font-size: 22px;
  line-height: 1.3;
  letter-spacing: -.005em;
  color: var(--text);
  min-height: 1.3em;
  word-break: break-word;
}

.pulse {
  width: 8px; height: 8px; border-radius: 999px;
  background: currentColor;
  position: relative;
  animation: pulse 1.4s ease-in-out infinite;
}
.caption-card--peek .pulse    { color: var(--citron); }
.caption-card--uniform .pulse { color: var(--purple); }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 currentColor; opacity: 1; } 50% { box-shadow: 0 0 0 8px transparent; opacity: .35; } }

/* -------------------------------------------------------------------------
   toast
   ------------------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  padding: 10px 16px;
  font-size: 13px;
  background: rgba(20,20,20,.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
  z-index: 50;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* -------------------------------------------------------------------------
   misc
   ------------------------------------------------------------------------- */
.underline-link { color: var(--text-2); border-bottom: 1px solid rgba(243,241,238,.20); transition: color .15s ease, border-color .15s ease; }
.underline-link:hover { color: var(--text); border-bottom-color: var(--citron); }

em { font-style: italic; }

@media (max-width: 640px) {
  .card { border-radius: 18px; }
  .step-no { font-size: 30px; }
  .example-panel__copy {
    display: block;
  }
  .example-panel__copy p {
    text-align: left;
    margin-top: 4px;
  }
  .frame-row { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .cap-body { font-size: 19px; }
}
