:root {
  --bg: #08080a;
  --card: #12121a;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f4f4f5;
  --muted: #71717a;
  --accent: #6366f1;
  --accent-dim: rgba(99, 102, 241, 0.14);
  --accent-border: rgba(99, 102, 241, 0.35);
  --green: #22c55e;
}

* { box-sizing: border-box; }

body.handling-editor {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.he-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.he-hero {
  margin-bottom: 24px;
}

.he-hero h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.he-hero p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.he-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.he-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 18px 16px;
  position: relative;
}

.he-card-wide { margin-bottom: 14px; }

.he-step {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  color: #c7d2fe;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.he-card h2 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
}

.he-hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  padding-right: 28px;
}

.he-optional {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.he-input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0a0a0f;
  color: var(--text);
  font-size: 14px;
}

.he-input:focus {
  outline: none;
  border-color: var(--accent-border);
}

.he-btn-secondary {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px dashed var(--accent-border);
  background: var(--accent-dim);
  color: #e0e7ff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.he-btn-secondary:hover { border-color: var(--accent); }

.he-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  font-size: 12px;
}

.he-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.he-link:hover { text-decoration: underline; }

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.preset-card {
  text-align: left;
  padding: 14px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0c0c12;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.preset-card:hover {
  border-color: var(--accent-border);
  background: rgba(99, 102, 241, 0.06);
}

.preset-card.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 0 1px var(--accent-border);
}

.preset-icon {
  font-size: 22px;
  line-height: 1;
  margin-bottom: 8px;
}

.preset-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 3px;
}

.preset-tag {
  display: block;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

.tune-grid {
  display: grid;
  gap: 14px;
}

.tune-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  grid-template-rows: auto auto;
  gap: 4px 12px;
  align-items: center;
}

.tune-label {
  font-size: 13px;
  font-weight: 600;
  grid-row: 1 / 3;
}

.tune-ends {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  grid-column: 2;
}

.tune-row input[type="range"] {
  grid-column: 2;
  width: 100%;
  accent-color: var(--accent);
}

.he-foot {
  text-align: center;
  padding-top: 8px;
}

.he-btn-primary {
  width: 100%;
  max-width: 420px;
  padding: 14px 20px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.he-btn-primary:hover:not(:disabled) {
  opacity: 0.94;
  transform: translateY(-1px);
}

.he-btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.he-foot-note {
  margin: 12px auto 0;
  max-width: 480px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.he-status {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--green);
}

.he-err {
  margin: 0 0 10px;
  font-size: 13px;
  color: #f87171;
}

.he-loading {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.hidden { display: none !important; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
}

@media (max-width: 680px) {
  .he-grid { grid-template-columns: 1fr; }
  .preset-grid { grid-template-columns: 1fr 1fr; }
}
