:root {
  /* Light theme (default) */
  --bg-0: #f7f7fb;
  --bg-1: #ffffff;
  --bg-2: #eef0f7;
  --surface: rgba(255, 255, 255, 0.7);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --border: rgba(15, 18, 40, 0.08);
  --border-strong: rgba(15, 18, 40, 0.16);
  --text: #14162a;
  --muted: #5b607a;
  --muted-2: #8a8fa6;
  --accent-1: #6d4dff;
  --accent-2: #ec4899;
  --accent-3: #06b6d4;
  --danger: #dc2626;
  --success: #16a34a;
  --input-bg: #ffffff;
  --input-bg-focus: #ffffff;
  --blob-opacity: 0.35;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-lg: 0 2px 7px rgba(15, 18, 40, 0.06);
  --shadow-glow: 0 0 0 1px rgba(109, 77, 255, 0.25), 0 6px 18px rgba(109, 77, 255, 0.12);
}

[data-theme="dark"] {
  --bg-0: #07070d;
  --bg-1: #0d0b1a;
  --bg-2: #14122a;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-strong: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f5fa;
  --muted: #9aa0b4;
  --muted-2: #6b7088;
  --accent-1: #7c5cff;
  --accent-2: #ff5cb3;
  --accent-3: #5cd4ff;
  --danger: #ff6b6b;
  --success: #4ade80;
  --input-bg: rgba(0, 0, 0, 0.25);
  --input-bg-focus: rgba(0, 0, 0, 0.35);
  --blob-opacity: 0.55;
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.30);
  --shadow-glow: 0 0 0 1px rgba(124, 92, 255, 0.30), 0 6px 18px rgba(124, 92, 255, 0.18);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--text);
  background: var(--bg-0);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
  opacity: var(--blob-opacity);
}

body::before {
  top: -180px;
  left: -120px;
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, var(--accent-1) 0%, transparent 60%);
}

body::after {
  bottom: -200px;
  right: -120px;
  width: 560px;
  height: 560px;
  background: radial-gradient(circle, var(--accent-2) 0%, transparent 60%);
}

.container {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 64px;
}

.content-narrow {
  max-width: 760px;
  margin: 0 auto;
}

.embed-frame {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color-scheme: light dark;
}

.embed-snippet {
  margin-top: 28px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  color: var(--muted);
}

.embed-snippet h3 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
}

.embed-snippet pre {
  margin: 8px 0 0;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre;
}

[data-theme="dark"] .embed-snippet pre { background: rgba(0, 0, 0, 0.35); }

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  display: grid;
  place-items: center;
  box-shadow: 0 1px 3px rgba(124, 92, 255, 0.45);
}

.brand-mark svg { width: 18px; height: 18px; color: #fff; }

.nav-links {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.nav-link.active {
  color: var(--text);
  background: var(--surface-strong);
  border-color: var(--border-strong);
}

.hero {
  text-align: center;
  margin: 24px 0 40px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.15);
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-weight: 700;
}

h1 .grad {
  background: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 60%, var(--accent-3) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  margin: 0 auto;
  max-width: 620px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.card {
  position: relative;
  background: linear-gradient(180deg, var(--surface-strong) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.card.tile {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.card.tile h2,
.card.tile .help { text-decoration: none; }

.card.tile:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-glow);
}

.card .icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.25), rgba(255, 92, 179, 0.25));
  border: 1px solid var(--border-strong);
}

.card .icon-wrap svg { width: 22px; height: 22px; color: var(--text); }

.card h2 {
  margin: 0 0 8px;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.card .help {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.card .arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-3);
  font-weight: 500;
  font-size: 14px;
}

.card.tile:hover .arrow { gap: 10px; }
.card .arrow svg { width: 16px; height: 16px; transition: transform 0.2s ease; }
.card.tile:hover .arrow svg { transform: translateX(3px); }

label {
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 500;
}

input[type="text"],
input[type="file"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-1);
  box-shadow: 0 0 0 4px rgba(109, 77, 255, 0.18);
  background: var(--input-bg-focus);
}

textarea {
  min-height: 130px;
  resize: vertical;
  line-height: 1.55;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235b607a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

[data-theme="dark"] select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa0b4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
}

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

button, .btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 100%);
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: -0.005em;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 8px 24px rgba(109, 77, 255, 0.30);
}

button:hover, .btn:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(109, 77, 255, 0.40); }
button:active, .btn:active { transform: translateY(0); }
button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

button.secondary {
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  color: var(--text);
  box-shadow: none;
}

button.secondary:hover {
  background: var(--surface);
  border-color: var(--border-strong);
  box-shadow: none;
}

button svg { width: 16px; height: 16px; }

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

button.loading .spinner { display: inline-block; }
button.loading .label { opacity: 0.85; }

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

.status {
  min-height: 22px;
  font-size: 13px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.status svg { width: 14px; height: 14px; flex-shrink: 0; }
.status.error { color: var(--danger); }
.status.ok { color: var(--success); }

.dropzone {
  position: relative;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
  margin-bottom: 16px;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent-1);
  background: rgba(109, 77, 255, 0.08);
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  margin: 0;
  padding: 0;
  border: 0;
}

.dropzone .dz-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.25), rgba(92, 212, 255, 0.25));
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
}

.dropzone .dz-icon svg { width: 22px; height: 22px; color: var(--text); }
.dropzone .dz-title { font-weight: 600; margin-bottom: 4px; }
.dropzone .dz-help { color: var(--muted); font-size: 13px; }

.preview-frame {
  margin-top: 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 8px;
  display: none;
}

.preview-frame.show { display: block; }

.preview-frame img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  max-height: 520px;
  object-fit: contain;
  background: #000;
}

.section-title {
  margin: 24px 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  font-weight: 600;
}

.empty-state {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  background: var(--surface);
}

.empty-state svg { width: 28px; height: 28px; margin-bottom: 8px; color: var(--muted-2); }

.footer {
  margin-top: 48px;
  text-align: center;
  color: var(--muted-2);
  font-size: 12px;
}

.theme-toggle {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  margin-left: 4px;
}

.theme-toggle:hover {
  background: var(--surface-strong);
  border-color: var(--border-strong);
  transform: none;
  box-shadow: none;
}

.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: inline-block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline-block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

@media (max-width: 820px) {
  .grid { grid-template-columns: 1fr; }
  .container { padding: 24px 16px 48px; }
  .top-nav { flex-direction: column; gap: 12px; align-items: flex-start; }
}
