:root {
  --bg: #f6f7f8;
  --panel: #ffffff;
  --text: #15181c;
  --muted: #747b86;
  --line: #e4e7eb;
  --primary: #111827;
  --accent: #14b8a6;
  --danger: #e5484d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

button {
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
}

button.secondary {
  background: #eef1f4;
  color: var(--text);
}

button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.shell {
  min-height: 100vh;
}

.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .86);
}

.brand {
  font-size: 18px;
  font-weight: 700;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px;
}

.login {
  width: 380px;
  max-width: calc(100vw - 32px);
  margin: 14vh auto 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 28px;
}

.login h1,
.page-title {
  margin: 0 0 8px;
  font-size: 24px;
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 16px;
}

.cols {
  grid-template-columns: 1.1fr .9fr;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
}

.field {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.field label {
  font-weight: 650;
  font-size: 14px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.65;
}

.script-box {
  min-height: 260px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.right {
  margin-left: auto;
}

.stepper {
  display: flex;
  gap: 8px;
  margin: 18px 0;
}

.step {
  flex: 1;
  padding: 10px 12px;
  border-bottom: 3px solid var(--line);
  color: var(--muted);
}

.step.active {
  color: var(--text);
  border-color: var(--accent);
  font-weight: 700;
}

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.asset-item,
.task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.progress {
  height: 10px;
  background: #e8ecef;
  border-radius: 999px;
  overflow: hidden;
}

.bar {
  height: 100%;
  width: 0;
  background: var(--accent);
}

.error {
  color: var(--danger);
  min-height: 22px;
}

.preview-frame {
  aspect-ratio: 9 / 16;
  max-height: 520px;
  margin: 0 auto;
  border-radius: 10px;
  background: #20252b;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.mock-title {
  position: absolute;
  top: 9%;
  width: 100%;
  text-align: center;
  font-weight: 800;
}

.mock-name {
  position: absolute;
  left: 8%;
  top: 18%;
  background: rgba(20, 184, 166, .92);
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 700;
}

.mock-caption {
  position: absolute;
  bottom: 12%;
  width: 100%;
  text-align: center;
  font-weight: 800;
  text-shadow: 0 2px 8px rgba(0,0,0,.7);
}

.mock-key {
  color: #ffd34d;
}

.drag-surface {
  background:
    linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px),
    #20252b;
  background-size: 20% 20%;
}

.caption-drag {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 4px 8px;
  font-weight: 800;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0,0,0,.72);
  cursor: grab;
  user-select: none;
  touch-action: none;
  max-width: 86%;
  overflow-wrap: anywhere;
}

.caption-drag:active {
  cursor: grabbing;
}

@media (max-width: 860px) {
  .cols,
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .topbar {
    padding: 0 16px;
  }
  .wrap {
    padding: 18px;
  }
}
