/* ============================================================
   Memoria · 纪念册工坊
   macOS 设计语言 · 黑白 · 毛玻璃 · 大胆排版
   ============================================================ */

:root {
  --bg: #f5f5f7;
  --bg-deep: #eaeaee;
  --paper: #ffffff;
  --ink: #1d1d1f;
  --ink-soft: #6e6e73;
  --ink-faint: #aeaeb2;
  --line: rgba(0, 0, 0, .08);
  --line-strong: rgba(0, 0, 0, .18);
  --glass: rgba(255, 255, 255, .72);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .05);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .14), 0 2px 8px rgba(0, 0, 0, .06);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro SC", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
}

@font-face {
  font-family: "Memoria Rounded";
  src: url("../assets/fonts/MemoriaRounded-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

::selection { background: var(--ink); color: var(--paper); }

/* ---------- 图标 ---------- */
.ic {
  width: 16px; height: 16px;
  fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -3px; flex-shrink: 0;
}

/* ---------- 视图切换 ---------- */
.view { display: none; height: 100vh; overflow-y: auto; }
.view.active { display: block; }

/* ---------- 通用控件 ---------- */
.btn {
  font-family: var(--font);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .02em;
  padding: 12px 32px;
  border-radius: 980px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: all .22s cubic-bezier(.32, .72, .35, 1);
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
}
.btn:hover { transform: scale(1.03); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--ink); color: var(--paper); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: #000; box-shadow: var(--shadow-lg); }
.btn-ghost { border-color: var(--line-strong); background: var(--glass); backdrop-filter: blur(12px); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-sm { padding: 8px 18px; font-size: 12.5px; }

.mini-btn {
  font-family: var(--font);
  font-size: 12.5px; font-weight: 500;
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  color: var(--ink);
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.mini-btn:hover { background: var(--ink); color: var(--paper); }
.mini-btn:disabled { opacity: .4; cursor: default; }
.mini-btn:disabled:hover { background: var(--paper); color: var(--ink); }

input[type="text"], input[type="password"], textarea, select {
  font-family: var(--font);
  font-size: 13px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3.5px rgba(0, 0, 0, .08);
}
input[readonly] {
  background: var(--bg);
  color: var(--ink-soft);
  cursor: default;
}
input[readonly]:focus { border-color: var(--line); box-shadow: none; }

/* 编辑器下拉框（字体 / 线型 / 模型）：黑框圆角矩形，选中黑色白字 */
select {
  -webkit-appearance: none;
  appearance: none;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: var(--paper)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%231d1d1f' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat right 12px center;
  padding: 8px 34px 8px 14px;
  font-weight: 600;
  cursor: pointer;
}
select:focus { border-color: var(--ink); box-shadow: 0 0 0 3.5px rgba(0, 0, 0, .1); }
select option {
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
  padding: 8px 12px;
}
select option:checked,
select option:hover,
select option:focus {
  background: var(--ink) !important;
  color: var(--paper) !important;
}

/* 自定义下拉（模型 / 字体 / 线型）：实底白卡，文字与页面风格统一 */
.cs { position: relative; }
.cs-trigger {
  font-family: var(--font);
  font-size: 12.5px; font-weight: 400;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
}
.cs-trigger:hover { border-color: var(--ink); }
.cs.open .cs-trigger { border-color: var(--ink); box-shadow: 0 0 0 3.5px rgba(0, 0, 0, .08); }
.cs.open .cs-trigger .cs-arrow { transform: rotate(180deg); }
.cs-arrow { width: 12px; height: 12px; transition: transform .2s; }
.cs-list {
  position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 100%; max-height: 300px; overflow-y: auto;
  background: var(--paper);
  border: 1px solid rgba(0, 0, 0, .1);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .16), 0 2px 8px rgba(0, 0, 0, .06);
  padding: 6px;
  display: none;
  z-index: 120;
}
.cs.open .cs-list { display: block; animation: panelPop .22s cubic-bezier(.22, 1, .36, 1); }
.cs-item {
  position: relative;
  padding: 9px 14px;
  border-radius: 9px;
  font-family: var(--font);
  font-size: 13px; font-weight: 400;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.cs-item:hover { background: rgba(0, 0, 0, .05); }
.cs-item.active { background: var(--ink); color: var(--paper); font-weight: 400; }
.cs-item.active::after {
  content: "✓";
  position: absolute; right: 13px; top: 50%;
  transform: translateY(-50%);
  font-size: 11px; line-height: 1;
}
.cs-item[data-value="__addfont__"] {
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  margin-top: 4px;
}
.cs-item.has-desc {
  padding: 9px 34px 9px 12px;
  line-height: 1.2;
}
.cs-item-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.cs-item-title {
  font-size: 12.5px;
  font-weight: 500;
  color: inherit;
}
.cs-item-desc {
  color: var(--ink-faint);
  font-size: 9.5px;
  font-weight: 400;
  line-height: 1.35;
}
.cs-item.active .cs-item-desc { color: rgba(255, 255, 255, .62); }

/* 模型选择下拉 */
.model-cs .cs-trigger { min-width: 220px; max-width: 320px; min-height: 44px; justify-content: space-between; }
.model-cs .cs-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-tier-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
  line-height: 1.15;
}
.model-tier-title { font-size: 12.5px; font-weight: 500; }
.model-tier-desc { color: var(--ink-faint); font-size: 9px; font-weight: 400; }
.model-cs .cs-list { min-width: 270px; max-height: min(62vh, 460px); }
.model-cs.busy { pointer-events: none; opacity: .62; }

/* 属性栏下拉：给字体、线型留出舒展的宽度 */
.eb-group .cs-list { min-width: 168px; }

/* 工具坞文字样式组 */
.dock-group.dock-style { flex-direction: row; justify-content: center; gap: 6px; }
.dock-style .font-style-btn { width: 34px; height: 34px; }

.toast {
  position: fixed; bottom: 44px; left: 50%;
  transform: translateX(-50%) translateY(16px) scale(.96);
  background: rgba(29, 29, 31, .92);
  backdrop-filter: blur(16px);
  color: var(--paper);
  font-size: 13px; font-weight: 500;
  padding: 12px 28px;
  border-radius: 980px;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: all .35s cubic-bezier(.32, .72, .35, 1);
  z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }

/* macOS 窗口圆点 */
.panel-dots { display: flex; gap: 7px; }
.panel-dots span {
  width: 11px; height: 11px; border-radius: 50%;
  background: #d4d4d8;
  border: .5px solid rgba(0, 0, 0, .06);
  transition: background .25s;
}
.panel-dots span:nth-child(1) { background: #8e8e93; }
.panel-dots span:nth-child(2) { background: #c7c7cc; }
.panel-dots span:nth-child(3) { background: #e5e5ea; }

/* ============================================================
   主页
   ============================================================ */
#view-home { position: relative; overflow: hidden; background: var(--bg); }

.home-icp {
  position: absolute;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 20;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 999px;
  background: rgba(255, 255, 255, .62);
  color: rgba(29, 29, 31, .54);
  font-size: 11px;
  line-height: 1;
  letter-spacing: .04em;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}
.home-icp a {
  color: inherit;
  text-decoration: none;
}
.home-icp a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 640px) {
  .home-icp {
    bottom: max(8px, env(safe-area-inset-bottom));
    padding: 5px 8px;
    font-size: 10px;
    background: rgba(255, 255, 255, .52);
  }
}

.avatar-river {
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background-repeat: repeat;
  transform: rotate(-14deg);
  animation: riverMove 140s linear infinite;
  will-change: background-position;
}
@keyframes riverMove {
  from { background-position: 0 0; }
  to   { background-position: calc(-1 * var(--river-tile-w, 1320px)) calc(-1 * var(--river-tile-h, 792px)); }
}

.home-corner {
  position: absolute; top: 26px; left: 30px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .14em;
  color: var(--ink-soft);
  cursor: pointer; z-index: 10;
  padding: 9px 18px;
  border-radius: 980px;
  background: var(--glass);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: all .25s;
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font);
}
.home-corner:hover { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.home-logo {
  width: clamp(270px, 28vw, 360px);
  padding: 0;
  gap: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
}
.home-logo img {
  display: block;
  width: 100%;
  height: auto;
  filter:
    contrast(1.08)
    drop-shadow(0 1px 1px rgba(255, 255, 255, .95))
    drop-shadow(0 0 3px rgba(255, 255, 255, .8))
    drop-shadow(0 3px 7px rgba(0, 0, 0, .12));
  transition: transform .25s ease, opacity .25s ease;
}
.home-corner.home-logo:hover {
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  transform: translateY(-2px);
  box-shadow: none;
}
.home-logo:hover img { transform: scale(1.012); opacity: .94; }
.home-logo:active { transform: translateY(0) scale(.992); }
.home-logo:focus-visible {
  outline: none;
  box-shadow: none;
  filter:
    drop-shadow(0 0 3px rgba(255, 255, 255, .95))
    drop-shadow(0 0 6px rgba(255, 255, 255, .75));
}

.home-center {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
}
.home-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 64px 88px 60px;
  text-align: center;
  position: relative;
  animation: panelIn .8s cubic-bezier(.22, 1, .36, 1);
}
@keyframes panelIn { from { opacity: 0; transform: translateY(28px) scale(.97); } to { opacity: 1; transform: none; } }
.home-panel .panel-dots { position: absolute; top: 22px; left: 24px; }

.home-kicker {
  font-size: 11px; font-weight: 700; letter-spacing: .5em;
  color: var(--ink-faint);
  margin-bottom: 26px; text-indent: .5em;
}
.home-title {
  font-size: clamp(40px, 5.4vw, 68px);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.14;
  color: var(--ink);
  margin-bottom: 22px;
}
.home-sub {
  font-size: 16px; font-weight: 400;
  color: var(--ink-soft);
  letter-spacing: .06em;
  margin-bottom: 48px;
}
.home-actions { display: flex; gap: 16px; justify-content: center; }
.home-actions .btn { min-width: 190px; }

/* ============================================================
   顶栏
   ============================================================ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 26px;
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 24px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.brand {
  font-size: 16px; font-weight: 800; letter-spacing: -.01em;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: opacity .2s;
}
.brand:hover { opacity: .6; }
button.brand {
  appearance: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-family: inherit;
}
.brand-logo-brand { flex-shrink: 0; gap: 9px; }
.brand-logo-image {
  display: block;
  width: clamp(160px, 11.5vw, 188px);
  height: auto;
}
.brand-section-label {
  padding-left: 9px;
  border-left: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .08em;
  white-space: nowrap;
}
.api-select-wrap { display: flex; gap: 8px; align-items: center; }

.code-field {
  display: flex; align-items: center; gap: 7px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 12px;
  color: var(--ink-faint);
  transition: border-color .2s, box-shadow .2s;
}
.code-field:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3.5px rgba(0, 0, 0, .08); }
.code-field input {
  border: none; background: none; padding: 9px 0; width: 130px;
  font-size: 12.5px;
}
.code-field input:focus { box-shadow: none; }

/* ============================================================
   编辑器
   ============================================================ */
#view-editor { display: none; flex-direction: column; height: 100vh; overflow: hidden; }
#view-editor.active { display: flex; }

.api-panel {
  position: absolute; top: 72px; left: 22px; z-index: 80;
  width: 350px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  background: var(--glass);
  backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 22px;
  display: none;
}
.api-panel.open { display: block; animation: panelPop .3s cubic-bezier(.22, 1, .36, 1); }
@keyframes panelPop { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
.api-panel-head {
  font-size: 13.5px; font-weight: 700;
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.api-panel-head .ic { margin-right: 6px; }
.api-close { cursor: pointer; color: var(--ink-faint); display: inline-flex; padding: 4px; border-radius: 6px; transition: all .2s; }
.api-close:hover { color: var(--ink); background: rgba(0, 0, 0, .06); }
.api-panel label { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-soft); letter-spacing: .04em; margin-bottom: 12px; }
.api-panel input, .api-panel textarea { width: 100%; margin-top: 5px; }
.api-note { font-size: 11px; color: #b3560e; line-height: 1.6; margin: -4px 0 12px; min-height: 0; }
.api-note:empty { display: none; }
.api-tier-context {
  margin: -2px 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}
.api-tier-context-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.api-tier-context-head strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
}
.api-tier-context-head span {
  flex-shrink: 0;
  padding: 3px 7px;
  border: 1px solid rgba(29, 29, 31, .12);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink-soft);
  font-size: 9.5px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
.api-tier-context-head span.limit {
  border-color: #edc7c3;
  background: #fff2f0;
  color: #9a2a21;
}
.api-tier-context p {
  margin: 6px 0 0;
  color: var(--ink-faint);
  font-size: 10.2px;
  font-weight: 400;
  line-height: 1.55;
}
.api-tier-context .api-tier-eta {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 9.6px;
}
.api-key-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  margin: -4px 0 12px;
  color: var(--ink-faint);
  font-size: 9.5px;
  line-height: 1.55;
}
.api-key-meta .mini-btn {
  align-self: flex-end;
  padding: 5px 8px;
  font-size: 9.5px;
}
.api-security-warning {
  margin: -2px 0 12px;
  padding: 8px 10px;
  border: 1px solid #efc8c5;
  border-radius: 8px;
  background: #fff2f1;
  color: #a32620;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.55;
}
.api-security-warning[hidden] { display: none; }
.model-tools { margin: -4px 0 10px; }
.model-list {
  display: flex; flex-wrap: wrap; gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  margin: 0 0 12px;
}
.model-list::-webkit-scrollbar,
.api-panel::-webkit-scrollbar,
.cs-list::-webkit-scrollbar { width: 8px; }
.model-list::-webkit-scrollbar-thumb,
.api-panel::-webkit-scrollbar-thumb,
.cs-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, .28);
  border-radius: 980px;
  border: none;
}
.model-list::-webkit-scrollbar-track,
.api-panel::-webkit-scrollbar-track,
.cs-list::-webkit-scrollbar-track { background: transparent; }
.model-list:empty { display: none; }
.model-chip {
  font-size: 11px; font-weight: 500;
  padding: 4px 10px; border-radius: 980px;
  border: 1px solid var(--line-strong);
  color: var(--ink-soft); cursor: pointer;
  transition: all .15s;
}
.model-chip:hover { border-color: var(--ink); color: var(--ink); }
.model-chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.api-hint { font-size: 11px; color: var(--ink-faint); margin-top: 12px; line-height: 1.7; }
.ai-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.ai-progress[hidden] { display: none; }
.ai-progress-spinner {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 2px solid var(--line-strong);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: aiProgressSpin .8s linear infinite;
}
@keyframes aiProgressSpin { to { transform: rotate(360deg); } }
.ai-progress-copy {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}
.ai-progress-copy strong {
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 700;
}
.ai-progress-copy small {
  color: var(--ink-faint);
  font-size: 9.5px;
  line-height: 1.5;
}
.ai-progress-time {
  flex-shrink: 0;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* 字体添加面板 */
.font-panel {
  position: absolute; top: 60px; right: 22px; z-index: 80;
  width: 300px;
  background: var(--glass);
  backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 22px;
  display: none;
}
.font-panel.open { display: block; animation: panelPop .3s cubic-bezier(.22, 1, .36, 1); }
.font-panel-head {
  font-size: 13.5px; font-weight: 700;
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.font-panel-close { cursor: pointer; color: var(--ink-faint); display: inline-flex; padding: 4px; border-radius: 6px; transition: all .2s; }
.font-panel-close:hover { color: var(--ink); background: rgba(0, 0, 0, .06); }
.font-panel label { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-soft); letter-spacing: .04em; margin-bottom: 12px; }
.font-panel input[type="text"] { width: 100%; margin-top: 5px; }
.font-panel .btn { width: 100%; margin-bottom: 12px; }
/* 统一的文件选择控件 */
.file-picker {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 6px; max-width: 100%;
  cursor: pointer;
}
.file-picker input[type="file"] { display: none; }
.file-picker-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 7px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 980px;
  background: var(--paper);
  font-size: 12px; font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  transition: all .18s;
}
.file-picker:hover .file-picker-btn { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.file-picker-name {
  font-size: 11.5px; color: var(--ink-faint);
  max-width: 180px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.font-file-block { margin-top: 4px; }
.font-file-hint { margin-top: 8px; font-size: 11px; color: var(--ink-faint); line-height: 1.6; }

/* 编辑器主体：顶部工具栏 + 中央工作区 */
.editor-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* 顶部工具栏 —— 横向悬浮毛玻璃 */
.tool-dock {
  width: auto; flex-shrink: 0;
  align-self: stretch;
  max-height: none;
  margin: 14px 22px 0;
  padding: 8px 14px;
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: row; align-items: center; gap: 10px;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(29, 29, 31, .2) transparent;
  position: relative; z-index: 40;
}
.tool-dock::-webkit-scrollbar { height: 5px; }
.tool-dock::-webkit-scrollbar-track { background: transparent; }
.tool-dock::-webkit-scrollbar-thumb {
  background: rgba(29, 29, 31, .18);
  border-radius: 999px;
}
.dock-group { display: flex; flex-direction: row; align-items: center; gap: 6px; width: auto; flex-shrink: 0; }
.dock-tools { display: flex; gap: 4px; }
.dock-sep { width: 1px; height: 24px; background: var(--line-strong); opacity: .5; flex-shrink: 0; margin: 0 3px; }
.dock-palette { display: flex; gap: 6px; align-items: center; }
.dock-history { flex-direction: row; gap: 6px; }
.tool-dock .brush-label {
  flex-direction: row; align-items: center;
  width: auto; gap: 8px; text-align: left;
}
.tool-dock .brush-label input { width: 90px; }
.dock-danger .tool { color: var(--ink-soft); }
.dock-danger .tool:hover { background: rgba(224, 49, 49, .1); color: #e03131; }

/* 中央工作区 */
.editor-center { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

/* 顶部属性栏 —— 悬浮毛玻璃 · 分组带功能标签 */
.editbar {
  display: flex; align-items: center;
  margin: 14px 22px 0;
  padding: 6px 20px;
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  position: relative; z-index: 40;
}
.eb-group { display: flex; align-items: center; gap: 10px; padding: 6px 18px; }
.eb-group:first-child { padding-left: 2px; }
.eb-group:last-child { padding-right: 2px; }
.eb-label { font-size: 10.5px; font-weight: 700; letter-spacing: .22em; color: var(--ink-faint); flex-shrink: 0; }
.eb-controls { display: flex; align-items: center; gap: 6px; }
.eb-sep { width: 1px; height: 22px; background: var(--line-strong); opacity: .4; flex-shrink: 0; }
.editbar input[type="range"] { width: 110px; accent-color: var(--ink); }
.tool {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 9px;
  background: transparent;
  cursor: pointer; color: var(--ink-soft);
  transition: all .18s;
}
.tool .ic { width: 17px; height: 17px; vertical-align: 0; }
.tool:hover { background: rgba(0, 0, 0, .06); color: var(--ink); }
.tool.active { background: var(--ink); color: var(--paper); box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }

.palette { gap: 7px; }
.swatch {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
  cursor: pointer; transition: transform .18s;
}
.swatch:hover { transform: scale(1.2); }
.swatch.active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }
#customColor {
  width: 26px; height: 26px; border: none; background: none;
  cursor: pointer; padding: 0; border-radius: 50%; overflow: hidden;
}

.brush-label { font-size: 12px; font-weight: 500; color: var(--ink-soft); display: flex; flex-direction: column; align-items: stretch; gap: 7px; width: 100%; text-align: center; }
.brush-label input { width: 100%; accent-color: var(--ink); margin: 0; }

.fill-toggle { font-size: 12px; font-weight: 500; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.fill-toggle input { accent-color: var(--ink); width: 14px; height: 14px; margin: 0; }

.bg-group { gap: 8px; }
.bg-label { font-size: 12px; font-weight: 500; color: var(--ink-soft); }
.bg-swatch { width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); cursor: pointer; transition: transform .18s; }
.bg-swatch:hover { transform: scale(1.2); }

.font-group { gap: 6px; }
.font-style-btn { font-size: 14px; width: 32px; }
.font-style-btn strong, .font-style-btn em { color: inherit; }
.font-style-btn.active { background: var(--ink); color: var(--paper); }

.dash-group { gap: 6px; }
.dash-label { font-size: 12px; font-weight: 500; color: var(--ink-soft); }

.zoom-group { display: flex; align-items: center; gap: 8px; }
.zoom-label { font-size: 12px; font-weight: 500; color: var(--ink-soft); display: flex; align-items: center; gap: 8px; }
.zoom-label input { width: 80px; accent-color: var(--ink); }
#zoomLabel { min-width: 34px; font-size: 12px; color: var(--ink-soft); }

.page-switcher { gap: 6px; }
.page-tabs { display: flex; gap: 6px; }
.page-ctl { font-size: 15px; font-weight: 700; }
.page-tab {
  min-width: 32px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 8px;
  background: transparent;
  font-family: var(--font);
  font-size: 11.5px; font-weight: 600;
  color: var(--ink-soft); cursor: pointer;
  transition: all .18s; padding: 0 9px;
}
.page-tab:hover { background: rgba(0, 0, 0, .06); color: var(--ink); }
.page-tab.active { background: var(--ink); color: var(--paper); }

/* 分页操作菜单：前/后插入与删除 */
.page-ctl-wrap { position: relative; display: inline-flex; }
.page-menu {
  position: absolute; top: calc(100% + 8px); left: 0;
  min-width: 152px;
  background: var(--paper);
  border: 1px solid rgba(0, 0, 0, .1);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .16), 0 2px 8px rgba(0, 0, 0, .06);
  padding: 6px;
  display: none;
  z-index: 130;
}
.page-menu.open { display: block; animation: panelPop .2s cubic-bezier(.22, 1, .36, 1); }
.page-menu button {
  display: block; width: 100%;
  padding: 9px 12px;
  border: none; border-radius: 8px;
  background: transparent;
  font-family: var(--font);
  font-size: 12.5px; font-weight: 400;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.page-menu button:hover { background: rgba(0, 0, 0, .05); }
.page-menu button:disabled { opacity: .35; cursor: default; }
.page-menu button:disabled:hover { background: transparent; }
.page-ctl:disabled { opacity: .35; cursor: default; }
.page-ctl:disabled:hover { background: transparent; color: var(--ink-soft); }

.editor-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

.canvas-stage {
  flex: 1; overflow: auto;
  padding: 30px 40px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  position: relative;
  z-index: 1;
  background: transparent;
}
.editor-body::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    url("../assets/editor-canvas-left-veronica.png"),
    url("../assets/editor-canvas-right-hunter.png");
  background-position: left bottom, right bottom;
  background-size: auto 86%, auto 86%;
  background-repeat: no-repeat;
  opacity: 1;
  pointer-events: none;
  user-select: none;
}

/* 画布容器 */
.spread-window {
  position: relative;
  z-index: 1;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  background: var(--paper);
  margin: auto;
  flex-shrink: 0;
  width: fit-content;
}
.spread-wrap { position: relative; }
#spreadCanvas { display: block; background: var(--paper); cursor: crosshair; width: 1184px; height: auto; }
#guideCanvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.text-overlay {
  position: absolute; z-index: 20;
  background: rgba(255, 255, 255, .94);
  border: 1.5px dashed #007aff;
  border-radius: 6px;
  padding: 6px 8px;
  font-family: inherit;
  outline: none;
  resize: none;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 122, 255, .15);
  line-height: 1.35;
}

/* 模板 & 元素侧栏 */
.template-rail { position: absolute; right: 0; top: 0; bottom: 0; z-index: 60; pointer-events: none; }
.rail-toggles {
  position: absolute; right: 0; top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: auto;
}
.rail-toggle {
  pointer-events: auto;
  writing-mode: vertical-rl;
  font-family: var(--font);
  font-size: 12.5px; font-weight: 600; letter-spacing: .3em;
  padding: 24px 11px;
  background: var(--ink); color: var(--paper);
  border: none; border-radius: 10px 0 0 10px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all .25s;
  display: inline-flex; align-items: center; gap: 10px;
}
.rail-toggle .ic { width: 15px; height: 15px; }
.rail-toggle:hover { padding-right: 16px; }
.rail-panel {
  pointer-events: auto;
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 300px;
  background: var(--glass);
  backdrop-filter: blur(30px) saturate(180%);
  border-left: 1px solid rgba(255, 255, 255, .6);
  box-shadow: -12px 0 40px rgba(0, 0, 0, .1);
  padding: 28px 22px;
  transform: translateX(100%);
  transition: transform .45s cubic-bezier(.22, 1, .36, 1);
  overflow-y: auto;
}
.rail-panel.open { transform: translateX(0); }
.rail-title { font-size: 17px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 6px; }
.rail-sub { font-size: 11.5px; color: var(--ink-faint); margin-bottom: 22px; line-height: 1.7; }
.template-list { display: grid; gap: 14px; }
.template-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  cursor: pointer;
  transition: all .22s;
  overflow: hidden;
}
.template-item:hover { border-color: var(--ink); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.template-item canvas { width: 100%; display: block; }
.template-item .tpl-name {
  font-size: 12px; font-weight: 600;
  padding: 11px 13px; color: var(--ink-soft);
  border-top: 1px solid var(--line);
}

/* 元素窗格 */
.layer-panel { width: 260px; }
.layer-list { display: flex; flex-direction: column; gap: 6px; }
.layer-empty { font-size: 12px; color: var(--ink-faint); text-align: center; padding: 40px 0; border: 1px dashed var(--line-strong); border-radius: 10px; }
.layer-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all .18s;
  font-size: 12px;
}
.layer-item:hover { border-color: var(--line-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.layer-item.selected { border-color: var(--ink); background: rgba(0, 0, 0, .04); box-shadow: 0 0 0 2px rgba(0, 0, 0, .06); }
.layer-item.anchor::after {
  content: "";
  position: absolute; left: -3px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 3px;
  background: var(--ink);
}
.layer-item { user-select: none; }
.layer-item[draggable="true"] { cursor: grab; }
.layer-item.dragging { opacity: .4; cursor: grabbing; }
.layer-item.drag-over { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(0, 0, 0, .12); transform: translateY(-2px); }
.layer-type {
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--ink); color: var(--paper);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.layer-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 500; }
.layer-seq { font-style: normal; color: var(--ink-faint); font-size: 11px; font-weight: 600; }
.layer-ops { display: flex; gap: 2px; flex-shrink: 0; }
.layer-ops button {
  border: none; background: transparent;
  width: 20px; height: 20px; border-radius: 5px;
  cursor: pointer; color: var(--ink-soft);
  font-size: 12px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.layer-ops button:hover { background: rgba(0, 0, 0, .08); color: var(--ink); }

/* ============================================================
   作品展示
   ============================================================ */
#view-gallery {
  position: relative;
  isolation: isolate;
  scrollbar-gutter: stable;
  background: #142536;
  color: #fff;
}

#view-gallery .topbar {
  background: rgba(15, 28, 42, .94);
  border-bottom-color: rgba(255, 255, 255, .12);
  backdrop-filter: blur(24px) saturate(140%);
}
#view-gallery .brand-logo-image { filter: invert(1) brightness(1.12); }
#view-gallery .topbar .btn-ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .08);
}
#view-gallery .topbar .btn-ghost:hover {
  color: var(--ink);
  border-color: #fff;
  background: #fff;
}

/* 两侧角色使用固定背景层，滚动作品时不随内容移动。 */
.gallery-backdrop {
  position: fixed;
  inset: 64px 0 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}
.gallery-character {
  position: absolute;
  bottom: 0;
  display: block;
  width: auto;
  max-width: none;
  object-fit: contain;
  object-position: bottom;
  opacity: 1;
}
.gallery-character-left {
  left: 0;
  height: min(94vh, 980px);
}
.gallery-character-right {
  right: 0;
  /* 原图上半部含较长的枪管，放大后人物主体才能与左侧角色同高。 */
  height: min(106.8vh, 1113px);
}

@media (max-width: 1100px) {
  .gallery-character-left {
    height: min(62vh, 720px);
  }
  .gallery-character-right {
    height: min(70.4vh, 818px);
  }
}

@media (max-width: 767px) {
  .gallery-backdrop { inset: 54px 0 0; }
  .gallery-character-left {
    height: min(58vh, 500px);
  }
  .gallery-character-right {
    height: min(65.9vh, 568px);
  }
}

.gallery-wrap {
  position: relative;
  z-index: 2;
  max-width: 1040px;
  margin: 0 auto;
  padding: 80px 40px 120px;
}
.gallery-heading {
  font-size: clamp(34px, 4vw, 48px);
  font-weight: 800; letter-spacing: -.03em;
  text-align: center; margin-bottom: 46px;
  text-wrap: balance;
  color: #fff;
  text-shadow: 0 2px 24px rgba(0, 0, 0, .28);
}

/* 展示页分段切换：与全站黑白色调保持一致 */
.gallery-tabs {
  display: flex; gap: 6px;
  width: fit-content;
  margin: 0 auto 18px;
  padding: 5px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 980px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .22);
}
.gallery-tab {
  font-family: var(--font);
  font-size: 13px; font-weight: 500; letter-spacing: .01em;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px;
  border: none; border-radius: 980px;
  background: transparent;
  color: rgba(255, 255, 255, .72);
  cursor: pointer;
  transition: all .22s cubic-bezier(.32, .72, .35, 1);
}
.gallery-tab .ic { width: 15px; height: 15px; vertical-align: 0; }
.gallery-tab:hover { color: #fff; background: rgba(255, 255, 255, .09); }
.gallery-tab.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.gallery-tab.active:hover { background: #fff; color: var(--ink); }

.gallery-search-area {
  width: min(100%, 460px);
  margin: 0 auto 44px;
}
.gallery-search {
  position: relative;
  display: flex;
  align-items: center;
  height: 48px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 980px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.gallery-search:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, .07), var(--shadow-sm);
  transform: translateY(-1px);
}
.gallery-search-icon {
  position: absolute;
  left: 17px;
  width: 17px;
  height: 17px;
  color: var(--ink-soft);
  pointer-events: none;
}
.gallery-search input[type="search"] {
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0 50px 0 44px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  box-shadow: none;
  font-size: 13.5px;
}
.gallery-search input[type="search"]:focus {
  border: 0;
  box-shadow: none;
}
.gallery-search input[type="search"]::-webkit-search-cancel-button {
  display: none;
  -webkit-appearance: none;
}
.gallery-search-clear {
  position: absolute;
  right: 9px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--bg);
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .18s, color .18s;
}
.gallery-search-clear[hidden] { display: none; }
.gallery-search-clear:hover { background: var(--ink); color: var(--paper); }
.gallery-search-clear .ic { width: 13px; height: 13px; }
.gallery-search-status {
  min-height: 18px;
  margin-top: 8px;
  text-align: center;
  color: rgba(255, 255, 255, .56);
  font-size: 11.5px;
  font-weight: 500;
}

.section-heading {
  font-size: 19px; font-weight: 800; letter-spacing: -.01em;
  margin: 72px 0 30px;
  display: flex; align-items: center; gap: 11px;
}
.section-heading .ic { width: 19px; height: 19px; }
.section-heading::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }

.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 26px;
}
.work-card {
  position: relative;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .24);
  transition: all .3s cubic-bezier(.22, 1, .36, 1);
  cursor: pointer;
}
.work-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.work-like-btn {
  position: static;
  flex-shrink: 0;
  margin-left: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 44px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  color: var(--ink-soft);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
  backdrop-filter: blur(12px);
  transition: transform .18s, background .18s, color .18s;
}
.work-like-btn:hover { transform: scale(1.06); background: var(--paper); color: var(--ink); }
.work-like-btn .ic { width: 14px; height: 14px; stroke-width: 2; }
.work-like-btn.liked {
  color: #d9363e;
  background: #fff1f1;
  border-color: rgba(217, 54, 62, .22);
  cursor: pointer;
  opacity: 1;
}
.work-like-btn.liked .ic { fill: currentColor; }
.work-like-btn:disabled { cursor: wait; opacity: .6; }
.work-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  margin-left: auto;
}
.work-report-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink-faint);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s;
}
.work-report-btn .ic { width: 13px; height: 13px; stroke-width: 1.9; }
.work-report-btn:hover { color: var(--ink); background: var(--paper); border-color: var(--line-strong); }
.work-report-btn.reported {
  color: #8a6200;
  background: #fff9e8;
  border-color: #ead6a4;
  cursor: default;
  opacity: 1;
}
.work-thumb {
  width: calc(100% - 20px);
  margin: 10px 10px 0;
  display: block;
  aspect-ratio: 148 / 105;
  object-fit: cover;
  background: var(--paper);
  border: 1px solid #c7c7cc;
  border-radius: 10px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .04);
  transition: border-color .22s, box-shadow .22s;
}
.work-card:hover .work-thumb {
  border-color: #a1a1a6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .07);
}
.work-info { display: flex; align-items: center; gap: 9px; padding: 14px 16px; }
.work-credit {
  display: flex;
  align-items: center;
  gap: 13px;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
a.work-credit:hover .work-name { text-decoration: underline; text-underline-offset: 3px; }
.work-credit-copy { min-width: 0; }
.work-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.work-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.work-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--ink-faint);
  margin-top: 3px;
}
.empty-hint {
  grid-column: 1 / -1;
  text-align: center; padding: 64px 0;
  font-size: 13px; font-weight: 500; color: rgba(255, 255, 255, .62);
  border: 1px dashed rgba(255, 255, 255, .24);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .035);
}

/* ============================================================
   登录 & 后台
   ============================================================ */
#view-admin-login { display: none; align-items: center; justify-content: center; height: 100vh; background: var(--bg-deep); }
#view-admin-login.active { display: flex; }
.login-card {
  width: 400px;
  background: var(--glass);
  backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  padding: 52px 46px 44px;
  display: flex; flex-direction: column; gap: 16px;
  position: relative;
  animation: panelIn .6s cubic-bezier(.22, 1, .36, 1);
}
.login-dots { position: absolute; top: 20px; left: 22px; }
.login-icon {
  width: 52px; height: 52px; margin: 0 auto 4px;
  border-radius: 16px;
  background: var(--ink); color: var(--paper);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
}
.login-icon .ic { width: 24px; height: 24px; }
.login-title { font-size: 24px; font-weight: 800; letter-spacing: -.02em; text-align: center; margin-bottom: 8px; }
.login-card label { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); letter-spacing: .04em; }
.login-card input { width: 100%; margin-top: 6px; }
.login-error { color: #ff3b30; font-size: 12px; min-height: 16px; text-align: center; font-weight: 500; }
.login-error.loading { color: var(--ink-soft); }
.login-card .btn[disabled] { opacity: .65; cursor: wait; transform: none; }

.admin-wrap {
  display: block;
  max-width: 1380px; margin: 0 auto;
  padding: 28px 36px 100px;
}
.admin-section-tabs {
  position: sticky;
  top: 12px;
  z-index: 12;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 16px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px) saturate(160%);
}
.admin-section-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  padding: 10px 14px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  transition: background .2s, color .2s, transform .2s;
}
.admin-section-tab:hover { background: var(--bg); color: var(--ink); }
.admin-section-tab.active {
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow-sm);
}
.admin-section-tab span {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .08);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.6;
}
.admin-section-tab.active span { background: rgba(255, 255, 255, .2); }
.admin-section-panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}
.admin-section-panel[hidden] { display: none; }
.admin-section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.admin-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.admin-wrap .section-heading {
  margin: 0;
  font-size: 17px;
}
.admin-section-total {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 10.5px;
  font-weight: 600;
}
.admin-section-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  flex: 1 1 420px;
}
.admin-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 260px;
  max-width: 390px;
  min-width: 180px;
}
.admin-search .ic {
  position: absolute;
  left: 12px;
  z-index: 1;
  color: var(--ink-faint);
  pointer-events: none;
}
.admin-search input {
  width: 100%;
  padding-left: 36px;
  border-radius: 10px;
  background: var(--bg);
}
.admin-section-panel > .admin-note {
  display: block;
  margin: 0 0 16px;
  line-height: 1.7;
}
.admin-report-filter.active {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}
.admin-report-filter span {
  display: inline-block;
  min-width: 18px;
  margin-left: 3px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .08);
  font-size: 9.5px;
  line-height: 1.7;
}
.admin-report-filter.active span { background: rgba(255, 255, 255, .2); }
.admin-report-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 12px;
  padding: 8px 10px;
  border: 1px solid #efcf9b;
  border-radius: 9px;
  background: #fff8e8;
  color: #735200;
  font-size: 11px;
  font-weight: 600;
}
.admin-report-alert[hidden] { display: none; }
.admin-report-alert span { flex: 1; }
.admin-report-alert .mini-btn { padding: 4px 8px; font-size: 10px; }
.admin-section-panel .admin-list,
.admin-panel-list {
  max-height: min(64vh, 760px);
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-gutter: stable;
}
.admin-section-panel .admin-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  align-items: start;
  gap: 10px;
}
.admin-section-panel .admin-tabs { margin-top: 2px; }
.admin-panel-list { margin-top: 14px; }
.export-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-note { font-size: 11.5px; color: var(--ink-faint); font-weight: 400; }
.admin-subhead {
  display: flex; align-items: center; justify-content: space-between;
  margin: 22px 0 10px;
  font-size: 12px; font-weight: 700; letter-spacing: .06em;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}
.admin-subhead:first-of-type { margin-top: 0; }
.admin-sub-count { font-size: 11px; font-weight: 600; color: var(--ink-faint); }
.admin-tabs {
  display: flex; gap: 4px;
  width: fit-content;
  margin: 0 0 14px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 980px;
}
.admin-tab {
  font-family: var(--font);
  font-size: 11.5px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px;
  border: none; border-radius: 980px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.admin-tab:hover { color: var(--ink); background: rgba(0, 0, 0, .05); }
.admin-tab.active { background: var(--ink); color: var(--paper); }
.admin-tab-count {
  font-size: 10px; font-weight: 600;
  padding: 1px 5px;
  border-radius: 980px;
  background: rgba(0, 0, 0, .08);
}
.admin-tab.active .admin-tab-count { background: rgba(255, 255, 255, .2); }
.admin-list { display: flex; flex-direction: column; gap: 16px; }
.admin-item {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  padding: 11px 12px;
  transition: box-shadow .25s, opacity .2s, transform .2s;
}
.admin-item:hover { box-shadow: var(--shadow-lg); }
.admin-item { cursor: grab; }
.admin-item.dragging { opacity: .4; cursor: grabbing; }
.admin-item.drag-over { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(0, 0, 0, .12), var(--shadow-lg); transform: translateY(-2px); }
.admin-item-head { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.admin-item-head img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.admin-item-order {
  flex-shrink: 0;
  font-size: 10px; font-weight: 700;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 5px;
  font-variant-numeric: tabular-nums;
}
.admin-item-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 700;
  flex: 1;
  letter-spacing: -.01em;
}
.admin-item-type {
  flex-shrink: 0;
  font-size: 9px; font-weight: 700; letter-spacing: .04em;
  color: var(--paper); background: var(--ink-faint);
  padding: 2px 6px; border-radius: 980px;
}
.admin-item-type.partner { background: var(--ink); }
.admin-item-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 7px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 10.5px;
}
.admin-item-code-label {
  flex-shrink: 0;
  color: var(--ink-faint);
  font-weight: 700;
  letter-spacing: .08em;
}
.admin-item-code-value,
.archive-item-code,
.index-row-code,
.export-code {
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-weight: 700;
  letter-spacing: .07em;
  user-select: all;
}
.admin-item-code-value { font-size: 10.5px; }
.admin-item-contact,
.archive-item-contact {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 0 0 7px;
  font-size: 11px;
  min-width: 0;
}
.admin-item-contact span,
.archive-item-contact span {
  flex-shrink: 0;
  color: var(--ink-faint);
  font-weight: 700;
}
.admin-item-contact strong,
.archive-item-contact strong {
  min-width: 0;
  color: var(--ink-soft);
  font-weight: 500;
  overflow-wrap: anywhere;
  user-select: text;
}
.admin-section-panel .admin-item-contact strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.archive-item-contact { margin: 5px 0 0; }
.admin-item-link {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  margin: 0 0 7px;
  font-size: 10px;
}
.admin-item-link span { flex-shrink: 0; color: var(--ink-faint); font-weight: 700; }
.admin-item-link a {
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-item-pages { display: flex; gap: 5px; overflow-x: auto; margin-bottom: 8px; padding-bottom: 3px; }
.admin-item-pages img { height: 54px; border-radius: 6px; border: 1px solid var(--line); cursor: zoom-in; }
.admin-item-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.admin-item-actions .mini-btn {
  padding: 4px 8px;
  font-size: 10.5px;
  border-radius: 6px;
}
.admin-report-box {
  margin: 0 0 8px;
  padding: 7px 8px;
  border: 1px solid #efcf9b;
  border-radius: 8px;
  background: #fffaf0;
}
.admin-report-box-title {
  color: #8a6200;
  font-size: 10px;
  font-weight: 700;
}
.admin-report-reasons {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 90px;
  overflow-y: auto;
  margin-top: 5px;
}
.admin-report-reason {
  padding-top: 4px;
  border-top: 1px solid rgba(138, 98, 0, .14);
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.admin-report-reason:first-child { padding-top: 0; border-top: 0; }
.admin-report-reason time {
  display: block;
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 9px;
}
.admin-section-panel .moderation-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin: 0 0 7px;
}
.admin-section-panel .moderation-badge {
  flex-shrink: 0;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .04em;
  white-space: nowrap;
}
.moderation-badge.passed { color: #26713a; background: #edf7ef; border-color: #cce6d3; }
.moderation-badge.suspicious { color: #7a5500; background: #fff5dc; border-color: #f0dfb0; }
.moderation-badge.blocked { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.moderation-badge.error { color: #a32620; background: #fff0ef; border-color: #f0cbc8; }
.moderation-badge.unchecked { color: var(--ink-faint); background: var(--bg); border-color: var(--line); }
.admin-section-panel .moderation-labels {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-faint);
  font-size: 10px;
}

.export-queue { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; min-height: 80px; }
.export-queue.admin-panel-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  align-items: start;
  gap: 8px;
}
.export-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  padding: 6px 8px; font-size: 11px; font-weight: 500;
}
.export-row img { height: 30px; border-radius: 5px; border: 1px solid var(--line); }
.export-order {
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  font-size: 11px; font-weight: 600;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.export-row { cursor: grab; }
.export-row.dragging { opacity: .4; cursor: grabbing; }
.export-row.drag-over { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(0, 0, 0, .12); }
.export-row .row-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.export-code {
  flex-shrink: 0;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--bg);
  font-size: 10.5px;
}
.export-row button { flex-shrink: 0; }
.export-row button { padding: 3px 7px; font-size: 9.5px; border-radius: 5px; }
.file-btn { display: inline-flex; cursor: pointer; margin-bottom: 14px; }
#buildPdfBtn { width: 100%; }

/* 站主通道配置 */
.admin-http-warning {
  max-width: 1520px;
  margin: 14px auto 0;
  padding: 10px 14px;
  border: 1px solid #efc8c5;
  border-radius: 10px;
  background: #fff2f1;
  color: #a32620;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
}
.admin-http-warning[hidden] { display: none; }
.admin-config-wrap { max-width: 1520px; margin: 0 auto; padding: 24px 36px 0; }
.admin-config-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 22px 20px;
}
.moderation-config-card { margin-top: 16px; }
.admin-config-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}
.admin-config-card .admin-config-title-row .section-heading { margin: 0; font-size: 16px; }
.admin-config-card .section-heading { margin: 0 0 10px; font-size: 16px; }
.admin-config-card .admin-note { display: block; margin: 0 0 16px; line-height: 1.7; }
.admin-config-title-row > div { min-width: 0; }
.admin-ai-provider-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 10px;
}
.admin-ai-provider-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg);
}
.admin-ai-provider-card.disabled { opacity: .62; }
.admin-ai-provider-head {
  display: flex;
  align-items: center;
  gap: 7px;
}
.admin-ai-provider-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}
.admin-ai-provider-badge {
  flex-shrink: 0;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eaf7ee;
  color: #26713a;
  font-size: 9px;
  font-weight: 700;
}
.admin-ai-provider-badge.disabled { color: #7c4d00; background: #fff3dc; }
.admin-ai-provider-meta {
  margin-top: 5px;
  color: var(--ink-faint);
  font-size: 10px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.admin-ai-provider-models {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 10.5px;
  line-height: 1.55;
  max-height: 42px;
  overflow: hidden;
}
.admin-ai-provider-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}
.admin-ai-provider-actions .mini-btn {
  padding: 4px 8px;
  font-size: 10px;
  border-radius: 6px;
}
.admin-ai-provider-empty {
  grid-column: 1 / -1;
  padding: 22px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--ink-faint);
  font-size: 11px;
  text-align: center;
}
.admin-ai-provider-list-status {
  min-height: 17px;
  margin-top: 9px;
  color: var(--ink-faint);
  font-size: 10.5px;
}
.admin-config-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(220px, 1.5fr);
  gap: 14px;
}
.ai-config-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-config-grid label {
  display: block;
  font-size: 11.5px; font-weight: 600;
  color: var(--ink-soft); letter-spacing: .04em;
}
.admin-config-grid input { width: 100%; margin-top: 6px; }
.admin-config-grid select { width: 100%; margin-top: 6px; }
.admin-config-grid .cs { margin-top: 6px; }
.admin-config-grid .cs-trigger { width: 100%; justify-content: space-between; }
.admin-config-grid .cs-list { min-width: 280px; max-height: min(62vh, 460px); }
.admin-tier-model-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.admin-tier-model-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg);
}
.admin-tier-model-head {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.admin-tier-model-head > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.admin-tier-model-head strong {
  color: var(--ink);
  font-size: 13px;
}
.admin-tier-model-head small {
  color: var(--ink-faint);
  font-size: 9.5px;
  line-height: 1.5;
}
.admin-tier-badge {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
}
.admin-tier-badge.fast { background: #e9f7ec; color: #26713b; }
.admin-tier-badge.regular { background: #edf1ff; color: #324ea8; }
.admin-tier-badge.deep { background: #f5eaff; color: #724099; }
.admin-tier-model-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: .04em;
}
.admin-tier-model-card select {
  width: 100%;
}
@media (max-width: 980px) {
  .admin-tier-model-grid { grid-template-columns: 1fr; }
}
.admin-config-endpoint { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-soft); letter-spacing: .04em; margin-top: 16px; max-width: 560px; }
.admin-config-endpoint input { width: 100%; margin-top: 6px; }
.admin-config-card .model-list { margin-top: 14px; }
.admin-model-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  font-size: 11.5px;
  color: var(--ink-soft);
}
.admin-model-picker-head strong { color: var(--ink); font-size: 12px; }
.admin-model-picker-head span { color: var(--ink-faint); font-size: 10.5px; }
.admin-model-search {
  width: 100%;
  margin-top: 8px;
  border-radius: 9px;
}
.admin-model-manual {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.admin-model-manual input { flex: 1; min-width: 0; }
.admin-model-manual .mini-btn { flex-shrink: 0; }
.admin-model-picker { max-height: 260px; }
button.model-chip {
  font-family: var(--font);
  background: transparent;
}
.admin-selected-models {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 27px;
  margin: 10px 0 4px;
  padding: 8px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  background: var(--bg);
}
.admin-selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 3px 5px 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 600;
}
.admin-selected-chip button {
  width: 17px;
  height: 17px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .08);
  color: var(--ink-soft);
  cursor: pointer;
  line-height: 1;
}
.admin-model-empty {
  color: var(--ink-faint);
  font-size: 10.5px;
  line-height: 1.8;
}
.admin-ai-provider-modal { width: min(760px, 94vw); max-height: min(90vh, 820px); }
.admin-ai-provider-modal .modal-body { line-height: 1.6; }
.admin-provider-form-grid {
  display: grid;
  grid-template-columns: minmax(150px, .8fr) minmax(170px, 1fr) minmax(170px, 1fr);
  gap: 10px;
}
.admin-provider-form-grid .field { margin-top: 0; }
.admin-provider-form-grid select,
.admin-provider-form-grid input { width: 100%; margin-top: 6px; }
.admin-provider-model-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin: 12px 0 4px;
}
.admin-provider-key-hint {
  color: var(--ink-faint);
  font-size: 10px;
}
.admin-provider-enabled { margin-top: 12px; }
.admin-provider-modal-actions { justify-content: flex-end; }
.admin-provider-modal-actions .admin-danger-btn { margin-right: auto; border-color: #e7b4b0; color: #a32620; }
.admin-provider-modal-actions .admin-danger-btn[hidden] { display: none; }
.admin-config-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.admin-config-status { font-size: 12px; font-weight: 500; color: var(--ink-soft); }
.admin-config-status.ok { color: #2f9e44; }
.admin-config-status.err { color: #e03131; }
.moderation-config-grid { grid-template-columns: minmax(210px, 1fr) minmax(210px, 1fr) minmax(170px, .8fr); }
.admin-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-soft);
}
.admin-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.admin-switch-track {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #d2d2d7;
  border: 1px solid rgba(0, 0, 0, .08);
  transition: background .2s, box-shadow .2s;
}
.admin-switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .24);
  transition: transform .2s;
}
.admin-switch input:checked + .admin-switch-track { background: var(--ink); }
.admin-switch input:checked + .admin-switch-track::after { transform: translateX(14px); }
.admin-switch input:focus-visible + .admin-switch-track { box-shadow: 0 0 0 3px rgba(0, 0, 0, .14); }
.moderation-key-line {
  margin-top: 10px;
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: .02em;
}
.moderation-key-line.ok { color: #2f7d3b; }

/* 收纳箱 */
.archive-modal { width: min(720px, 92vw); }
.archive-list {
  display: flex; flex-direction: column; gap: 10px;
  max-height: 52vh; overflow-y: auto;
  margin-top: 16px;
}
.archive-list.admin-panel-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  align-items: start;
  gap: 10px;
}
.archive-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  cursor: grab;
}
.archive-item.dragging { opacity: .4; cursor: grabbing; }
.archive-item.drag-over { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(0, 0, 0, .12); }
.archive-item-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.archive-item-main { flex: 1; min-width: 0; }
.archive-item-name { font-size: 12px; font-weight: 650; color: var(--ink); }
.archive-item-meta { font-size: 10px; color: var(--ink-faint); margin-top: 2px; }
.archive-item-code { font-size: 10.5px; letter-spacing: .05em; }
.archive-item .moderation-row { margin: 5px 0 0; }
.archive-item-pages {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  margin-top: 6px;
  padding-bottom: 3px;
}
.archive-item-pages img {
  width: 72px;
  height: 54px;
  flex: 0 0 auto;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  cursor: zoom-in;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.archive-item-pages img:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.archive-item-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 5px;
  flex-shrink: 0;
  justify-content: flex-end;
}
.archive-item-actions .mini-btn { padding: 4px 8px; font-size: 10px; }
.archive-empty { text-align: center; padding: 40px 0; color: var(--ink-faint); font-size: 12px; }

@media (max-width: 640px) {
  .archive-item { flex-wrap: wrap; }
  .archive-item-main { flex: 1 1 calc(100% - 52px); }
  .archive-item-actions { width: 100%; justify-content: flex-end; }
  .archive-item-pages img { width: 78px; height: 59px; }
}

/* 排序目录 */
.index-modal { width: min(640px, 92vw); }
.index-tabs { margin: 0 auto 14px; }
.index-tabs[hidden] { display: none; }
.index-search { max-width: none; margin: 0 0 12px; }
.index-list {
  max-height: 55vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 12px;
}
.index-section-title {
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  color: var(--ink-faint);
  margin: 10px 0 2px;
}
.index-section-title:first-child { margin-top: 0; }
.index-group { display: flex; flex-direction: column; gap: 8px; }
.index-group[hidden] { display: none; }
.index-group + .index-group { margin-top: 6px; }
.index-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  cursor: grab;
  user-select: none;
}
.index-row.dragging { opacity: .4; cursor: grabbing; }
.index-row.drag-over { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(0, 0, 0, .12); }
.index-row.no-sort { cursor: default; }
.index-row input {
  width: 58px; flex-shrink: 0;
  padding: 4px 8px;
  text-align: center;
  font-size: 12px;
}
.index-row-position {
  width: 58px;
  flex-shrink: 0;
  text-align: center;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.index-row-name {
  flex: 1; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px; font-weight: 500;
}
.index-row-code {
  flex-shrink: 0;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  font-size: 10.5px;
}
.index-empty { text-align: center; padding: 30px 0; color: var(--ink-faint); font-size: 12px; }
.meta-field-hint {
  margin: 6px 0 0;
  color: var(--ink-faint);
  font-size: 10.5px;
  line-height: 1.6;
}
.report-modal { width: min(540px, 92vw); }
.report-target {
  margin: 0 0 12px;
  color: var(--ink-soft);
}
.report-target strong { color: var(--ink); }
.report-reason-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.report-reason-presets button {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink-soft);
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}
.report-reason-presets button:hover,
.report-reason-presets button.active {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}
.report-modal textarea {
  width: 100%;
  min-height: 104px;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 12.5px;
  line-height: 1.65;
  resize: vertical;
}
.report-modal textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .08);
}
.report-form-status {
  min-height: 17px;
  margin: 7px 0 0;
  color: #b42318;
  font-size: 10.5px;
  line-height: 1.5;
}
.report-form-status.ok { color: #2f7d3b; }

/* 头像裁剪 */
#avatarCropModal { z-index: 260; }
.avatar-crop-modal { width: min(520px, 92vw); }
.avatar-crop-viewport {
  width: 320px; height: 320px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: var(--bg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.avatar-crop-viewport:active { cursor: grabbing; }
.avatar-crop-viewport img {
  position: absolute; left: 0; top: 0;
  max-width: none;
  transform-origin: 0 0;
  pointer-events: none;
}
.avatar-crop-guide {
  position: absolute; inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .9) inset;
  pointer-events: none;
}
.avatar-crop-zoom {
  display: flex; align-items: center; gap: 12px;
  width: 320px;
  margin: 18px auto 0;
  font-size: 11.5px; font-weight: 600;
  color: var(--ink-soft);
}
.avatar-crop-zoom input { flex: 1; accent-color: var(--ink); }
.avatar-crop-hint { text-align: center; margin-top: 10px; }
@media (max-width: 520px) {
  .avatar-crop-viewport { width: 260px; height: 260px; }
  .avatar-crop-zoom { width: 260px; }
}

/* ============================================================
   弹窗
   ============================================================ */
.modal-mask {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(29, 29, 31, .4);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center; justify-content: center;
}
.modal-mask.show { display: flex; }
.modal {
  width: 540px; max-width: 92vw; max-height: 86vh; overflow-y: auto;
  background: var(--paper);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 46px 48px 40px;
  position: relative;
  animation: modalIn .4s cubic-bezier(.22, 1, .36, 1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-dots { position: absolute; top: 20px; left: 22px; }
.modal-title {
  font-size: 21px; font-weight: 800; letter-spacing: -.01em;
  text-align: center; margin-bottom: 26px;
  padding-bottom: 18px; border-bottom: 1px solid var(--line);
}
.modal-body { font-size: 13.5px; line-height: 2.1; color: var(--ink-soft); }
.modal-body .field { display: block; margin-top: 14px; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; }
.modal-body .field input { width: 100%; margin-top: 6px; }
.domestic-api-privacy-modal { width: min(600px, 92vw); }
.ai-privacy-modal { width: min(600px, 92vw); }
.ai-privacy-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 14px 0;
  padding: 0;
  list-style: none;
}
.ai-privacy-list li {
  position: relative;
  padding: 8px 10px 8px 28px;
  border: 1px solid #efcf9b;
  border-radius: 9px;
  background: #fff9ea;
  color: #72520a;
  font-size: 11px;
  line-height: 1.65;
}
.ai-privacy-list li::before {
  content: "!";
  position: absolute;
  left: 10px;
  top: 10px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #c58a10;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 12px;
  text-align: center;
}
.ai-privacy-commitment {
  margin: 14px 0 10px;
  padding: 9px 11px;
  border: 1px solid #cfe4d3;
  border-radius: 9px;
  background: #f2faf4;
  color: #2f6b3d;
  font-size: 10.8px;
  line-height: 1.65;
}
.shortcut-guide-modal {
  width: min(760px, 92vw);
  padding: 42px 44px 30px;
}
.shortcut-guide-modal .modal-title {
  margin-bottom: 18px;
  padding-bottom: 14px;
}
.shortcut-guide-modal .modal-body { line-height: 1.5; }
.shortcut-section + .shortcut-section { margin-top: 14px; }
.shortcut-section h4 {
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--ink-faint);
}
.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 11.5px;
}
.shortcut-item span { color: var(--ink-soft); }
.shortcut-item kbd {
  flex-shrink: 0;
  padding: 3px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 9.5px;
  font-weight: 700;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .08);
}
.shortcut-guide-modal .modal-actions { margin-top: 18px; }
@media (max-width: 820px) {
  .shortcut-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.submit-modal { width: min(620px, 92vw); max-height: min(88vh, 780px); }
.submit-modal.code-stage {
  width: min(620px, 92vw);
}
.submit-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.submit-fields-grid .field { min-width: 0; }
.submit-modal.code-stage #submitEditFields {
  opacity: .68;
  transition: opacity .2s ease;
}
.submit-modal.code-stage .code-result { margin-top: 14px; }
.submit-modal.code-stage .modal-actions { margin-top: 18px; }
.submit-modal.code-stage #submitConfirm { min-width: 220px; }
#submitCancel[hidden] { display: none; }
.privacy-warning-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 16px 0;
  padding: 0;
}
.privacy-warning-list li {
  position: relative;
  padding: 10px 12px 10px 30px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  font-size: 12px;
  line-height: 1.75;
}
.privacy-warning-list li::before {
  content: "";
  position: absolute;
  top: 16px;
  left: 13px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
}
.privacy-warning-footer {
  margin: 0;
  color: var(--ink-faint);
  font-size: 11px;
  text-align: center;
}
.radio-row { display: flex; gap: 24px; margin: 10px 0 6px; }
.radio-row label { font-size: 13px; display: flex; align-items: center; gap: 7px; cursor: pointer; font-weight: 500; }
.radio-row input { accent-color: var(--ink); }
.avatar-preview { margin-top: 12px; }
.avatar-preview img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.code-result {
  margin-top: 18px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
#codeResult[hidden] { display: none; }
.code-result-info { min-width: 0; }
.code-result-title { margin: 0 0 3px; color: var(--ink); font-weight: 700; }
.the-code {
  flex-shrink: 0;
  margin: 0;
  color: var(--ink);
  font-size: 27px;
  font-weight: 800;
  letter-spacing: .18em;
  line-height: 1.2;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.code-hint { font-size: 11.5px; color: var(--ink-faint); }
.submit-limit-alert {
  margin-top: 12px;
  padding: 10px 13px;
  border: 1px solid #ead6a4;
  border-radius: 10px;
  background: #fff9e8;
  color: #6f5200;
  font-size: 11.5px;
  line-height: 1.65;
  font-weight: 600;
}
.submit-limit-alert.limit {
  border-color: #edc7c3;
  background: #fff2f0;
  color: #8c251d;
}
.submit-limit-alert[hidden] { display: none; }
.modal-actions { display: flex; gap: 14px; justify-content: center; margin-top: 30px; }

/* 大图灯箱 */
.lightbox-inner {
  position: relative;
  width: min(940px, 94vw); max-height: 92vh;
  background: var(--glass);
  backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 28px 34px;
  display: flex; flex-direction: column; gap: 14px;
}
.lightbox-close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(0, 0, 0, .06);
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .2s;
}
.lightbox-close:hover { background: var(--ink); color: var(--paper); }
.lightbox-meta { font-size: 13px; font-weight: 600; color: var(--ink-soft); display: flex; align-items: center; gap: 10px; }
.lightbox-meta a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}
.lightbox-meta a:hover span { text-decoration: underline; text-underline-offset: 3px; }
.lightbox-meta img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.lightbox-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.lightbox-stage img { max-width: 100%; max-height: 58vh; object-fit: contain; border-radius: 8px; }
.lightbox-nav { display: flex; align-items: center; justify-content: center; gap: 20px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* 对象操作浮动条 */
.obj-bar {
  position: fixed; z-index: 120;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px;
  background: var(--ink);
  border-radius: 980px;
  padding: 5px 8px;
  box-shadow: var(--shadow-lg);
}
.obj-bar[hidden] { display: none; }
.obj-bar .align-group { display: none; }
.obj-bar .align-group.show { display: inline-flex; }
.obj-bar button {
  border: none; background: transparent; color: var(--paper);
  font-family: var(--font); font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 980px; cursor: pointer;
  transition: background .18s;
}
.obj-bar button:hover { background: rgba(255, 255, 255, .16); }
.obj-bar .obj-size { color: var(--paper); font-size: 12px; font-weight: 600; min-width: 24px; text-align: center; }

/* 框选覆盖层：画布外也完整可见 */
.marquee-overlay {
  position: fixed;
  z-index: 300;
  pointer-events: none;
  display: none;
  border: 1.2px dashed #007aff;
  background: rgba(0, 122, 255, .08);
}

/* 橡皮擦圆形光标（大小随笔触变化） */
.eraser-cursor {
  position: fixed;
  z-index: 320;
  pointer-events: none;
  display: none;
  border: 1.5px solid rgba(29, 29, 31, .8);
  background: rgba(255, 255, 255, .35);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .8) inset;
}

/* 滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .18); border-radius: 980px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, .32); background-clip: content-box; border: 2px solid transparent; }

@media (max-width: 1100px) {
  .brand-logo-image { width: 150px; }
  .brand-logo-brand { gap: 7px; }
  .brand-section-label { padding-left: 7px; font-size: 8.5px; }
  .topbar-left { gap: 12px; }
  .code-field input { width: 108px; }
  .admin-wrap { grid-template-columns: 1fr; }
  .admin-config-grid { grid-template-columns: 1fr 1fr; }
  .admin-config-grid label:last-child { grid-column: 1 / -1; }
  .home-actions { flex-direction: column; align-items: center; }
  .home-panel { padding: 52px 40px 44px; margin: 0 20px; }
}

@media (max-width: 720px) {
  .admin-config-wrap { padding: 18px 20px 0; }
  .admin-config-grid { grid-template-columns: 1fr; }
  .admin-config-grid label:last-child { grid-column: auto; }
}

/* ============================================================
   手机端适配
   只在手机 UA / 短边不超过 540px 触屏设备上启用专属交互；
   768px 起的平板保持原有桌面布局和鼠标交互。
   ============================================================ */
.mobile-rotate-gate { display: none; }

.mobile-keyboard-editor {
  display: none;
  position: fixed;
  z-index: 190;
  left: 8px;
  right: 8px;
  top: 20vh;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 14px;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 16px 46px rgba(0, 0, 0, .2);
}

.mobile-keyboard-editor.show { display: block; }

.mobile-keyboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.mobile-keyboard-tip {
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 500;
}

.mobile-keyboard-editor textarea {
  width: 100%;
  min-height: 44px;
  max-height: 92px;
  padding: 8px 10px;
  resize: none;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

.mobile-keyboard-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 7px;
}

.mobile-keyboard-font-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: auto;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.mobile-keyboard-font-btn {
  width: 27px;
  height: 25px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.mobile-keyboard-actions .mini-btn,
.mobile-keyboard-actions .btn {
  padding: 6px 13px;
  font-size: 11px;
}

.mobile-keyboard-editor.compact {
  padding: 6px 8px;
}

.mobile-keyboard-editor.compact .mobile-keyboard-head { display: none; }
.mobile-keyboard-editor.compact .mobile-keyboard-actions { margin-top: 4px; }
.mobile-keyboard-editor.compact .mobile-keyboard-actions .mini-btn,
.mobile-keyboard-editor.compact .mobile-keyboard-actions .btn { padding: 4px 10px; }
.mobile-keyboard-editor.compact .mobile-keyboard-font-btn { height: 23px; }
.mobile-keyboard-editor.compact textarea { min-height: 36px; padding: 6px 8px; }

html.phone-ui body {
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

html.phone-ui .view {
  height: 100vh;
  height: 100dvh;
}

html.phone-ui #view-editor.active {
  height: 100vh;
  height: 100dvh;
}

@media (max-width: 767px) {
  .home-corner {
    top: max(14px, env(safe-area-inset-top));
    left: max(14px, env(safe-area-inset-left));
    max-width: calc(100vw - 28px);
    padding: 8px 13px;
    font-size: 11px;
    letter-spacing: .07em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .home-logo {
    width: min(300px, calc(100vw - 28px));
    padding: 0;
    border-radius: 0;
  }

  .home-panel {
    width: calc(100vw - 32px);
    max-width: 430px;
    padding: 44px 24px 34px;
    margin: 0;
    border-radius: 22px;
  }

  .home-kicker {
    margin-bottom: 18px;
    font-size: 9.5px;
    letter-spacing: .32em;
    text-indent: .32em;
  }

  .home-title {
    margin-bottom: 18px;
    font-size: clamp(34px, 11.5vw, 48px);
    line-height: 1.12;
  }

  .home-sub {
    margin-bottom: 32px;
    font-size: 14px;
    letter-spacing: .02em;
  }

  .home-actions {
    width: 100%;
    gap: 10px;
  }

  .home-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .topbar {
    padding: 10px max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left));
  }

  .topbar .brand { font-size: 14px; }
  .brand-logo-image { width: 140px; }
  .brand-section-label { padding-left: 6px; font-size: 8px; }
  .topbar .btn-sm { padding: 8px 15px; font-size: 11.5px; }

  .gallery-wrap {
    padding: 36px 16px calc(72px + env(safe-area-inset-bottom));
  }

  .gallery-heading {
    margin-bottom: 24px;
    font-size: clamp(30px, 9vw, 40px);
  }

  .gallery-tabs {
    width: 100%;
    gap: 3px;
    padding: 4px;
  }

  .gallery-tab {
    flex: 1;
    justify-content: center;
    padding: 9px 8px;
    font-size: 11.5px;
  }

  .gallery-search-area { margin-bottom: 28px; }
  .work-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .work-card { border-radius: 15px; }
  .work-info { padding: 14px 15px; }

  .login-card {
    width: calc(100vw - 28px);
    padding: 42px 22px 30px;
    border-radius: 20px;
  }

  #view-admin .topbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  #view-admin .topbar > div {
    display: flex;
    gap: 5px;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 1px;
  }

  #view-admin .topbar .mini-btn { flex-shrink: 0; }
  .admin-http-warning { margin: 10px 12px 0; }
  .admin-config-wrap { padding: 14px 12px 0; }
  .admin-config-card { padding: 16px; }
  .admin-config-title-row { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .admin-switch { align-self: flex-start; }
  .admin-config-actions { align-items: stretch; }
  .admin-ai-provider-list { grid-template-columns: 1fr; }
  .admin-provider-form-grid { grid-template-columns: 1fr; }
  .admin-provider-modal-actions { flex-wrap: wrap; }
  .moderation-row { flex-wrap: wrap; }
  .admin-wrap { padding: 18px 12px calc(64px + env(safe-area-inset-bottom)); }
  .admin-section-tabs {
    top: 6px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-radius: 14px;
  }
  .admin-section-tab { padding: 9px 8px; font-size: 11.5px; }
  .admin-section-panel { padding: 16px 14px; border-radius: 16px; }
  .admin-section-toolbar { align-items: stretch; gap: 10px; }
  .admin-section-tools { flex-basis: 100%; flex-wrap: wrap; justify-content: stretch; }
  .admin-search { max-width: none; min-width: 0; flex-basis: 100%; }
  .admin-section-panel .admin-list,
  .admin-panel-list { max-height: none; overflow: visible; padding-right: 0; }
  .export-actions { align-items: stretch; }
  .export-actions .btn { flex: 1 1 100%; }
  .admin-tabs { max-width: 100%; overflow-x: auto; }

  .modal-mask {
    align-items: flex-start;
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .modal {
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    margin: auto;
    padding: 34px 22px 26px;
    border-radius: 18px;
  }

  .modal-title { margin-bottom: 20px; padding-bottom: 14px; font-size: 19px; }
  .modal-actions { flex-wrap: wrap; gap: 9px; margin-top: 22px; }
  .modal-actions .btn { flex: 1 1 130px; min-width: 0; padding-inline: 16px; }
  .submit-fields-grid { grid-template-columns: 1fr; gap: 0; }
  .code-result { flex-direction: column; align-items: flex-start; gap: 7px; padding: 12px 14px; }
  .the-code { font-size: 24px; letter-spacing: .16em; }
  .shortcut-grid { grid-template-columns: 1fr; }
  .submit-modal.code-stage { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; }
  .submit-modal.code-stage #submitConfirm { min-width: 0; }
  .radio-row { flex-direction: column; gap: 9px; }

  .lightbox-inner {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    padding: 22px 14px 16px;
    border-radius: 18px;
  }

  .lightbox-stage img { max-height: 62dvh; }
  .lightbox-nav { gap: 9px; }
  .lightbox-nav .mini-btn { padding: 7px 10px; font-size: 11px; }

  .avatar-crop-viewport {
    width: min(260px, calc(100vw - 92px));
    height: min(260px, calc(100vw - 92px));
  }

  .avatar-crop-zoom { width: min(260px, calc(100vw - 92px)); }
}

/* 手机横屏：压缩顶部控件，把主要空间留给画布。 */
@media (orientation: landscape) and (max-height: 600px) {
  html.phone-ui #view-editor .topbar {
    flex: 0 0 46px;
    min-height: 46px;
    padding: 3px max(10px, env(safe-area-inset-right)) 3px max(10px, env(safe-area-inset-left));
    gap: 6px;
  }

  html.phone-ui #view-editor .topbar-left {
    flex: 1;
    min-width: 0;
    gap: 6px;
  }

  html.phone-ui #view-editor .brand {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    justify-content: center;
    gap: 0;
    font-size: 0;
    border-radius: 9px;
    background: rgba(0, 0, 0, .04);
  }
  html.phone-ui #view-editor .brand.brand-logo-brand {
    width: auto;
    height: 32px;
    flex: 0 0 auto;
    justify-content: flex-start;
    padding: 0;
    border-radius: 0;
    background: transparent;
  }
  html.phone-ui #view-editor .brand-logo-image { width: 168px; }

  html.phone-ui #view-editor .brand .ic { width: 18px; height: 18px; }
  html.phone-ui #view-editor .api-select-wrap { flex: 1; min-width: 0; gap: 5px; }
  html.phone-ui #view-editor .model-cs { flex: 1; min-width: 0; max-width: 180px; }

  html.phone-ui #view-editor .model-cs .cs-trigger {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    height: 38px;
    padding: 3px 9px;
    font-size: 10.5px;
  }
  html.phone-ui #view-editor .model-tier-title { font-size: 10.5px; }
  html.phone-ui #view-editor .model-tier-desc { font-size: 8.2px; }

  html.phone-ui #view-editor .model-cs .cs-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html.phone-ui #view-editor .model-cs .cs-list {
    min-width: min(280px, calc(100vw - 20px));
    max-height: min(58vh, 250px);
  }

  html.phone-ui #view-editor .api-select-wrap > .mini-btn {
    width: auto;
    height: 32px;
    flex: 0 0 auto;
    justify-content: center;
    gap: 4px;
    padding: 0 9px;
    font-size: 11px;
  }

  html.phone-ui #view-editor .topbar-right {
    flex: 0 0 auto;
    gap: 6px;
  }

  html.phone-ui #view-editor .code-field {
    gap: 6px;
    padding: 0 10px;
    border-radius: 7px;
  }

  html.phone-ui #view-editor .code-field .ic { width: 12px; height: 12px; }

  html.phone-ui #view-editor .code-field input {
    width: 128px;
    padding: 7px 4px 7px 0;
    font-size: 11px;
  }

  html.phone-ui #view-editor #resumeBtn {
    padding: 6px 8px;
    font-size: 10.5px;
  }

  html.phone-ui #view-editor #saveSubmitBtn {
    gap: 4px;
    padding: 7px 9px;
    font-size: 10.5px;
  }

  html.phone-ui #view-editor #saveSubmitBtn .ic { display: none; }

  html.phone-ui #view-editor .tool-dock {
    min-height: 40px;
    max-height: 40px;
    margin: 4px 8px 0;
    padding: 4px 8px;
    gap: 6px;
    border-radius: 11px;
  }

  html.phone-ui #view-editor .tool-dock::-webkit-scrollbar { height: 3px; }

  html.phone-ui #view-editor .dock-group {
    gap: 4px;
  }

  html.phone-ui #view-editor .dock-tools { gap: 2px; }

  html.phone-ui #view-editor .tool {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  html.phone-ui #view-editor .tool .ic { width: 16px; height: 16px; }
  html.phone-ui #view-editor .dock-sep { height: 21px; margin: 0 1px; }
  html.phone-ui #view-editor .swatch { width: 17px; height: 17px; }
  html.phone-ui #view-editor #customColor { width: 23px; height: 23px; }

  html.phone-ui #view-editor .tool-dock .brush-label {
    gap: 5px;
    font-size: 10.5px;
  }

  html.phone-ui #view-editor .tool-dock .brush-label input { width: 64px; }
  html.phone-ui #view-editor .fill-toggle { font-size: 10.5px; }

  html.phone-ui #view-editor .editbar {
    min-height: 36px;
    max-height: 36px;
    flex-wrap: nowrap;
    margin: 4px 8px 0;
    padding: 4px 8px;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    border-radius: 11px;
    scrollbar-width: thin;
    scrollbar-color: rgba(29, 29, 31, .2) transparent;
  }

  html.phone-ui #view-editor .editbar::-webkit-scrollbar { height: 3px; }
  html.phone-ui #view-editor .editbar::-webkit-scrollbar-track { background: transparent; }
  html.phone-ui #view-editor .editbar::-webkit-scrollbar-thumb {
    background: rgba(29, 29, 31, .18);
    border-radius: 999px;
  }

  html.phone-ui #view-editor .eb-group {
    gap: 6px;
    padding: 3px 9px;
  }

  html.phone-ui #view-editor .eb-label {
    font-size: 9px;
    letter-spacing: .13em;
  }

  html.phone-ui #view-editor .eb-controls { gap: 4px; }
  html.phone-ui #view-editor .editbar input[type="range"] { width: 84px; }
  html.phone-ui #view-editor .cs-trigger { padding: 5px 8px; font-size: 10.5px; }
  html.phone-ui #view-editor .page-tab { min-width: 29px; height: 28px; padding: 0 7px; }

  html.phone-ui #view-editor .editor-body {
    min-height: 0;
  }

  html.phone-ui #view-editor .canvas-stage {
    padding: 8px 12px;
    overscroll-behavior: contain;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
  }

  html.phone-ui #view-editor .spread-window {
    border-radius: 10px;
  }

  html.phone-ui #view-editor .template-rail {
    top: 4px;
    bottom: 4px;
  }

  html.phone-ui #view-editor .rail-toggles { gap: 6px; }

  html.phone-ui #view-editor .rail-toggle {
    padding: 12px 7px;
    font-size: 10.5px;
    letter-spacing: .18em;
    border-radius: 8px 0 0 8px;
  }

  html.phone-ui #view-editor .rail-toggle:hover { padding-right: 7px; }

  html.phone-ui #view-editor .rail-panel {
    width: min(300px, 72vw);
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  }

  html.phone-ui #view-editor .rail-sub { margin-bottom: 14px; }

  html.phone-ui #view-editor .obj-bar {
    max-width: calc(100vw - 16px);
    padding: 4px 6px;
    overflow-x: auto;
  }

  html.phone-ui #view-editor .obj-bar button { padding: 6px 8px; }

  html.phone-ui #view-editor .api-panel,
  html.phone-ui #view-editor .font-panel {
    position: fixed;
    top: 50px;
    max-height: min(310px, calc(var(--mobile-vv-height, 100dvh) - 52px));
    padding: 14px;
    border-radius: 12px;
    overflow-y: auto;
  }

  html.phone-ui #view-editor .api-panel {
    left: max(8px, env(safe-area-inset-left));
    right: auto;
    width: min(420px, calc(100vw - 92px));
  }

  html.phone-ui #view-editor .font-panel {
    right: max(8px, env(safe-area-inset-right));
    left: auto;
    width: min(340px, calc(100vw - 92px));
  }

  html.phone-ui #view-editor .api-panel-head {
    margin-bottom: 12px;
    padding-bottom: 10px;
    font-size: 12.5px;
  }

  html.phone-ui #view-editor .api-panel label {
    margin-bottom: 9px;
    font-size: 10.5px;
  }

  html.phone-ui #view-editor .api-panel input,
  html.phone-ui #view-editor .api-panel textarea {
    padding: 7px 10px;
    font-size: 12px;
  }

  html.phone-ui #view-editor .api-tier-context {
    margin-bottom: 10px;
    padding: 8px 10px;
  }
  html.phone-ui #view-editor .api-tier-context-head strong { font-size: 11px; }
  html.phone-ui #view-editor .api-tier-context-head span { font-size: 9px; }
  html.phone-ui #view-editor .api-tier-context p { font-size: 9.5px; line-height: 1.45; }
  html.phone-ui #view-editor .api-tier-context .api-tier-eta { font-size: 9px; }
  html.phone-ui #view-editor .api-panel .model-list { max-height: 112px; }
  html.phone-ui #view-editor .api-panel .api-hint { font-size: 10px; line-height: 1.55; }

  html.phone-ui .modal-mask {
    align-items: flex-start;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    overflow-y: auto;
  }

  html.phone-ui .modal {
    width: min(660px, calc(100vw - 16px));
    max-width: none;
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    margin: auto;
    padding: 24px 28px 22px;
  }

  html.phone-ui .modal-title {
    margin-bottom: 14px;
    padding-bottom: 10px;
    font-size: 18px;
  }

  html.phone-ui .modal-body { line-height: 1.75; }
  html.phone-ui .modal-actions { margin-top: 16px; }
  html.phone-ui .avatar-crop-modal { width: min(520px, calc(100vw - 16px)); }
}

/* 手机竖屏编辑：双行顶栏 + 左侧竖向工具坞 + 两行属性栏 */
@media (orientation: portrait) {
  html.phone-ui #view-editor .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 40px 32px;
    align-content: center;
    flex: 0 0 84px;
    height: 84px;
    min-height: 84px;
    padding: 4px max(8px, env(safe-area-inset-right)) 4px max(8px, env(safe-area-inset-left));
    gap: 4px;
  }

  html.phone-ui #view-editor .topbar-left {
    display: flex;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    gap: 6px;
  }

  html.phone-ui #view-editor .brand {
    width: auto;
    height: 32px;
    flex: 0 0 auto;
    justify-content: flex-start;
    gap: 5px;
    padding: 0 7px;
    border-radius: 8px;
    background: rgba(0, 0, 0, .04);
    font-size: 11px;
    white-space: nowrap;
  }
  html.phone-ui #view-editor .brand.brand-logo-brand {
    width: auto;
    height: 32px;
    padding: 0;
    border-radius: 0;
    background: transparent;
  }
  html.phone-ui #view-editor .brand-logo-image { width: clamp(120px, 17vw, 150px); }

  html.phone-ui #view-editor .brand .ic { width: 16px; height: 16px; }
  html.phone-ui #view-editor .api-select-wrap { flex: 1; min-width: 0; gap: 5px; }
  html.phone-ui #view-editor .model-cs {
    flex: 1 1 0;
    min-width: 0;
    max-width: 180px;
  }

  html.phone-ui #view-editor .model-cs .cs-trigger {
    width: 100%;
    min-height: 38px;
    height: 38px;
    padding: 3px 7px;
    font-size: 9.5px;
  }
  html.phone-ui #view-editor .model-tier-title { font-size: 9.5px; }
  html.phone-ui #view-editor .model-tier-desc { font-size: 7.8px; }

  html.phone-ui #view-editor .model-cs .cs-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html.phone-ui #view-editor .api-select-wrap > .mini-btn {
    width: 32px;
    min-width: 32px;
    max-width: 32px;
    height: 32px;
    flex: 0 0 32px;
    gap: 0;
    margin-left: auto;
    padding: 0;
    justify-content: center;
    border-radius: 8px;
  }
  html.phone-ui #view-editor #apiPanelToggle .api-btn-label {
    display: none;
  }

  html.phone-ui #view-editor .topbar-right {
    display: flex;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    gap: 5px;
  }

  html.phone-ui #view-editor .code-field {
    flex: 1;
    min-width: 0;
    gap: 5px;
    padding: 0 8px;
    border-radius: 8px;
  }

  html.phone-ui #view-editor .code-field .ic { width: 12px; height: 12px; }

  html.phone-ui #view-editor .code-field input {
    width: 100%;
    min-width: 0;
    padding: 7px 2px 7px 0;
    font-size: 11px;
  }

  html.phone-ui #view-editor #resumeBtn {
    flex: 0 0 auto;
    padding: 6px 9px;
    font-size: 10.5px;
  }

  html.phone-ui #view-editor #saveSubmitBtn {
    flex: 0 0 auto;
    padding: 7px 10px;
    font-size: 10.5px;
    white-space: nowrap;
  }

  html.phone-ui #view-editor .editor-main {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    width: 100%;
    min-height: 0;
  }

  html.phone-ui #view-editor .tool-dock {
    grid-column: 1;
    grid-row: 1;
    flex-direction: column;
    align-items: center;
    align-self: stretch;
    width: auto;
    min-width: 0;
    min-height: 0;
    max-height: none;
    height: auto;
    margin: 5px 0 6px 4px;
    padding: 5px 2px;
    gap: 5px;
    overflow-x: hidden;
    overflow-y: auto;
    border-radius: 10px;
    scrollbar-width: thin;
  }

  html.phone-ui #view-editor .tool-dock::-webkit-scrollbar {
    width: 3px;
    height: 0;
  }

  html.phone-ui #view-editor .dock-group {
    width: 100%;
    flex-wrap: wrap;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    gap: 3px;
  }

  html.phone-ui #view-editor .dock-tools {
    display: grid;
    grid-template-columns: 30px;
    gap: 2px;
  }

  html.phone-ui #view-editor .dock-palette {
    display: grid;
    grid-template-columns: repeat(2, 17px);
    gap: 4px 3px;
    justify-content: center;
  }

  html.phone-ui #view-editor #customColor {
    grid-column: 1 / -1;
    justify-self: center;
  }

  html.phone-ui #view-editor .dock-brush {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  html.phone-ui #view-editor .tool-dock .brush-label {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 3px;
    text-align: center;
    font-size: 9px;
  }

  html.phone-ui #view-editor .tool-dock .brush-label input { width: 100%; }
  html.phone-ui #view-editor .fill-toggle { justify-content: center; gap: 3px; font-size: 9px; }

  html.phone-ui #view-editor .dock-style,
  html.phone-ui #view-editor .dock-history {
    display: grid;
    grid-template-columns: 30px;
    justify-content: center;
    gap: 2px;
  }

  html.phone-ui #view-editor .dock-danger { justify-content: center; }

  html.phone-ui #view-editor .dock-sep {
    width: 100%;
    height: 1px;
    flex: 0 0 1px;
    margin: 1px 0;
  }

  html.phone-ui #view-editor .tool {
    width: 30px;
    height: 30px;
    border-radius: 7px;
  }

  html.phone-ui #view-editor .tool .ic { width: 15px; height: 15px; }
  html.phone-ui #view-editor .swatch { width: 16px; height: 16px; }
  html.phone-ui #view-editor #customColor { width: 22px; height: 22px; }

  html.phone-ui #view-editor .editor-center {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  html.phone-ui #view-editor .editbar {
    display: grid;
    grid-template-columns: max-content max-content;
    grid-auto-rows: 32px;
    align-content: center;
    justify-content: start;
    gap: 2px 8px;
    min-height: 70px;
    max-height: 70px;
    flex-wrap: nowrap;
    margin: 5px 6px 0;
    padding: 4px 6px;
    overflow: visible;
    border-radius: 10px;
  }

  html.phone-ui #view-editor .editbar > .eb-sep { display: none; }
  html.phone-ui #view-editor .eb-group { gap: 5px; padding: 1px 4px; }
  html.phone-ui #view-editor .eb-group:nth-child(1) { grid-area: 1 / 1; }
  html.phone-ui #view-editor .eb-group:nth-child(3) { grid-area: 1 / 2; }
  html.phone-ui #view-editor .eb-group:nth-child(5) { grid-area: 2 / 1; }
  html.phone-ui #view-editor .eb-group:nth-child(7) { grid-area: 2 / 2; }

  html.phone-ui #view-editor .eb-group:nth-child(5) .eb-label,
  html.phone-ui #view-editor .eb-group:nth-child(7) .eb-label { display: none; }

  html.phone-ui #view-editor #fontCS .cs-trigger { max-width: 145px; }

  html.phone-ui #view-editor #fontCS .cs-label {
    max-width: 112px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html.phone-ui #view-editor .page-switcher { gap: 3px; }
  html.phone-ui #view-editor .page-tabs { gap: 3px; }
  html.phone-ui #view-editor .page-tab { min-width: 24px; height: 28px; padding: 0 5px; }
  html.phone-ui #view-editor .zoom-group { gap: 4px; }
  html.phone-ui #view-editor .editbar input[type="range"] { width: 58px; }

  html.phone-ui #view-editor .canvas-stage {
    padding: 10px 46px 10px 8px;
    overscroll-behavior: contain;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
  }

  html.phone-ui #view-editor .editor-body::before {
    background-size: auto 72%, auto 72%;
    opacity: 1;
  }

  html.phone-ui #view-editor .spread-window { border-radius: 9px; }

  html.phone-ui #view-editor .api-panel,
  html.phone-ui #view-editor .font-panel {
    position: fixed;
    top: 90px;
    max-height: min(440px, calc(var(--mobile-vv-height, 100dvh) - 90px));
    padding: 14px;
    border-radius: 12px;
  }

  html.phone-ui #view-editor .api-panel {
    left: 8px;
    right: auto;
    width: min(370px, calc(100vw - 16px));
  }

  html.phone-ui #view-editor .font-panel {
    right: 8px;
    left: auto;
    width: min(340px, calc(100vw - 16px));
  }
}

/* 竖屏只拦截画布编辑；主页、展示页和管理页仍可正常竖向浏览。 */
@media (orientation: portrait) {
  html.phone-ui body[data-view="editor"]:not(.portrait-editor-mode) .mobile-rotate-gate {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
    background:
      radial-gradient(circle at 50% 20%, rgba(255, 255, 255, .96), rgba(245, 245, 247, .94) 52%),
      var(--bg);
    backdrop-filter: blur(22px);
  }
}

.mobile-rotate-card {
  position: relative;
  width: min(350px, 100%);
  padding: 34px 28px 28px;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 26px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .13);
  text-align: center;
}

.mobile-rotate-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  animation: rotatePhoneHint 2.6s cubic-bezier(.4, 0, .2, 1) infinite;
}

.mobile-rotate-icon .ic {
  width: 31px;
  height: 31px;
}

@keyframes rotatePhoneHint {
  0%, 25% { transform: rotate(0deg); }
  55%, 78% { transform: rotate(-90deg); }
  100% { transform: rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-rotate-icon { animation: none; }
}

.mobile-rotate-kicker {
  margin-bottom: 10px;
  color: var(--ink-faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .25em;
  text-indent: .25em;
}

.mobile-rotate-card h2 {
  margin-bottom: 14px;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -.03em;
}

.mobile-rotate-quick-tip {
  margin: -4px 0 12px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.mobile-rotate-copy {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.8;
}

.mobile-rotate-hint {
  margin: 18px 0 22px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink-soft);
  font-size: 10.5px;
  line-height: 1.6;
}

.mobile-rotate-actions {
  display: flex;
  justify-content: center;
  gap: 9px;
  flex-wrap: wrap;
}

.mobile-rotate-actions .btn {
  min-width: 0;
  padding: 9px 15px;
}

/* 手机横屏：左侧竖向工具坞 */
@media (orientation: landscape) and (max-height: 600px) {
  html.phone-ui #view-editor .editor-main {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    width: 100%;
    min-height: 0;
  }

  html.phone-ui #view-editor .tool-dock {
    grid-column: 1;
    grid-row: 1;
    flex-direction: column;
    align-items: center;
    align-self: stretch;
    width: auto;
    min-width: 0;
    min-height: 0;
    max-height: none;
    height: auto;
    margin: 4px 0 6px 5px;
    padding: 5px 2px;
    gap: 5px;
    overflow-x: hidden;
    overflow-y: auto;
    border-radius: 11px;
    scrollbar-width: thin;
  }

  html.phone-ui #view-editor .tool-dock::-webkit-scrollbar {
    width: 3px;
    height: 0;
  }

  html.phone-ui #view-editor .dock-group {
    width: 100%;
    flex-wrap: wrap;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    gap: 4px;
  }

  html.phone-ui #view-editor .dock-tools {
    display: grid;
    grid-template-columns: repeat(2, 32px);
    gap: 2px;
  }

  html.phone-ui #view-editor .dock-palette {
    display: grid;
    grid-template-columns: repeat(3, 17px);
    gap: 5px 4px;
    justify-content: center;
  }

  html.phone-ui #view-editor #customColor {
    grid-column: 1 / -1;
    justify-self: center;
  }

  html.phone-ui #view-editor .dock-brush {
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
  }

  html.phone-ui #view-editor .tool-dock .brush-label {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 4px;
    text-align: center;
    font-size: 10px;
  }

  html.phone-ui #view-editor .tool-dock .brush-label input { width: 100%; }
  html.phone-ui #view-editor .fill-toggle { justify-content: center; font-size: 10px; }

  html.phone-ui #view-editor .dock-style,
  html.phone-ui #view-editor .dock-history {
    display: grid;
    grid-template-columns: repeat(2, 32px);
    justify-content: center;
    gap: 3px;
  }

  html.phone-ui #view-editor .dock-danger { justify-content: center; }

  html.phone-ui #view-editor .dock-sep {
    width: 100%;
    height: 1px;
    flex: 0 0 1px;
    margin: 1px 0;
  }

  html.phone-ui #view-editor .editor-center {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

}

/* 手机横屏属性栏：两行布局，避免下拉菜单被横向滚动容器裁切 */
@media (orientation: landscape) and (max-height: 600px) {
  html.phone-ui #view-editor .editbar {
    display: grid;
    grid-template-columns: max-content max-content;
    grid-auto-rows: 32px;
    align-content: center;
    justify-content: start;
    gap: 2px 20px;
    min-height: 70px;
    max-height: 70px;
    flex-wrap: nowrap;
    margin: 4px 8px 0;
    padding: 4px 10px;
    overflow: visible;
    border-radius: 11px;
  }

  html.phone-ui #view-editor .editbar > .eb-sep { display: none; }
  html.phone-ui #view-editor .eb-group { flex: 0 0 auto; gap: 6px; padding: 2px 5px; }
  html.phone-ui #view-editor .eb-group:nth-child(1) { grid-area: 1 / 1; }
  html.phone-ui #view-editor .eb-group:nth-child(3) { grid-area: 1 / 2; }
  html.phone-ui #view-editor .eb-group:nth-child(5) { grid-area: 2 / 1; }
  html.phone-ui #view-editor .eb-group:nth-child(7) { grid-area: 2 / 2; }
  html.phone-ui #view-editor .editbar .cs-list { z-index: 180; }
  html.phone-ui #view-editor .editbar .cs-list {
    max-height: clamp(90px, calc(var(--mobile-vv-height, 100dvh) - 110px), 210px);
  }
  html.phone-ui #view-editor .page-menu { z-index: 190; }
}

/* 低高度横屏首页：压缩品牌与主面板，保证 Logo 和内容不互相遮挡。 */
@media (orientation: landscape) and (max-height: 540px) {
  .home-logo {
    top: 10px;
    left: 12px;
    width: 230px;
    padding: 0;
    border-radius: 0;
  }

  .home-panel {
    max-width: calc(100vw - 32px);
    padding: 34px 34px 24px;
    border-radius: 18px;
  }

  .home-panel .panel-dots { top: 12px; left: 16px; }
  .home-kicker { margin-bottom: 10px; font-size: 8.5px; letter-spacing: .34em; text-indent: .34em; }
  .home-title { margin-bottom: 10px; font-size: clamp(28px, 5vw, 38px); line-height: 1.06; }
  .home-sub { margin-bottom: 16px; font-size: 12px; }
  .home-actions { flex-direction: row; gap: 8px; }
  .home-actions .btn { min-width: 150px; padding: 10px 16px; }
}

/* 桌面端放大完整品牌 Logo；触屏和手机尺寸保持不变。 */
@media (min-width: 1024px) and (pointer: fine) {
  .brand-logo-image { width: clamp(230px, 15vw, 265px); }
  .brand-logo-brand { gap: 10px; }
  .brand-section-label { font-size: 10px; }
}

@media (max-width: 767px) {
  html.phone-ui #view-editor .editor-body::before {
    background-image:
      url("../assets/editor-canvas-left-veronica.png"),
      url("../assets/editor-canvas-right-hunter.png");
    background-position: left bottom, right bottom;
    background-size: auto 42%, auto 42%;
    opacity: 1;
  }
}

/* 竖屏画布：按屏宽缩放两张宽幅人物图，保证左右角色完整且互不重叠。 */
@media (max-width: 767px) and (orientation: portrait) {
  html.phone-ui #view-editor .editor-body::before {
    background-size:
      auto calc(56vw - 30.24px),
      auto calc(56vw - 30.24px);
  }
}
