:root {
  --bg: #0a0a0a;
  --bg-2: #050505;
  --panel: rgba(18, 18, 18, 0.6);
  --panel-2: rgba(22, 22, 22, 0.85);
  --line: rgba(255, 255, 255, 0.08);
  --text: #ffffff;
  --muted: #a1a1a1;
  --accent: #00d4ff;
  --accent-hover: #66e6ff;
  --accent-2: #00d4ff;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-1: 0 12px 30px rgba(0, 0, 0, 0.28);
  --shadow-2: 0 18px 50px rgba(0, 0, 0, 0.35);
  --ring: 0 0 0 3px rgba(0, 212, 255, 0.35);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(900px 420px at 18% 8%, rgba(0, 212, 255, 0.12), transparent 55%),
              radial-gradient(860px 520px at 86% 14%, rgba(0, 212, 255, 0.08), transparent 55%),
              linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #0a0a0a 100%);
  min-height: 100vh;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
}
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.86);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}
.btn:hover { border-color: rgba(0, 212, 255, 0.45); box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.12) inset; transform: translateY(-1px); }
.btn:active { transform: translateY(0px); }
.btn.primary { background: linear-gradient(135deg, var(--accent), rgba(124, 58, 237, 0.75)); border-color: rgba(139, 92, 246, 0.9); color: #fff; }
.btn.primary:hover { background: linear-gradient(135deg, var(--accent-hover), rgba(0, 212, 255, 0.35)); border-color: rgba(0, 212, 255, 0.6); }

.app {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 10px;
  padding: 10px;
}
.app-top { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 10px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-1);
  transition: transform 140ms ease, border-color 160ms ease;
}
a.card { text-decoration: none; color: inherit; display: block; }
a.card:hover { border-color: rgba(0, 212, 255, 0.45); transform: translateY(-1px); }
.card .k { color: var(--muted); font-size: 12px; }
.card .v { font-size: 18px; font-weight: 700; margin-top: 4px; font-family: "Space Grotesk", sans-serif; }
.pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  min-height: 0;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-2);
}
.head {
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: "Space Grotesk", sans-serif;
}
.body { padding: 12px; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
label { font-size: 12px; color: var(--muted); }
select, textarea, button, input {
  background: rgba(15, 23, 42, 0.86);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}
select { padding: 7px 8px; min-width: 240px; }
button { padding: 8px 12px; cursor: pointer; transition: transform 120ms ease, border-color 160ms ease, background-color 160ms ease; }
button:hover { border-color: rgba(0, 212, 255, 0.35); transform: translateY(-1px); }
button:active { transform: translateY(0px); }
button.primary { background: linear-gradient(135deg, var(--accent), rgba(0, 212, 255, 0.35)); border-color: rgba(0, 212, 255, 0.6); color: #001018; }
button.primary:hover { background: linear-gradient(135deg, var(--accent-hover), rgba(0, 212, 255, 0.45)); border-color: rgba(0, 212, 255, 0.8); }
button.ghost:hover { border-color: rgba(0, 212, 255, 0.45); color: #cfefff; }
textarea {
  width: 100%;
  flex: 1;
  min-height: 190px;
  resize: vertical;
  padding: 10px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  line-height: 1.4;
}
.row :is(select, textarea, input, button):focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
.status { font-size: 13px; padding: 8px 10px; background: rgba(15, 23, 42, 0.86); border: 1px solid var(--line); border-radius: 6px; }
.status.running { color: var(--warn); }
.status.completed { color: var(--ok); }
.status.failed, .status.stopped { color: var(--bad); }
.status.queued { color: #8ab4f8; }
.plot { width: 100%; min-height: 220px; max-height: 42vh; object-fit: contain; border: 1px solid var(--line); background: rgba(15, 23, 42, 0.86); border-radius: 6px; }
.slider-row { display: flex; align-items: center; gap: 8px; }
.slider-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.slider-meta { color: var(--muted); font-size: 12px; min-width: 74px; text-align: right; }
.hint { color: var(--muted); font-size: 12px; }
.mask-box { border: 1px solid var(--line); border-radius: 6px; background: rgba(15, 23, 42, 0.86); padding: 8px; }
.mask-canvas { width: 100%; max-width: 360px; height: 220px; border: 1px solid var(--line); border-radius: 6px; background: #0a0f1f; cursor: grab; }
.mask-canvas.dragging { cursor: grabbing; }
.mask-meta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.progress-wrap { display: flex; align-items: center; gap: 8px; }
.progress-track { flex: 1; height: 8px; background: rgba(15, 23, 42, 0.86); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #0066ff, #00d4ff); transition: width 0.2s ease; }
.progress-text { font-size: 12px; color: var(--muted); min-width: 82px; text-align: right; }
.error-box { display: none; border: 1px solid #7a2f2f; background: #3b1f1f; color: #ffb4b4; border-radius: 6px; padding: 8px; font-size: 12px; }
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; height: auto; min-height: 100vh; }
  .plot, pre { max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .btn, button, a.card { transition: none !important; }
}
