:root {
  --primary: #7c3aed;
  --secondary: #a78bfa;
  --ink: #2e1065;
  --muted: #6d28d9;
  --line: #ddd6fe;
  --panel: #ffffff;
  --bg: #f8f5ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 0%, #ede9fe 0%, #f5f3ff 30%, #faf9ff 100%);
}

.bg-shape {
  position: fixed;
  pointer-events: none;
  filter: blur(60px);
  opacity: 0.4;
  z-index: 0;
}

.bg-shape-a {
  top: -100px;
  left: -60px;
  width: 260px;
  height: 260px;
  background: #a78bfa;
}

.bg-shape-b {
  right: -80px;
  bottom: -120px;
  width: 320px;
  height: 320px;
  background: #7c3aed;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px;
  display: grid;
  gap: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(124, 58, 237, 0.08);
}

.header {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.header h1 {
  margin: 0;
  font-size: 1.35rem;
}

.header p {
  margin: 6px 0 0;
  color: #5b21b6;
  max-width: 820px;
}

.health {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  background: #f5f3ff;
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}

.controls {
  padding: 14px;
  display: grid;
  gap: 12px;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field > span {
  font-weight: 700;
  color: #5b21b6;
  font-size: 0.9rem;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  color: #3b0764;
  background: #fdfcff;
  outline: none;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.25);
}

.upload-wrap.hidden {
  display: none;
}

.dropzone {
  display: grid;
  gap: 4px;
  border: 1.5px dashed #8b5cf6;
  border-radius: 13px;
  padding: 14px;
  background: #f5f3ff;
  cursor: pointer;
}

.dropzone.dragover {
  border-color: #6d28d9;
  background: #ede9fe;
}

.dropzone input {
  display: none;
}

.dropzone span {
  color: #4c1d95;
  font-weight: 700;
}

.dropzone small {
  color: #6d28d9;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(120deg, var(--primary), #8b5cf6);
}

.btn-secondary {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(120deg, #8b5cf6, var(--secondary));
}

.btn-ghost {
  color: #5b21b6;
  background: #f5f3ff;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.hidden {
  display: none !important;
}

.status {
  min-height: 20px;
  color: #5b21b6;
  font-size: 0.92rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(380px, 1.2fr) minmax(380px, 1.2fr);
  gap: 12px;
}

.panel {
  min-height: 64vh;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.panel-head {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  background: #f8f5ff;
  font-weight: 700;
}

.panel-head-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.editor-mode {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-mode label {
  font-size: 12px;
  font-weight: 700;
  color: #5b21b6;
}

.editor-mode select {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: #4c1d95;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.editor-views {
  height: 100%;
}

.editor-view {
  width: 100%;
  height: 100%;
  overflow: auto;
}

.json-view {
  margin: 0;
  padding: 12px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.5;
  color: #4c1d95;
  background: #fff;
}

.html-editor {
  border: 0;
  border-radius: 0;
  height: 100%;
  padding: 12px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #4c1d95;
  resize: none;
}

.fields-view {
  padding: 12px;
  background: #fff;
}

.field-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfbff;
  padding: 10px;
  margin-bottom: 10px;
}

.field-group:last-child {
  margin-bottom: 0;
}

.field-group h4 {
  margin: 0 0 10px;
  font-size: 13px;
  color: #5b21b6;
}

.field-item {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.field-item:last-child {
  margin-bottom: 0;
}

.field-item label {
  font-size: 12px;
  font-weight: 700;
  color: #6d28d9;
}

.field-item input,
.field-item textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.4;
  color: #4c1d95;
  background: #fff;
}

.field-item textarea {
  min-height: 64px;
  resize: vertical;
}

.empty-view {
  border: 1px dashed var(--line);
  border-radius: 11px;
  padding: 12px;
  color: #6d28d9;
  font-size: 13px;
  background: #faf8ff;
}

.preview-panel iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

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

  .panel {
    min-height: 45vh;
  }

  .grid-two {
    grid-template-columns: 1fr;
  }
}
