/* ============================================================
   创而不代 · 创作教室 — 演示站样式
   与介绍站同源视觉语言：绘本颜料 × 拟物纸感
   ============================================================ */

:root {
  --paper: #FFF7EC;
  --paper-deep: #FDEEDC;
  --surface: #FFFFFF;
  --ink: #22376B;
  --ink-soft: #5C6B94;
  --line: #EADDC8;
  --sun: #FFC531;
  --sun-soft: #FFE9A8;
  --coral: #FF7E9D;
  --coral-soft: #FFD6E2;
  --sky: #4EA8DE;
  --sky-soft: #CFE9F8;
  --leaf: #4CB782;
  --leaf-soft: #D8F0E2;
  --grape: #8B5CF6;

  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --shadow: 0 12px 28px -14px rgba(34, 55, 107, 0.16);

  --font-display: "ZCOOL KuaiLe", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --font-body: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

/* 纸纹肌理 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='260' height='260' filter='url(%23n)'/%3E%3C/svg%3E");
}

button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 6px; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  z-index: 300;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ---------- 顶栏 ---------- */
.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 2.5px solid var(--ink);
}
.app-brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  height: 42px;
  width: auto;
  border-radius: 9px;
}
.app-name {
  font-family: var(--font-display);
  font-size: 21px;
  letter-spacing: 0.03em;
}
.demo-chip {
  padding: 2px 10px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink);
  background: var(--sun-soft);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  transform: rotate(-2deg);
}
.app-link {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 6px 12px;
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease;
}
.app-link:hover { background: var(--sun-soft); color: var(--ink); }

/* ---------- 步骤进度 ---------- */
.steps {
  padding: 14px 24px;
  background: var(--paper-deep);
  border-bottom: 1.5px solid var(--line);
}
.steps-track {
  display: flex;
  gap: 10px;
  max-width: 1080px;
  margin: 0 auto;
}
.step-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 9px 14px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-soft);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.35s ease;
}
.step-no {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  font-size: 12px;
  background: var(--paper-deep);
  border: 1.5px solid var(--line);
  border-radius: 50%;
}
.step-pill.is-done {
  color: var(--ink);
  border-color: var(--leaf);
  background: var(--leaf-soft);
}
.step-pill.is-done .step-no {
  background: var(--leaf);
  border-color: var(--ink);
  color: var(--surface);
}
.step-pill.is-current {
  color: var(--ink);
  border-color: var(--ink);
  background: var(--sun);
  box-shadow: 3px 3px 0 rgba(34, 55, 107, 0.22);
}
.step-pill.is-current .step-no {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--sun);
}

/* ---------- 主工作区 ---------- */
.studio {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px 24px;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  min-height: 0;
  overflow-y: auto;
}

.chat-panel,
.create-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.create-panel { gap: 14px; }

.chat-panel {
  background: var(--surface);
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 5px 6px 0 var(--sun-soft);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px;
  background: var(--paper-deep);
  border-bottom: 2px solid var(--ink);
}
.panel-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 16.5px;
  letter-spacing: 0.03em;
}
.panel-note { font-size: 12px; color: var(--ink-soft); }

/* 对话 */
.chat-log {
  flex: 1;
  min-height: 150px;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface);
}

.msg {
  max-width: 88%;
  padding: 11px 15px;
  font-size: 14.5px;
  line-height: 1.8;
  border: 2px solid var(--ink);
  border-radius: 15px;
  animation: msgIn 0.4s cubic-bezier(0.34, 1.4, 0.64, 1) backwards;
}
.msg-ai {
  align-self: flex-start;
  background: var(--paper);
  border-bottom-left-radius: 4px;
}
.msg-kid {
  align-self: flex-end;
  background: var(--sky-soft);
  border-bottom-right-radius: 4px;
}
.msg-name {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin-bottom: 3px;
}
.msg-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 5px;
  padding: 13px 18px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 15px;
  border-bottom-left-radius: 4px;
}
.msg-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-soft);
  animation: typingBounce 1s ease-in-out infinite;
}
.msg-typing i:nth-child(2) { animation-delay: 0.15s; }
.msg-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-4px); opacity: 1; }
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

/* 选项 / 输入 */
.chat-actions {
  border-top: 2px solid var(--ink);
  padding: 13px 14px;
  background: var(--paper-deep);
  min-height: 64px;
  flex-shrink: 0;
  max-height: 42%;
  overflow-y: auto;
}
.action-hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 9px;
}
.option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.option-btn {
  padding: 9px 15px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: 999px;
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}
.option-btn:hover {
  transform: translateY(-2px);
  background: var(--sun-soft);
  box-shadow: 2px 3px 0 rgba(34, 55, 107, 0.18);
}
.option-btn:active { transform: translateY(0); }

.input-row { display: flex; gap: 8px; }
.input-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: 999px;
}
.input-row input::placeholder { color: var(--ink-soft); opacity: 0.7; }
.input-row button {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  color: var(--surface);
  background: var(--ink);
  border-radius: 999px;
}
.input-row button:hover { background: #2e4a86; }

/* ---------- 构思墙 ---------- */
.idea-wall,
.canvas-wrap {
  background: var(--surface);
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.idea-wall {
  flex: 0 0 auto;
}

.notes-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 16px 10px;
  min-height: 74px;
  max-height: 168px;
  overflow-y: auto;
}
.notes-empty {
  margin: 4px 0;
  font-size: 13px;
  color: var(--ink-soft);
}
.note {
  position: relative;
  max-width: 220px;
  padding: 12px 14px 14px;
  font-family: var(--font-display);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 4px 4px 14px 4px;
  box-shadow: 3px 4px 0 rgba(34, 55, 107, 0.14);
  animation: noteStick 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
.note::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  width: 34px;
  height: 14px;
  transform: translateX(-50%) rotate(-3deg);
  background: rgba(255, 255, 255, 0.75);
  border: 1.5px solid rgba(34, 55, 107, 0.35);
}
.note:nth-child(2n) { transform: rotate(1.6deg); background: var(--sun-soft); }
.note:nth-child(2n + 1) { transform: rotate(-1.4deg); background: var(--coral-soft); }
.note:nth-child(3n) { background: var(--sky-soft); }
.note:nth-child(4n) { background: var(--leaf-soft); }
@keyframes noteStick {
  from { opacity: 0; transform: translateY(-16px) rotate(-8deg) scale(0.85); }
}

.plan-card {
  margin: 4px 16px 16px;
  padding: 14px 16px;
  background: var(--sun-soft);
  border: 2px dashed var(--ink);
  border-radius: var(--radius-sm);
  animation: msgIn 0.5s ease backwards;
}
.plan-tag {
  display: inline-block;
  margin-bottom: 6px;
  padding: 2px 10px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: var(--ink);
  color: var(--sun);
  border-radius: 4px;
}
.plan-card p {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15.5px;
  line-height: 1.7;
}

/* ---------- 画板 ---------- */
.canvas-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 320px;
}

.canvas-status {
  padding: 3px 11px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 999px;
  background: var(--line);
  color: var(--ink-soft);
  white-space: nowrap;
}
.canvas-status[data-state="unlocked"] {
  background: var(--leaf-soft);
  color: #1c5c3e;
}

.paper {
  position: relative;
  flex: 1;
  min-height: 260px;
  background: #FFFDF8;
  background-image:
    radial-gradient(rgba(34, 55, 107, 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
}
.paper canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: none;
  touch-action: none;
}
.paper.is-locked canvas { cursor: default; }

.paper-lock {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  background: rgba(255, 247, 236, 0.88);
  transition: opacity 0.45s ease;
}
.paper-lock p {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--ink-soft);
}
.paper.is-unlocked .paper-lock {
  opacity: 0;
  pointer-events: none;
}

.brush-cursor {
  position: absolute;
  border: 2px solid var(--ink);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.75;
  transform: translate(-50%, -50%);
  z-index: 5;
}

/* 工具栏 */
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 11px 14px;
  background: var(--paper-deep);
  border-top: 2px solid var(--ink);
}
.palette { display: flex; gap: 7px; }
.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  transition: transform 0.15s ease;
}
.swatch:hover { transform: scale(1.14); }
.swatch.is-active {
  transform: scale(1.18);
  box-shadow: 0 0 0 2.5px var(--surface), 0 0 0 5px var(--ink);
}

.tool-group {
  display: flex;
  gap: 6px;
  padding: 3px;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: 999px;
}
.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 30px;
  padding: 0 11px;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 999px;
  color: var(--ink);
}
.tool-btn:hover { background: var(--sun-soft); }
.tool-btn.is-active {
  background: var(--ink);
  color: var(--sun);
}
.tool-save {
  background: var(--coral-soft);
}
.tool-save:hover { background: var(--coral); }

/* ---------- 过程记录 ---------- */
.process {
  background: var(--ink);
  color: rgba(255, 255, 255, 0.82);
}
.process-box {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
}
.process-box summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  cursor: pointer;
  list-style: none;
}
.process-box summary::-webkit-details-marker { display: none; }
.process-title {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.05em;
  color: var(--sun);
}
.process-meta { font-size: 12px; opacity: 0.75; }

.process-log {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 0 0 16px;
  max-height: 148px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
}
.process-empty { font-size: 12.5px; opacity: 0.6; }
.log-item {
  padding: 5px 12px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  animation: msgIn 0.35s ease backwards;
}
.log-item b {
  color: var(--sun);
  font-weight: 700;
  margin-right: 4px;
}
.process-foot {
  margin: 0;
  padding: 10px 24px 14px;
  font-size: 11.5px;
  text-align: center;
  opacity: 0.55;
}

/* ---------- 创作小结 ---------- */
.summary-card {
  margin: 6px 0 10px;
  padding: 18px;
  background: var(--paper);
  border: 2.5px dashed var(--ink);
  border-radius: var(--radius-md);
  animation: summaryFlip 0.7s cubic-bezier(0.34, 1.4, 0.64, 1) backwards;
}
@keyframes summaryFlip {
  from { opacity: 0; transform: rotateX(28deg) translateY(18px); }
  to { opacity: 1; transform: none; }
}
.summary-card h2 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.03em;
}
.summary-card .summary-sub {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.summary-list {
  display: grid;
  gap: 9px;
  margin: 0 0 16px;
}
.summary-list li {
  padding: 9px 13px;
  font-size: 13.5px;
  background: var(--surface);
  border: 1.8px solid var(--ink);
  border-radius: var(--radius-sm);
}
.summary-list b {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}
.summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
.summary-actions button {
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: 999px;
  border: 2px solid var(--ink);
}
.btn-save {
  background: var(--sun);
  color: var(--ink);
}
.btn-restart {
  background: var(--surface);
}
.btn-save:hover { background: var(--sun-soft); }
.btn-restart:hover { background: var(--paper-deep); }

/* ---------- 响应式 ---------- */
@media (max-width: 880px) {
  html, body { height: auto; }
  .studio {
    display: flex;
    flex-direction: column;
    overflow: visible;
  }
  .chat-panel { max-height: none; }
  .chat-log { min-height: 200px; max-height: 380px; }
  .canvas-wrap { min-height: 460px; }
  .steps-track { overflow-x: auto; padding-bottom: 4px; }
  .step-pill { flex: 0 0 auto; }
}

@media (max-width: 620px) {
  .app-bar { padding: 10px 14px; }
  .app-name { font-size: 17px; }
  .demo-chip { display: none; }
  .steps { padding: 10px 14px; }
  .studio { padding: 12px 12px; }
  .process-box { padding: 0 14px; }
  .toolbar { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ============================================================
   特效层 · 溅射粒子 / 步骤动效 / 漂浮色块
   ============================================================ */

/* 背景漂浮色块 */
body::after {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(220px 160px at 12% 28%, rgba(255, 197, 49, 0.14), transparent 70%),
    radial-gradient(260px 190px at 86% 18%, rgba(255, 126, 157, 0.12), transparent 70%),
    radial-gradient(240px 200px at 74% 82%, rgba(78, 168, 222, 0.12), transparent 70%),
    radial-gradient(200px 170px at 18% 88%, rgba(76, 183, 130, 0.11), transparent 70%);
  animation: dabDrift 26s ease-in-out infinite alternate;
}
@keyframes dabDrift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(2.5%, -2%, 0) scale(1.06); }
}

/* 步骤条：当前步骤渐变呼吸 */
.step-pill { position: relative; overflow: hidden; }
.step-pill.is-current::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    transparent 20%,
    rgba(255, 255, 255, 0.55) 45%,
    transparent 70%
  );
  transform: translateX(-120%);
  animation: stepShine 2.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes stepShine {
  0% { transform: translateX(-120%); }
  55%, 100% { transform: translateX(160%); }
}

/* 颜料溅射 / 彩纸 */
.splash-dot {
  position: fixed;
  z-index: 250;
  width: 9px;
  height: 9px;
  border-radius: 52% 48% 55% 45%;
  pointer-events: none;
  animation: splashFly 0.66s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
.splash-dot.confetti {
  width: 11px;
  height: 14px;
  border-radius: 3px;
  animation: confettiFall 1.15s cubic-bezier(0.2, 0.65, 0.35, 1) forwards;
}
@keyframes splashFly {
  0% { transform: translate(0, 0) scale(1); opacity: 0.95; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.15) rotate(60deg); opacity: 0; }
}
@keyframes confettiFall {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}

/* 作画飞溅光点 */
.spark {
  position: absolute;
  z-index: 6;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  pointer-events: none;
  animation: sparkFade 0.5s ease-out forwards;
}
@keyframes sparkFade {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(0.1) translateY(-14px); opacity: 0; }
}

/* 便签贴上时的强调闪光 */
.note { transition: transform 0.25s ease; }
.note:hover { transform: rotate(0deg) scale(1.05) !important; z-index: 2; }

@media (prefers-reduced-motion: reduce) {
  body::after { animation: none; }
  .step-pill.is-current::before { animation: none; display: none; }
  .splash-dot, .spark { display: none; }
}
