:root {
  --bg: #0f1116; --sidebar: #161922; --panel: #1b1e27; --panel2: #22262f;
  --border: #2e333f; --text: #e8eaf0; --muted: #9aa1b0;
  --accent: #4f8cff; --accent2: #37d39a; --danger: #ff5d5d;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: var(--bg); color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  font-size: 14px; min-height: 100vh;
}
.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 30px; text-align: center; }
.logo {
  width: 52px; height: 52px; border-radius: 13px; margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center; font-size: 25px; color: #fff;
}
.logo.small { width: 34px; height: 34px; border-radius: 9px; font-size: 17px; margin: 0; }
.login-box h1 { font-size: 19px; }
.login-box .sub { font-size: 12px; color: var(--muted); margin: 8px 0 20px; line-height: 1.7; }
.login-box label { display: block; text-align: left; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.login-box input { width: 100%; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 210px; flex-shrink: 0; background: var(--sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 16px; }
.brand-text h1 { font-size: 15px; line-height: 1.2; }
.brand-text p { font-size: 11px; color: var(--muted); }
nav { flex: 1; overflow-y: auto; padding: 4px 8px 10px; }
nav::-webkit-scrollbar { width: 6px; }
nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.nav-group { margin-bottom: 10px; }
.nav-group-title { font-size: 11px; color: var(--muted); padding: 6px 10px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px;
  border: none; background: transparent; color: var(--text); border-radius: 8px;
  cursor: pointer; font-size: 13px; text-align: left; margin-bottom: 1px;
}
.nav-item:hover { background: var(--panel2); }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item .ico { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-item .tag { margin-left: auto; font-size: 10px; padding: 1px 5px; border-radius: 4px; background: rgba(255,255,255,.1); color: var(--muted); }
.nav-item.active .tag { background: rgba(255,255,255,.22); color: #fff; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--border); }
.sidebar-foot button { width: 100%; }

.workspace { flex: 1; min-width: 0; }
.ws-head { padding: 18px 24px; border-bottom: 1px solid var(--border); }
.ws-head h2 { font-size: 18px; }
.ws-head p { font-size: 12px; color: var(--muted); margin-top: 3px; }
.ws-body { padding: 18px 24px 40px; max-width: 900px; }

/* ---------- 组件 ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin-top: 14px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
  background: var(--panel2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 11px; font-size: 14px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
button.primary { background: var(--accent); border: none; color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 15px; cursor: pointer; }
button.primary:disabled { opacity: .5; cursor: not-allowed; }
button.primary.wide { width: 100%; margin-top: 14px; }
button.ghost { background: transparent; border: 1px solid var(--border); color: var(--muted); padding: 7px 13px; border-radius: 8px; cursor: pointer; font-size: 13px; }
button.ghost:hover { border-color: var(--accent); color: var(--text); }

.drop { border: 2px dashed var(--border); border-radius: 12px; padding: 26px; text-align: center; color: var(--muted); cursor: pointer; transition: .15s; }
.drop.over, .drop:hover { border-color: var(--accent); color: var(--text); }
.drop-hint { font-size: 12px; margin-top: 7px; opacity: .8; }

.presets { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.presets:not(:empty) { margin-bottom: 12px; }
.presets-label { font-size: 13px; color: var(--muted); }
.chip { background: var(--panel2); border: 1px solid var(--border); color: var(--text); padding: 6px 12px; border-radius: 999px; cursor: pointer; font-size: 13px; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.field.checkbox { grid-column: 1 / -1; }
.field.checkbox label { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
.field select, .field input[type="number"], .field input[type="text"] { width: 100%; }
.field input[type="range"] { width: 100%; accent-color: var(--accent); }
.field b { color: var(--accent); }

.progress { height: 6px; background: var(--border); border-radius: 3px; margin-top: 14px; overflow: hidden; }
.progress > div { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .3s; }
.msg { margin-top: 10px; font-size: 13px; min-height: 18px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--accent2); }
.result { margin-top: 10px; font-size: 14px; }
.result a { color: var(--accent2); font-weight: 600; margin-right: 12px; }
.preview { margin-top: 12px; text-align: center; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.preview img, .preview video { max-width: 100%; max-height: 400px; border-radius: 10px; border: 1px solid var(--border); }
.preview.multi img { max-height: 130px; width: auto; }
.preview .cap { width: 100%; font-size: 12px; color: var(--muted); }
.preview pre { width: 100%; text-align: left; background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; max-height: 300px; overflow: auto; font-size: 12px; line-height: 1.6; white-space: pre-wrap; }

.filelist { list-style: none; margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.filelist li { background: var(--panel2); border-radius: 8px; padding: 7px 11px; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.filelist li button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 15px; }
.filelist li button:hover { color: var(--danger); }

.trans-area { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.trans-col textarea { width: 100%; min-height: 220px; resize: vertical; line-height: 1.6; }
.trans-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 12px; color: var(--muted); }
#trans-msg.err { color: var(--danger); }
#trans-msg.ok { color: var(--accent2); }
.gen-result { margin-top: 14px; text-align: center; }
.gen-result img { max-width: 100%; max-height: 520px; border-radius: 10px; border: 1px solid var(--border); }
.gen-result a { color: var(--accent2); font-weight: 600; display: inline-block; margin-top: 8px; }

@media (max-width: 760px) {
  .sidebar { width: 58px; }
  .brand-text, .nav-group-title, .nav-item span:not(.ico), .sidebar-foot { display: none; }
  .nav-item { justify-content: center; }
  .trans-area { grid-template-columns: 1fr; }
  .ws-body { padding: 14px; }
}

/* ---------- 水印可视化编辑器 ---------- */
.wm-editor { margin-top: 14px; }
.wm-stage {
  position: relative; display: inline-block; max-width: 100%;
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  background: #0a0c11 repeating-conic-gradient(#15181f 0% 25%, #0f1218 0% 50%) 0/24px 24px;
}
.wm-stage canvas { display: block; max-width: 100%; touch-action: none; }
.wm-stage.draggable canvas { cursor: grab; }
.wm-stage.dragging canvas { cursor: grabbing; }
.wm-badge {
  position: absolute; top: 8px; left: 8px; font-size: 11px; color: #fff;
  background: rgba(0,0,0,.55); padding: 3px 8px; border-radius: 6px; pointer-events: none;
  backdrop-filter: blur(2px);
}
.wm-hint { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.6; }
