:root {
  --bg0: #071018;
  --bg1: #0c1824;
  --bg2: #122333;
  --line: rgba(180, 220, 255, 0.12);
  --text: #e8f1f8;
  --muted: #8aa0b5;
  --accent: #2fe0c5;
  --accent-2: #ff7a45;
  --danger: #ff5d6c;
  --ok: #3dd68c;
  --glow: rgba(47, 224, 197, 0.25);
  --radius: 18px;
  --font-display: "Syne", "Noto Sans SC", sans-serif;
  --font-body: "IBM Plex Sans", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(47, 224, 197, 0.16), transparent 55%),
    radial-gradient(900px 600px at -10% 30%, rgba(255, 122, 69, 0.12), transparent 50%),
    linear-gradient(165deg, var(--bg0), var(--bg1) 45%, #0a141f);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 35%, transparent 80%);
  opacity: 0.5;
  z-index: 0;
}

a { color: var(--accent); text-decoration: none; }
img, video { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }

.shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 36px;
  animation: rise 0.7s ease both;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.brand-mark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: 0.04em;
  background: linear-gradient(120deg, #fff 20%, var(--accent) 70%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-sub {
  color: var(--muted);
  font-size: 0.92rem;
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.ghost-link {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: 0.2s ease;
}
.ghost-link:hover {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255,255,255,0.03);
}

.hero-line {
  margin: 0 0 28px;
  animation: rise 0.8s ease 0.05s both;
}
.hero-line h1 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.2vw, 2.15rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.25;
}
.hero-line p {
  margin: 0;
  color: var(--muted);
  max-width: 42rem;
  line-height: 1.65;
}

.workspace {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 22px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(18, 35, 51, 0.88), rgba(10, 20, 31, 0.92));
  backdrop-filter: blur(10px);
  padding: 22px;
  animation: rise 0.85s ease 0.1s both;
}

.panel h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.panel .hint {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(0,0,0,0.28);
  border: 1px solid var(--line);
}

.tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 12px 10px;
  border-radius: 11px;
  cursor: pointer;
  transition: 0.25s ease;
  font-weight: 560;
}
.tab.active {
  color: var(--bg0);
  background: linear-gradient(120deg, var(--accent), #7af0df);
  box-shadow: 0 8px 24px var(--glow);
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.86rem;
  color: var(--muted);
}
.field .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

input[type="text"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.28);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
input:focus, textarea:focus, select:focus {
  border-color: rgba(47, 224, 197, 0.55);
  box-shadow: 0 0 0 3px rgba(47, 224, 197, 0.12);
}

.dropzone {
  position: relative;
  border: 1.5px dashed rgba(47, 224, 197, 0.35);
  border-radius: 14px;
  min-height: 160px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
  cursor: pointer;
  overflow: hidden;
  background:
    radial-gradient(400px 160px at 50% 0%, rgba(47,224,197,0.08), transparent),
    rgba(0,0,0,0.2);
  transition: 0.25s ease;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: rgba(47, 224, 197, 0.08);
}
.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.dropzone .dz-title { font-weight: 600; margin-bottom: 4px; }
.dropzone .dz-sub { color: var(--muted); font-size: 0.85rem; }
.dropzone .preview {
  position: absolute;
  inset: 0;
  object-fit: cover;
  width: 100%;
  height: 100%;
}
.dropzone.has-image .dz-copy { display: none; }
.dropzone .clear-img {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  border: 0;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  cursor: pointer;
  display: none;
}
.dropzone.has-image .clear-img { display: inline-flex; }

.hidden { display: none !important; }

.actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 13px 20px;
  cursor: pointer;
  font-weight: 650;
  letter-spacing: 0.02em;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  color: #04131a;
  background: linear-gradient(120deg, var(--accent), #9af7e8 55%, #ffe0c2);
  box-shadow: 0 10px 30px var(--glow);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 14px 36px rgba(47, 224, 197, 0.35);
}

.btn-secondary {
  color: var(--text);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
}

.status-line {
  margin-top: 14px;
  min-height: 1.4em;
  color: var(--muted);
  font-size: 0.9rem;
}
.status-line.error { color: var(--danger); }
.status-line.ok { color: var(--ok); }

.progress {
  margin-top: 12px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
  display: none;
}
.progress.show { display: block; }
.progress > span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 0.35s ease;
}

.result-box {
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  min-height: 240px;
  display: grid;
  place-items: center;
  position: relative;
}
.result-box .placeholder {
  color: var(--muted);
  text-align: center;
  padding: 24px;
  line-height: 1.6;
}
.result-box video {
  width: 100%;
  max-height: 420px;
  background: #000;
}

.result-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  flex-wrap: wrap;
}
.result-meta .tag {
  font-size: 0.8rem;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 999px;
}

.history {
  margin-top: 28px;
  animation: rise 0.9s ease 0.15s both;
}
.history h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0 0 14px;
}
.history-list {
  display: grid;
  gap: 10px;
}
.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(8, 16, 26, 0.55);
  cursor: pointer;
  transition: 0.2s ease;
}
.history-item:hover {
  border-color: rgba(47, 224, 197, 0.35);
  transform: translateY(-1px);
}
.history-item .title {
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.history-item .meta {
  color: var(--muted);
  font-size: 0.8rem;
}
.badge {
  font-size: 0.75rem;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.badge.ok { color: var(--ok); border-color: rgba(61, 214, 140, 0.35); }
.badge.fail { color: var(--danger); border-color: rgba(255, 93, 108, 0.35); }
.badge.run { color: var(--accent); border-color: rgba(47, 224, 197, 0.35); }

.admin-wrap {
  width: min(760px, calc(100% - 32px));
  margin: 40px auto;
}
.admin-wrap pre {
  overflow: auto;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  font-size: 0.85rem;
  line-height: 1.5;
}

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

@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; }
  .field .row { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .brand { flex-direction: column; gap: 2px; }
}
