* { box-sizing: border-box; }
:root {
  --ink: #1d2733;
  --muted: #6c7a89;
  --line: #e3e9ef;
  --bg: #f4f7fa;
  --accent: #2f7d63;
  --accent-soft: #e7f2ed;
  --warn: #c4553d;
  font-family: ui-sans-serif, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
body { margin: 0; min-height: 100vh; }

.bar {
  position: sticky; top: 0; z-index: 10;
  height: 60px; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,.9); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand .logo { color: var(--accent); font-size: 20px; }
.brand strong { font-size: 17px; }
.brand small { color: var(--muted); font-size: 12px; }
.engine { font-size: 12px; color: var(--muted); }

main { max-width: 1320px; margin: 0 auto; padding: 26px 24px 60px; }

.drop {
  padding: 60px 24px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line); border-radius: 18px; background: #fff;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.dragging { border-color: var(--accent); background: var(--accent-soft); }
.drop p { margin: 0 0 8px; }
.drop strong { font-size: 17px; }
.drop .hint { color: var(--muted); font-size: 12.5px; }

.workspace { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 22px; align-items: start; }
.hidden { display: none !important; }

.stage { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px; }

.canvas-wrap {
  position: relative;
  line-height: 0;
  background: #f7f9fb;
  cursor: crosshair;
  transform-origin: 0 0;
  will-change: transform;
}
.canvas-wrap img { width: 100%; height: auto; display: block; user-select: none; -webkit-user-drag: none; }
.canvas-wrap canvas { position: absolute; top: 0; left: 0; touch-action: none; opacity: .55; }
.hint-bar { margin-top: 10px; padding: 8px 12px; border-radius: 8px; background: var(--accent-soft); color: #2c5d4d; font-size: 12.5px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
button {
  height: 38px; padding: 0 16px; border-radius: 10px; font-size: 13.5px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
button:hover:not(:disabled) { border-color: #c4d2dd; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { border: 0; background: var(--accent); color: #fff; font-weight: 600; }
button.ghost { background: #fff; }
.slider { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.slider input { width: 110px; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }

.panel { display: grid; gap: 12px; }
.step {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 13.5px;
}
.step b { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; }
.step span { flex: 1; }
.step em { font-style: normal; color: var(--muted); font-size: 12px; }
.step.done em { color: var(--accent); }

.stats { padding: 14px; border-radius: 12px; background: #fff; border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); display: grid; gap: 6px; }
.stats:empty { display: none; }
.stats strong { color: var(--ink); }

.preview { padding: 14px; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.preview-title { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.preview-title span { color: var(--muted); font-weight: 400; font-size: 12px; }
.preview-pair { display: grid; gap: 10px; }
.preview-pair figure canvas, .preview-pair figure img { width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; }
.preview-pair figure canvas { cursor: zoom-in; transition: transform .15s; }
.preview-pair figure img { cursor: zoom-in; transition: transform .15s; }
.preview-pair figure img:hover { transform: scale(1.01); }
figure { margin: 0; }
figure img { width: 100%; border-radius: 8px; border: 1px solid var(--line); }
figcaption { margin-top: 4px; color: var(--muted); font-size: 11.5px; text-align: center; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .panel { order: -1; }
}

.slider select {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 12.5px;
  color: var(--ink);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.switch input { accent-color: var(--accent); }

.switch:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #2c5d4d;
  font-weight: 600;
}

.toolbar .primary { order: -1; }

/* 顶部返回 */
.bar-right { display: flex; align-items: center; gap: 12px; }
.bar-back {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 12.5px;
  cursor: pointer;
}
.bar-back:hover { border-color: var(--accent); color: var(--accent); }
.brand { text-decoration: none; color: inherit; cursor: pointer; }

/* 画笔相关 */
.canvas-wrap { cursor: crosshair; }
.brush-size input { width: 96px; }

/* hidden 属性对 label 生效 */
[hidden] { display: none !important; }

/* 预览放大遮罩 */
.lightbox {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(12, 18, 24, .82);
  cursor: zoom-out;
}
.lightbox.is-open { display: grid; }
.lightbox canvas { max-width: 100%; max-height: 100%; border-radius: 8px; }







/* ---------- 全屏涂抹层 ---------- */

.canvas-wrap { position: relative; cursor: zoom-in; }
.canvas-wrap canvas { position: absolute; inset: 0; pointer-events: none; opacity: .6; }
/* 桌面端直接在预览图上涂，不需要弹层 */
.canvas-wrap.direct-paint { cursor: crosshair; }
.canvas-wrap.direct-paint canvas { pointer-events: auto; }

.paint-modal {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
  background: rgba(12, 18, 24, .88);
  backdrop-filter: blur(3px);
}
.paint-modal[hidden] { display: none; }

.paint-dialog {
  width: 100%;
  height: 100%;
  max-width: 1100px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
}

.paint-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 4px;
}
.paint-title {
  flex: 1;
  text-align: center;
  color: #eef3f8;
  font-size: 14px;
}
.paint-bar .ghost { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.22); color: #eef3f8; }
.paint-bar .primary { background: var(--accent); border: 0; color: #fff; font-weight: 600; }

.paint-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  border-radius: 10px;
  background: #0f151b;
}
.paint-stage canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.paint-hint { color: var(--muted); font-size: 12px; }

.paint-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 4px;
}
.paint-foot .slider { color: rgba(255,255,255,.75); }
.paint-foot .slider span { color: #fff; }
.paint-foot .ghost { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.22); color: #eef3f8; }
.paint-foot .ghost:disabled { opacity: .35; }

/* ---------- SEO 内容区（对用户也是有用的说明） ---------- */

.intro {
  max-width: 760px;
  margin: 0 auto 18px;
  text-align: center;
}
.intro h1 {
  margin: 0 0 8px;
  font-size: 26px;
  letter-spacing: .01em;
}
.intro p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.seo {
  max-width: 820px;
  margin: 44px auto 0;
  padding: 0 4px 60px;
  color: var(--ink);
  line-height: 1.75;
  font-size: 14px;
}
.seo h2 {
  margin: 28px 0 10px;
  font-size: 17px;
}
.seo ol, .seo ul {
  margin: 0;
  padding-left: 22px;
  color: #46525f;
}
.seo li { margin-bottom: 6px; }
.seo dl { margin: 0; }
.seo dt {
  margin-top: 14px;
  font-weight: 600;
}
.seo dd {
  margin: 4px 0 0;
  color: #46525f;
}

@media (max-width: 720px) {
  .intro h1 { font-size: 22px; }
  .intro p { font-size: 13px; }
  .seo { font-size: 13.5px; padding-bottom: 40px; }
}

/* ---------- 账户 ---------- */

.bar-right { display: flex; align-items: center; gap: 12px; }
.account { display: flex; align-items: center; gap: 8px; }
.account.hidden, .modal[hidden] { display: none; }
.acct-email { font-size: 12.5px; color: var(--muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-credit {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: #e8f6f2;
  border-radius: 999px;
  padding: 2px 9px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(12, 18, 24, .5);
}
.modal-box {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 18px 50px rgba(10, 20, 30, .25);
}
.modal-box header { display: flex; align-items: center; margin-bottom: 10px; }
.modal-box header strong { flex: 1; font-size: 15px; }
.modal-x { border: 0; background: transparent; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.login-hint {
  margin: 8px 0 0; padding: 10px 12px; border-radius: 8px;
  background: #fff6e8; color: #8a5a1a; font-size: 12.5px; line-height: 1.5;
}
#forgotLink.is-highlight { color: var(--accent); font-weight: 600; }

.mp-box { text-align: center; }
.mp-qr {
  width: 220px; height: 220px; margin: 8px auto 4px; display: block;
  border-radius: 12px; background: #f2f5f4;
}
.mp-qr[src=""] { visibility: hidden; }

.auth-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.auth-tab {
  flex: 1; height: 34px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--muted); font-size: 13px; cursor: pointer;
}
.auth-tab.is-on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.modal-tip { font-size: 12.5px; color: var(--muted); margin: 0 0 12px; line-height: 1.6; }
.modal-box input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
  margin-bottom: 10px;
}
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }
.code-row button { white-space: nowrap; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; }
.primary.wide { width: 100%; padding: 11px; border: 0; border-radius: 9px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.modal-msg { font-size: 12.5px; color: #b91c1c; margin: 10px 0 0; min-height: 16px; }
.modal-msg.ok { color: var(--accent); }
.modal-msg.info { color: var(--muted); }

.pkgs { display: grid; gap: 8px; margin-bottom: 12px; }
.pkg {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.pkg.on { border-color: var(--accent); background: #f2fbf9; }
.pkg strong { font-size: 14px; }
.pkg span { color: var(--accent); font-weight: 600; }
.pay-channels { display: flex; gap: 8px; margin-bottom: 4px; }
.pay-channels button { flex: 1; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; font: inherit; }
.pay-channels button:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 640px) {
  .acct-email { display: none; }
  .bar-right { gap: 6px; }
}

.redeem-row { display: flex; gap: 8px; margin-bottom: 12px; }
.redeem-row input {
  flex: 1; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 9px; font: inherit; text-transform: uppercase;
}
.redeem-row button {
  padding: 0 16px; border: 1px solid var(--accent); border-radius: 9px;
  background: #fff; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer;
  white-space: nowrap;
}
.divider-or {
  text-align: center; color: var(--muted); font-size: 12px;
  margin: 4px 0 12px; position: relative;
}
.divider-or::before, .divider-or::after {
  content: ""; position: absolute; top: 50%; width: 34%; height: 1px; background: var(--line);
}
.divider-or::before { left: 0; }
.divider-or::after { right: 0; }

.pay-qr {
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line);
  text-align: center;
}
.pay-qr.hidden { display: none; }
.pay-qr img { width: 200px; height: 200px; display: block; margin: 0 auto 8px; }
.qr-tip { font-size: 12px; color: var(--muted); margin: 0 0 6px; }
.qr-wait { font-size: 13px; color: var(--accent); margin: 0; font-weight: 600; }

.intro .contact {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}
.intro .contact b {
  color: var(--accent);
  font-size: 15px;
  letter-spacing: .03em;
  cursor: pointer;
  border-bottom: 1px dashed var(--accent);
  padding-bottom: 1px;
}
.intro .contact b:hover { opacity: .75; }
.contact-tip { margin-left: 8px; font-size: 12px; opacity: .8; }

.modal-contact {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}
.modal-contact b { color: var(--accent); }

/* 反馈入口：做成低调的小链接，不要跟客服 QQ 抢视觉 */
.link-btn {
  margin-left: 8px; padding: 0; border: 0; background: none;
  color: var(--muted); font: inherit; font-size: 12.5px;
  text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}
.link-btn:hover { color: var(--accent); }

.fb-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.fb-cats button {
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; font: inherit; font-size: 12.5px; color: var(--muted); cursor: pointer;
}
.fb-cats button.on { border-color: var(--accent); color: var(--accent); background: #f2fbf9; font-weight: 600; }

#fbContent {
  width: 100%; min-height: 110px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 9px;
  font: inherit; resize: vertical; margin-bottom: 10px;
}

.fb-list { margin-top: 16px; }
.fb-item {
  border-top: 1px solid var(--line); padding: 12px 0 0; margin-top: 12px;
}
.fb-item:first-child { border-top: 0; margin-top: 0; }
.fb-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.fb-tag { padding: 1px 8px; border-radius: 999px; font-size: 11.5px; }
.fb-tag.open { background: #fff4e5; color: #b45309; }
.fb-tag.replied { background: #e8f6f2; color: var(--accent); }
.fb-tag.closed { background: #f1f3f5; color: var(--muted); }
.fb-body { font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.fb-reply {
  margin-top: 8px; padding: 9px 11px; border-radius: 9px;
  background: #f2fbf9; border-left: 3px solid var(--accent);
  font-size: 13px; line-height: 1.6; white-space: pre-wrap;
}
.db-empty { font-size: 13px; color: var(--muted); text-align: center; padding: 8px 0; }

@media (max-width: 640px) {
  .link-btn { margin-left: 6px; padding: 2px 8px; font-size: 12px; }
}

/* ---------- 窄屏顶栏：内容太多会挤成一团，逐项收敛 ---------- */

@media (max-width: 720px) {
  .bar { gap: 8px; }
  .brand { flex: 0 0 auto; white-space: nowrap; }
  .brand small { display: none; }        /* 副标题「点图涂抹」 */
  .brand strong { font-size: 15px; }
  .engine { display: none; }             /* 服务状态，手机上不需要 */
  #openMp { display: none; }             /* 小程序码在手机上没法扫，藏起来 */

  .bar-right { gap: 6px; flex: 0 0 auto; }
  .account { gap: 6px; }
  .acct-email { display: none; }         /* 邮箱太长 */
  .acct-credit { white-space: nowrap; font-size: 11.5px; padding: 2px 8px; }
  .bar-right .ghost { height: 30px; padding: 0 9px; font-size: 12.5px; }
}

/* ---------- 邀请好友 ---------- */

.invite-entry {
  width: 100%; margin-top: 10px; padding: 10px 12px;
  border: 1px dashed var(--accent); border-radius: 10px;
  background: #f2fbf8; color: var(--accent);
  font: inherit; font-size: 12.5px; cursor: pointer; text-align: left;
}
.invite-entry:hover { background: #e8f6f2; }

.invite-code-box {
  margin: 14px 0 10px; padding: 18px; text-align: center;
  border-radius: 12px; background: linear-gradient(135deg, #e8f6f2, #f6fbf9);
}
.invite-code {
  font-size: 28px; font-weight: 700; letter-spacing: 4px; color: var(--accent);
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

.invite-link-row { display: flex; gap: 8px; }
.invite-link-row input {
  flex: 1; height: 36px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 12.5px; color: var(--muted);
}

.invite-stats { display: flex; gap: 10px; margin-top: 14px; }
.invite-stats .stat {
  flex: 1; padding: 10px; border-radius: 10px; background: #fff;
  border: 1px solid var(--line); text-align: center;
}
.invite-stats b { display: block; font-size: 18px; color: var(--accent); }
.invite-stats span { font-size: 11.5px; color: var(--muted); }

/* 窄屏：顶栏的「邀请」按钮放不下，靠充值弹层里的入口 */
@media (max-width: 720px) {
  #openInvite { display: none; }
}

/* 中等宽度：邮箱和长额度文案会把顶栏挤换行，提前收起来 */
@media (max-width: 900px) {
  .acct-email { display: none; }
  .acct-credit { white-space: nowrap; }
}

/* ---------- 页脚（备案号是法定要求） ---------- */

.site-foot {
  max-width: 1320px; margin: 40px auto 0; padding: 24px 24px 40px;
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12.5px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--accent); text-decoration: underline; }
.site-foot .sep { color: #c8d4cf; }

/* 顶栏的链接按钮（工具箱入口） */
.bar-right a.ghost {
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; color: inherit;
}
