:root {
  --paper: #f4ede3;
  --paper-deep: #eadfd1;
  --surface: #fffdf9;
  --surface-soft: #fbf6ee;
  --surface-tint: #f7efe4;
  --ink: #2c231c;
  --ink-soft: #65584b;
  --ink-muted: #998a7b;
  --brand: #b5512a;
  --brand-dark: #8f3a19;
  --brand-soft: #f5e2d5;
  --line: #e7dccd;
  --line-strong: #d9c9b7;
  --green: #3d7a58;
  --green-soft: #e9f2ec;
  --amber: #a36a1f;
  --amber-soft: #fbf0dc;
  --red: #b04037;
  --red-soft: #f9e8e5;
  --shadow-soft: 0 18px 44px rgba(80, 54, 33, 0.08);
  --shadow-card: 0 24px 70px rgba(75, 48, 27, 0.13);
  --radius-lg: 26px;
  --radius-md: 18px;
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  color: var(--ink);
  font-family: var(--font-sans);
  background:
    radial-gradient(1100px 760px at 14% -8%, #fff8ee 0%, rgba(255, 248, 238, 0) 62%),
    radial-gradient(900px 700px at 102% 4%, #f0e1d1 0%, rgba(240, 225, 209, 0) 55%),
    linear-gradient(180deg, #f6efe5 0%, #f1e8dc 100%);
  -webkit-font-smoothing: antialiased;
}

button,
textarea,
input {
  font-family: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* ------------------------------------------------------------------ */
/* 左侧作品栏                                                          */
/* ------------------------------------------------------------------ */
.works-rail {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 22px 18px 18px;
  border-right: 1px solid rgba(217, 201, 183, 0.7);
  background: rgba(255, 251, 245, 0.78);
  backdrop-filter: blur(18px);
}

.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 4px 20px;
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.rail-brand img {
  border-radius: 11px;
  box-shadow: 0 5px 14px rgba(80, 54, 33, 0.16);
}

.rail-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.rail-brand-text strong {
  font-size: 0.98rem;
  letter-spacing: 0.02em;
}

.rail-brand-text small {
  color: var(--ink-muted);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  margin-top: 3px;
}

.rail-close {
  display: none;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: 1.4rem;
  line-height: 1;
  padding: 4px 8px;
}

.new-chat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--ink);
  border-radius: 14px;
  background: var(--ink);
  color: #fff9f1;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: transform 0.16s ease, background 0.16s ease;
}

.new-chat:hover {
  background: #1f1813;
  transform: translateY(-1px);
}

.new-chat-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.rail-section {
  flex: 1;
  min-height: 0;
  margin-top: 26px;
  display: flex;
  flex-direction: column;
}

.rail-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 10px;
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.rail-refresh {
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.95rem;
  padding: 0 2px;
  transition: color 0.16s ease, transform 0.3s ease;
}

.rail-refresh:hover {
  color: var(--ink);
  transform: rotate(45deg);
}

.works-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 0 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.work-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 8px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.work-rename {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 7px;
  background: rgba(255, 253, 249, 0.94);
  color: var(--ink-muted);
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease, background 0.14s ease;
}

.work-item:hover .work-rename,
.work-item:focus-within .work-rename,
.work-item.active .work-rename {
  opacity: 1;
  pointer-events: auto;
}

.work-rename:hover {
  background: var(--surface);
  color: var(--ink);
}

.work-rename-input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  padding: 3px 6px;
  outline: none;
}

.work-item:hover {
  background: rgba(255, 253, 249, 0.8);
  border-color: var(--line);
}

.work-item.active {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 8px 22px rgba(80, 54, 33, 0.07);
}

.work-thumb {
  flex: 0 0 40px;
  width: 40px;
  height: 52px;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(155deg, #f0e2d2, #e4d2bd);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(80, 54, 33, 0.55);
  font-family: var(--font-serif);
  font-size: 0.9rem;
  position: relative;
}

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

.work-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 18px;
}

.work-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.845rem;
  font-weight: 600;
  color: var(--ink);
}

.work-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.7rem;
  color: var(--ink-muted);
}

.works-empty {
  padding: 26px 14px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.78rem;
  line-height: 1.7;
}

.works-empty span {
  font-size: 0.7rem;
  color: #b4a596;
}

.work-skeleton {
  height: 66px;
  margin: 3px 4px;
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(231, 220, 205, 0.4) 25%, rgba(255, 253, 249, 0.85) 37%, rgba(231, 220, 205, 0.4) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

.rail-foot {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 14px 8px 2px;
  border-top: 1px solid rgba(217, 201, 183, 0.58);
}

.rail-link {
  color: var(--ink-soft);
  font-size: 0.78rem;
  padding: 4px 0;
  transition: color 0.16s ease;
}

.rail-link:hover {
  color: var(--brand);
}

.rail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(44, 35, 28, 0.32);
  backdrop-filter: blur(2px);
}

/* ------------------------------------------------------------------ */
/* 对话主区                                                           */
/* ------------------------------------------------------------------ */
.chat-main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-width: 0;
}

.chat-top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 34px 16px;
  position: relative;
  z-index: 5;
}

.menu-btn {
  display: none;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 11px;
  width: 38px;
  height: 38px;
  color: var(--ink);
  font-size: 1rem;
}

.chat-heading {
  min-width: 0;
  flex: 1;
}

.eyebrow {
  color: var(--brand);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.chat-heading h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-heading p {
  margin: 5px 0 0;
  color: var(--ink-muted);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.user-chip {
  color: var(--ink-soft);
  font-size: 0.76rem;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.7);
  border: 1px solid var(--line);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: rgba(255, 253, 249, 0.66);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.btn-outline:hover {
  background: var(--surface);
  border-color: var(--ink-muted);
  transform: translateY(-1px);
}

.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 34px 0;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.thread {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 8px 0 220px;
}

.thread::after {
  content: "";
  display: block;
  height: 1px;
}

/* 消息 ------------------------------------------------------------- */
.msg {
  display: flex;
  gap: 12px;
  margin: 24px 0;
  animation: rise 0.26s ease both;
}

.msg-user {
  justify-content: flex-end;
}

.msg-avatar {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  margin-top: 2px;
}

.msg-body {
  max-width: min(78%, 680px);
  min-width: 0;
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--ink-muted);
  font-size: 0.7rem;
}

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

.bubble {
  padding: 14px 18px;
  border-radius: 20px 20px 20px 6px;
  background: rgba(255, 253, 249, 0.85);
  border: 1px solid var(--line);
  box-shadow: 0 8px 26px rgba(80, 54, 33, 0.05);
  font-size: 0.92rem;
  line-height: 1.78;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-user .bubble {
  border: 0;
  border-radius: 20px 20px 6px 20px;
  background: linear-gradient(145deg, #35291f, #241b14);
  color: #fff8ef;
  box-shadow: 0 14px 32px rgba(44, 35, 28, 0.17);
}

.msg-error .bubble {
  border-color: #e6c3bd;
  background: var(--red-soft);
  color: #7c2f29;
}

/* 载入 / 空态 ------------------------------------------------------- */
.loading-card {
  margin: 60px auto;
  width: min(420px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.loading-title {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-bottom: 16px;
}

.loading-bar {
  height: 5px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-tint);
  position: relative;
}

.loading-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 40%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-soft), var(--brand));
  animation: slide 1.2s ease-in-out infinite;
}

.onboarding {
  margin: 34px auto 10px;
  padding: 34px 34px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(600px 260px at 90% -10%, #f7e4d6 0%, rgba(247, 228, 214, 0) 65%),
    var(--surface);
  box-shadow: var(--shadow-soft);
}

.onboarding-kicker {
  color: var(--brand);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  font-weight: 700;
  margin-bottom: 12px;
}

.onboarding h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.6rem;
  letter-spacing: 0.01em;
  line-height: 1.35;
}

.onboarding p {
  margin: 12px 0 22px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.8;
  max-width: 560px;
}

.prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.prompt-chip {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 0.8rem;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.prompt-chip:hover {
  background: var(--brand-soft);
  border-color: #e7c8b6;
  color: var(--brand-dark);
}

.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px dashed var(--line);
  color: var(--ink-muted);
  font-size: 0.73rem;
}

.steps span::before {
  content: "●";
  margin-right: 6px;
  color: var(--brand);
  font-size: 0.6rem;
}

/* 生成进度 ---------------------------------------------------------- */
.progress-card {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin: 24px 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 249, 0.88);
  box-shadow: var(--shadow-soft);
  animation: rise 0.26s ease both;
}

.progress-spinner {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border-radius: 50%;
  border: 2px solid var(--brand-soft);
  border-top-color: var(--brand);
  animation: spin 0.9s linear infinite;
  flex-shrink: 0;
}

.progress-copy {
  min-width: 0;
}

.progress-title {
  font-size: 0.84rem;
  font-weight: 700;
  margin-bottom: 3px;
}

.progress-text {
  color: var(--ink-muted);
  font-size: 0.77rem;
  line-height: 1.6;
}

.progress-card.is-error {
  border-color: #e6c3bd;
  background: var(--red-soft);
}

.progress-card.is-error .progress-spinner {
  border-color: #e6c3bd;
  border-top-color: var(--red);
  animation: none;
}

/* 执行计划 ---------------------------------------------------------- */
.plan-card {
  margin: 20px 0 26px;
  padding: 16px 18px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #fffdf9 0%, #fbf5ec 100%);
  box-shadow: var(--shadow-soft);
  animation: rise 0.26s ease both;
}

.plan-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.plan-kicker {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.plan-goal {
  font-size: 0.9rem;
  line-height: 1.5;
}

.plan-steps {
  margin: 0;
  padding-left: 20px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.75;
}

.plan-steps li::marker {
  color: var(--brand);
  font-weight: 700;
}

.plan-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--ink-muted);
  font-size: 0.75rem;
}

.plan-spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--brand-soft);
  border-top-color: var(--brand);
  animation: spin 0.9s linear infinite;
}

.plan-card.is-done .plan-spinner {
  border: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: none;
}

.plan-card.is-error {
  border-color: #e6c3bd;
  background: var(--red-soft);
}

.plan-card.is-error .plan-spinner {
  border: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  animation: none;
}

.plan-card.is-error .plan-status {
  color: var(--red);
}

/* ------------------------------------------------------------------ */
/* 作品卡片                                                           */
/* ------------------------------------------------------------------ */
.artifact {
  margin: 10px 0 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  animation: rise 0.4s ease both;
}

.artifact-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fffdf9, #fbf6ee);
}

.artifact-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.artifact-label-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.artifact-status {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}

.status-pass {
  color: var(--green);
  background: var(--green-soft);
}

.status-warn {
  color: var(--amber);
  background: var(--amber-soft);
}

.status-block {
  color: var(--red);
  background: var(--red-soft);
}

.status-neutral {
  color: var(--ink-soft);
  background: var(--surface-tint);
}

.artifact-body {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 28px;
  padding: 26px 26px 22px;
}

.artifact-cover {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(155deg, #f2e4d3, #e3cfb9);
  box-shadow: 0 16px 34px rgba(80, 54, 33, 0.15);
}

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

.artifact-cover.is-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px;
  text-align: center;
  color: #7f6a56;
  font-family: var(--font-serif);
}

.placeholder-mark {
  font-size: 2.2rem;
  color: rgba(181, 81, 42, 0.55);
  margin-bottom: 10px;
}

.placeholder-title {
  font-size: 1.05rem;
  line-height: 1.5;
}

.cover-badge {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 5px 9px;
  border-radius: 8px;
  background: rgba(32, 24, 18, 0.68);
  backdrop-filter: blur(6px);
  color: #fff8ef;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
}

.artifact-detail {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.artifact-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--brand);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  margin-bottom: 10px;
}

.artifact-kicker::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--brand-soft), transparent);
}

.artifact-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.3rem, 2.2vw, 1.8rem);
  line-height: 1.38;
  letter-spacing: 0.005em;
}

.artifact-subtitle {
  margin: 8px 0 0;
  color: var(--ink-muted);
  font-size: 0.83rem;
  line-height: 1.6;
}

.artifact-excerpt {
  margin: 16px 0 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.8;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.artifact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 16px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--surface-tint);
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 500;
}

.meta-chip strong {
  color: var(--ink);
  font-weight: 700;
}

.audit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px dashed var(--line);
}

.audit-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 0.73rem;
}

.audit-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.audit-item.is-warn .audit-dot {
  background: var(--amber);
}

.audit-item.is-block .audit-dot {
  background: var(--red);
}

.artifact-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding-top: 20px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: 0;
  border-radius: 11px;
  background: var(--ink);
  color: #fff9f1;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.btn-primary:hover {
  background: #1f1813;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(44, 35, 28, 0.2);
}

.btn-primary .arrow {
  transition: transform 0.16s ease;
}

.btn-primary:hover .arrow {
  transform: translateX(2px);
}

.btn-soft {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.btn-soft:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-color: #e6c7b5;
}

.btn-soft[disabled] {
  opacity: 0.55;
  cursor: default;
}

/* 页面缩略图条 ------------------------------------------------------ */
.artifact-pages {
  padding: 0 26px 22px;
}

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

.pages-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
}

.pages-count {
  font-size: 0.7rem;
  color: var(--ink-muted);
}

.pages-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 3px 2px 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.page-thumb {
  position: relative;
  flex: 0 0 92px;
  width: 92px;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  padding: 0;
  background: var(--surface-tint);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.page-thumb:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: 0 10px 22px rgba(80, 54, 33, 0.13);
}

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

.page-thumb .thumb-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  padding: 9px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.thumb-fallback::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(35, 26, 19, 0.02) 25%, rgba(35, 26, 19, 0.7) 100%);
}

.thumb-fallback strong {
  position: relative;
  z-index: 1;
  color: #fff8ef;
  font-size: 0.58rem;
  line-height: 1.45;
  text-align: left;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.thumb-fallback.is-blank {
  background: linear-gradient(155deg, #f7ecdf, #eeddca);
  justify-content: center;
}

.thumb-fallback.is-blank::before {
  display: none;
}

.thumb-fallback.is-blank strong {
  color: var(--ink-soft);
}

.page-thumb .page-no {
  position: absolute;
  left: 6px;
  top: 6px;
  z-index: 2;
  min-width: 22px;
  height: 19px;
  padding: 0 5px;
  border-radius: 6px;
  background: rgba(32, 24, 18, 0.62);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.page-thumb.is-current {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(181, 81, 42, 0.18);
}

/* 完整文案 ---------------------------------------------------------- */
.copy-full {
  margin: 0 26px 24px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}

.copy-full h4 {
  margin: 0 0 8px;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
}

.copy-full h4:not(:first-child) {
  margin-top: 18px;
}

.copy-title-option {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 0.84rem;
  line-height: 1.6;
  padding: 4px 0;
}

.copy-title-option span {
  flex-shrink: 0;
  color: var(--brand);
  font-size: 0.68rem;
  font-weight: 700;
}

.copy-body {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.83rem;
  line-height: 1.85;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 360px;
  overflow-y: auto;
}

.copy-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.copy-tag {
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.72rem;
}

.artifact-footnote {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 26px 16px;
  color: var(--ink-muted);
  font-size: 0.68rem;
  line-height: 1.5;
}

.artifact-footnote::before {
  content: "ⓘ";
  font-size: 0.8rem;
}

/* ------------------------------------------------------------------ */
/* 输入区                                                             */
/* ------------------------------------------------------------------ */
.composer-slot {
  position: sticky;
  bottom: 0;
  z-index: 8;
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 30px 0 16px;
  background: linear-gradient(180deg, rgba(244, 237, 227, 0), rgba(244, 237, 227, 0.92) 34%, var(--paper) 65%);
}

.composer {
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: rgba(255, 253, 249, 0.96);
  box-shadow: 0 18px 48px rgba(75, 48, 27, 0.13);
  padding: 14px 14px 10px;
  backdrop-filter: blur(12px);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.composer:focus-within {
  border-color: #c8aa92;
  box-shadow: 0 22px 56px rgba(75, 48, 27, 0.18);
}

.composer textarea {
  width: 100%;
  min-height: 46px;
  max-height: 180px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.7;
  padding: 4px 6px 8px;
}

.composer textarea::placeholder {
  color: #b4a596;
}

.composer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 0 4px;
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.produce-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.77rem;
  font-weight: 700;
  padding: 8px 12px;
  transition: background 0.16s ease, transform 0.16s ease;
}

.produce-btn:hover {
  background: #f0d3c1;
  transform: translateY(-1px);
}

.produce-btn[disabled] {
  opacity: 0.55;
  cursor: default;
  transform: none;
}

.produce-btn .spark {
  font-size: 0.9rem;
}

.composer-hint {
  color: var(--ink-muted);
  font-size: 0.7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.send-btn {
  flex-shrink: 0;
  border: 0;
  border-radius: 11px;
  background: var(--ink);
  color: #fff8ef;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 9px 16px;
  transition: background 0.16s ease, transform 0.16s ease;
}

.send-btn:hover {
  background: #1f1813;
  transform: translateY(-1px);
}

.send-btn[disabled] {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

.page-hint {
  margin: 8px 4px 0;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.66rem;
  letter-spacing: 0.01em;
}

/* ------------------------------------------------------------------ */
/* Toast                                                              */
/* ------------------------------------------------------------------ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 80;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 11px;
  background: rgba(34, 26, 19, 0.92);
  color: #fff8ef;
  font-size: 0.78rem;
  box-shadow: 0 14px 32px rgba(34, 26, 19, 0.26);
  animation: toastIn 0.2s ease both;
}

/* ------------------------------------------------------------------ */
/* 动画                                                               */
/* ------------------------------------------------------------------ */
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@keyframes slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(260%); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ------------------------------------------------------------------ */
/* 响应式                                                             */
/* ------------------------------------------------------------------ */
@media (max-width: 1080px) {
  .studio-shell {
    grid-template-columns: 246px minmax(0, 1fr);
  }

  .artifact-body {
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 22px;
  }
}

@media (max-width: 920px) {
  .studio-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .works-rail {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(310px, 86vw);
    transform: translateX(-104%);
    transition: transform 0.22s ease;
    box-shadow: 20px 0 60px rgba(44, 35, 28, 0.12);
  }

  .works-rail.open {
    transform: translateX(0);
  }

  .rail-close {
    display: block;
  }

  .menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .chat-top {
    padding: 16px 18px 12px;
  }

  .chat-scroll {
    padding: 8px 18px 0;
  }

  .thread {
    padding-bottom: 200px;
  }

  .top-actions .user-chip {
    display: none;
  }
}

@media (max-width: 680px) {
  .chat-heading h1 {
    font-size: 1.05rem;
  }

  .chat-heading p {
    display: none;
  }

  .btn-outline {
    padding: 8px 11px;
    font-size: 0.74rem;
  }

  .msg-body {
    max-width: 88%;
  }

  .artifact-head {
    padding: 13px 16px;
  }

  .artifact-status {
    display: none;
  }

  .artifact-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 18px 18px 14px;
  }

  .artifact-cover {
    width: min(240px, 72%);
    margin: 0 auto;
  }

  .artifact-detail {
    text-align: left;
  }

  .artifact-pages {
    padding: 0 18px 18px;
  }

  .page-thumb {
    flex-basis: 78px;
    width: 78px;
  }

  .copy-full {
    margin: 0 18px 18px;
  }

  .artifact-footnote {
    padding: 10px 18px 14px;
  }

  .composer-slot {
    padding: 22px 0 10px;
  }

  .composer-hint {
    display: none;
  }

  .onboarding {
    padding: 24px 20px;
  }

  .onboarding h2 {
    font-size: 1.3rem;
  }
}

/* 正文消息 ---------------------------------------------------------- */
.msg-copy .msg-body {
  width: min(760px, 100%);
  max-width: min(760px, 100%);
}

.copy-bubble {
  white-space: normal;
  padding: 18px 22px 16px;
}

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

.copy-kicker {
  color: var(--brand);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.copy-mini {
  flex-shrink: 0;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--ink-muted);
  font-size: 0.68rem;
  font-weight: 600;
  transition: background 0.16s ease, color 0.16s ease;
}

.copy-mini:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.copy-strategy {
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 8px 11px;
}

.copy-strategy summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  cursor: pointer;
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-weight: 600;
  list-style: none;
}

.copy-strategy summary::-webkit-details-marker {
  display: none;
}

.copy-strategy summary span {
  color: var(--brand-dark);
  letter-spacing: 0.06em;
}

.copy-strategy summary small {
  font-weight: 500;
  color: var(--ink-muted);
}

.copy-strategy-body {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  color: var(--ink-muted);
  font-size: 0.76rem;
  line-height: 1.65;
}

.copy-strategy-body p {
  margin: 0 0 4px;
}

.copy-strategy-body b {
  color: var(--ink);
  font-weight: 600;
  margin-right: 8px;
}

.copy-strategy-body ol {
  margin: 6px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

.copy-strategy-body li b {
  display: block;
  margin-right: 0;
}

.copy-headline {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: 1.16rem;
  line-height: 1.55;
  letter-spacing: 0.005em;
  color: var(--ink);
}

.copy-alts {
  margin-top: 2px;
}

.copy-divider {
  height: 1px;
  margin: 14px 0;
  background: var(--line);
}

.copy-text {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.9;
}

.copy-foot {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  color: var(--ink-muted);
  font-size: 0.68rem;
  line-height: 1.6;
}

/* 编辑器弹层 -------------------------------------------------------- */
body.modal-open {
  overflow: hidden;
}

.editor-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(31, 23, 17, 0.62);
  backdrop-filter: blur(7px);
}

.editor-modal[hidden] {
  display: none;
}

.editor-modal-card {
  display: flex;
  flex-direction: column;
  width: min(1240px, 96vw);
  height: min(920px, 92vh);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 40px 100px rgba(18, 12, 8, 0.5);
}

.editor-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.editor-modal-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.editor-modal-kicker {
  color: var(--brand);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.15em;
}

#editorModalTitle {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.editor-modal-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 1.3rem;
  line-height: 1;
  transition: background 0.16s ease, color 0.16s ease;
}

.editor-modal-close:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

#editorFrame {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
  background: #fff;
}

@media (max-width: 720px) {
  .editor-modal {
    padding: 0;
  }

  .editor-modal-card {
    width: 100vw;
    height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .editor-modal-head {
    padding: 10px 12px;
  }

  .editor-modal-actions .btn-outline {
    display: none;
  }

  .copy-bubble {
    padding: 16px 16px 14px;
  }
}
