/* ==============================================================
   D5tour · 编辑页共用组件层（d5ui）
   --------------------------------------------------------------
   用途：登录页 / 仪表盘 / 上传页 / 项目编辑器 共用。

   ⚠️ 设计令牌的唯一真相源是 `site/styles.css` 的 `:root`，
      本文件【不重复定义】任何颜色/圆角/字号变量，只消费。
      因此引用本文件时【必须先加载 site/styles.css】：
          <link rel="stylesheet" href="/styles.css">
          <link rel="stylesheet" href="/assets/css/d5ui.css">

   命名：全部 `d5-` 前缀，与官网主页的 `.nav/.hero/.btn` 零冲突
        （官网不加载本文件，本文件后加载也不会被官网样式影响）。

   纯静态 · 零外部请求（图标全内联 SVG）
   ============================================================== */

/* --------------------------------------------------------------
   〇 语义色补充（★ 与 styles.css 的 :root 不重复，是"新增"不是"另立"）
   --------------------------------------------------------------
   styles.css 只定义了**品牌色阶**（--brand / --bg / --text / --line）；
   编辑页还需要一套**校验三色**（错误/警告/成功）用于徽标、行内提示、横幅。
   定义在这里，避免同一组颜色在 6 个地方各硬编码一次。
   -------------------------------------------------------------- */

:root {
  --d5-danger:      #ff8080;
  --d5-danger-bg:   rgba(255, 128, 128, 0.10);
  --d5-danger-line: rgba(255, 128, 128, 0.32);

  --d5-warn:        #ffc766;
  --d5-warn-bg:     rgba(255, 199, 102, 0.08);
  --d5-warn-line:   rgba(255, 199, 102, 0.32);

  /* 浮层底色：比 --bg-alt 更亮一档，保证 toast/模态在深色底上"浮起来" */
  --d5-elev-1:      #10161e;
  --d5-elev-2:      #141a22;
}

/* --------------------------------------------------------------
   ⓪ [hidden] 全局兜底 —— ⭐ 必须放在最前，且必须 !important
   --------------------------------------------------------------
   坑（实测踩过 4 次）：`.d5-btn{display:inline-flex}`、`.d5-kv{display:grid}`、
   `.d5-tabs{display:grid}`、`.d5-reveal{display:flex}` 这类**作者样式**里的
   `display` 会盖掉浏览器默认的 `[hidden]{display:none}`（作者样式 > UA 样式），
   于是 `el.hidden = true` 写着"隐藏"，画面上照样显示。

   以前是逐个打补丁（`.d5-tabs[hidden]` / `.d5-reveal[hidden]` / `.d5-modal[hidden]`），
   每新增一个带 display 的组件就漏一次。改成一处全局兜底。
   实测后果：上传页在「无法继续」时仍然把「仍然继续」按钮显示出来。 */
[hidden] { display: none !important; }

/* --------------------------------------------------------------
   ① 页面骨架
   -------------------------------------------------------------- */

.d5-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1000px 520px at 50% -12%, rgba(0, 226, 255, 0.10), transparent 62%),
    var(--bg);
}

/* 顶栏：窄，只在编辑页出现，不用官网那套带锚点导航的 .nav */
.d5-topbar {
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 13, 18, 0.72);
  backdrop-filter: blur(10px);
}

.d5-topbar__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.d5-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  transition: color 0.2s;
}

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

.d5-brand__logo {
  width: 26px;
  height: 26px;
  color: var(--brand);
  display: inline-flex;
  flex-shrink: 0;
}

.d5-brand__logo svg { width: 100%; height: 100%; }

.d5-topbar__side {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13.5px;
  color: var(--text-dim);
}

.d5-topbar__side a { transition: color 0.2s; white-space: nowrap; }
.d5-topbar__side a:hover { color: var(--brand); }

/* 主区：垂直水平居中（登录页用）；仪表盘用 .d5-main--top */
.d5-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px var(--pad);
}

.d5-main--top { align-items: flex-start; padding-top: 40px; }

.d5-wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; }

/* --------------------------------------------------------------
   ② 卡片
   -------------------------------------------------------------- */

.d5-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}

.d5-card--auth {
  width: 100%;
  max-width: 420px;
  padding: 30px 28px 26px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.9);
}

.d5-card__title {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.d5-card__desc {
  margin: 0 0 22px;
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.7;
}

/* --------------------------------------------------------------
   ③ Tab（微信 / 账号密码）
      只有一个 Tab 时 JS 不渲染 .d5-tabs，避免"点不动的二维码"
   -------------------------------------------------------------- */

.d5-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 22px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.d5-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}

.d5-tab:hover { color: var(--text); }

.d5-tab.is-active {
  background: var(--brand-dim);
  color: var(--brand);
  font-weight: 600;
}

.d5-tabs[hidden] { display: none; }   /* 已被 ⓪ 的全局兜底覆盖，保留仅为可读性 */

/* --------------------------------------------------------------
   ④ 表单控件
   -------------------------------------------------------------- */

.d5-field { margin-bottom: 16px; }

/* ⚠️ 不要用 justify-content: space-between —— 标签行有三个子元素
   （文字 / 必填星号 / 右侧说明），space-between 会把星号甩到行中间，
   看起来像"密码 * 至少 8 位"三栏对齐，实际是排版事故（截图实测）。
   正确做法：靠左排列，只把最后的说明用 margin-left:auto 顶到右边。 */
.d5-label {
  display: flex;
  align-items: baseline;
  margin-bottom: 7px;
  font-size: 13px;
  color: var(--text-dim);
}

.d5-label b {
  color: var(--d5-danger);
  font-weight: 400;
  margin-left: 3px;
  font-size: 14px;
  line-height: 1;
}

.d5-label > span {
  margin-left: auto;
  padding-left: 12px;
  font-size: 12px;
  color: var(--text-mute);
  white-space: nowrap;
}

.d5-input {
  width: 100%;
  appearance: none;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

.d5-input::placeholder { color: var(--text-mute); }

.d5-input:hover { border-color: rgba(255, 255, 255, 0.24); }

.d5-input:focus {
  outline: none;
  border-color: var(--brand);
  background: rgba(0, 0, 0, 0.42);
  box-shadow: 0 0 0 3px rgba(0, 226, 255, 0.14);
}

.d5-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* 多行输入（项目描述）。只允许纵向拉伸 —— 横向拉会撑破卡片，
   而卡片一破，编辑器右栏就跟着被挤出视口。 */
textarea.d5-input {
  resize: vertical;
  min-height: 62px;
  line-height: 1.6;
  padding: 10px 13px;
}

.d5-input.is-error {
  border-color: var(--d5-danger);
  box-shadow: 0 0 0 3px var(--d5-danger-bg);
}

/* 深色底下的浏览器自动填充：不改写会变成白底黑字的方块 */
.d5-input:-webkit-autofill,
.d5-input:-webkit-autofill:hover,
.d5-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px #0d1219 inset;
  transition: background-color 9999s ease-out;
}

.d5-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-mute);
  line-height: 1.6;
}

/* 行内消息：默认隐藏，靠 .is-on 显示 */
.d5-msg {
  display: none;
  margin: 6px 0 0;
  font-size: 12.5px;
  line-height: 1.6;
}

.d5-msg.is-on { display: block; }
.d5-msg--err { color: var(--d5-danger); }
.d5-msg--ok { color: var(--brand); }
.d5-msg--warn { color: var(--d5-warn); }

/* 勾选行 */
.d5-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 2px 0 18px;
  font-size: 13.5px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  line-height: 1.55;
}

.d5-check input {
  appearance: none;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.32);
  cursor: pointer;
  position: relative;
  transition: border-color 0.18s, background 0.18s;
}

.d5-check input:checked {
  background: var(--brand);
  border-color: var(--brand);
}

.d5-check input:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1.5px;
  width: 4px;
  height: 8px;
  border: solid var(--brand-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.d5-check:hover input { border-color: var(--brand); }

/* 仅在勾选「我是新用户」后才出现的字段（JS 控制 hidden）—— 兜底见 ⓪ */
.d5-reveal[hidden] { display: none; }

/* --------------------------------------------------------------
   ⑤ 按钮
   -------------------------------------------------------------- */

.d5-btn {
  appearance: none;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1;
  padding: 13px 24px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s, background 0.18s, border-color 0.18s, color 0.18s, opacity 0.18s;
}

.d5-btn--primary {
  background: var(--brand);
  color: var(--brand-ink);
}

.d5-btn--primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px -12px rgba(0, 226, 255, 0.7);
}

.d5-btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line-strong);
}

.d5-btn--ghost:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }

/* 危险操作（删除项目等）——实心红，让"确认删除"看起来就是危险动作 */
.d5-btn--danger {
  background: #ff4d4f;
  color: #fff;
  border-color: #ff4d4f;
}

.d5-btn--danger:hover:not(:disabled) {
  background: #ff6b6b;
  border-color: #ff6b6b;
  transform: translateY(-1px);
  box-shadow: 0 12px 26px -12px rgba(255, 77, 79, 0.7);
}

.d5-btn--block { width: 100%; }

/* 微信一键登录 —— 用微信品牌绿。
   ⚠️ 刻意不用 --brand（青色）：这是**第三方身份入口**，用户是靠"绿色"认出
      微信的（肌肉记忆）。换成站点主题色会让它在深色底上看着像普通按钮，
      反而降低点击率。
   ⚠️ 整块是 <a> 不是 <button>：它必须让浏览器【直接导航】到
      /api/auth/wechat/start（那里会 302 到微信）。用 XHR 发起会撞
      跨域/Cookie 策略，微信授权页在 iframe 里也打不开。 */
.d5-btn--wx {
  background: #07C160;
  color: #fff;
  text-decoration: none;
}

.d5-btn--wx:hover:not(:disabled) {
  background: #06AD56;
  transform: translateY(-1px);
  box-shadow: 0 12px 26px -12px rgba(7, 193, 96, 0.75);
}

.d5-btn--wx svg { flex: none; }

/* 按钮下方的补充说明（比 .d5-hint 更弱一档，用于"为什么没自动跳"这类交代） */
.d5-hint--fine {
  margin-top: 10px;
  font-size: 12px;
  opacity: 0.72;
}

.d5-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 忙碌态：按钮内的文字前加一个转圈 */
.d5-btn.is-busy { pointer-events: none; opacity: 0.75; }

.d5-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: d5-spin 0.7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .d5-spinner { animation-duration: 2s; }
  .d5-btn, .d5-input, .d5-tab { transition: none; }
}

/* --------------------------------------------------------------
   ⑥ 底部小字 / 分隔
   -------------------------------------------------------------- */

.d5-fine {
  margin: 20px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-mute);
  text-align: center;
  line-height: 1.7;
}

.d5-fine a { color: var(--text-dim); border-bottom: 1px solid var(--line-strong); }
.d5-fine a:hover { color: var(--brand); border-color: var(--brand); }

.d5-foot {
  flex-shrink: 0;
  padding: 22px var(--pad) 30px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-mute);
}

/* --------------------------------------------------------------
   ⑥-b 键值表 / 进度条 / 通用提示块（仪表盘、编辑器用）
   -------------------------------------------------------------- */

.d5-kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 11px 20px;
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
}

.d5-kv dt { color: var(--text-mute); white-space: nowrap; }
.d5-kv dd { margin: 0; color: var(--text); word-break: break-all; }

.d5-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin: 10px 0 6px;
}

.d5-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), #6cf0ff);
  transition: width 0.3s;
}

/* 额度用满：红条 + 「已达上限」（上传页 §5.3 的同一套规则） */
.d5-bar.is-full > i { background: linear-gradient(90deg, var(--d5-danger), #ff9a6b); }

.d5-note {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--brand-dim);
  border: 1px solid var(--brand-line);
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.75;
}

.d5-note strong { color: var(--text); font-weight: 600; }

/* 待审 / 异常账号的只读横幅 */
.d5-banner {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 15px;
  margin-bottom: 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.7;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
}

.d5-banner--warn   { border-color: var(--d5-warn-line); background: var(--d5-warn-bg); }
.d5-banner--danger { border-color: var(--d5-danger-line); background: var(--d5-danger-bg); }
.d5-banner__body { flex: 1; }
.d5-banner b { color: var(--text); }

.d5-stack { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }

/* --------------------------------------------------------------
   ⑦ 徽标（状态）
   -------------------------------------------------------------- */

.d5-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--text-dim);
  white-space: nowrap;
}

.d5-badge--ok     { color: var(--brand); border-color: var(--brand-line); background: var(--brand-dim); }
.d5-badge--warn   { color: var(--d5-warn); border-color: var(--d5-warn-line); background: var(--d5-warn-bg); }
.d5-badge--danger { color: var(--d5-danger); border-color: var(--d5-danger-line); background: var(--d5-danger-bg); }
.d5-badge--mute   { color: var(--text-mute); }

/* --------------------------------------------------------------
   ⑧ Toast
   -------------------------------------------------------------- */

.d5-toasts {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: min(92vw, 420px);
}

.d5-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13.5px;
  line-height: 1.6;
  padding: 11px 15px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--d5-elev-2);
  color: var(--text);
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.9);
  animation: d5-toast-in 0.22s ease-out;
}

.d5-toast--ok     { border-color: var(--brand-line); color: var(--text); }
.d5-toast--err    { border-color: rgba(255, 128, 128, 0.38); }
.d5-toast--warn   { border-color: rgba(255, 199, 102, 0.38); }
.d5-toast.is-out  { animation: d5-toast-out 0.2s ease-in forwards; }

@keyframes d5-toast-in  { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes d5-toast-out { to { opacity: 0; transform: translateY(-8px); } }

/* --------------------------------------------------------------
   ⑨ 模态（完善资料等）
   -------------------------------------------------------------- */

.d5-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.d5-modal__mask {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 9, 0.72);
  backdrop-filter: blur(3px);
}

.d5-modal__box {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--d5-elev-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 26px 24px 22px;
  box-shadow: 0 34px 80px -34px rgba(0, 0, 0, 1);
  animation: d5-modal-in 0.2s ease-out;
}

@keyframes d5-modal-in { from { opacity: 0; transform: translateY(10px) scale(0.99); } to { opacity: 1; transform: none; } }

.d5-modal__title { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.d5-modal__desc  { margin: 0 0 20px; font-size: 13px; color: var(--text-dim); line-height: 1.7; }

.d5-modal__note {
  margin: 16px 0 0;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: rgba(0, 226, 255, 0.07);
  border: 1px solid var(--brand-line);
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.7;
}

.d5-modal__foot {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.d5-modal__foot .d5-btn { flex: 1; }

/* --------------------------------------------------------------
   ⑪ 上传页（§五：三步流程 + 三色校验清单）
   -------------------------------------------------------------- */

/* 步骤条 */
.d5-steps { display: flex; align-items: center; gap: 10px; margin: 0 0 22px; }
.d5-step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-mute); white-space: nowrap; }
.d5-step__no {
  width: 20px; height: 20px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 11.5px; font-weight: 600;
  background: rgba(255, 255, 255, .07); color: var(--text-mute);
}
.d5-step.is-on   { color: var(--text); }
.d5-step.is-on   .d5-step__no { background: var(--brand); color: var(--brand-ink); }
.d5-step.is-done .d5-step__no { background: rgba(0, 226, 255, .16); color: var(--brand); }
.d5-step__sep { flex: 1; min-width: 8px; height: 1px; background: var(--line); }

/* ⭐ 额度条 —— 铁律：必须在**选文件之前**显示（§5.3）。
   拦截要发生在上传之前，而不是切完片再说"超限"。 */
.d5-quota {
  padding: 14px 16px; margin-bottom: 22px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--line);
}
.d5-quota__row { display: flex; align-items: baseline; gap: 10px; font-size: 13.5px; }
.d5-quota__row + .d5-quota__row { margin-top: 8px; }
.d5-quota__k { color: var(--text-mute); }
.d5-quota__v { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.d5-quota__v.is-full { color: var(--d5-danger); }
.d5-quota__hint { margin-left: auto; font-size: 12.5px; color: var(--text-mute); }
.d5-quota .d5-bar { margin: 7px 0 0; }

/* 拖放区 */
.d5-drop {
  position: relative; display: block; padding: 40px 24px; text-align: center;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
  background: rgba(255, 255, 255, .02); cursor: pointer;
  transition: border-color .18s, background .18s;
}
.d5-drop:hover,
.d5-drop.is-over { border-color: var(--brand); background: var(--brand-dim); }
.d5-drop.is-over { border-style: solid; }
.d5-drop.is-disabled { cursor: not-allowed; opacity: .5; }
.d5-drop.is-disabled:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, .02); }
/* ⚠️ 这三行必须 display:block —— 它们用的是 <span>（inline），
   不给 block 的话「图标 / 主文案 / 副文案」会横向挤成一行，
   margin-bottom 对 inline 元素也无效（截图才发现）。 */
.d5-drop__icon  { display: block; color: var(--brand); margin-bottom: 12px; }
.d5-drop__icon svg { display: block; margin: 0 auto; }
.d5-drop__title { display: block; font-size: 15px; font-weight: 600; color: var(--text); }
.d5-drop__sub   { display: block; margin-top: 7px; font-size: 12.5px; color: var(--text-mute); }
.d5-drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* 上传进度（XHR upload.onprogress 驱动） */
.d5-prog { margin-top: 18px; }
.d5-prog__head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--text-dim); margin-bottom: 2px; }
.d5-prog__pct { color: var(--brand); font-weight: 600; font-variant-numeric: tabular-nums; }

/* 校验清单 —— 三色 = "能不能继续"（§5.4） */
.d5-checks { display: flex; flex-direction: column; gap: 9px; list-style: none; margin: 0; padding: 0; }
.d5-check {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 11px 13px; font-size: 13.5px; line-height: 1.65;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .025);
}
.d5-check__icon { flex: none; margin-top: 1px; width: 15px; height: 15px; }
.d5-check__body { flex: 1; min-width: 0; }
.d5-check__level { margin-right: 7px; font-size: 11.5px; color: var(--text-mute); }
.d5-check__msg { color: var(--text); }
.d5-check__details { margin: 7px 0 0; padding-left: 16px; font-size: 12.5px; color: var(--text-dim); }
.d5-check__fix { margin-top: 6px; font-size: 12.5px; color: var(--brand); }

/* 🔵 提示级（PASS 但有说明）→ 折叠，避免把阻断项挤出屏幕。
   用原生 <details>，零 JS。 */
.d5-check__more { margin-top: 7px; }
.d5-check__more > summary {
  font-size: 12.5px; color: var(--brand); cursor: pointer;
  list-style: none; width: fit-content;
}
.d5-check__more > summary::-webkit-details-marker { display: none; }
.d5-check__more > summary::before { content: '▸ '; }
.d5-check__more[open] > summary::before { content: '▾ '; }
.d5-check__more > summary:hover { text-decoration: underline; }
.d5-check.is-pass   { border-color: rgba(0, 226, 255, .22); }
.d5-check.is-warn   { border-color: var(--d5-warn-line);   background: var(--d5-warn-bg); }
.d5-check.is-fail,
.d5-check.is-reject { border-color: var(--d5-danger-line); background: var(--d5-danger-bg); }

/* 结论块 */
.d5-callout {
  padding: 14px 16px; margin-top: 20px;
  font-size: 13.5px; line-height: 1.7;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .03);
}
.d5-callout--ok     { border-color: rgba(0, 226, 255, .3); background: var(--brand-dim); }
.d5-callout--warn   { border-color: var(--d5-warn-line);   background: var(--d5-warn-bg); }
.d5-callout--danger { border-color: var(--d5-danger-line); background: var(--d5-danger-bg); }
.d5-callout b { color: var(--text); }

.d5-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

/* --------------------------------------------------------------
   ⑫ 项目编辑器（§七：基础信息 + 场景命名网格 + 发布/分享）
   -------------------------------------------------------------- */

/* 编辑器顶栏：返回 + 项目名 + 动作组。
   不复用 .d5-topbar —— 那个是「品牌 + 账号」，这里是「位置 + 项目 + 动作」。 */
.d5-appbar {
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 13, 18, 0.72);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 40;
}

.d5-appbar__inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 11px var(--pad);
  display: flex;
  align-items: center;
  gap: 14px;
}

.d5-appbar__back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  font-size: 13.5px;
  color: var(--text-dim);
  transition: color 0.2s;
}
.d5-appbar__back:hover { color: var(--brand); }
.d5-appbar__back svg { width: 15px; height: 15px; }

.d5-appbar__title {
  flex: 1;
  min-width: 0;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.d5-appbar__actions { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }

/* ---- 保存状态指示器（§7.3：自动保存 + 状态指示器）----
   三态共用一行位置，切换时不跳版：靠固定最小宽度。
   ⚠️ 这里必须写 display，所以 ⓪ 段的 [hidden] 兜底是必需的。 */
.d5-save {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 96px;
  justify-content: flex-end;
  font-size: 12.5px;
  color: var(--text-mute);
  white-space: nowrap;
}
.d5-save__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.d5-save--busy { color: var(--text-dim); }
.d5-save--busy .d5-save__dot { background: var(--d5-warn); animation: d5-pulse 1s ease-in-out infinite; }
.d5-save--ok   { color: var(--text-dim); }
.d5-save--ok .d5-save__dot { background: var(--brand); }
.d5-save--err  { color: var(--d5-danger); }
.d5-save--err .d5-save__dot { background: var(--d5-danger); }

@keyframes d5-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* 保存失败时可点，重试。其余状态 disabled（免得键盘用户撞上一个空按钮） */
button.d5-save { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-size: 12.5px; }
button.d5-save:disabled { cursor: default; }

/* ---- 主体两栏：左网格 / 右改名面板 ---- */
.d5-editor__split {
  display: grid;
  grid-template-columns: 1fr 250px;
  gap: 22px;
  align-items: start;
  margin-top: 18px;
}

/* ---- 缩略图网格：桌面 4 列（§7.2）---- */
.d5-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 11px;
}

/* ⚠️ 是 <button>，不是 <div>：整块可点、可键盘聚焦。
   正因为写了 display，才需要 ⓪ 段的 [hidden] 兜底。 */
.d5-thumb {
  display: block;
  position: relative;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color 0.18s, transform 0.18s;
}
.d5-thumb:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.d5-thumb.is-on { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }

.d5-thumb__img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 1;          /* D5 全景缩略图是 2:1 */
  object-fit: cover;
  background: var(--bg-alt);
}

.d5-thumb__name {
  display: block;
  padding: 7px 9px;
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.d5-thumb.is-on .d5-thumb__name { color: var(--text); }

/* 起始场景角标 */
.d5-thumb__badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--brand-ink);
  background: var(--brand);
  font-weight: 600;
}

/* 网格空态 */
.d5-grid__empty {
  grid-column: 1 / -1;
  padding: 30px 16px;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-mute);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
}

/* ---- 右侧改名面板（桌面常驻 / 窄屏底部抽屉，见 ⑩ 段）---- */
.d5-rename {
  position: sticky;
  top: 78px;
  padding: 16px 15px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
}
.d5-rename__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.d5-rename__ttl { font-size: 13px; font-weight: 600; color: var(--text); }
.d5-rename__close {
  display: none;                /* 仅窄屏抽屉里出现 */
  background: none;
  border: 0;
  padding: 2px;
  color: var(--text-mute);
  cursor: pointer;
  line-height: 0;
}
.d5-rename__close svg { width: 16px; height: 16px; }

.d5-rename__preview {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 1;
  object-fit: cover;
  border-radius: 6px;
  background: var(--bg-alt);
  margin-bottom: 12px;
}

.d5-rename__idx { font-size: 12px; color: var(--text-mute); margin-bottom: 9px; }

.d5-rename__tip {
  margin: 9px 0 0;
  font-size: 12px;
  color: var(--text-mute);
  line-height: 1.6;
}

/* 窄屏抽屉遮罩（桌面恒隐） */
.d5-mask {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(0, 0, 0, 0.55);
}

/* 有固定顶栏的页面（编辑器）：toast 必须让开顶栏。
   默认 .d5-toasts 在 top:18px，会正好压住顶栏里的项目名 ——
   而用户此刻正盯着那一行（保存失败时实测截图确认）。
   用 body class 而不是 :has()：不依赖新选择器支持度，也不牵连其他页面。 */
.d5-has-appbar .d5-toasts { top: 70px; }

/* ---- 分享面板（§7.4）---- */
.d5-share__url {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg-alt);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  text-overflow: ellipsis;
}
.d5-share__row { display: flex; gap: 9px; margin-top: 12px; flex-wrap: wrap; }

/* 待审提示条（发布后 review_status=pending 时） */
.d5-share__pending {
  border-color: var(--d5-warn-line);
  background: var(--d5-warn-bg);
}

/* 区块小标题（编辑器「场景命名」等）—— 18px 太大，用 15px 与卡片标题拉开层级 */
.d5-subtitle {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin: 26px 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.d5-subtitle > span { font-size: 12.5px; font-weight: 400; color: var(--text-mute); }

/* --------------------------------------------------------------
   ⑩ 响应式
   -------------------------------------------------------------- */

/* 编辑器：平板 3 列（§九 断点表 768–1024px） */
@media (max-width: 1024px) {
  .d5-grid { grid-template-columns: repeat(3, 1fr); }
}

/* 编辑器：窄屏 2 列，改名面板改为底部抽屉（§九 ≤768px）
   ⚠️ 用 transform 而不是 display 切换：能保留过渡动画，且不影响面板内的
      表单焦点与滚动位置。打开时由 JS 加 .is-open + 放出遮罩。 */
@media (max-width: 768px) {
  .d5-grid { grid-template-columns: repeat(2, 1fr); }
  .d5-editor__split { grid-template-columns: 1fr; gap: 16px; }

  .d5-rename {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 60;
    max-height: 76vh;
    overflow-y: auto;
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: 0;
    background: var(--d5-elev-2);
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.55);
    transform: translateY(102%);
    transition: transform 0.24s ease;
  }
  .d5-rename.is-open { transform: translateY(0); }
  .d5-rename__close { display: inline-flex; }
}

@media (max-width: 640px) {
  .d5-topbar__inner { padding: 12px 18px; }
  .d5-topbar__side { gap: 14px; font-size: 13px; }
  .d5-main { padding: 26px 18px 34px; }
  .d5-card { padding: 22px 18px; }
  .d5-card--auth { padding: 24px 20px 22px; }
  .d5-card__title { font-size: 18px; }
  /* 输入框 16px：iOS Safari 低于 16px 会在聚焦时自动放大页面 */
  .d5-input { font-size: 16px; }
  .d5-toasts { top: 12px; }
  /* 上传页：拖放区收窄、步骤条只留序号与当前步、按钮整行 */
  .d5-drop { padding: 30px 16px; }
  .d5-steps { gap: 6px; margin-bottom: 18px; }
  .d5-step  { font-size: 12px; }
  .d5-step__sep { min-width: 4px; }
  .d5-actions .d5-btn { flex: 1 1 100%; }
  .d5-quota__hint { display: none; }   /* 窄屏放不下，改到下一行说明 */

  /* 编辑器：appbar 收窄；保存状态只留圆点（文案太占位，靠 title 属性提示） */
  .d5-appbar__inner { padding: 10px 16px; gap: 10px; }
  .d5-appbar__title { font-size: 14.5px; }
  .d5-appbar__actions .d5-btn { padding: 8px 12px; font-size: 13px; }
  .d5-save { min-width: 0; }
  .d5-save__text { display: none; }
  .d5-thumb__name { padding: 6px 7px; font-size: 12px; }
}
