:root {
  --bg: #fbfbfb;
  --surface: #ffffff;
  --surface-soft: #f2f2f2;
  --ink: #101014;
  --muted: #7b7b82;
  --line: #e8e8e8;
  --violet-light: #b09bff;
  --violet: #8a6aff;
  --violet-deep: #5031a4;
  --violet-soft: #f0edff;
  --yellow: #f4f35a;
  --yellow-soft: #f4f35a;
  --shadow: 0 20px 60px rgba(28, 28, 34, 0.09);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 4%, rgba(176, 155, 255, 0.2), transparent 25%),
    radial-gradient(circle at 96% 12%, rgba(244, 243, 90, 0.1), transparent 20%),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

button {
  cursor: pointer;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px minmax(620px, 1fr) 360px;
  gap: 18px;
  padding: 18px;
}

.rail,
.inspector {
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
  overflow: auto;
}

.rail {
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  margin-top: 2px;
}

.rail-nav {
  display: grid;
  gap: 8px;
}

.rail-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: var(--radius);
}

.rail-nav a.active,
.rail-nav a:hover {
  background: var(--ink);
  color: #fff;
}

.rail-note {
  margin-top: auto;
  border: 1px solid rgba(176, 155, 255, 0.34);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--violet-soft);
}

.rail-note p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.workspace {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.mobile-home {
  display: none;
}

.topbar,
.hero-flow,
.section-block,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 36px rgba(28, 28, 34, 0.04);
}

.topbar {
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--violet-deep);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.18;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.primary,
.ghost {
  border: 0;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-weight: 700;
}

.link-button {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.primary {
  background: var(--ink);
  color: #fff;
}

.primary:hover {
  background: #242429;
}

.ghost {
  background: var(--surface-soft);
  color: var(--ink);
}

.wide {
  width: 100%;
  margin-top: 12px;
}

.hero-flow {
  padding: 20px 22px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  background:
    radial-gradient(circle at 82% 36%, rgba(238, 232, 255, 0.76), transparent 24%),
    linear-gradient(135deg, #c8d1e7 0%, #a88fff 43%, #251653 100%);
  color: #fff;
}

.flow-copy p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.7;
  max-width: 680px;
}

.flow-status {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 280px;
}

.flow-status span,
.panel-head span,
.tag {
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--surface-soft);
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.hero-flow .flow-status span {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
}

.panel-head span {
  background: var(--violet-soft);
  color: var(--violet-deep);
  border-color: rgba(176, 155, 255, 0.38);
}

.section-block {
  padding: 20px 22px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  align-items: flex-start;
}

.section-head > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  max-width: 440px;
  text-align: right;
}

.step {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--violet-light);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.contract-grid,
.role-grid,
.format-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.role-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.format-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.select-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  padding: 13px;
  min-height: 156px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.select-card:hover {
  border-color: var(--violet-light);
}

.select-card.active {
  border-color: var(--violet-light);
  background: var(--violet-soft);
  box-shadow: inset 0 0 0 1px rgba(176, 155, 255, 0.28);
}

.select-card strong {
  font-size: 15px;
  line-height: 1.35;
}

.select-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

.select-card small {
  margin-top: auto;
  color: var(--ink);
  line-height: 1.45;
  font-weight: 700;
}

.anchor-layout {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 14px;
}

.upload-panel,
.anchor-fields,
.script-panel,
.shot-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #fff;
}

.upload-box {
  min-height: 168px;
  border: 1px dashed rgba(176, 155, 255, 0.7);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(240, 237, 255, 0.9), rgba(255, 255, 255, 0.86));
}

.upload-box input {
  display: none;
}

.upload-box span {
  display: block;
  font-weight: 800;
}

.upload-box small {
  display: block;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.5;
}

.thumb-row,
.sample-strip {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  overflow-x: auto;
}

.thumb,
.sample {
  width: 90px;
  flex: 0 0 90px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  padding: 0;
  text-align: left;
}

.thumb img,
.sample img {
  display: block;
  width: 100%;
  height: 116px;
  object-fit: cover;
}

.thumb span,
.sample span {
  display: block;
  padding: 7px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sample.active {
  border-color: var(--violet-light);
  box-shadow: inset 0 0 0 1px rgba(176, 155, 255, 0.34);
}

.anchor-fields {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

textarea {
  min-height: 82px;
  resize: vertical;
  line-height: 1.55;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--violet-light);
  box-shadow: 0 0 0 3px rgba(176, 155, 255, 0.2);
}

.story-layout {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 14px;
}

.script-panel {
  display: grid;
  gap: 12px;
}

.script-row {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.script-row:last-of-type {
  border-bottom: 0;
}

.script-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.script-row p {
  margin: 6px 0 0;
  line-height: 1.65;
}

.shot-list {
  margin: 0;
  list-style: none;
  counter-reset: shot;
  display: grid;
  gap: 10px;
}

.shot-list li {
  counter-increment: shot;
  position: relative;
  padding: 12px 12px 12px 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.shot-list li::before {
  content: counter(shot);
  position: absolute;
  left: 12px;
  top: 12px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
}

.shot-list strong {
  display: block;
  margin-bottom: 5px;
}

.shot-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.inspector {
  display: grid;
  gap: 14px;
  align-content: start;
}

.panel {
  padding: 16px;
}

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

.panel-head h2 {
  font-size: 16px;
}

.truth-card dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

.truth-card div {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.truth-card div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

dd {
  margin: 5px 0 0;
  line-height: 1.6;
}

.phone-preview {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: var(--radius);
  overflow: hidden;
  background: #0e1114;
  box-shadow: var(--shadow);
}

.phone-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.caption-stack {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: grid;
  gap: 7px;
}

.caption-stack strong,
.caption-stack span {
  background: rgba(15, 17, 19, 0.74);
  color: #fff;
  border-radius: 6px;
  padding: 8px 10px;
  line-height: 1.45;
}

.caption-stack span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
}

.publish-copy {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.publish-copy textarea {
  min-height: 64px;
  background: var(--surface-soft);
}

.qc-panel ul,
.route-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
}

.qc-panel li {
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  line-height: 1.5;
  background: #fff;
}

.qc-panel li.pass {
  border-color: rgba(176, 155, 255, 0.42);
  background: var(--violet-soft);
}

.qc-panel li.warn {
  border-color: var(--yellow);
  background: var(--yellow);
  color: var(--ink);
  font-weight: 800;
}

.route-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: #fff;
}

.route-item strong {
  font-size: 13px;
}

.route-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.status {
  border-radius: 999px;
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 800;
  color: var(--ink);
  background: var(--violet-soft);
  border: 1px solid rgba(176, 155, 255, 0.42);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius);
  padding: 11px 14px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
  z-index: 20;
}

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

@media (max-width: 1180px) {
  .app {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .inspector {
    grid-column: 2;
    position: static;
    height: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preview-panel {
    grid-row: span 3;
  }
}

@media (max-width: 860px) {
  body {
    background: var(--bg);
  }

  .app {
    display: block;
    padding: 0 0 92px;
  }

  .rail {
    display: none;
  }

  .inspector {
    position: static;
    height: auto;
  }

  .workspace {
    display: block;
  }

  .mobile-home {
    display: block;
    background: var(--surface);
    padding: 18px 20px 16px;
  }

  .mobile-brand-row,
  .mobile-logo,
  .mobile-account,
  .mobile-tool,
  .mobile-prompt div,
  .mobile-bottom-nav {
    display: flex;
    align-items: center;
  }

  .mobile-brand-row {
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 26px;
  }

  .mobile-logo {
    gap: 11px;
    font-size: 30px;
    font-weight: 900;
  }

  .mobile-account {
    gap: 12px;
  }

  .mobile-points {
    height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    background: var(--surface-soft);
    display: grid;
    place-items: center;
    color: var(--ink);
    font-weight: 900;
  }

  .mobile-avatar {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: linear-gradient(135deg, #1b1b22, var(--violet-deep));
    display: block;
  }

  .mobile-hero-card {
    min-height: 176px;
    border-radius: 30px;
    padding: 26px;
    background:
      radial-gradient(circle at 82% 36%, rgba(238, 232, 255, 0.82), transparent 25%),
      linear-gradient(135deg, #c8d1e7 0%, #a88fff 43%, #251653 100%);
    color: #fff;
    margin-bottom: 18px;
    overflow: hidden;
    position: relative;
  }

  .mobile-hero-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.25) 1px, transparent 1px);
    background-size: 4px 4px;
    opacity: 0.22;
  }

  .mobile-hero-card > * {
    position: relative;
    z-index: 1;
  }

  .mobile-dots {
    letter-spacing: 4px;
    opacity: 0.8;
  }

  .mobile-hero-card h1 {
    margin: 48px 0 8px;
    font-size: 34px;
    line-height: 1;
    color: #fff;
    white-space: nowrap;
  }

  .mobile-hero-card p {
    margin: 0;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 800;
  }

  .mobile-tool-list {
    display: grid;
    gap: 12px;
    margin-bottom: 22px;
  }

  .mobile-tool {
    width: fit-content;
    min-height: 56px;
    gap: 14px;
    border: 0;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--ink);
    padding: 10px 18px;
    font-size: 22px;
    font-weight: 900;
  }

  .mobile-tool.wide {
    width: min(100%, 348px);
  }

  .mobile-tool span {
    width: 32px;
    height: 32px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: var(--violet-light);
    color: var(--ink);
    font-size: 14px;
    flex: 0 0 auto;
  }

  .mobile-tool em {
    background: var(--yellow);
    border-radius: 12px;
    font-size: 15px;
    font-style: normal;
    padding: 4px 9px;
  }

  .mobile-tool.active {
    background: var(--ink);
    color: #fff;
  }

  .mobile-hint {
    margin: 0 0 18px 18px;
    color: #9f9b9e;
    font-size: 17px;
    font-weight: 700;
  }

  .mobile-prompt {
    border-radius: 30px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: 0 18px 40px rgba(45, 37, 54, 0.08);
    padding: 18px;
    min-height: 122px;
  }

  .mobile-prompt > span {
    display: block;
    color: #9f9b9e;
    font-size: 25px;
    font-weight: 800;
    margin-bottom: 24px;
  }

  .mobile-prompt div {
    justify-content: space-between;
    gap: 10px;
  }

  .mobile-plus,
  .mobile-mic {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--ink);
    border: 0;
    display: grid;
    place-items: center;
    text-decoration: none;
    font-size: 32px;
    font-weight: 500;
  }

  .mobile-mic {
    font-size: 24px;
  }

  .mobile-model {
    height: 48px;
    border: 0;
    border-radius: 999px;
    padding: 0 24px;
    background: var(--surface-soft);
    color: var(--ink);
    font-size: 18px;
    font-weight: 900;
  }

  .mobile-bottom-nav {
    justify-content: space-between;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    background: #fff;
    padding: 8px 28px 10px;
    box-shadow: 0 -12px 30px rgba(28, 28, 34, 0.06);
  }

  .mobile-bottom-nav a {
    display: grid;
    gap: 5px;
    place-items: center;
    text-decoration: none;
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
  }

  .mobile-bottom-nav span {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    border: 2px solid var(--ink);
    font-size: 16px;
  }

  .mobile-bottom-nav .active span {
    background: var(--ink);
    color: #fff;
  }

  .topbar,
  .hero-flow {
    display: none;
  }

  .section-block {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 18px 20px;
  }

  .section-head,
  .anchor-layout,
  .story-layout {
    display: grid;
    gap: 12px;
  }

  .section-head {
    margin-bottom: 12px;
  }

  .section-head p,
  .select-card p,
  .upload-box small,
  .route-panel {
    display: none;
  }

  .section-head p {
    text-align: left;
  }

  .contract-grid,
  .role-grid,
  .format-grid {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 2px;
    scroll-snap-type: x mandatory;
  }

  .select-card {
    min-height: 82px;
    flex: 0 0 168px;
    border-radius: 20px;
    scroll-snap-align: start;
  }

  .select-card strong {
    font-size: 15px;
  }

  .select-card small {
    font-size: 12px;
    color: var(--muted);
  }

  .upload-panel,
  .anchor-fields,
  .script-panel,
  .shot-list,
  .panel {
    border-radius: 20px;
  }

  .upload-box {
    min-height: 112px;
    padding: 18px;
    border-radius: 22px;
  }

  .sample {
    width: 78px;
    flex-basis: 78px;
  }

  .sample img,
  .thumb img {
    height: 96px;
  }

  textarea {
    min-height: 64px;
  }

  .shot-list li {
    padding: 12px 12px 12px 42px;
  }

  .inspector {
    display: grid;
    grid-template-columns: 1fr;
    padding: 0 20px;
    gap: 12px;
  }

  .truth-card dl {
    display: none;
  }

  .phone-preview {
    max-width: 320px;
    margin: 0 auto;
  }

  .qc-panel li {
    font-size: 13px;
  }
}
