/* ui-ux-pro-max: Dark Mode (OLED) + JetBrains Mono / IBM Plex Sans + run green.
   FAQ/documentation landing was a mismatch for this one-task tool, so the
   create → preview → library flow stays. Motion is a short CSS enter
   (y 12px) instead of GSAP ScrollTrigger. ponytail: upgrade if a later
   page needs scroll-linked motion. */

html.dark {
  color-scheme: dark;
  --color-primary: #1e293b;
  --color-on-primary: #ffffff;
  --color-secondary: #334155;
  --color-accent: #22c55e;
  --color-on-accent: #0f172a;
  --color-background: #0f172a;
  --color-foreground: #f8fafc;
  --color-card: #1b2336;
  --color-muted: #272f42;
  --color-muted-foreground: #94a3b8;
  --color-border: #475569;
  --color-destructive: #ef4444;
  --color-ring: #ffffff;
  --font-body: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-display: "JetBrains Mono", ui-monospace, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-enter: 360ms;
  --dur-state: 180ms;
}

html.dark body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-foreground);
  background-color: var(--color-background);
  background-image:
    radial-gradient(680px 280px at 88% -8%, rgba(34, 197, 94, 0.14), transparent 62%),
    radial-gradient(520px 260px at -8% 0%, rgba(51, 65, 85, 0.55), transparent 58%);
}

html.dark ::selection {
  background: rgba(34, 197, 94, 0.35);
}

html.dark :focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 3px;
}

html.dark button,
html.dark a,
html.dark [role="button"] {
  cursor: pointer;
}

html.dark button:disabled {
  cursor: not-allowed;
}

html.dark div.max-w-3xl {
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

html.dark div.max-w-3xl:has(form) {
  max-width: 72rem;
}

html.dark div.max-w-3xl:not(:has(form)) {
  max-width: 40rem;
}

@media (min-width: 768px) {
  html.dark div.max-w-3xl:has(form) {
    padding-left: max(40px, env(safe-area-inset-left));
    padding-right: max(40px, env(safe-area-inset-right));
  }
}

html.dark header.h-14 {
  position: sticky;
  top: 0;
  z-index: 20;
  height: auto;
  min-height: 64px;
  margin-left: -20px;
  margin-right: -20px;
  padding: env(safe-area-inset-top) 20px 0;
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid rgba(71, 85, 105, 0.65);
  backdrop-filter: blur(16px);
}

@media (min-width: 768px) {
  html.dark div.max-w-3xl:has(form) > header.h-14 {
    margin-left: -40px;
    margin-right: -40px;
    padding-left: 40px;
    padding-right: 40px;
  }
}

html.dark header a {
  min-height: 44px;
  padding: 4px 2px;
}

html.dark header span.bg-sky-400 {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background-color: var(--color-accent);
  color: var(--color-on-accent);
}

html.dark header .font-semibold {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

html.dark main > section:first-of-type {
  padding-top: 36px;
  padding-bottom: 8px;
}

html.dark main > section:first-of-type > p:first-child {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin: 0;
  padding: 6px 12px;
  border: 1px solid rgba(34, 197, 94, 0.4);
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

html.dark main > section:first-of-type h1 {
  max-width: 16ch;
  margin-top: 20px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.2vw, 3.15rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.15;
  color: var(--color-foreground);
}

html.dark main > section:first-of-type > p:last-child {
  max-width: 42ch;
  margin-top: 16px;
  color: #cbd5e1;
  font-size: 1.0625rem;
  line-height: 1.65;
}

html.dark form.rounded-3xl,
html.dark [data-testid="spark-result"],
html.dark main.py-8 > .rounded-3xl,
html.dark main.py-10 > .rounded-3xl {
  border-color: rgba(71, 85, 105, 0.9);
  border-radius: 20px;
  background-color: var(--color-card);
  box-shadow:
    0 0 0 1px rgba(34, 197, 94, 0.06),
    0 24px 48px -32px rgba(0, 0, 0, 0.85);
}

html.dark form.rounded-3xl {
  padding: 20px;
}

@media (min-width: 640px) {
  html.dark form.rounded-3xl {
    padding: 28px;
  }
}

html.dark form label {
  margin-bottom: 8px;
  color: var(--color-foreground);
  font-size: 14px;
  font-weight: 500;
}

html.dark form label span {
  color: var(--color-muted-foreground);
}

html.dark form .space-y-4 > :not([hidden]) ~ :not([hidden]) {
  margin-top: 20px;
}

html.dark form input {
  min-height: 48px;
  border-color: var(--color-border);
  border-radius: 12px;
  background-color: var(--color-muted);
  color: var(--color-foreground);
  font-size: 16px;
  transition:
    border-color var(--dur-state) var(--ease-out),
    box-shadow var(--dur-state) var(--ease-out);
}

html.dark form input::placeholder {
  color: var(--color-muted-foreground);
}

html.dark form input:focus-visible {
  border-color: var(--color-accent);
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
}

html.dark form svg {
  color: var(--color-muted-foreground);
}

html.dark #spark-error {
  border-color: rgba(252, 165, 165, 0.5);
  background: rgba(239, 68, 68, 0.14);
  color: #fecaca;
}

html.dark #spark-error:focus {
  outline: 2px solid var(--color-ring);
  outline-offset: 3px;
}

html.dark .bg-sky-400 {
  background-color: var(--color-accent);
  color: var(--color-on-accent);
}

html.dark .hover\:bg-sky-300:hover,
html.dark button.bg-sky-400:hover,
html.dark a.bg-sky-400:hover {
  background-color: #4ade80;
}

html.dark button.bg-white {
  background-color: var(--color-accent);
  color: var(--color-on-accent);
}

html.dark button.bg-white:hover,
html.dark .hover\:bg-zinc-200:hover {
  background-color: #4ade80;
}

html.dark button.bg-sky-400,
html.dark a.bg-sky-400,
html.dark button.bg-white,
html.dark button.border {
  min-height: 48px;
  border-radius: 12px;
  transition:
    background-color var(--dur-state) var(--ease-out),
    border-color var(--dur-state) var(--ease-out),
    transform var(--dur-state) var(--ease-out);
}

html.dark button.border {
  border-color: var(--color-border);
  color: var(--color-foreground);
}

html.dark button.border:hover {
  border-color: #94a3b8;
  background-color: rgba(255, 255, 255, 0.06);
}

html.dark button:active {
  transform: scale(0.98);
}

@media (min-width: 1024px) {
  html.dark main.flex-1:has(> form) {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    column-gap: 48px;
    align-items: center;
  }

  html.dark main.flex-1:has(> form) > section:first-of-type {
    grid-column: 1;
    grid-row: 1;
    padding-top: 28px;
    padding-bottom: 28px;
  }

  html.dark main.flex-1:has(> form) > form {
    grid-column: 2;
    grid-row: 1;
  }

  html.dark main.flex-1:has(> form) > [data-testid="spark-result"] {
    grid-column: 2;
    grid-row: 2;
    align-self: start;
    margin-top: 16px;
  }

  html.dark main.flex-1:has(> form) > p,
  html.dark main.flex-1:has(> form) > section[aria-labelledby="library-heading"],
  html.dark main.flex-1:has(> form) > footer {
    grid-column: 1 / -1;
  }
}

html.dark [data-testid="spark-result"] {
  margin-top: 20px;
}

html.dark [data-testid="spark-result"] .text-sky-300 {
  color: #86efac;
  font-family: var(--font-display);
  letter-spacing: 0.08em;
}

html.dark [data-testid="spark-link"],
html.dark .font-mono {
  font-family: var(--font-display);
}

html.dark [data-testid="spark-link"] {
  border-radius: 12px;
  background-color: var(--color-muted);
  color: #bbf7d0;
  font-size: 13px;
}

html.dark [data-testid="spark-result"] .mt-4 {
  flex-wrap: wrap;
}

html.dark [data-testid="spark-result"] .mt-4 > button {
  flex: 1 1 auto;
  justify-content: center;
  white-space: nowrap;
}

html.dark section[aria-labelledby="library-heading"] {
  margin-top: 56px;
}

html.dark #library-heading {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

html.dark section[aria-labelledby="library-heading"] > div {
  justify-content: flex-start;
  gap: 12px;
}

html.dark section[aria-labelledby="library-heading"] > div > p {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--color-muted);
  color: var(--color-muted-foreground);
  font-family: var(--font-display);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

html.dark section[aria-labelledby="library-heading"] .border-dashed {
  border-color: rgba(71, 85, 105, 0.95);
  border-radius: 16px;
  background: rgba(27, 35, 54, 0.65);
  color: #cbd5e1;
  line-height: 1.6;
}

html.dark section[aria-labelledby="library-heading"] > .border-dashed {
  padding: 28px 20px;
  text-align: center;
}

html.dark section[aria-labelledby="library-heading"] > .border-dashed::before {
  content: "";
  display: block;
  width: 40px;
  height: 40px;
  margin: 0 auto 14px;
  border-radius: 12px;
  background-color: rgba(34, 197, 94, 0.12);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2322C55E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13 2 3 14h9l-1 8 10-12h-9l1-8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

@media (min-width: 640px) {
  html.dark section[aria-labelledby="library-heading"] > .border-dashed {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 28px;
    text-align: left;
  }

  html.dark section[aria-labelledby="library-heading"] > .border-dashed::before {
    margin: 0;
    flex-shrink: 0;
  }
}

html.dark section[aria-labelledby="library-heading"] > p {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  color: var(--color-muted-foreground);
}

html.dark section[aria-labelledby="library-heading"] > p::before {
  content: "";
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 2px solid rgba(148, 163, 184, 0.35);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spark-spin 0.7s linear infinite;
}

html.dark section[aria-labelledby="library-heading"] li {
  border-color: rgba(71, 85, 105, 0.9);
  border-radius: 16px;
  background-color: var(--color-card);
  transition: border-color var(--dur-state) var(--ease-out);
}

html.dark section[aria-labelledby="library-heading"] li:hover {
  border-color: rgba(34, 197, 94, 0.5);
}

html.dark section[aria-labelledby="library-heading"] .text-xs {
  font-size: 13px;
  color: var(--color-muted-foreground);
}

html.dark section[aria-labelledby="library-heading"] .gap-1 {
  gap: 8px;
}

html.dark p[role="status"] {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(253, 230, 138, 0.4);
  border-radius: 12px;
  background: rgba(253, 230, 138, 0.08);
  color: #fde68a;
}

html.dark [data-testid="leaving"] {
  display: flex;
  width: fit-content;
  margin-top: 28px;
  padding: 6px 12px;
  border: 1px solid rgba(34, 197, 94, 0.4);
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

html.dark main.py-8 p.text-rose-300 {
  display: flex;
  width: fit-content;
  margin-top: 28px;
  padding: 6px 12px;
  border: 1px solid rgba(252, 165, 165, 0.5);
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.14);
  color: #fecaca;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
}

html.dark main.py-8 h1,
html.dark main.py-10 h1,
html.dark main.max-w-lg h1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

html.dark main.py-8 > .rounded-3xl > button:first-child {
  display: flex;
  width: fit-content;
  min-height: 44px;
  margin-left: -4px;
  padding: 8px 4px;
}

html.dark main.max-w-lg > p:first-child {
  display: inline-flex;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
  font-family: var(--font-display);
  letter-spacing: 0.08em;
}

html.dark footer {
  max-width: 68ch;
  margin-top: 48px;
  color: var(--color-muted-foreground);
  font-size: 14px;
  line-height: 1.6;
}

html.dark ::-webkit-scrollbar-thumb {
  background: #475569;
}

@media (prefers-reduced-motion: no-preference) {
  html.dark main > section:first-of-type,
  html.dark main > form {
    animation: spark-enter var(--dur-enter) var(--ease-out) both;
  }

  html.dark main > form {
    animation-delay: 60ms;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.dark section[aria-labelledby="library-heading"] > p::before {
    animation: none;
  }
}

@keyframes spark-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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