/* Word 图片导出 · 批量水印
   主题：与 Mr.Zhong 主站亮色模式一致的浅色玻璃拟态（glassmorphism）风格
   注意：本文件为 iframe 内独立文档样式，未引入 Tailwind */

:root {
  --bg-base: #eef1f8;
  --bg-card: rgba(255, 255, 255, 0.28);
  --bg-card-hover: rgba(255, 255, 255, 0.42);
  --bg-inset: rgba(255, 255, 255, 0.22);
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(99, 102, 241, 0.28);
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #4f46e5;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(99, 102, 241, 0.1);
  --accent-glow: rgba(99, 102, 241, 0.22);
  --danger: #dc2626;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 8px 32px rgba(99, 102, 241, 0.1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: transparent;
  min-height: 100vh;
  line-height: 1.6;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.7);
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 22px 36px;
}

.app__header {
  margin-bottom: 28px;
}

.app__header h1 {
  font-size: 26px;
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
  background: linear-gradient(90deg, #4f46e5, #8b5cf6 55%, #d946ef);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.app__header p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  max-width: 720px;
}

.step {
  margin-top: 24px;
}

/* 上传区 */
.drop {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-card);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  transition: border-color 0.25s, background 0.25s, transform 0.25s, box-shadow 0.25s;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.drop:hover {
  border-color: rgba(99, 102, 241, 0.5);
  background: var(--bg-card-hover);
}

.drop.is-drag {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 30px var(--accent-glow);
  transform: translateY(-2px);
}

.drop__inner {
  padding: 48px 24px;
  text-align: center;
}

.drop__icon {
  font-size: 44px;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 12px rgba(99, 102, 241, 0.25));
}

.drop__inner p {
  margin: 10px 0 0;
  color: var(--text);
  font-size: 15px;
}

.drop__hint {
  font-size: 12px !important;
  color: var(--text-muted) !important;
  margin-top: 8px !important;
}

.link {
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  font-size: inherit;
  transition: color 0.2s;
}

.link:hover {
  color: #6366f1;
  text-decoration: underline;
}

.status {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  min-height: 18px;
}

.status.is-error {
  color: var(--danger);
}

/* 网格 */
.grid-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 4px;
}

.grid-head h2 {
  font-size: 17px;
  margin: 0;
  font-weight: 700;
  color: var(--text);
}

.grid-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.chk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
}

.chk input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}

.cell {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-card);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  position: relative;
}

.cell:hover {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15);
  transform: translateY(-3px);
}

.cell.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cell__chk {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 18px;
  height: 18px;
  z-index: 2;
  accent-color: var(--accent);
}

.cell__thumb {
  height: 128px;
  background: var(--bg-inset);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cell__thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.cell__vec {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  line-height: 1.4;
}

.cell__name {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 14px;
}

/* 水印设置 */
.wm-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  align-items: start;
}

.wm-settings,
.wm-preview {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  box-shadow: var(--shadow);
}

.wm-settings h2,
.wm-preview h2 {
  font-size: 16px;
  margin: 0 0 18px;
  font-weight: 700;
  color: var(--text);
}

.field {
  margin-bottom: 18px;
}

.field > label {
  display: block;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 7px;
  font-weight: 600;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field-line {
  display: flex;
  align-items: center;
  gap: 12px;
}

.field input[type="text"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  background: rgba(255, 255, 255, 0.35);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input[type="text"]::placeholder {
  color: var(--text-muted);
}

.field input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.field input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
}

.field input[type="color"] {
  width: 48px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.35);
  padding: 3px;
  cursor: pointer;
}

.val {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 42px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-inset);
}

.seg__btn {
  border: 0;
  background: transparent;
  padding: 9px 18px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.seg__btn:hover {
  color: var(--text);
  background: rgba(15, 23, 42, 0.04);
}

.seg__btn.is-active {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 600;
}

.pos-grid {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  gap: 7px;
}

.pos__btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-inset);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.1s;
}

.pos__btn:hover {
  border-color: rgba(99, 102, 241, 0.4);
  background: var(--accent-soft);
}

.pos__btn:active {
  transform: translateY(1px);
}

.pos__btn.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.28);
}

.hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 8px;
  font-weight: 400;
}

.btn {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.2s, transform 0.1s, box-shadow 0.2s;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
  width: 100%;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.22);
}

.btn--primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.32);
}

.btn--primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* 逻辑禁用态（不使用原生 disabled，保证点击仍触发提示而非静默无反应） */
.btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  pointer-events: auto;
}
.btn.is-busy {
  opacity: 0.7;
  cursor: progress;
}

.btn--ghost {
  background: var(--bg-inset);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn--ghost:hover {
  border-color: rgba(99, 102, 241, 0.4);
  color: var(--text);
  background: rgba(99, 102, 241, 0.06);
}

.btn--sm {
  padding: 7px 12px;
  font-size: 13px;
}

.wm-preview .preview-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(45deg, rgba(15, 23, 42, 0.04) 25%, transparent 25%) -10px 0/20px 20px,
    linear-gradient(-45deg, rgba(15, 23, 42, 0.04) 25%, transparent 25%) -10px 0/20px 20px,
    linear-gradient(45deg, transparent 75%, rgba(15, 23, 42, 0.04) 75%) -10px 0/20px 20px,
    linear-gradient(-45deg, transparent 75%, rgba(15, 23, 42, 0.04) 75%) -10px 0/20px 20px,
    var(--bg-inset);
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  position: relative;
  overflow: hidden;
}

.preview-notice {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 10;
  background: linear-gradient(90deg, rgba(79, 70, 229, 0.92), rgba(139, 92, 246, 0.92));
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 4px 18px rgba(79, 70, 229, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
}

.preview-notice[hidden] {
  display: none !important;
}

.preview-notice__icon {
  margin-right: 6px;
}

#preview {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.18);
}

.wm-positioner {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  cursor: move;
  pointer-events: none;
  user-select: none;
  z-index: 5;
  display: none;
  color: var(--accent);
}

.wm-positioner.is-active {
  display: block;
}

.wm-positioner.is-dragging {
  z-index: 10;
}

.wm-visual {
  transform-origin: center center;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 48px;
  border-radius: 6px;
  border: 2px dashed currentColor;
  background: rgba(255, 255, 255, 0.4);
  color: inherit;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
  position: relative;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.wm-content {
  white-space: nowrap;
  font-weight: 600;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  text-align: center;
  line-height: 1.2;
  pointer-events: none;
  color: inherit;
}

.wm-content img {
  display: block;
  margin: 0 auto;
}

.wm-handle {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.25);
  z-index: 2;
  touch-action: none;
}

.wm-handle--rotate {
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  cursor: grab;
}

.wm-handle--scale {
  right: -12px;
  bottom: -12px;
  cursor: nwse-resize;
}

.hidden {
  display: none !important;
}

/* 滚动条与主站统一 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.7);
}
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.3) transparent;
}

@media (max-width: 800px) {
  .wm-layout {
    grid-template-columns: 1fr;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
  .app {
    padding: 22px 16px 40px;
  }
}
