* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #1d2230;
  --panel: #262c3d;
  --panel2: #2f3650;
  --line: #3b435f;
  --txt: #e8ebf5;
  --txt-dim: #9aa3bd;
  --accent: #4f7cff;
  --accent2: #00cece;
}

body {
  font-family: "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--txt);
  font-size: 14px;
}

.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  padding: 14px 22px;
  background: linear-gradient(90deg, #232a40, #2b3556);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: baseline; gap: 14px;
}
.topbar h1 { font-size: 19px; font-weight: 700; letter-spacing: 1px; }
.topbar .sub { color: var(--txt-dim); font-size: 12.5px; }

.main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 380px;
  gap: 22px;
  padding: 22px;
  align-items: start;
}

/* ---------- 舞台 ---------- */
.stage {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  display: flex; flex-direction: column; align-items: center;
  position: sticky; top: 22px;
}
.canvas-wrap {
  position: relative;
  width: min(72vh, 520px);
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,.45);
  background: #c3cacc;
}
#cv { width: 100%; height: 100%; display: block; image-rendering: auto; }
#refImg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: .55; pointer-events: none; mix-blend-mode: difference;
}
.badge {
  position: absolute; left: 10px; bottom: 10px;
  background: rgba(0,0,0,.55); color: #fff;
  padding: 3px 10px; border-radius: 20px; font-size: 12px;
}

.transport {
  margin-top: 18px; width: 100%; max-width: 520px;
  display: flex; align-items: center; gap: 10px;
}
#scrub { flex: 1; accent-color: var(--accent2); }
.chk { display: flex; align-items: center; gap: 5px; color: var(--txt-dim); white-space: nowrap; cursor: pointer; }
.chk input { accent-color: var(--accent2); }

.hint { color: var(--txt-dim); font-size: 12px; margin-top: 10px; }

/* ---------- 面板 ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.group {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.group h2 {
  font-size: 13px; font-weight: 700; color: #cdd6f4;
  margin-bottom: 10px; letter-spacing: .5px;
}
.group label { display: block; font-size: 12.5px; color: var(--txt-dim); margin-bottom: 8px; }
.group label:last-child { margin-bottom: 0; }
.group input[type="text"], .group select {
  width: 100%; margin-top: 5px;
  background: #1c2236; color: var(--txt);
  border: 1px solid #454e6e; border-radius: 7px;
  padding: 8px 10px; font-size: 14px; font-family: inherit;
}
.group input[type="text"]:focus, .group select:focus { outline: none; border-color: var(--accent); }
.group input[type="range"] { width: 100%; margin-top: 6px; accent-color: var(--accent); }
.v { color: var(--accent2); font-weight: 700; }

.colors { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.colors label { text-align: center; margin: 0; }
.colors input[type="color"] {
  width: 100%; height: 34px; border: 1px solid #454e6e; border-radius: 6px;
  background: none; padding: 2px; cursor: pointer; margin-top: 5px;
}

.row { display: flex; gap: 10px; }
.btn {
  background: #3a4364; color: var(--txt); border: 1px solid #4d5780;
  border-radius: 8px; padding: 9px 14px; cursor: pointer; font-size: 13.5px;
  font-family: inherit; transition: background .15s;
}
.btn:hover { background: #47527c; }
.btn.primary { background: var(--accent); border-color: var(--accent); font-weight: 700; }
.btn.primary:hover { background: #5f88ff; }
.btn.wide { flex: 1; }
.btn.ghost { background: transparent; color: var(--txt-dim); }
.btn.ghost:hover { background: #3a4364; color: var(--txt); }

.progress { height: 8px; background: #1c2236; border-radius: 5px; overflow: hidden; margin-top: 10px; }
#bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .1s; }

@media (max-width: 960px) {
  .main { grid-template-columns: 1fr; }
  .stage { position: static; }
}
