/*!
 * app.css — stylesheet of the article canvas editor
 * Visual language: teal accent #1E7B6B, light grey surface #f4f5f7,
 * three-column layout with a phone-sized canvas in the middle.
 */

* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
/* 编辑区固定占满首屏（.app），说明区排在首屏之下：窗口可滚动，三栏工作区尺寸不受影响 */
body { min-height: 100%; background: #f4f5f7; color: #333; }
.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; min-height: 0; }

/* ================= 顶栏 ================= */
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: #fff; border-bottom: 1px solid #e6e8eb; flex-wrap: wrap;
}
.topbar h1 { font-size: 15px; font-weight: 700; color: #1e7b6b; margin-right: 8px; white-space: nowrap; }
.topbar .field { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #666; }
.topbar select, .topbar input[type=text] {
  padding: 6px 8px; border: 1px solid #d9dde1; border-radius: 6px; font-size: 13px;
}
.topbar input[type=text] { width: 180px; }
.btn { padding: 7px 14px; border: none; border-radius: 6px; font-size: 13px; cursor: pointer; font-weight: 600; }
.btn-primary { background: #1e7b6b; color: #fff; }
.btn-primary:hover { background: #155c50; }
.btn-smart { background: #c07a2b; color: #fff; }
.btn-smart:hover { background: #a9651f; }
.btn-cloud { background: #07c160; color: #fff; }
.btn-cloud:hover { background: #06ad56; }
.btn-ghost { background: #eef1f3; color: #444; }
.btn-ghost:hover { background: #e2e6ea; }
.spacer { flex: 1; }
.topbar a.btn { text-decoration: none; display: inline-block; }
.wordcount { font-size: 12px; color: #888; background: #f0f2f4; padding: 5px 10px; border-radius: 6px; white-space: nowrap; }

/* ================= 三栏布局 ================= */
.layout { flex: 1; display: flex; min-height: 0; }
.panel-l, .panel-r { width: 240px; background: #fff; overflow-y: auto; border-right: 1px solid #e6e8eb; }
.panel-r { border-right: none; border-left: 1px solid #e6e8eb; }
.canvas-wrap { flex: 1; overflow: hidden; padding: 22px; display: flex; justify-content: center; align-items: flex-start; }

.panel-title { font-size: 12px; font-weight: 700; color: #999; padding: 14px 14px 8px; letter-spacing: .5px; }
.comp-group { margin-bottom: 6px; }
.comp-group-h { font-size: 11px; color: #aaa; padding: 8px 14px 4px; }
.comp-btn {
  display: flex; align-items: center; gap: 8px; width: calc(100% - 16px); margin: 4px 8px;
  padding: 9px 10px; background: #f7f9fa; border: 1px solid #ecedef; border-radius: 8px;
  font-size: 13px; color: #444; cursor: pointer; text-align: left;
}
.comp-btn:hover { background: #eaf4f1; border-color: #1e7b6b; color: #155c50; }
.comp-btn .ico { font-size: 15px; }

/* ================= 手机画布 ================= */
.phone {
  width: 380px; min-height: 600px; max-height: 100%; overflow-y: auto;
  background: #fff; border-radius: 14px; box-shadow: 0 4px 24px rgba(0, 0, 0, .08); padding: 16px;
}
.phone-empty { color: #bbb; text-align: center; padding: 80px 20px; font-size: 13px; line-height: 1.8; }
.block { position: relative; }
.block img { cursor: pointer; }
.block img:hover { outline: 2px dashed rgba(30, 123, 107, .7); outline-offset: 2px; }
.block-tools { position: absolute; right: 2px; top: 2px; display: none; gap: 3px; z-index: 5; }
.block:hover .block-tools { display: flex; }
.block-tools button {
  width: 22px; height: 22px; border: none; border-radius: 5px; background: rgba(30, 123, 107, .92);
  color: #fff; font-size: 11px; cursor: pointer; line-height: 1; padding: 0;
}
.block-tools button.del { background: rgba(217, 83, 79, .92); }
.block-tools button:hover { filter: brightness(1.1); }
.block [contenteditable="true"] { outline: none; }
.block [contenteditable="true"]:focus {
  background: rgba(30, 123, 107, .06); border-radius: 4px; box-shadow: 0 0 0 2px rgba(30, 123, 107, .25);
}

/* ================= 右栏：主题 + 代码 ================= */
.theme-card { margin: 8px 12px; padding: 10px; border: 1px solid #ececec; border-radius: 8px; cursor: pointer; }
.theme-card.active { border-color: #1e7b6b; box-shadow: 0 0 0 2px rgba(30, 123, 107, .15); }
.theme-card .row { display: flex; gap: 6px; margin-top: 8px; }
.theme-card .sw { width: 22px; height: 22px; border-radius: 5px; }
.theme-card .name { font-size: 13px; font-weight: 600; }
.theme-card .desc { font-size: 11px; color: #999; margin-top: 2px; }
.code-box {
  margin: 8px 12px; background: #2b2b2b; color: #e6e6e6; border-radius: 8px; padding: 10px;
  font-family: Consolas, Menlo, monospace; font-size: 11px; line-height: 1.5;
  max-height: 280px; overflow: auto; white-space: pre-wrap; word-break: break-all;
}
.tip { font-size: 11px; color: #999; padding: 6px 14px 14px; line-height: 1.7; }
.hint {
  background: #fff8e1; border: 1px solid #ffe0a3; color: #9a6b00; font-size: 12px;
  padding: 8px 12px; margin: 8px 12px; border-radius: 8px; line-height: 1.6;
}

/* ================= 浮层 / 弹窗 ================= */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: none;
  align-items: center; justify-content: center; z-index: 50;
}
.modal-mask.show { display: flex; }
.modal {
  width: 440px; max-width: 92vw; max-height: 90vh; overflow: auto; background: #fff;
  border-radius: 14px; padding: 22px 24px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
}
.modal h3 { margin: 0 0 4px; font-size: 18px; color: #1e7b6b; }
.modal .sub { margin: 0 0 6px; font-size: 12px; color: #999; line-height: 1.6; }
.modal label { display: block; font-size: 13px; color: #444; margin: 14px 0 5px; }
.modal input, .modal textarea, .modal select {
  width: 100%; box-sizing: border-box; padding: 9px 11px; border: 1px solid #d8dee2;
  border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff;
}
.modal textarea { height: 62px; resize: vertical; }
.modal .row { display: flex; gap: 10px; }
.modal .row > div { flex: 1; min-width: 0; }
.modal .acts { display: flex; gap: 10px; margin-top: 20px; }
.modal .acts button { flex: 1; padding: 11px; border: none; border-radius: 9px; font-size: 15px; cursor: pointer; }
.modal .acts .gen { background: #1e7b6b; color: #fff; font-weight: bold; }
.modal .acts .gen:hover { background: #155c50; }
.modal .acts .cancel { background: #f0f2f4; color: #555; }
.modal .acts .dl { background: #1e7b6b; color: #fff; font-weight: bold; }
.modal .acts .dl:hover { background: #155c50; }
.modal .code-box {
  background: #f6f8f9; border: 1px solid #e3e7ea; border-radius: 8px; padding: 10px 12px;
  font-size: 11px; line-height: 1.5; max-height: 44vh; overflow: auto;
  white-space: pre-wrap; word-break: break-all; color: #444;
}

/* 轻提示 */
.toast {
  position: fixed; left: 50%; bottom: 42px; transform: translateX(-50%) translateY(20px);
  background: rgba(28, 38, 33, .94); color: #fff; padding: 11px 22px; border-radius: 24px;
  font-size: 14px; z-index: 99; opacity: 0; transition: .3s; pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ================= 选区格式工具条 ================= */
.sel-bar {
  position: fixed; z-index: 60; display: none; align-items: center; gap: 6px;
  background: #2b2f33; color: #fff; padding: 6px 8px; border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .3); font-size: 13px;
}
.sel-bar.show { display: flex; }
.sel-bar select { background: #3a3f44; color: #fff; border: 1px solid #555; border-radius: 6px; padding: 4px; font-size: 13px; }
.sel-bar button { background: #3a3f44; color: #fff; border: none; border-radius: 6px; padding: 5px 9px; cursor: pointer; font-size: 13px; }
.sel-bar button:hover { background: #4a5056; }
.sel-palette {
  position: fixed; z-index: 61; display: none; background: #2b2f33; padding: 10px;
  border-radius: 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); width: 176px;
}
.sel-palette.show { display: block; }
.sel-palette .sel-mode-label { color: #fff; font-size: 12px; margin-bottom: 4px; }
.sel-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.sel-swatches .sw {
  width: 22px; height: 22px; border-radius: 5px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .28);
}
.sel-palette .cust { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 12px; margin-top: 8px; }
.sel-palette .cust input { width: 38px; height: 26px; border: none; background: none; padding: 0; cursor: pointer; }

/* ================= 付费闸门弹窗 =================
   默认关闭（APP_CONFIG.ENABLED = false → 导出/复制免费）。
   开启需自备聚合支付后端，本项目不内置任何支付通道。 */
#payMask .modal { width: 340px; text-align: center; }
#payMask .amount { font-size: 26px; font-weight: 700; color: #1e7b6b; margin: 6px 0 14px; }
#payMask .qr { width: 200px; height: 200px; object-fit: contain; border: 1px solid #e3e7ea; border-radius: 8px; }
#payMask .hint { color: #999; font-size: 13px; margin: 10px 0; }
#payMask .status { font-size: 14px; margin-top: 8px; }
#payMask .status.ok { color: #07a34a; }
#payMask .status.wait { color: #999; }
#payMask a.payurl { display: inline-block; margin-top: 8px; color: #1e7b6b; font-size: 13px; word-break: break-all; }
#payMask .close { margin-top: 14px; padding: 10px 18px; }
#payMask .err { color: #e54d42; font-size: 13px; margin-top: 8px; min-height: 16px; }

/* ================= 窄屏兜底 =================
   桌面端固定三栏；仅在窗口过窄时保证可用，不改变桌面版式 */
@media (max-width: 1100px) {
  .panel-l, .panel-r { width: 200px; }
  .phone { width: 340px; }
}
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .panel-l, .panel-r { width: 100%; max-height: 220px; border: none; border-top: 1px solid #e6e8eb; }
  .canvas-wrap { padding: 12px; }
  .phone { width: 100%; max-width: 420px; }
}

/* ================= 首屏之下的说明区（SEO 内容，真实可见） ================= */
.site-info { background: #fff; border-top: 1px solid #e6e8eb; }
.si-inner { max-width: 900px; margin: 0 auto; padding: 40px 20px 48px; }
.site-info section + section { margin-top: 30px; }
.site-info h2 { font-size: 18px; line-height: 1.5; color: #1e7b6b; font-weight: 800; margin-bottom: 10px; }
.site-info h2 + p { margin-top: 0; }
.site-info p { font-size: 14px; line-height: 1.9; color: #4a5158; }
.site-info p + p { margin-top: 10px; }
.site-info code { background: #f0f2f4; border-radius: 4px; padding: 1px 5px; font-size: 13px; color: #b3532b; }
.site-info ol { margin: 6px 0 0 20px; }
.site-info ol li { font-size: 14px; line-height: 1.9; color: #4a5158; margin-bottom: 6px; }
.site-info strong { color: #2b3138; }
.si-hero h2 { font-size: 20px; }
.si-faq { margin-top: 4px; }
.si-faq dt { font-size: 14px; font-weight: 700; color: #2b3138; margin-top: 12px; }
.si-faq dt::before { content: "Q "; color: #1e7b6b; }
.si-faq dd { font-size: 14px; line-height: 1.85; color: #5a6169; margin: 4px 0 0; padding-left: 18px; }
.si-meta { margin-top: 32px; padding-top: 16px; border-top: 1px solid #eef1f3; font-size: 13px; line-height: 1.9; color: #8b9299; }
.si-meta a { color: #1e7b6b; text-decoration: none; }
.si-meta a:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .si-inner { padding: 28px 16px 36px; }
  .si-hero h2 { font-size: 18px; }
  .site-info h2 { font-size: 16px; }
}
