:root {
  --bg: #0d0c10;
  --panel: #16141c;
  --panel-2: #1d1a25;
  --line: #2b2735;
  --text: #ece9f2;
  --muted: #9b93ad;
  --accent: #ff3d6e;
  --accent-2: #ffb03a;
  --ok: #46d39a;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background:
    radial-gradient(1100px 600px at 12% -10%, #2a1130 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #10203a 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}

/* ---------- hero ---------- */
.hero {
  border-bottom: 1px solid var(--line);
  background: rgba(13, 12, 16, 0.6);
  backdrop-filter: blur(8px);
}

.hero-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 20px 18px;
}

.hero h1 {
  margin: 0 0 6px;
  font-size: 24px;
  letter-spacing: 0.5px;
}

.hero .sub {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  max-width: 820px;
}

.hero .sub strong {
  color: var(--accent-2);
  font-weight: 600;
}

/* ---------- layout ---------- */
.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

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

.panel {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}

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

.panel-head:not(:first-child) {
  margin-top: 22px;
}

.panel-head h2 {
  font-size: 14px;
  margin: 0;
  letter-spacing: 0.4px;
  color: var(--text);
}

/* ---------- textarea / inputs ---------- */
textarea,
input[type="text"],
select {
  width: 100%;
  background: #0e0d13;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  font: inherit;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.8;
}

#lyrics {
  min-height: 240px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 61, 110, 0.14);
}

.hint-row {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.dot {
  opacity: 0.5;
}

/* ---------- options ---------- */
.opts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}

.field.stack textarea {
  margin-top: 2px;
  font-size: 13px;
}

.toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text);
}

.toggles label {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

input[type="checkbox"] {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #0e0d13;
  cursor: pointer;
  position: relative;
  flex: 0 0 auto;
}

input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  color: #fff;
}

.fold {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 11px;
  background: #131119;
}

.fold summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
}

.fold[open] summary {
  margin-bottom: 8px;
  color: var(--text);
}

/* ---------- buttons ---------- */
button {
  font: inherit;
  cursor: pointer;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #1b1822;
  color: var(--text);
  padding: 7px 12px;
  transition: 0.15s;
}

button:hover {
  border-color: #4a4258;
  background: #221e2b;
}

button.primary {
  width: 100%;
  margin-top: 16px;
  padding: 13px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.6px;
  border: none;
  background: linear-gradient(92deg, var(--accent), var(--accent-2));
  color: #180712;
}

button.primary:hover {
  filter: brightness(1.08);
}

button.primary:active {
  transform: translateY(1px);
}

button.ghost {
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 5px 9px;
}

button.ghost:hover {
  color: var(--text);
}

button.small {
  font-size: 12px;
}

.mini-actions {
  display: flex;
  gap: 6px;
}

/* ---------- tabs ---------- */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.tab {
  font-size: 12.5px;
  padding: 6px 11px;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
}

.tab.active {
  background: rgba(255, 61, 110, 0.14);
  border-color: var(--accent);
  color: #ffd9e3;
}

/* ---------- output ---------- */
.out-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

#out-meta {
  font-size: 12px;
  color: var(--muted);
}

.out {
  margin: 0;
  background: #0b0a0f;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px;
  min-height: 320px;
  max-height: 560px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.75;
  color: #d9d4e6;
}

.warnings {
  border: 1px solid #5a4a1e;
  background: rgba(255, 176, 58, 0.08);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 12.5px;
  color: #ffdfa8;
  margin-bottom: 10px;
}

.warnings ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.hidden {
  display: none;
}

/* ---------- section editor ---------- */
.section-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow: auto;
  margin-bottom: 10px;
}

.sec-card {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  background: #100e16;
}

.sec-card .sec-text {
  font-size: 12px;
  color: var(--muted);
  white-space: pre-wrap;
  max-height: 70px;
  overflow: hidden;
  margin-top: 4px;
}

.sec-card .sec-title {
  font-size: 12.5px;
  color: var(--text);
}

.sec-card .badge {
  font-size: 11px;
  color: var(--accent-2);
  margin-left: 6px;
}

.sec-card select {
  font-size: 12.5px;
  padding: 6px 8px;
}

/* ---------- footer / toast ---------- */
.foot {
  max-width: 1280px;
  margin: 0 auto;
  padding: 6px 20px 40px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  gap: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: var(--ok);
  color: #04231a;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: 0.22s;
}

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