/* ========== 在线PS 暗色主题 ========== */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #1e1e1e;
  color: #ddd;
}

/* 应用外壳：固定为视口高度的全屏工具布局（等价于原先直接挂在 body 上） */
#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

/* ---------- 页面内容区（SEO / 介绍 / FAQ）与站点页脚 ---------- */
.page-content {
  max-width: 780px;
  margin: 0 auto;
  padding: 48px 20px 24px;
  line-height: 1.7;
  font-size: 15px;
  color: #bbb;
}
.page-content h1 { font-size: 28px; color: #eee; margin: 0 0 12px; }
.page-content h2 { font-size: 20px; color: #ddd; margin: 36px 0 10px; }
.page-content p { margin: 10px 0; }
.page-content ul, .page-content ol { margin: 10px 0; padding-left: 22px; }
.page-content li { margin: 6px 0; }
.page-content strong { color: #ddd; }
.page-content details {
  border: 1px solid #333; border-radius: 6px;
  padding: 10px 14px; margin: 8px 0; background: #242424;
}
.page-content summary { cursor: pointer; color: #ddd; font-weight: 600; }
.page-content details p { margin: 8px 0 2px; }
.site-footer {
  border-top: 1px solid #111;
  background: #232323;
  padding: 18px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #777;
}
.site-footer a { color: #999; text-decoration: none; }
.site-footer a:hover { color: #fff; }

/* ---------- 文档页（隐私政策 / 关于） ---------- */
.doc-page {
  max-width: 780px;
  margin: 0 auto;
  padding: 40px 20px 60px;
  line-height: 1.7;
  font-size: 15px;
  color: #bbb;
}
.doc-page h1 { font-size: 26px; color: #eee; margin: 0 0 14px; }
.doc-page h2 { font-size: 18px; color: #ddd; margin: 28px 0 8px; }
.doc-page a { color: #31a8ff; }
.doc-page .doc-nav { margin-bottom: 24px; font-size: 14px; }

/* ---------- 菜单栏 ---------- */
#menubar {
  height: 38px;
  background: #232323;
  border-bottom: 1px solid #111;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 14px;
  flex-shrink: 0;
}
.logo { font-weight: 600; font-size: 14px; }
.menus { display: flex; height: 100%; }
.menu { position: relative; display: flex; align-items: center; }
.menu > button {
  background: none; border: 0; color: #ddd;
  padding: 0 12px; height: 100%;
  cursor: pointer; font-size: 13px;
}
.menu:hover > button { background: #333; }
.dropdown {
  display: none;
  position: absolute;
  top: 100%; left: 0;
  background: #2b2b2b;
  border: 1px solid #111;
  min-width: 230px;
  z-index: 100;
  box-shadow: 0 6px 16px rgba(0,0,0,.5);
  border-radius: 0 0 6px 6px;
  padding: 4px 0;
}
.menu:hover .dropdown, .menu.open .dropdown { display: block; }
.dropdown .item {
  padding: 7px 14px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  cursor: pointer;
  white-space: nowrap;
}
.dropdown .item:hover { background: #31a8ff; color: #fff; }
.dropdown .item:hover .sc { color: #e6f3ff; }
.dropdown .sc { color: #888; font-size: 11px; }
.dropdown .sep { height: 1px; background: #1a1a1a; margin: 4px 0; }
.menubar-right { margin-left: auto; font-size: 11px; color: #777; }

/* ---------- 工具选项栏 ---------- */
#optionsbar {
  min-height: 36px;
  background: #262626;
  border-bottom: 1px solid #111;
  display: flex;
  align-items: center;
  padding: 4px 12px;
  gap: 8px;
  font-size: 12px;
  color: #bbb;
  flex-shrink: 0;
  flex-wrap: wrap;
}
#optionsbar input[type="range"] { accent-color: #31a8ff; width: 110px; }
#optionsbar input[type="number"] {
  width: 60px; background: #1e1e1e; border: 1px solid #111;
  color: #eee; padding: 3px 5px; border-radius: 4px;
}
#optionsbar select {
  background: #1e1e1e; border: 1px solid #111; color: #ddd;
  padding: 3px 5px; border-radius: 4px;
}
#optionsbar .val { color: #eee; min-width: 32px; display: inline-block; }
#optionsbar .hint { color: #777; margin-left: auto; }

/* ---------- 主区域 ---------- */
#main { flex: 1; display: flex; min-height: 0; }

#toolbar {
  width: 48px;
  background: #262626;
  border-right: 1px solid #111;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0;
  gap: 2px;
  overflow-y: auto;
  flex-shrink: 0;
}
.tool-btn {
  width: 38px; height: 38px;
  background: none;
  border: 1px solid transparent;
  color: #ddd;
  font-size: 17px;
  cursor: pointer;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.tool-btn:hover { background: #3a3a3a; }
.tool-btn.active { background: #31a8ff; color: #fff; }

#canvasArea {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a1a;
}
#canvasWrap {
  position: relative;
  line-height: 0;
  box-shadow: 0 4px 30px rgba(0,0,0,.6);
}
#display {
  background: repeating-conic-gradient(#c8c8c8 0 25%, #f0f0f0 0 50%) 0 0 / 16px 16px;
  touch-action: none; /* 触屏绘制由 Pointer Events 接管，禁掉浏览器默认滚动/缩放 */
}
#overlay {
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

/* ---------- 右侧面板 ---------- */
#side {
  width: 270px;
  background: #262626;
  border-left: 1px solid #111;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}
.panel { border-bottom: 1px solid #111; padding: 10px 12px; }
.panel-title { font-size: 12px; color: #999; margin-bottom: 8px; letter-spacing: 2px; }

.color-row { display: flex; align-items: center; gap: 12px; }
.swatches { position: relative; width: 46px; height: 46px; flex-shrink: 0; }
.swatch {
  position: absolute;
  width: 28px; height: 28px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #000;
  cursor: pointer;
}
.swatch.fg { left: 0; top: 0; z-index: 2; }
.swatch.bg { left: 16px; top: 16px; z-index: 1; }
#swapColors {
  background: #333; border: 1px solid #111; color: #ddd;
  width: 28px; height: 28px; border-radius: 4px; cursor: pointer; font-size: 14px;
}
#swapColors:hover { background: #444; }
#palette {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  margin-top: 10px;
}
.pal { height: 18px; border-radius: 3px; cursor: pointer; border: 1px solid #111; }
.pal:hover { transform: scale(1.1); }

.layer-ctrl label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: #bbb; margin-bottom: 6px;
}
.layer-ctrl input[type="range"] { flex: 1; accent-color: #31a8ff; }
.layer-ctrl select {
  flex: 1; background: #1e1e1e; border: 1px solid #111;
  color: #ddd; padding: 4px; border-radius: 4px; font-size: 12px;
}
#layerList {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #111;
  background: #1e1e1e;
  border-radius: 4px;
}
.layer-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px;
  cursor: pointer;
  border-bottom: 1px solid #262626;
  font-size: 12px;
}
.layer-row.active { background: #2d4a67; }
.layer-row .eye { width: 20px; text-align: center; cursor: pointer; color: #aaa; flex-shrink: 0; }
.layer-row .thumb {
  width: 46px; height: 32px;
  background: repeating-conic-gradient(#c8c8c8 0 25%, #f0f0f0 0 50%) 0 0 / 8px 8px;
  border: 1px solid #111;
  flex-shrink: 0;
}
.layer-row .lname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-btns { display: flex; gap: 4px; margin-top: 8px; }
.layer-btns button {
  flex: 1;
  background: #333; border: 1px solid #111; color: #ddd;
  font-size: 11px; padding: 5px 2px;
  border-radius: 4px; cursor: pointer;
}
.layer-btns button:hover { background: #444; }

/* ---------- 状态栏 ---------- */
#statusbar {
  height: 26px;
  background: #232323;
  border-top: 1px solid #111;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 11px;
  color: #888;
  flex-shrink: 0;
}

/* ---------- 对话框 ---------- */
#modalMask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
#modalMask.hidden { display: none; }
.dialog {
  background: #2b2b2b;
  border: 1px solid #111;
  border-radius: 8px;
  min-width: 330px;
  box-shadow: 0 10px 40px rgba(0,0,0,.6);
  display: none;
}
.dialog.show { display: block; }
.dlg-title { padding: 12px 16px; font-size: 14px; border-bottom: 1px solid #1a1a1a; }
.dlg-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.dlg-body label {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; font-size: 13px; color: #ccc;
}
.dlg-body input[type="number"] {
  width: 90px; background: #1e1e1e; border: 1px solid #111;
  color: #eee; padding: 5px; border-radius: 4px;
}
.dlg-body input[type="range"] { flex: 1; accent-color: #31a8ff; }
.dlg-body select {
  background: #1e1e1e; border: 1px solid #111; color: #ddd;
  padding: 5px; border-radius: 4px; font-size: 13px;
}
.dlg-body textarea {
  width: 300px; height: 80px;
  background: #1e1e1e; border: 1px solid #111; color: #eee;
  border-radius: 4px; padding: 6px; resize: vertical;
  font-family: inherit;
}
.dlg-body .note { font-size: 12px; color: #888; }
.dlg-btns {
  padding: 12px 16px;
  display: flex; justify-content: flex-end; gap: 8px;
  border-top: 1px solid #1a1a1a;
}
.btn {
  background: #3a3a3a; border: 1px solid #111; color: #ddd;
  padding: 6px 16px; border-radius: 4px;
  cursor: pointer; font-size: 13px;
}
.btn:hover { background: #4a4a4a; }
.btn.primary { background: #31a8ff; color: #fff; border-color: #31a8ff; }
.btn.primary:hover { background: #4db4ff; }

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  left: 50%; bottom: 50px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.85);
  color: #fff;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  z-index: 2000;
}
#toast.show { opacity: 1; }

/* ---------- 菜单栏右侧：隐私标识 + 移动端面板开关 ---------- */
.menubar-right { display: flex; align-items: center; gap: 8px; }
.lang-switch {
  color: #aaa; text-decoration: none; font-size: 11px;
  border: 1px solid #444; border-radius: 4px; padding: 3px 7px;
}
.lang-switch:hover { color: #fff; border-color: #666; }
#panelToggle {
  display: none;
  background: #333; border: 1px solid #111; color: #ddd;
  width: 30px; height: 26px; border-radius: 4px; cursor: pointer; font-size: 14px;
}
#panelToggle:hover { background: #444; }

/* ---------- 状态栏坐标 ---------- */
#statusPos { color: #6aa6d8; min-width: 90px; text-align: center; }

/* ---------- 裁剪确认条（触屏友好） ---------- */
#cropBar {
  position: absolute;
  left: 50%; bottom: 18px;
  transform: translateX(-50%);
  display: flex; gap: 8px;
  background: rgba(20,20,20,.92);
  border: 1px solid #111;
  border-radius: 8px;
  padding: 8px 10px;
  z-index: 50;
  box-shadow: 0 6px 20px rgba(0,0,0,.5);
}
#cropBar.hidden { display: none; }

/* ---------- 忙碌遮罩 ---------- */
#busy {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px;
  z-index: 3000;
}
#busy.hidden { display: none; }
.spinner {
  width: 42px; height: 42px;
  border: 4px solid rgba(255,255,255,.25);
  border-top-color: #31a8ff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.busy-text { color: #eee; font-size: 13px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 快捷键表 ---------- */
.kbd-table { border-collapse: collapse; width: 100%; font-size: 12px; color: #ccc; }
.kbd-table td { padding: 5px 8px; border-bottom: 1px solid #1a1a1a; }
.kbd-table td:first-child { color: #6aa6d8; white-space: nowrap; font-family: monospace; }

/* ---------- 防止触屏下拉刷新 / 回弹 ---------- */
html, body { overscroll-behavior: none; }

/* ---------- 移动端 / 窄屏适配 ---------- */
@media (max-width: 900px) {
  #menubar { gap: 6px; padding: 0 8px; }
  .logo { font-size: 12px; white-space: nowrap; }
  .menus { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .menus::-webkit-scrollbar { display: none; }
  .menu > button { padding: 0 8px; font-size: 12px; white-space: nowrap; }
  .menubar-right { margin-left: 0; }
  .menubar-right .trust { display: none; }
  #panelToggle { display: block; flex-shrink: 0; }
  #statusText, #statusHint {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  #statusHint { display: none; }
  #side {
    position: absolute;
    right: 0; top: 0; bottom: 0;
    z-index: 60;
    transform: translateX(100%);
    transition: transform .2s ease;
    box-shadow: -6px 0 20px rgba(0,0,0,.5);
  }
  #side.open { transform: translateX(0); }
  #main { position: relative; }
  .dialog { min-width: 0; width: calc(100vw - 48px); max-width: 380px; }
  .dlg-body textarea { width: 100%; }
  #optionsbar .hint { display: none; }
}
