html, body {
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 16px 44px;
  background: #ffffff;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: #5d6b79;
}

/* p5 会把 canvas 放进它自己创建的 <main> 里，用 order 控制顺序：说明 → 画布 → 视频 */
body > main {
  order: 0;
  margin: 0;
}

canvas {
  display: block;
  border-radius: 4px;
}

.hint {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.02em;
  line-height: 1.6;
  text-align: center;
}

.hint.top {
  order: -2;
  color: #8b98a5;
}

.hint code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  background: #f1f4f7;
  padding: 1px 5px;
  border-radius: 3px;
}

.player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  order: 1;
  margin-top: 10px;
  padding-top: 22px;
  border-top: 1px solid #e8edf2;
  width: min(600px, 100%);
}

.player video {
  width: 100%;
  max-width: 600px;
  border-radius: 6px;
  background: #f3f6f8;
  box-shadow: 0 1px 2px rgba(20, 35, 50, 0.06), 0 8px 24px rgba(20, 35, 50, 0.08);
}

/* ── 被作品集内嵌时：只留画布，去掉说明与视频，避免出现内部滚动条 ── */
html.embed body {
  padding: 0;
  gap: 0;
  justify-content: center;
  min-height: 100vh;
  background: #edf2f6;
}

html.embed .hint,
html.embed .player {
  display: none;
}

html.embed canvas {
  max-width: 100%;
  height: auto;
  border-radius: 0;
}
