:root {
  --bg: #060810;
  --panel: rgba(15, 21, 39, 0.78);
  --panel-strong: #0e1526;
  --line: rgba(148, 170, 255, 0.14);
  --line-strong: rgba(148, 170, 255, 0.26);
  --text: #eef2ff;
  --muted: #93a2c4;
  --accent: #7c8cff;
  --accent-2: #33d6c0;
  --accent-soft: rgba(124, 140, 255, 0.14);
  --danger: #ff7a90;
  --warn: #ffc46b;
  --ok: #4ade9b;
  --radius: 18px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
  color: #c9d6ff;
  background: rgba(124, 140, 255, 0.12);
  padding: 1px 5px;
  border-radius: 5px;
}

.export-fallback {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding: 9px 11px;
  border: 1px dashed rgba(124, 140, 255, 0.32);
  border-radius: 10px;
  background: rgba(124, 140, 255, 0.06);
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.mini {
  font-size: 0.78rem;
}

/* ---------- 背景 ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(1100px 600px at 12% -10%, rgba(74, 58, 175, 0.32), transparent 60%),
    radial-gradient(900px 600px at 95% 0%, rgba(18, 111, 120, 0.18), transparent 55%),
    radial-gradient(900px 700px at 50% 110%, rgba(44, 48, 120, 0.25), transparent 60%),
    var(--bg);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  animation: float 16s ease-in-out infinite;
}

.orb-a {
  width: 380px;
  height: 380px;
  left: -120px;
  top: 18%;
  background: rgba(92, 70, 255, 0.35);
}

.orb-b {
  width: 420px;
  height: 420px;
  right: -160px;
  top: 46%;
  background: rgba(20, 190, 170, 0.2);
  animation-delay: -7s;
}

@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(20px, -28px, 0); }
}

.grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(140, 160, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(140, 160, 255, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 50% 20%, #000 0%, transparent 75%);
}

/* ---------- 顶部 ---------- */

.topbar {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-weight: 800;
  font-size: 1.35rem;
  color: #0a0f1f;
  background: linear-gradient(140deg, #9fb0ff, #47e5cd);
  box-shadow: 0 10px 30px rgba(94, 116, 255, 0.35);
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  letter-spacing: 0.01em;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

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

.pill {
  padding: 5px 11px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: #b9c6ff;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(124, 140, 255, 0.08);
}

/* ---------- 布局 ---------- */

.layout {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 14px 0 40px;
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
  gap: 22px;
  align-items: start;
}

.column {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}

.panel {
  position: relative;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.035), transparent 45%),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.panel-soft {
  background: rgba(12, 17, 32, 0.6);
  box-shadow: none;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.panel-head h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.02em;
  flex: 1;
}

.step {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  font-size: 0.72rem;
  font-weight: 700;
  color: #b7c3ff;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--accent-soft);
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

h2.soft-title {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.hint {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.6;
}

.hint.center {
  text-align: center;
  margin: 12px 0 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ---------- 表单 ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  min-width: 0;
}

.field > span {
  font-size: 0.78rem;
  color: var(--muted);
}

input[type="text"],
input[type="url"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(5, 9, 20, 0.62);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

textarea {
  resize: vertical;
  min-height: 58px;
}

input::placeholder,
textarea::placeholder {
  color: #5c6a8c;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(124, 140, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(124, 140, 255, 0.15);
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #8fa0c8 50%),
    linear-gradient(135deg, #8fa0c8 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 4px 0 14px;
  font-size: 0.82rem;
  color: #c3cdea;
  cursor: pointer;
}

.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.advanced {
  margin: 2px 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  background: rgba(6, 10, 22, 0.38);
}

.advanced summary {
  cursor: pointer;
  padding: 9px 0;
  font-size: 0.8rem;
  color: var(--muted);
  user-select: none;
}

.advanced-body {
  padding: 2px 0 4px;
}

.advanced-body .field:last-child {
  margin-bottom: 8px;
}

/* ---------- 按钮 ---------- */

button,
.ghost,
.primary {
  font: inherit;
}

button {
  cursor: pointer;
}

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 18px;
  border: 0;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.92rem;
  color: #0a1020;
  background: linear-gradient(135deg, #a2b0ff, #45e0c8);
  box-shadow: 0 12px 30px rgba(93, 122, 255, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.primary:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 16px 38px rgba(93, 122, 255, 0.34);
}

.primary:active:not(:disabled) {
  transform: translateY(0);
}

.primary:disabled {
  cursor: not-allowed;
  filter: grayscale(0.6);
  opacity: 0.55;
  box-shadow: none;
}

.primary.small,
.ghost.small {
  width: auto;
  padding: 7px 13px;
  font-size: 0.8rem;
  border-radius: 9px;
}

.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: #cfd9ff;
  background: rgba(124, 140, 255, 0.08);
  text-decoration: none;
  font-size: 0.84rem;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.ghost:hover:not(.disabled) {
  border-color: rgba(124, 140, 255, 0.55);
  background: rgba(124, 140, 255, 0.16);
}

.ghost.danger {
  color: #ffb3c0;
  border-color: rgba(255, 122, 144, 0.35);
  background: rgba(255, 122, 144, 0.08);
}

.ghost.disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: default;
}

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

.row.wrap {
  flex-wrap: wrap;
}

.row.gap {
  gap: 8px;
}

.row.between {
  justify-content: space-between;
}

/* ---------- 上传 ---------- */

.dropzone {
  padding: 26px 18px;
  text-align: center;
  border: 1.5px dashed rgba(140, 160, 235, 0.3);
  border-radius: 14px;
  background: rgba(6, 10, 22, 0.35);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.dropzone:hover,
.dropzone:focus-visible {
  outline: none;
  border-color: rgba(124, 140, 255, 0.7);
  background: rgba(124, 140, 255, 0.08);
}

.dropzone.dragover {
  border-color: var(--accent-2);
  background: rgba(51, 214, 192, 0.09);
  transform: scale(0.995);
}

.dropzone p {
  margin: 0;
  font-size: 0.85rem;
}

.dz-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  color: #bcc8ff;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--accent-soft);
}

.link {
  color: #a9b7ff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.file-meta {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 16, 32, 0.7);
}

.file-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.file-name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
}

.file-info {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
}

.file-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* ---------- 任务面板 ---------- */

.empty {
  padding: 34px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.84rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(7, 11, 22, 0.35);
}

.code-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.code-block {
  min-width: 0;
}

.job-code {
  margin-top: 2px;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1.2;
  background: linear-gradient(100deg, #e7ecff, #9fb2ff 55%, #52e2cc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  word-break: break-all;
}

.badge {
  padding: 5px 11px;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: #c3cfff;
  background: rgba(124, 140, 255, 0.12);
  white-space: nowrap;
}

.badge.status-running {
  color: #a9eee1;
  border-color: rgba(51, 214, 192, 0.4);
  background: rgba(51, 214, 192, 0.12);
}

.badge.status-done {
  color: #0a1f17;
  border-color: transparent;
  background: linear-gradient(120deg, #69f0ba, #45d7de);
}

.badge.status-failed {
  color: #ffc2cc;
  border-color: rgba(255, 122, 144, 0.42);
  background: rgba(255, 122, 144, 0.13);
}

.badge.status-canceled {
  color: #cfd5e6;
  border-color: rgba(180, 190, 210, 0.3);
  background: rgba(160, 170, 195, 0.12);
}

.progress {
  height: 9px;
  margin: 18px 0 7px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(124, 140, 255, 0.12);
  border: 1px solid rgba(124, 140, 255, 0.12);
}

.bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7c8cff, #45e0c8);
  box-shadow: 0 0 18px rgba(80, 220, 210, 0.45);
  transition: width 0.5s ease;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0;
}

.meta-item {
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(7, 11, 23, 0.45);
}

.meta-item span {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
}

.meta-item strong {
  display: block;
  margin-top: 2px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #dce4ff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.error {
  margin: 0 0 14px;
  padding: 11px 13px;
  font-size: 0.8rem;
  line-height: 1.6;
  color: #ffc6cf;
  border: 1px solid rgba(255, 122, 144, 0.35);
  border-radius: 10px;
  background: rgba(255, 122, 144, 0.08);
  word-break: break-word;
}

.downloads {
  margin: 4px 0 16px;
}

.logs {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(4, 7, 16, 0.65);
  overflow: hidden;
}

.logs summary {
  padding: 9px 13px;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--muted);
  user-select: none;
  border-bottom: 1px solid transparent;
}

.logs[open] summary {
  border-bottom-color: var(--line);
}

.logs pre {
  margin: 0;
  padding: 11px 13px;
  max-height: 220px;
  overflow: auto;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.65;
  color: #aab8d8;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- 查询 / 历史 ---------- */

.code-input {
  display: flex;
  gap: 9px;
}

.code-input input {
  flex: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

.code-input .primary {
  width: auto;
  padding: 10px 18px;
  flex: none;
}

.history {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  min-height: 8px;
}

.history:empty {
  margin-top: 0;
}

.history-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(124, 140, 255, 0.07);
  color: #c3cff5;
  font-size: 0.72rem;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.history-chip:hover {
  border-color: rgba(124, 140, 255, 0.5);
  background: rgba(124, 140, 255, 0.16);
}

.history-chip b {
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: #dfe6ff;
}

.history-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
  color: var(--muted);
}

/* ---------- 说明 / 页脚 ---------- */

.tips {
  margin: 0;
  padding-left: 18px;
  color: #aab7d5;
  font-size: 0.8rem;
  line-height: 1.9;
}

.tips li::marker {
  color: rgba(124, 140, 255, 0.7);
}

.footer {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 28px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #5f6c8d;
  font-size: 0.72rem;
}

/* ---------- 弹窗 / Toast ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 4, 10, 0.72);
  backdrop-filter: blur(6px);
}

.modal-card {
  width: min(620px, 100%);
  max-height: 84vh;
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #0b1120;
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.help-list {
  margin: 0 0 14px;
  padding-left: 18px;
  color: #b3c0dc;
  font-size: 0.82rem;
  line-height: 1.85;
}

.snippet {
  margin: 0 0 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(4, 8, 18, 0.8);
  color: #b8c6ff;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.74rem;
  overflow: auto;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 80;
  max-width: min(560px, calc(100% - 32px));
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(14, 21, 40, 0.96);
  color: #e3e9ff;
  font-size: 0.82rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  word-break: break-word;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  border-color: rgba(255, 122, 144, 0.5);
  color: #ffd0d8;
}

/* ---------- 响应式 ---------- */

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

  .topbar {
    align-items: flex-start;
  }

  .pill {
    display: none;
  }
}

@media (max-width: 620px) {
  .topbar,
  .layout,
  .footer {
    width: calc(100% - 28px);
  }

  .topbar {
    padding-top: 20px;
  }

  .panel {
    padding: 17px;
    border-radius: 15px;
  }

  .grid-2,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .brand p {
    font-size: 0.74rem;
  }

  .code-row {
    align-items: flex-start;
  }

  .row.gap {
    flex-wrap: wrap;
  }

  .footer {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
