/* 第 8 轮：顶层浮层、稳定几何与集中尺寸变量。 */
:root[data-g20271-chulian] {
  --prototype-h: 0px;
  --home-content-max: 1120px;
  --home-title-size: 48px;
  --home-title-line: 60px;
  --composer-min-h: 132px;
  --composer-slot-h: 132px;
  --composer-footer-h: 160px;
  --tool-icon-size: 18px;
  --account-menu-w: 320px;
  --account-menu-pad: 8px;
  --account-menu-head-h: 48px;
  --account-menu-item-h: 32px;
  --account-menu-gap: 2px;
  --prototype-launcher-h: 36px;
  --prototype-panel-w: 680px;
}

/* 产品界面从 y=0 开始；演示控制条仅为左下角浮层。 */
.app-shell { height: 100dvh; }
.prototype-bar {
  position: fixed;
  z-index: 10020;
  left: 12px;
  right: auto;
  top: auto;
  bottom: 12px;
  display: block;
  width: auto;
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
}
.prototype-launcher {
  height: var(--prototype-launcher-h);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-pill);
  background: var(--glass-strong);
  color: var(--muted);
  box-shadow: var(--shadow-float);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  font-size: var(--text-xs);
}
.prototype-launcher:hover, .prototype-launcher[aria-expanded='true'] { background: var(--surface-3); color: var(--ink); }
.prototype-panel {
  position: absolute;
  left: 0;
  bottom: calc(var(--prototype-launcher-h) + 8px);
  width: min(var(--prototype-panel-w), calc(100vw - 24px));
  max-height: calc(100dvh - var(--prototype-launcher-h) - 32px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  overflow: auto;
  scrollbar-gutter: stable;
  padding: 12px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-popover);
  background: var(--glass-strong);
  box-shadow: var(--shadow-float);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}
.prototype-panel[hidden] { display: none !important; }
.prototype-panel .prototype-identity { min-height: 24px; }
.prototype-panel .prototype-noop { display: inline; }
.prototype-panel .prototype-pages {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  overflow: visible;
}
.prototype-panel .prototype-pages button { flex: 1 0 auto; }
.prototype-panel .prototype-variants { display: flex; flex: none; align-self: flex-start; }
.prototype-panel .prototype-controls { justify-content: space-between; }
.prototype-panel .motion-toggle > span:last-child { display: inline; }

/* 菜单挂在 body 直属根节点，和页头、页面卡片不在同一层叠上下文。 */
#account-menu-root { position: fixed; inset: 0; z-index: 10010; pointer-events: none; }
.r7-avatar-menu {
  position: fixed;
  z-index: 1;
  top: 0;
  right: 0;
  width: min(var(--account-menu-w), calc(100vw - 16px));
  max-height: 225px;
  overflow: auto;
  scrollbar-gutter: stable;
  padding: var(--account-menu-pad);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--glass-strong);
  box-shadow: var(--shadow-float);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  pointer-events: auto;
}
.r7-profile-head {
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  height: var(--account-menu-head-h);
  min-height: var(--account-menu-head-h);
  padding: 4px;
}
.r7-profile-name { min-width: 0; display: flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.r7-profile-head .r7-profile-name strong, .r7-profile-head .r7-profile-name span { display: inline; }
.r7-profile-head .r7-profile-name strong { font-size: 13px; line-height: 18px; }
.r7-profile-head .r7-profile-name span { overflow: hidden; color: var(--muted); font-size: 11px; line-height: 16px; text-overflow: ellipsis; }
.r7-profile-balance { display: flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.r7-profile-head .r7-profile-balance small { display: inline; font-size: 11px; line-height: 16px; }
.r7-profile-balance b { display: inline; font-size: 15px; line-height: 20px; }
.r7-avatar-menu .r7-recharge { height: 28px; min-height: 28px; padding: 0 10px; font-size: 12px; }
.r7-avatar-menu .r7-menu-links { gap: var(--account-menu-gap); }
.r7-avatar-menu .r7-menu-grid, .r7-avatar-menu .r7-menu-footer { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 4px; }
.r7-avatar-menu .r7-menu-links button {
  min-width: 0;
  min-height: var(--account-menu-item-h);
  height: var(--account-menu-item-h);
  gap: 6px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
}
.r7-avatar-menu .r7-menu-links svg { width: 16px; height: 16px; }
.r7-avatar-menu .r7-menu-divider { height: 1px; margin: 4px 0; }
.r7-avatar-menu .r7-menu-hint { font-size: 11px; }

/* 纯图标按钮不包含一个占 flex 间距的空文字节点。 */
.tool-btn > span:empty { display: none; }
.tool-btn svg { width: var(--tool-icon-size); height: var(--tool-icon-size); margin: 0; }
.icon-btn, .send-button:not(.script):not(.generate), .card-more, .prototype-icon, .play-button,
.new-project-plus, .new-asset-plus { align-items: center; justify-items: center; justify-content: center; }
.icon-btn > svg, .send-button > svg, .card-more > svg, .prototype-icon > svg, .play-button svg,
.new-project-plus > svg, .new-asset-plus > svg { margin: 0; }

/* 输入框外框和占位始终存在；附件、错误与队列信息使用浮层。 */
.composer { min-height: var(--composer-min-h); }
.home-composer-wrap, .master-footer [data-composer-slot] { min-height: var(--composer-slot-h); }
.chat-footer-inner { min-height: var(--composer-footer-h); }
.composer.is-collapsed {
  height: var(--composer-min-h);
  min-height: var(--composer-min-h);
  max-height: var(--composer-min-h);
  padding: var(--s4) var(--s5) var(--s3);
}
.composer.compact.is-collapsed { padding: var(--s3) var(--s4) var(--s2); }
.home-page .composer.is-collapsed { width: 100%; }
.r7-home .skill-suggestions { grid-template-rows: 1fr; opacity: 1; }
.composer-attachments {
  position: absolute;
  z-index: 12;
  left: 8px;
  right: 8px;
  bottom: calc(100% + 8px);
  max-height: 76px;
  margin: 0;
  padding: 8px;
  overflow: auto;
  scrollbar-gutter: stable;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-object);
  background: var(--glass-strong);
  box-shadow: var(--shadow-float);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
.composer-error, .queue-row {
  position: absolute;
  z-index: 11;
  top: calc(100% + 4px);
  left: 8px;
  right: 8px;
  margin: 0;
  padding: 4px 8px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--glass-strong);
  box-shadow: var(--shadow-1);
}

/* 选中只用内阴影/颜色；卡片重渲染不再重播位移动画。 */
.quick-card.is-selected, .project-home-card.is-selected, .asset-card.is-selected, .fragment-tile.is-selected {
  border-width: 1px;
  border-color: var(--selected-border);
  box-shadow: inset 0 0 0 1px var(--selected-border), var(--shadow-inset);
}
.composer.has-params .param-section.has-issue {
  margin-inline: 0;
  padding-inline: 0;
  border: 0;
  outline: 1px solid var(--error);
  outline-offset: -1px;
}
.asset-card, .history-item { animation: none; }
.asset-card, .history-item, .creation-card, .project-home-card, .quick-card, .project-card,
.r7-project-card, .r7-oneclick-card, .skill-pill, .card-more, .master-capsule,
.btn, .icon-btn, .send-button { transition-property: background-color, border-color, color, box-shadow, opacity; }
.asset-card:hover, .creation-card:hover, .project-home-card:hover, .quick-card:hover, .project-card:hover,
.r7-project-card:hover, .r7-oneclick-card:hover, .skill-pill:hover, .card-more:hover, .master-capsule:hover,
.quick-card:active, .btn:active, .icon-btn:active, .send-button:active { transform: none; }
.r7-script-source-tabs button, .r7-script-source-tabs button.is-active { font-weight: 500; }
.r7-novel-steps span.is-active, .r7-stepper > span > strong, .r7-stepper > span.is-active > strong { font-weight: 500; }
.project-content-head > .chip { min-width: 88px; justify-content: center; }
.r7-recharge-row > span { flex: 1; }
.r7-recharge-row > span b { display: inline-block; min-width: 70px; text-align: right; }
.r7-recharge-row .btn.primary { width: 140px; min-width: 140px; }

/* 滚动条出现/消失不改变内容宽度。 */
.home-page, .chat-scroll, .history-scroll, .master-body, .asset-wall, .project-stage-content,
.fragment-editor, .params-scroll, .r7-page, .r7-script-pane, .r7-script-result-card,
.r7-flow-body, .r7-flow-progress { scrollbar-gutter: stable; }

.r7-home .home-content { max-width: var(--home-content-max); }
.r7-home .art-title { font-size: var(--home-title-size); line-height: var(--home-title-line); }

@media (max-width: 700px) {
  :root[data-g20271-chulian] { --home-title-size: 36px; --home-title-line: 46px; }
  .prototype-panel { width: calc(100vw - 24px); }
  .prototype-panel .prototype-pages button { padding-inline: 9px; }
  .r7-avatar-menu { right: 8px; }
  .chat-footer-inner { min-height: var(--composer-footer-h); }
}
