:root {
  --bg: #09090f;
  --panel: #101018;
  --panel-2: #13131d;
  --line: rgba(255,255,255,.08);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #6d5efc;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: radial-gradient(circle at top, rgba(109,94,252,.18), transparent 28%), var(--bg);
  color: var(--text);
}

.page-shell {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 24px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px;
}

.sidebar-card,
.preview-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 24px 80px rgba(0,0,0,.28);
}

.sidebar-card { padding: 24px; }

.brand-head {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 20px;
}

.brand-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(109,94,252,.18);
  color: #c4b5fd;
  font-weight: 800;
}

.brand-head h1 {
  margin: 0;
  font-size: 28px;
}

.brand-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.field-group label,
.detected-box h3 {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 14px;
}

.field-group input,
.field-group textarea,
.field-group select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #0d0d14;
  color: var(--text);
  padding: 14px 16px;
  outline: none;
}

.field-group textarea {
  resize: vertical;
  min-height: 96px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.top-align {
  align-items: start;
}

.inline-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.mini-btn,
.ghost-btn,
.primary-btn {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--text);
  background: #171723;
}

.primary-btn {
  background: linear-gradient(135deg, #6d5efc, #8b5cf6);
  border: 0;
  font-weight: 700;
  padding: 14px 18px;
}

.mini-btn {
  padding: 8px 12px;
  font-size: 12px;
}

.action-row {
  display: flex;
  justify-content: flex-start;
}

.result-column {
  display: grid;
  gap: 24px;
}

.preview-card {
  padding: 18px;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.preview-head h2 {
  margin: 0;
}

.preview-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.head-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.preview-frame {
  width: 100%;
  height: 720px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #000;
}

.modal[hidden] { display: none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.7);
}

.modal-panel {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  height: 80vh;
  margin: 5vh auto 0;
  background: #0d0d14;
  border: 1px solid var(--line);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
}

pre {
  margin: 0;
  padding: 20px;
  overflow: auto;
  height: 100%;
  color: #e2e8f0;
}

.detected-box {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  background: rgba(255,255,255,.02);
}

.detected-box p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.detected-box h3 {
  margin: 0 0 4px;
}

.detected-grid {
  display: grid;
  gap: 16px;
}

/* ===== COLOR FIELD ===== */
.hidden-color-picker {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-chip {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: inline-block;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.15);
  flex: 0 0 24px;
}

.color-input-wrap input[type="text"] {
  flex: 1;
  min-width: 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1150px) {
  .page-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .two-col,
  .preview-head {
    grid-template-columns: 1fr;
    display: grid;
  }

  .page-shell {
    padding: 14px;
    gap: 16px;
  }

  .sidebar-card,
  .preview-card {
    padding: 16px;
  }

  .preview-frame {
    height: 620px;
  }
}