:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --line: #e5eaf2;
  --text: #1f2937;
  --sub: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --ok: #059669;
  --danger: #dc2626;
  --shadow: 0 10px 28px rgba(16, 24, 40, .08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 10% -10%, #dbeafe 0%, transparent 36%), radial-gradient(circle at 90% 0%, #e0e7ff 0%, transparent 34%), var(--bg);
}
.wrap { width: min(1120px, 92vw); margin: 0 auto; }
.topbar { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); }
.topbar .wrap { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; flex-direction: column; }
.brand-main { font-size: 22px; font-weight: 800; color: #f97316; }
.brand-sub { font-size: 13px; color: #475569; }
.auth-actions { display: flex; align-items: center; gap: 10px; }
.btn, .link-btn { border: none; border-radius: 10px; padding: 8px 12px; font-size: 14px; cursor: pointer; transition: .2s ease; }
.btn { background: var(--primary); color: #fff; font-weight: 700; }
.btn:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; color: #1e3a8a; border: 1px solid #bfdbfe; }
.btn-outline:hover { background: #eff6ff; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.link-btn { background: transparent; color: #334155; }
.link-btn:hover { background: #f1f5f9; }
.main { padding: 22px 0 44px; }
.section-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
.section-head { padding: 16px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #fff, #fbfdff); }
.section-head h2 { margin: 0; font-size: 22px; }
.meta { color: var(--sub); font-size: 13px; margin-top: 6px; }
.content { padding: 16px 18px 18px; }
.viewer-thumb { cursor: zoom-in; transition: transform .22s ease, box-shadow .22s ease; }
.viewer-thumb:hover { transform: translateY(-2px); box-shadow: 0 10px 18px rgba(15, 23, 42, .18); }
.status { color: var(--ok); font-size: 13px; font-weight: 700; }
.publish-panel {
  margin-top: 14px;
  border: 1px solid #c7dcff;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff, #f1f7ff);
  padding: 14px;
  display: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}
.publish-panel.show { display: block; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-item { display: flex; flex-direction: column; gap: 6px; }
.form-item.full { grid-column: 1 / -1; }
.form-item label { font-size: 13px; color: #334155; font-weight: 700; }
input, textarea {
  width: 100%;
  border: 1px solid #cfd8e3;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fff;
  outline: none;
  font-family: inherit;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
input:focus, textarea:focus { border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(96, 165, 250, .22); }
textarea { min-height: 110px; resize: vertical; line-height: 1.7; }

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid #cfd8e3;
  border-radius: 12px 12px 0 0;
  border-bottom: none;
  background: linear-gradient(180deg, #ffffff, #f6f9ff);
}
.editor-toolbar button {
  border: 1px solid #d5dbe7;
  background: #fff;
  border-radius: 10px;
  padding: 6px 11px;
  font-size: 12px;
  cursor: pointer;
  color: #1f2937;
  font-weight: 600;
  transition: all .2s ease;
}
.editor-toolbar button:hover {
  background: #eef5ff;
  border-color: #9dc1ff;
  color: #1d4ed8;
  transform: translateY(-1px);
}
.rich-editor {
  min-height: 200px;
  border: 1px solid #cfd8e3;
  border-radius: 0 0 12px 12px;
  padding: 12px;
  background: #fff;
  outline: none;
  line-height: 1.75;
  overflow: auto;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .04);
}
.rich-editor:focus { border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(96,165,250,.22), inset 0 1px 2px rgba(15, 23, 42, .04); }
.rich-editor img { max-width: 100%; border-radius: 10px; margin: 12px 0; display: block; border: 1px solid #dbe4f0; }
.tips { margin-top: 8px; color: #64748b; font-size: 12px; }
.actions { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; }

.form-item .btn-outline {
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
}

#tutorialPanel .btn,
#publishPanel .btn {
  border-radius: 12px;
  padding: 9px 14px;
  box-shadow: 0 6px 14px rgba(37, 99, 235, .22);
}
.timeline { margin-top: 14px; }
.log-item { border: 1px solid #e6ebf5; border-radius: 12px; background: #fff; padding: 14px; margin-bottom: 12px; }
.log-title { margin: 0; font-size: 19px; }
.log-info { margin-top: 5px; color: #64748b; font-size: 13px; }
.log-time { margin-top: 6px; color: #94a3b8; font-size: 12px; }
.log-content { margin-top: 9px; color: #1f2937; white-space: pre-wrap; line-height: 1.78; font-size: 15px; }
.log-content.collapsed { display: -webkit-box; -webkit-line-clamp: 6; line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.toggle-link { margin-top: 8px; background: transparent; border: none; color: #2563eb; font-size: 13px; cursor: pointer; padding: 0; font-weight: 700; }
.log-actions { margin-top: 10px; display: flex; gap: 10px; flex-wrap: wrap; }
.version-download { display: inline-flex; align-items: center; text-decoration: none; border-radius: 10px; padding: 7px 12px; font-size: 13px; border: 1px solid #bfdbfe; background: #eff6ff; color: #1e3a8a; font-weight: 700; }
.version-download:hover { background: #dbeafe; }
.btn-log-edit, .btn-log-delete { border-radius: 10px; padding: 7px 12px; font-size: 13px; font-weight: 700; cursor: pointer; }
.btn-log-edit { border: 1px solid #bfdbfe; background: #eff6ff; color: #1d4ed8; }
.btn-log-delete { border: 1px solid #fecaca; background: #fef2f2; color: #b91c1c; }
.log-images { margin-top: 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.log-images img { width: 100%; max-height: 180px; object-fit: cover; border-radius: 8px; border: 1px solid #dbe4f0; background: #fff; }
.auth-modal, .edit-modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 50; padding: 18px; }
.auth-modal { background: radial-gradient(circle at 18% 22%, rgba(56,189,248,.20), transparent 38%), radial-gradient(circle at 78% 18%, rgba(99,102,241,.18), transparent 36%), rgba(15, 23, 42, .42); overflow: hidden; }
.auth-modal::before,
.auth-modal::after {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
  opacity: .55;
}
.auth-modal::before {
  left: -60px;
  top: -40px;
  background: radial-gradient(circle, rgba(148,163,184,.10) 0%, rgba(148,163,184,0) 70%);
  animation: none;
}
.auth-modal::after {
  right: -50px;
  bottom: -50px;
  background: radial-gradient(circle, rgba(148,163,184,.08) 0%, rgba(148,163,184,0) 72%);
  animation: none;
}
.edit-modal { background: rgba(15, 23, 42, .52); z-index: 90; padding: 20px; }
.auth-modal.show, .edit-modal.show { display: flex; }
.auth-card { width: min(460px, 96vw); border: 1px solid #dbe4f0; border-radius: 14px; background: linear-gradient(180deg, #ffffff, #f8fbff); padding: 18px; box-shadow: 0 18px 36px rgba(15, 23, 42, .18); }
.auth-card.modern-login {
  width: min(500px, 96vw);
  background: linear-gradient(145deg, #ffffff 0%, #f7fbff 100%);
  border: 1px solid #dbeafe;
  color: #1f2937;
  box-shadow: 0 20px 44px rgba(15, 23, 42, .16);
  position: relative;
  overflow: hidden;
}
.auth-card.modern-login::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.42), rgba(255,255,255,0));
  animation: none;
  pointer-events: none;
}
.auth-card.modern-login > * { position: relative; z-index: 1; }
.auth-hero { text-align: center; margin-bottom: 10px; }
.auth-avatar {
  width: 84px;
  height: 84px;
  margin: 2px auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 34px;
  color: #1d4ed8;
  background: radial-gradient(circle at 30% 30%, #dbeafe, #bfdbfe 72%);
  border: 1px solid rgba(59, 130, 246, .35);
  box-shadow: 0 0 0 6px rgba(59, 130, 246, .12), 0 8px 22px rgba(59, 130, 246, .18);
}
.auth-avatar img { width: 34px; height: 34px; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(30,64,175,.25)); }
.auth-title { margin: 0 0 8px; font-size: 24px; color: #0f172a; font-weight: 800; }
.auth-subtitle { color: #475569; font-size: 13px; margin-bottom: 8px; }
.auth-card.modern-login .form-item label { color: #334155; }
.auth-card.modern-login input,
.auth-card.modern-login textarea {
  background: #ffffff;
  border: 1px solid #bfdbfe;
  color: #0f172a;
}
.auth-card.modern-login input::placeholder { color: #94a3b8; opacity: .95; }
.auth-card.modern-login input:focus,
.auth-card.modern-login textarea:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, .22);
}
.auth-help { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; font-size: 12px; }
.auth-card.modern-login .captcha-box {
  background: #f0f9ff;
  border: 1px dashed #60a5fa;
  color: #1d4ed8;
}
.auth-card.modern-login .btn {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  animation: none;
}
.auth-card.modern-login .btn:hover { background: linear-gradient(180deg, #4f8ff7 0%, #2f6fe9 100%); }
.auth-card.modern-login .btn-outline {
  background: #ffffff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
}
.auth-card.modern-login .btn-outline:hover { background: #eff6ff; }
.auth-card.modern-login .auth-bottom { color: #64748b; }
@keyframes pulse-login-btn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, .34); }
  50% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
}
@keyframes matrix-scan {
  0% { transform: translateY(-20%); }
  100% { transform: translateY(20%); }
}
.captcha-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.captcha-box { min-width: 120px; text-align: center; border: 1px dashed #93c5fd; background: #eff6ff; color: #1d4ed8; border-radius: 8px; padding: 10px 8px; font-weight: 800; letter-spacing: 2px; cursor: pointer; user-select: none; }
.lock-tip { margin-top: 8px; color: #b91c1c; font-size: 12px; font-weight: 700; min-height: 18px; }
.auth-bottom { margin-top: 10px; font-size: 13px; color: #6b7280; }
.image-viewer { position: fixed; inset: 0; background: rgba(2, 6, 23, .9); display: none; z-index: 80; overflow: hidden; }
.image-viewer.show { display: block; }
.viewer-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; cursor: grab; user-select: none; }
.viewer-stage.dragging { cursor: grabbing; }
#viewerImage { max-width: none; max-height: none; transform-origin: center center; transition: transform .05s linear; pointer-events: none; }
.viewer-toolbar { position: absolute; top: 14px; right: 16px; display: flex; gap: 8px; background: rgba(15, 23, 42, .7); border: 1px solid rgba(148, 163, 184, .35); border-radius: 10px; padding: 8px; }
.viewer-toolbar button { border: 1px solid rgba(148, 163, 184, .5); background: rgba(255, 255, 255, .12); color: #fff; border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.viewer-tip { position: absolute; left: 16px; bottom: 16px; color: #cbd5e1; font-size: 12px; background: rgba(15, 23, 42, .6); border: 1px solid rgba(148, 163, 184, .35); border-radius: 8px; padding: 7px 10px; }
.edit-card { width: min(920px, 96vw); max-height: 88vh; overflow: auto; border: 1px solid #dbe4f0; border-radius: 14px; background: #fff; box-shadow: 0 20px 50px rgba(15, 23, 42, .25); padding: 16px; }
.edit-card h3 { margin: 0 0 10px; font-size: 20px; }
.edit-card textarea { min-height: 360px; font-size: 15px; line-height: 1.85; }
.edit-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.edit-tools-left { display: flex; gap: 8px; }
.tool-btn { border: 1px solid #bfdbfe; background: #eff6ff; color: #1e40af; border-radius: 8px; padding: 6px 10px; font-size: 12px; cursor: pointer; font-weight: 700; }
.tool-btn:disabled { opacity: .45; cursor: not-allowed; }
.char-count { font-size: 12px; color: #64748b; font-weight: 700; }
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0;
  padding: 12px;
  border: 1px solid #cfe0ff;
  border-bottom: none;
  border-radius: 14px 14px 0 0;
  background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}

.editor-toolbar button {
  border: 1px solid #c5d8ff;
  background: linear-gradient(180deg, #ffffff 0%, #f6f9ff 100%);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  color: #1e3a8a;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 1px 0 rgba(255,255,255,.8), 0 2px 8px rgba(30,64,175,.06);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}

.editor-toolbar button:hover {
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #93c5fd;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,.12);
}

.editor-toolbar button:active { transform: translateY(0); }

.rich-editor {
  min-height: 280px;
  border: 2px solid #cfe0ff;
  border-radius: 0 0 14px 14px;
  padding: 14px;
  font-size: 14px;
  line-height: 1.8;
  background: #fff;
  outline: none;
  overflow: auto;
  box-shadow: inset 0 1px 2px rgba(15,23,42,.04);
}

.rich-editor:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37,99,235,.16), inset 0 1px 2px rgba(15, 23, 42, .04);
}

.rich-editor:empty::before {
  content: '请输入内容，可图文混排（文字 + 图片）';
  color: #94a3b8;
}

.rich-editor img {
  max-width: 100%;
  border-radius: 10px;
  margin: 12px 0;
  display: block;
  border: 1px solid #e2e8f0;
}

.tutorial-preview {
  color: #334155;
  line-height: 1.8;
  white-space: pre-wrap;
}

#publishPanel .rich-editor,
#tutorialPanel .rich-editor {
  min-height: 320px !important;
  border: 2px solid #93c5fd !important;
  background: #ffffff !important;
  border-radius: 0 0 12px 12px;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .04);
}

#publishPanel .rich-editor:focus,
#tutorialPanel .rich-editor:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 4px rgba(37,99,235,.16), inset 0 1px 2px rgba(15, 23, 42, .04);
}

#publishPanel .rich-editor,
#tutorialPanel .rich-editor,
#publishPanel .rich-editor *,
#tutorialPanel .rich-editor * {
  color: #111827 !important;
  background-color: transparent !important;
}

#publishPanel .editor-toolbar,
#tutorialPanel .editor-toolbar {
  border: 2px solid #93c5fd;
  border-bottom: none;
  background: #f0f7ff;
}

#publishPanel .editor-toolbar button,
#tutorialPanel .editor-toolbar button {
  font-size: 13px;
  padding: 7px 12px;
  font-weight: 700;
}

@media (max-width: 860px) { .form-grid { grid-template-columns: 1fr; } .section-head h2, .brand-main { font-size: 20px; } }
