@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/Bricolage.ttf") format("truetype");
  font-weight: 300 800;
  font-display: swap;
}

:root {
  --bg0: #0a0f0d;
  --bg1: #10161300;
  --ink: #f2f5f1;
  --muted: #9aa79f;
  --faint: #6b766f;
  --lime: #c6f56a;
  --lime-dim: #8fbf3a;
  --accent-ink: #0e140c;
  /* Layered surfaces for depth (Apple-like) */
  --surface-1: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --surface-3: rgba(255, 255, 255, 0.09);
  --hairline: rgba(255, 255, 255, 0.09);
  --hairline-strong: rgba(255, 255, 255, 0.16);
  --line: rgba(255, 255, 255, 0.09);
  --danger: #ff6b6b;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --radius-sm: 10px;
  --font-display: "Bricolage Grotesque", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter",
    system-ui, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 700px at 10% -10%, #243528 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #1a2a22 0%, transparent 50%),
    linear-gradient(165deg, var(--bg0), var(--bg1));
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.01em;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.top,
.shell,
.toast {
  position: relative;
  z-index: 1;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.status-pill {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
}

.status-pill.ok {
  color: var(--lime);
  border-color: rgba(198, 245, 106, 0.35);
}

.status-pill.warn {
  color: #ffd166;
  border-color: rgba(255, 209, 102, 0.35);
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 1.5rem;
  padding: 1.5rem 1.75rem 2.5rem;
  max-width: 1280px;
  margin: 0 auto;
  min-height: calc(100vh - 4.5rem);
}

.stage {
  min-height: 70vh;
}

.drop {
  height: 100%;
  min-height: 520px;
  border: 1px dashed rgba(198, 245, 106, 0.35);
  border-radius: 28px;
  background: rgba(12, 18, 16, 0.45);
  display: grid;
  place-items: center;
  padding: 2rem;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.25s ease;
}

.drop.drag {
  border-color: var(--lime);
  background: rgba(198, 245, 106, 0.06);
  transform: translateY(-2px);
}

.drop-inner {
  max-width: 28rem;
  text-align: left;
}

.drop h1 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.drop p {
  margin: 0 0 1.5rem;
  color: var(--muted);
  line-height: 1.5;
  font-size: 1.05rem;
}

.file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--lime);
  color: #10160f;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.85rem 1.25rem;
  border-radius: 999px;
  cursor: pointer;
  border: none;
  transition: transform 0.15s ease, background 0.15s ease;
}

.file-btn:hover {
  background: #d7ff86;
  transform: translateY(-1px);
}

.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.1rem;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
}

/* ---- welcome / landing ---- */
/* Let the landing hero use the full shell width (rail is hidden here). */
.stage:has(#welcome:not(.is-hidden)) {
  grid-column: 1 / -1;
}

.welcome {
  position: relative;
  height: 100%;
  min-height: 560px;
  border: 1px solid var(--hairline);
  border-radius: 28px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(80% 60% at 100% 0%, rgba(198, 245, 106, 0.1), transparent 60%),
    radial-gradient(70% 60% at 0% 100%, rgba(34, 211, 238, 0.08), transparent 60%),
    linear-gradient(165deg, rgba(18, 26, 22, 0.6), rgba(9, 13, 11, 0.72));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: rise 0.5s ease both;
}

/* soft glow for depth behind the copy */
.welcome-glow {
  position: absolute;
  inset: -18% -8% auto auto;
  width: 52%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(
    closest-side,
    rgba(198, 245, 106, 0.16),
    transparent 70%
  );
  filter: blur(44px);
  z-index: 0;
  pointer-events: none;
}

.welcome-inner {
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  padding: clamp(2rem, 4vw, 4rem);
}

.welcome-copy {
  max-width: 34rem;
}

.welcome-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--hairline);
  background: var(--surface-1);
  border-radius: 999px;
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.welcome-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 3px rgba(198, 245, 106, 0.15),
    0 0 12px rgba(198, 245, 106, 0.7);
}

.welcome-title {
  margin: 1.25rem 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.5rem, 5vw, 4.2rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.welcome-arrow {
  color: var(--faint);
  font-weight: 500;
}

.welcome-title-accent {
  color: var(--lime);
}

.welcome-tag {
  margin: 1.25rem 0 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: clamp(1rem, 1.4vw, 1.12rem);
  max-width: 30rem;
}

.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.25rem;
  margin-top: 2rem;
}

.welcome-cta {
  font-size: 1.02rem;
  padding: 0.95rem 1.8rem;
  box-shadow: 0 10px 30px rgba(198, 245, 106, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.welcome-cta:hover {
  box-shadow: 0 14px 38px rgba(198, 245, 106, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.welcome-note {
  color: var(--faint);
  font-size: 0.85rem;
  letter-spacing: 0.01em;
}

.welcome-features {
  list-style: none;
  margin: 2.25rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.welcome-features li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--hairline);
  background: var(--surface-1);
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--ink);
  white-space: nowrap;
}

.welcome-features li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 8px rgba(198, 245, 106, 0.6);
}

/* ---- phone mockup ---- */
.welcome-hero {
  display: grid;
  place-items: center;
  width: 100%;
}

.welcome-phone {
  position: relative;
  width: 100%;
  max-width: 300px;
  aspect-ratio: 9 / 16;
  max-height: 560px;
  border-radius: 36px;
  overflow: hidden;
  background: #050706;
  border: 1px solid var(--hairline-strong);
  box-shadow: var(--shadow), 0 0 0 6px rgba(255, 255, 255, 0.02),
    0 0 60px rgba(198, 245, 106, 0.1);
}

/* camera notch pill — stays above the swiping slides */
.welcome-phone::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 42px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  z-index: 60;
}

/* ---- Tinder-style slideshow ---- */
.welcome-stack {
  position: absolute;
  inset: 0;
}

.welcome-slide {
  position: absolute;
  inset: 0;
  overflow: hidden;
  transform-origin: 50% 85%;
  will-change: transform, opacity;
  transition:
    transform 0.5s cubic-bezier(0.22, 0.61, 0.36, 1),
    opacity 0.5s ease,
    filter 0.5s ease;
}

/* stack depth: d0 = top card, d1/d2 peek behind, dback = hidden */
.welcome-slide.d0 {
  transform: translateY(0) scale(1);
  opacity: 1;
  filter: none;
  z-index: 30;
}

.welcome-slide.d1 {
  transform: translateY(12px) scale(0.95);
  opacity: 1;
  filter: brightness(0.72);
  z-index: 20;
}

.welcome-slide.d2 {
  transform: translateY(24px) scale(0.9);
  opacity: 1;
  filter: brightness(0.5);
  z-index: 10;
}

.welcome-slide.dback {
  transform: translateY(30px) scale(0.86);
  opacity: 0;
  z-index: 1;
}

/* the swipe-away animation (must win over depth transforms) */
.welcome-slide.swipe {
  transform: translate(88%, 6%) rotate(10deg);
  opacity: 0;
  filter: none;
  z-index: 40;
}

/* snap a card back into the stack without animating across the screen */
.welcome-slide.instant {
  transition: none;
}

.welcome-slide-ph {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(198, 245, 106, 0.16), transparent 55%),
    radial-gradient(120% 80% at 20% 100%, rgba(34, 211, 238, 0.12), transparent 60%),
    linear-gradient(165deg, #1f2a1d 0%, #121a14 45%, #080c0a 100%);
}

/* per-slide tint so placeholders look distinct while real images are absent */
.welcome-slide[data-tint="2"] .welcome-slide-ph {
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(34, 211, 238, 0.18), transparent 55%),
    radial-gradient(120% 80% at 80% 100%, rgba(198, 245, 106, 0.1), transparent 60%),
    linear-gradient(165deg, #16262a 0%, #0e181b 45%, #070c0d 100%);
}

.welcome-slide[data-tint="3"] .welcome-slide-ph {
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255, 176, 89, 0.18), transparent 55%),
    radial-gradient(120% 80% at 20% 100%, rgba(198, 245, 106, 0.1), transparent 60%),
    linear-gradient(165deg, #2a2318 0%, #1a140d 45%, #0c0806 100%);
}

.welcome-slide[data-tint="4"] .welcome-slide-ph {
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(198, 245, 106, 0.2), transparent 55%),
    radial-gradient(120% 80% at 80% 100%, rgba(34, 211, 238, 0.1), transparent 60%),
    linear-gradient(165deg, #1c2a1d 0%, #101a12 45%, #070c09 100%);
}

.welcome-slide[data-tint="5"] .welcome-slide-ph {
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(178, 129, 255, 0.18), transparent 55%),
    radial-gradient(120% 80% at 20% 100%, rgba(34, 211, 238, 0.1), transparent 60%),
    linear-gradient(165deg, #201a2b 0%, #14101b 45%, #08060c 100%);
}

.welcome-slide[data-tint="6"] .welcome-slide-ph {
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255, 107, 149, 0.18), transparent 55%),
    radial-gradient(120% 80% at 80% 100%, rgba(198, 245, 106, 0.1), transparent 60%),
    linear-gradient(165deg, #2a1820 0%, #1a0f15 45%, #0c060a 100%);
}

.welcome-slide-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.welcome-slide-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, 0.55) 100%);
}

.welcome-caption {
  position: absolute;
  left: 50%;
  bottom: 13%;
  transform: translateX(-50%);
  width: 86%;
  text-align: center;
  z-index: 2;
  pointer-events: none;
}

/* Slideshow page dots — Apple-tight, lime active pill */
.welcome-pager {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: auto;
}

.welcome-pager-dot {
  width: 6px;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.38);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    width 0.4s cubic-bezier(0.22, 0.61, 0.36, 1),
    background 0.35s ease,
    opacity 0.35s ease;
}

.welcome-pager-dot:hover {
  background: rgba(255, 255, 255, 0.55);
}

.welcome-pager-dot.is-active {
  width: 18px;
  background: var(--lime);
}

.welcome-pager-dot:focus-visible {
  outline: 1.5px solid var(--lime);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .welcome-pager-dot {
    transition: none;
  }
}

/* Reduced motion: no fly-away/scale — quiet crossfade only. */
@media (prefers-reduced-motion: reduce) {
  .welcome-slide {
    transition: opacity 0.4s ease;
  }

  .welcome-slide.d0,
  .welcome-slide.d1,
  .welcome-slide.d2 {
    transform: none;
    filter: none;
    opacity: 1;
  }

  .welcome-slide.d1,
  .welcome-slide.d2,
  .welcome-slide.dback {
    opacity: 0;
  }

  .welcome-slide.swipe {
    transform: none;
    opacity: 0;
  }
}

.welcome-caption span {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.4rem, 2vw, 1.9rem);
  line-height: 1.15;
  color: #fff;
  letter-spacing: -0.01em;
  text-shadow:
    2px 0 0 #000, -2px 0 0 #000, 0 2px 0 #000, 0 -2px 0 #000,
    2px 2px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
}

.welcome-caption .hl {
  color: var(--lime);
  font-size: 1.16em;
}

@media (max-width: 900px) {
  .welcome-inner {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .welcome-phone {
    max-width: 260px;
  }
}

@media (max-width: 560px) {
  .welcome {
    min-height: 0;
  }

  .welcome-phone {
    max-width: 230px;
  }

  .welcome-features li {
    font-size: 0.78rem;
    padding: 0.45rem 0.7rem;
  }
}

.player-wrap {
  display: grid;
  gap: 1rem;
  animation: rise 0.45s ease both;
}

.phone {
  position: relative;
  width: min(100%, 380px);
  margin: 0 auto;
  aspect-ratio: 9 / 16;
  border-radius: 28px;
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.phone video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

.caption-layer {
  position: absolute;
  left: 50%;
  top: 88%;
  transform: translate(-50%, -100%);
  max-width: 84%;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
  pointer-events: none;
  transition: opacity 0.12s ease;
  white-space: pre-wrap;
  word-break: break-word;
}

.caption-layer:empty {
  opacity: 0;
}

/* ---- premium processing overlay ---- */
.processing {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 15%, rgba(198, 245, 106, 0.08), transparent 55%),
    linear-gradient(180deg, rgba(6, 10, 8, 0.72), rgba(6, 10, 8, 0.92));
  backdrop-filter: blur(3px);
  animation: fade 0.3s ease both;
}

.proc-glow {
  position: absolute;
  width: 130%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    conic-gradient(
      from 0deg,
      rgba(198, 245, 106, 0.0),
      rgba(198, 245, 106, 0.35),
      rgba(34, 211, 238, 0.25),
      rgba(198, 245, 106, 0.0)
    );
  filter: blur(48px);
  opacity: 0.55;
  animation: spin 6s linear infinite;
}

.proc-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  padding: 0 1.5rem;
}

.proc-ring {
  --p: 0;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(closest-side, #0b100e 78%, transparent 79% 100%),
    conic-gradient(
      var(--lime) calc(var(--p) * 1%),
      rgba(255, 255, 255, 0.1) 0
    );
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 0 40px rgba(198, 245, 106, 0.28);
  transition: --p 0.5s ease;
}

/* animatable custom prop for the ring fill */
@property --p {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}

.proc-center {
  width: 78%;
  height: 78%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(closest-side, #0d130f, #080b09);
}

.proc-pct {
  display: flex;
  align-items: baseline;
  font-family: var(--font-display);
  color: #fff;
  letter-spacing: -0.03em;
}

.proc-pct b {
  font-size: 2.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.proc-pct i {
  font-size: 1.1rem;
  font-style: normal;
  color: var(--lime);
  margin-left: 2px;
}

.proc-step {
  margin: 0.5rem 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
  letter-spacing: -0.01em;
}

.proc-sub {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  min-height: 1.1em;
}

.proc-sub::after {
  content: "";
  animation: dots 1.4s steps(4, end) infinite;
}

@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- premium export modal (reuses .proc-* ring/glow) ---- */
.export-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  animation: fade 0.25s ease both;
}

.export-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 5, 0.72);
  backdrop-filter: blur(6px);
}

.export-card {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: min(90vw, 400px);
  padding: 3rem 2rem 2.5rem;
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 15%, rgba(198, 245, 106, 0.08), transparent 55%),
    linear-gradient(180deg, rgba(12, 18, 14, 0.92), rgba(8, 12, 9, 0.97));
  border: 1px solid var(--hairline-strong);
  box-shadow: var(--shadow);
  animation: rise 0.35s ease both;
}

.export-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 2;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.2s ease;
}

.export-close:hover {
  border-color: var(--hairline-strong);
  background: var(--surface-3);
  transform: rotate(90deg);
}

.export-actions {
  margin-top: 1.35rem;
}

.primary.lg {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.85rem 1.7rem;
  font-size: 0.95rem;
  text-decoration: none;
}

/* freeze the animated dots for terminal (done/error) states */
.proc-sub.is-static::after {
  content: none;
  animation: none;
}

.caption-layer .w {
  display: inline-block;
  transition: color 0.1s ease, transform 0.1s ease;
}

.caption-layer.is-draggable {
  pointer-events: auto;
  cursor: grab;
}

.caption-layer.is-draggable.dragging {
  cursor: grabbing;
}

.player-meta {
  text-align: center;
}

.player-meta p {
  margin: 0.2rem 0;
}

.job-state {
  color: var(--muted);
  font-size: 0.9rem;
}

.job-state.error {
  color: var(--danger);
}

.rail {
  border-left: 1px solid var(--line);
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  animation: rise 0.5s ease 0.05s both;
}

.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.tabs {
  display: flex;
  gap: 2px;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 11px;
  padding: 3px;
}

.tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 550;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}

.tab:hover {
  color: var(--ink);
}

.tab.is-active {
  background: var(--surface-3);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: min(72vh, 760px);
  padding: 2px 10px 8px 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--hairline-strong) transparent;
  overscroll-behavior: contain;
}

.tab-panel::-webkit-scrollbar {
  width: 8px;
}

.tab-panel::-webkit-scrollbar-thumb {
  background: var(--hairline-strong);
  border-radius: 999px;
}

.tab-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

.tab-panel.is-active {
  display: flex;
  animation: fade 0.22s ease both;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

.hint {
  margin: 0;
  color: var(--faint);
  font-size: 0.8rem;
  letter-spacing: 0;
}

/* ---- preset cards (compact square-tile grid) ---- */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.preset-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  background: var(--surface-1);
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  font: inherit;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.preset-card:hover {
  background: var(--surface-2);
  border-color: var(--hairline-strong);
  transform: translateY(-1px);
}

.preset-card.is-active {
  border-color: var(--lime);
  background: rgba(198, 245, 106, 0.07);
}

.pc-swatch {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: -0.02em;
  overflow: hidden;
  border: 1px solid var(--hairline);
  background:
    radial-gradient(120% 120% at 30% 10%, rgba(255, 255, 255, 0.08), transparent 60%),
    #05070500,
    linear-gradient(160deg, #1c241a, #0a0f0c);
}

.pc-swatch span {
  display: inline-block;
}

.pc-body {
  min-width: 0;
}

.preset-card .pc-name {
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset-card .pc-desc {
  color: var(--faint);
  font-size: 0.7rem;
  margin-top: 0.1rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pc-check {
  display: none;
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--lime);
  color: var(--accent-ink);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

.preset-card.is-active .pc-check {
  display: block;
}

/* ---- selection row ---- */
.field-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
}

.sel-label {
  color: var(--faint);
  font-size: 0.75rem;
}

.sel-value {
  font-size: 0.82rem;
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ghost.sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
  flex: none;
}

/* ---- control group card ---- */
.controls {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
}

.ctl {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.82rem;
  color: var(--ink);
  padding: 0.8rem 0.85rem;
  border-bottom: 1px solid var(--hairline);
}

.ctl:last-child {
  border-bottom: none;
}

.ctl > span {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-weight: 500;
}

.ctl b {
  color: var(--accent-ink);
  background: var(--lime);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
}

.ctl.inline {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

/* native slider, high-contrast accent (filled track + thumb) */
.ctl input[type="range"] {
  width: 100%;
  height: 22px;
  accent-color: var(--lime);
  cursor: pointer;
}

/* color swatch */
.ctl input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 0 0 2px var(--hairline-strong), inset 0 0 0 2px rgba(0, 0, 0, 0.35);
}

.ctl input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.ctl input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

.toggles {
  display: flex;
  gap: 0.5rem;
  padding: 0.7rem 0.8rem;
}

.chk {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--ink);
  cursor: pointer;
  flex: 1;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--surface-1);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.chk:hover {
  border-color: var(--hairline-strong);
}

.chk input {
  accent-color: var(--lime);
}

/* word emphasis chips */
.word-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip {
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 0.3rem 0.55rem;
  font-size: 0.8rem;
  background: var(--surface-1);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.14s ease;
}

.chip:hover {
  border-color: var(--hairline-strong);
}

.chip.on {
  border-color: transparent;
  background: var(--lime);
  color: var(--accent-ink);
  font-weight: 600;
}

/* ---- placement anchor picker ---- */
.anchor-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 0;
  width: 132px;
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  padding: 8px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.05), transparent 60%),
    #0b100e;
  border: 1px solid var(--hairline-strong);
  border-radius: 16px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4), var(--shadow-sm);
}

.anchor-grid button {
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
  border-radius: 6px;
  transition: background 0.14s ease;
}

.anchor-grid button::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  transition: all 0.14s ease;
}

.anchor-grid button:hover::after {
  background: rgba(255, 255, 255, 0.6);
}

.anchor-grid button.is-active::after {
  width: 12px;
  height: 12px;
  background: var(--lime);
  box-shadow: 0 0 0 5px rgba(198, 245, 106, 0.18),
    0 0 14px rgba(198, 245, 106, 0.5);
}

.pos-readout {
  margin: 0;
  font-size: 0.78rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  text-align: center;
  letter-spacing: 0.02em;
}

.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
}

.ghost:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ghost:not(:disabled):hover {
  border-color: var(--lime-dim);
  color: var(--lime);
}

.head-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.primary {
  border: none;
  background: var(--lime);
  color: var(--accent-ink);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.primary:hover {
  background: #d7ff86;
  transform: translateY(-1px);
}

.primary:disabled {
  opacity: 0.5;
  cursor: progress;
  transform: none;
}

.segments {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.seg {
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 0.6rem 0.7rem;
  background: var(--surface-1);
  transition: border-color 0.14s ease, background 0.14s ease;
  cursor: pointer;
}

.seg:hover {
  border-color: var(--hairline-strong);
}

.seg.selected {
  border-color: var(--lime);
  background: rgba(198, 245, 106, 0.06);
}

.seg.active {
  border-color: rgba(198, 245, 106, 0.4);
}

.seg time {
  display: block;
  font-size: 0.7rem;
  color: var(--faint);
  margin-bottom: 0.3rem;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.seg textarea {
  width: 100%;
  resize: vertical;
  min-height: 2.6rem;
  background: transparent;
  border: none;
  color: var(--ink);
  font: inherit;
  line-height: 1.35;
  outline: none;
}

.json-box {
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
  margin-top: auto;
}

.json-box summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
}

.json-box pre {
  margin: 0.6rem 0 0;
  max-height: 220px;
  overflow: auto;
  font-size: 0.72rem;
  line-height: 1.4;
  color: #b7c9b4;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  padding: 0.75rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  background: #1c2a20;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 0.9rem;
}

.is-hidden {
  display: none !important;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .rail {
    border-left: none;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 1.25rem;
  }

  .drop {
    min-height: 420px;
  }
}
