:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #667085;
  --line: #d9e1e8;
  --surface: #ffffff;
  --soft: #f4f7f8;
  --accent: #0f8a7d;
  --accent-dark: #0b5f57;
  --warm: #e7a23b;
  --blue: #2d6cdf;
  --danger: #b54708;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background: #f4f7fb;
}

button,
input,
textarea {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: grid;
  grid-template-rows: auto auto 1fr;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: #0d1728;
  color: #f8fbfb;
}

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

.mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--warm);
  color: #1a1a1a;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 21px;
}

.brand p {
  margin: 3px 0 0;
  color: #a8c0c3;
  font-size: 13px;
}

.agent-list {
  display: grid;
  gap: 14px;
  padding: 22px 0;
}

.agent-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.agent-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #c5d2df;
  font-size: 22px;
}

.agent-copy strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
}

.agent-card small {
  display: block;
  margin-top: 3px;
  color: #b9cbce;
  line-height: 1.45;
}

.agent-card.active {
  background: #1e63ff;
  box-shadow: 0 14px 30px rgba(30, 99, 255, 0.25);
}

.history-panel {
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 20px;
  min-height: 0;
  overflow: auto;
}

.history-panel h3 {
  margin: 0 0 12px;
  color: #aab7c6;
  font-size: 13px;
  font-weight: 700;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-list button,
.history-empty {
  border: 0;
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #d9e5ef;
  text-align: left;
}

.history-list button.active {
  background: rgba(255, 255, 255, 0.16);
}

.history-list span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-list small,
.history-empty {
  color: #8fa0b4;
}

.workspace {
  height: 100vh;
  overflow: hidden;
  padding: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  height: 78px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.eyebrow {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.topbar h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: 0;
}

.status {
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff7ed;
  color: var(--danger);
  font-size: 13px;
  white-space: nowrap;
}

.status.ready {
  background: #e9fbf5;
  color: var(--accent-dark);
}

.pill {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: #e7f3f1;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
}

.hero-panel p {
  margin: 10px 0 0;
  color: var(--muted);
}

.content-grid {
  height: calc(100vh - 78px);
  min-height: 0;
}

.hidden {
  display: none !important;
}

.chat-column {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  padding: 22px;
}

.chat-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin: 0 auto 12px;
  width: min(100%, 1280px);
}

.chat-toolbar p {
  margin: 8px 0 0;
  color: var(--muted);
}

.settings {
  width: min(100%, 1280px);
  margin: 0 auto 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.settings summary {
  padding: 12px 14px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.composer {
  padding: 0 14px 14px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.mini-field,
.field {
  display: grid;
  gap: 7px;
}

.mini-field span,
.field span,
.result-head {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.mini-field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--ink);
  outline: none;
}

.mini-field input {
  height: 40px;
  padding: 0 10px;
}

.field textarea {
  resize: vertical;
  padding: 12px;
  line-height: 1.6;
}

.mini-field input:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 138, 125, 0.12);
}

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.examples button,
.ghost-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
  cursor: pointer;
}

.examples button {
  padding: 8px 10px;
  font-size: 13px;
}

.ghost-button {
  padding: 10px 12px;
  white-space: nowrap;
}

#copyButton {
  min-height: 42px;
  padding: 0 18px;
  border-color: transparent;
  background: #1e63ff;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(30, 99, 255, 0.2);
}

#copyButton:hover:not(:disabled) {
  background: #164fd0;
}

#copyButton:disabled {
  opacity: 0.55;
  box-shadow: none;
  cursor: not-allowed;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.primary-button {
  width: 100%;
  height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

.primary-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.result {
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto;
  width: min(100%, 1280px);
  min-height: 0;
  margin: 0 auto;
  padding: 0;
  background: transparent;
}

.result {
}

.result-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.result-head small {
  color: var(--blue);
}

.message pre,
.empty-state {
  overflow: auto;
  margin: 0;
  padding: 16px;
  border-radius: 8px;
  white-space: pre-wrap;
  line-height: 1.65;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 15px;
}

.messages {
  display: grid;
  align-content: start;
  gap: 18px;
  overflow: auto;
  min-height: 0;
  padding: 4px 4px 18px;
}

.message {
  display: grid;
  gap: 6px;
}

.message-meta {
  display: flex;
  gap: 8px;
  align-items: center;
}

.message.user .message-meta {
  justify-content: flex-end;
}

.message-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.message-copy {
  min-height: 32px;
  border: 1px solid rgba(15, 138, 125, 0.24);
  border-radius: 6px;
  background: #e7f3f1;
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  padding: 7px 12px;
}

.message-copy:hover {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}

.message.user {
  justify-items: end;
}

.message.assistant {
  justify-items: start;
  width: 100%;
}

.message.user pre {
  max-width: min(760px, 78%);
  border-radius: 8px 8px 0 8px;
  background: #1e63ff;
  color: #fff;
}

.message.assistant pre {
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.message.assistant:last-child pre {
  min-height: clamp(380px, 52vh, 680px);
}

.empty-state {
  background: var(--soft);
  color: var(--muted);
}

.follow-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

.follow-form textarea {
  width: 100%;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  line-height: 1.5;
}

.follow-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 138, 125, 0.12);
}

.follow-form button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.follow-form button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.canvas-column {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(300px, 0.9fr) minmax(360px, 1fr);
  gap: 18px;
  height: 100%;
  min-height: 0;
  padding: 22px;
}

.canvas-input,
.canvas-assets {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.canvas-assets {
  grid-template-rows: auto minmax(0, 1fr);
}

.canvas-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.canvas-panel-head h3 {
  margin: 8px 0 0;
  font-size: 18px;
}

.canvas-panel-head p,
.canvas-panel-head small {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.canvas-input textarea {
  width: 100%;
  min-height: 280px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--ink);
  line-height: 1.65;
  outline: none;
  padding: 12px;
}

.canvas-input textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 138, 125, 0.12);
}

.canvas-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.wide {
  width: 100%;
}

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

.canvas-stage-wrap {
  display: grid;
  min-height: 0;
  place-items: center;
}

.canvas-stage {
  position: relative;
  aspect-ratio: 9 / 16;
  width: min(100%, 390px);
  max-height: calc(100vh - 130px);
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid #172033;
  background:
    linear-gradient(180deg, rgba(13, 23, 40, 0.18), rgba(13, 23, 40, 0.75)),
    linear-gradient(140deg, #203047 0%, #0f766e 46%, #d9a441 100%);
  box-shadow: 0 20px 55px rgba(15, 23, 42, 0.22);
}

.avatar-zone {
  position: absolute;
  left: 50%;
  bottom: 92px;
  display: grid;
  justify-items: center;
  transform: translateX(-50%);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.avatar-head {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: #f1d2b8;
  border: 5px solid rgba(255, 255, 255, 0.8);
}

.avatar-body {
  width: 158px;
  height: 190px;
  margin-top: -6px;
  border-radius: 42px 42px 8px 8px;
  background: #12335f;
  border: 5px solid rgba(255, 255, 255, 0.55);
}

.subtitle-zone {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 24px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.45);
  color: rgba(255, 255, 255, 0.86);
  text-align: center;
  font-size: 13px;
}

.pip-card {
  position: absolute;
  display: grid;
  width: 38%;
  aspect-ratio: 4 / 3;
  place-items: center;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent-dark);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.pip-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pip-card.top-right {
  top: calc(34px + var(--offset));
  right: 22px;
}

.pip-card.top-left {
  top: calc(46px + var(--offset));
  left: 22px;
}

.pip-card.top-center {
  top: calc(32px + var(--offset));
  left: 50%;
  transform: translateX(-50%);
}

.pip-card.middle-right {
  top: calc(36% + var(--offset));
  right: 18px;
}

.pip-card.middle-left {
  top: calc(36% + var(--offset));
  left: 18px;
}

.canvas-items {
  display: grid;
  align-content: start;
  gap: 14px;
  overflow: auto;
  min-height: 0;
  padding-right: 4px;
}

.canvas-item {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.canvas-thumb {
  display: grid;
  aspect-ratio: 9 / 12;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #e7f3f1;
  color: var(--accent-dark);
  font-weight: 800;
  text-align: center;
}

.canvas-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.canvas-item-body {
  min-width: 0;
}

.canvas-item-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.canvas-item-title small,
.canvas-item p,
.canvas-item-actions small {
  color: var(--muted);
}

.canvas-item p {
  margin: 8px 0;
  line-height: 1.55;
}

.canvas-item details {
  margin-top: 8px;
}

.canvas-edit-field {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.canvas-edit-field span {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
}

.canvas-edit-field textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 10px;
  line-height: 1.55;
  font-size: 13px;
}

.canvas-edit-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 138, 125, 0.12);
}

.canvas-edit-field textarea.negative {
  color: var(--danger);
}

.canvas-item summary {
  color: var(--accent-dark);
  cursor: pointer;
  font-weight: 800;
}

.canvas-item pre {
  overflow: auto;
  max-height: 140px;
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  white-space: pre-wrap;
  line-height: 1.55;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 13px;
}

.canvas-item pre.negative {
  color: var(--danger);
}

.canvas-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.canvas-item-actions .ghost-button {
  display: inline-flex;
  padding: 8px 10px;
  text-decoration: none;
}

.canvas-error {
  color: var(--danger) !important;
}

.canvas-column {
  grid-template-columns: minmax(300px, 420px) minmax(520px, 1fr);
}

.canvas-input select,
.canvas-edit-field select,
.canvas-edit-field input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--ink);
  outline: none;
  padding: 0 10px;
}

.canvas-input select:focus,
.canvas-edit-field select:focus,
.canvas-edit-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 138, 125, 0.12);
}

.canvas-input {
  position: sticky;
  top: 22px;
  max-height: calc(100vh - 122px);
  overflow: auto;
}

.canvas-assets {
  min-width: 0;
}

.canvas-items {
  gap: 16px;
}

.canvas-item.prompt-card {
  grid-template-columns: 1fr;
  background: #fff;
}

.canvas-check-grid {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.canvas-asset-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 120px 120px;
  gap: 10px;
  align-items: start;
}

.canvas-item-title strong {
  line-height: 1.35;
}

.canvas-item-title small {
  border-radius: 999px;
  background: #e7f3f1;
  color: var(--accent-dark);
  padding: 4px 8px;
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .shell,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    height: auto;
    overflow: visible;
  }

  .content-grid {
    height: auto;
  }

  .result {
    min-height: 70vh;
  }

  .sidebar {
    border-right: 0;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .topbar,
  .hero-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .canvas-column {
    grid-template-columns: 1fr;
    height: auto;
  }

  .canvas-stage {
    max-height: none;
    width: min(100%, 360px);
  }

  .canvas-item {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .canvas-asset-grid,
  .canvas-check-grid {
    grid-template-columns: 1fr;
  }
}
