
/* ================== Watermark ================== */

.wm-trigger {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  transition: all 0.12s;
}
.wm-trigger:hover { color: var(--text); border-color: var(--border-strong); background: var(--bg-card); }
.wm-trigger.active { border-color: color-mix(in oklab, var(--doc) 50%, var(--border)); background: color-mix(in oklab, var(--doc) 8%, var(--bg-raised)); }
.wm-trigger.active .wm-trigger-state { color: var(--doc); }
.wm-trigger-text { text-align: left; line-height: 1.2; }
.wm-trigger-label {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  color: var(--text);
}
.wm-trigger-state {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-faint);
}

.wm-panel {
  position: fixed; top: 72px; right: 20px; z-index: 65;
  width: 340px;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 18px 48px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.02);
  font-family: var(--font-sans);
  max-height: calc(100vh - 100px);
  display: flex; flex-direction: column;
  animation: wmSlide 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes wmSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.wm-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg);
  border-radius: 10px 10px 0 0;
}
.wm-head-title {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text);
}
.wm-dot { width: 7px; height: 7px; border-radius: 2px; background: var(--doc); box-shadow: 0 0 8px var(--doc); }
.wm-body {
  padding: 4px 0;
  overflow-y: auto;
  flex: 1;
}
.wm-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.wm-section:last-child { border-bottom: 0; }
.wm-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-faint);
  margin-bottom: 10px;
}
.wm-hint {
  font-size: 11px; color: var(--text-faint);
}

/* upload */
.wm-upload {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 24px;
  border: 1px dashed var(--border-strong);
  border-radius: 6px;
  color: var(--text-dim);
  font-family: var(--font-mono); font-size: 12px;
  transition: all 0.12s;
}
.wm-upload:hover { color: var(--text); border-color: var(--text); background: var(--bg-card); }

.wm-presets {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 12px;
}
.wm-preset-label {
  font-family: var(--font-mono); font-size: 10px; color: var(--text-faint);
  width: 100%; margin-bottom: 4px;
}
.wm-preset {
  padding: 5px 9px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.05em;
  border: 1px solid var(--border); border-radius: 4px;
  color: var(--text-dim);
  transition: all 0.12s;
}
.wm-preset:hover { color: var(--text); border-color: var(--border-strong); background: var(--bg-card); }
.wm-preset.active {
  color: var(--doc);
  border-color: var(--doc);
  background: color-mix(in oklab, var(--doc) 12%, var(--bg));
}

.wm-source {
  display: flex; gap: 12px; align-items: center;
}
.wm-source-preview {
  width: 70px; height: 50px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background:
    linear-gradient(45deg, oklch(0.22 0.008 260) 25%, transparent 25%),
    linear-gradient(-45deg, oklch(0.22 0.008 260) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, oklch(0.22 0.008 260) 75%),
    linear-gradient(-45deg, transparent 75%, oklch(0.22 0.008 260) 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
  background-color: oklch(0.18 0.008 260);
  padding: 4px;
}
.wm-source-preview > div {
  width: 100%; height: 100%;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}
.wm-source-meta { flex: 1; min-width: 0; }
.wm-source-name {
  font-family: var(--font-mono); font-size: 11.5px;
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-bottom: 4px;
}
.wm-source-actions {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 10px;
}
.wm-linkbtn { color: var(--text-dim); text-decoration: underline; text-underline-offset: 2px; }
.wm-linkbtn:hover { color: var(--text); }
.wm-linkbtn.danger { color: var(--danger); }
.wm-sep { color: var(--text-ghost); }

/* master switch row */
.wm-master-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}

/* position grid */
.wm-pos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  aspect-ratio: 4 / 3;
  margin-bottom: 8px;
}
.wm-pos-cell {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 3px;
  display: grid; place-items: center;
  transition: all 0.1s;
}
.wm-pos-cell:hover { border-color: var(--border-strong); background: var(--bg-card-hover); }
.wm-pos-cell .wm-pos-dot {
  width: 10px; height: 10px;
  border-radius: 2px;
  background: var(--text-ghost);
  transition: all 0.1s;
}
.wm-pos-cell.active {
  border-color: var(--doc);
  background: color-mix(in oklab, var(--doc) 18%, var(--bg-card));
}
.wm-pos-cell.active .wm-pos-dot {
  background: var(--doc);
  box-shadow: 0 0 8px var(--doc);
  transform: scale(1.2);
}

.wm-full {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 5px;
  color: var(--text-dim);
  font-family: var(--font-mono); font-size: 11px;
  transition: all 0.12s;
}
.wm-full:hover { color: var(--text); border-color: var(--border-strong); }
.wm-full.active {
  color: var(--doc);
  border-color: var(--doc);
  background: color-mix(in oklab, var(--doc) 10%, var(--bg));
}
.wm-full-icon {
  width: 16px; height: 12px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}
.wm-full.active .wm-full-icon { background: color-mix(in oklab, currentColor 30%, transparent); }

/* sliders */
.wm-slider { margin-bottom: 12px; }
.wm-slider:last-child { margin-bottom: 0; }
.wm-slider.disabled { opacity: 0.4; pointer-events: none; }
.wm-slider-head {
  display: flex; justify-content: space-between;
  margin-bottom: 6px;
}
.wm-slider-label {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--text-dim);
}
.wm-slider-val {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text);
  font-weight: 500;
}
.wm-slider input[type="range"] {
  width: 100%;
  -webkit-appearance: none; appearance: none;
  height: 3px; background: var(--border); border-radius: 2px;
  outline: none;
}
.wm-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--bg-raised);
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--border-strong);
  transition: transform 0.1s;
}
.wm-slider input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
.wm-slider input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--bg-raised);
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--border-strong);
}

/* scope rows */
.wm-scope-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0;
  font-size: 12px;
}
.wm-scope-row.disabled { opacity: 0.45; }
.wm-cat-chip {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11.5px;
  color: var(--text-dim);
}
.wm-cat-badge {
  width: 7px; height: 7px; border-radius: 2px;
}
.wm-cat-count { color: var(--text-ghost); font-size: 10.5px; }
.wm-na { font-family: var(--font-mono); font-size: 10px; color: var(--text-ghost); letter-spacing: 0.08em; }

.wm-footer-hint {
  padding: 10px 16px 14px;
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.45;
  background: var(--bg);
  border-top: 1px solid var(--border-soft);
}
.wm-footer-hint strong { color: var(--doc); font-weight: 500; font-family: var(--font-mono); }

/* Switch component */
.wm-switch {
  width: 34px; height: 20px;
  border-radius: 20px;
  background: var(--border);
  position: relative;
  transition: all 0.15s;
  flex-shrink: 0;
}
.wm-switch.on { background: var(--doc); }
.wm-switch-knob {
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.wm-switch.on .wm-switch-knob {
  transform: translateX(14px);
  background: var(--bg);
}
.wm-toolbar-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-raised);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.wm-toolbar-toggle .state { color: var(--text-faint); }
.wm-toolbar-toggle .state.on { color: var(--doc); }

/* Per-card WM chip */
.wm-chip {
  position: absolute; top: 8px; right: 8px;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 4px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.55);
  opacity: 0;
  transition: all 0.12s;
  z-index: 2;
}
.card:hover .wm-chip { opacity: 1; }
.wm-chip.on {
  color: var(--doc);
  border-color: color-mix(in oklab, var(--doc) 60%, transparent);
  background: color-mix(in oklab, var(--doc) 18%, rgba(0,0,0,0.6));
  opacity: 1;
}
.wm-chip:hover { background: rgba(0,0,0,0.85); }
.wm-chip.on:hover { background: color-mix(in oklab, var(--doc) 28%, rgba(0,0,0,0.6)); }
