/* Video dewatermark tool — scoped, does not alter landing layout */

.vwm {
  position: relative;
  z-index: 1;
  padding: 104px 0 80px;
  min-height: 100vh;
}

.vwm__hero {
  text-align: center;
  margin-bottom: 40px;
}

.vwm__hero .section-tag {
  display: inline-block;
  margin-bottom: 12px;
}

.vwm__hero h1 {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 12px;
}

.vwm__hero p {
  color: var(--text-muted);
  font-size: 16px;
  max-width: 520px;
  margin: 0 auto;
}

.vwm__layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

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

.vwm__stage {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.vwm__drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 420px;
  padding: 40px 24px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  border: 2px dashed transparent;
  border-radius: var(--radius);
}

.vwm__drop:hover,
.vwm__drop--drag {
  background: var(--bg-card-hover);
  border-color: var(--cyan);
}

.vwm__drop-icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--gradient);
  display: grid;
  place-items: center;
  color: #fff;
  margin-bottom: 8px;
  box-shadow: var(--btn-primary-shadow);
}

.vwm__drop h2 {
  font-size: 18px;
  font-weight: 700;
}

.vwm__drop p {
  color: var(--text-muted);
  font-size: 14px;
}

.vwm__drop-hint {
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.8;
}

.vwm__workspace {
  display: none;
}

.vwm__workspace.is-active {
  display: block;
}

.vwm__viewport {
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: min(62vh, 560px);
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior: contain;
  user-select: none;
  touch-action: none;
  cursor: crosshair;
}

.vwm__viewport::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.vwm__viewport.is-panning,
.vwm__viewport.is-space {
  cursor: grab;
}

.vwm__viewport.is-panning.is-dragging {
  cursor: grabbing;
}

.vwm__sizer {
  position: relative;
  min-width: 100%;
  min-height: 100%;
}

.vwm__canvas-inner {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.vwm__canvas-inner video,
.vwm__canvas-inner canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.vwm__canvas-inner video {
  opacity: 0;
  pointer-events: none;
}

.vwm__overlay {
  z-index: 2;
  cursor: inherit;
}

.vwm__timeline {
  padding: 10px 14px 8px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

.vwm__tracks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  max-height: 148px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.vwm__tracks:empty {
  display: none;
  margin-bottom: 0;
}

.vwm__track {
  position: relative;
  min-height: 26px;
}

.vwm__track-lane {
  position: relative;
  width: 100%;
  height: 26px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--border) 85%, transparent);
  cursor: pointer;
}

.vwm__track-lane.is-snapping::after {
  content: "";
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: var(--snap-pct, 0%);
  width: 2px;
  margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 0 1px var(--cyan), 0 0 8px rgba(0, 212, 170, 0.6);
  pointer-events: none;
  z-index: 3;
}

.vwm__track-bar {
  position: absolute;
  top: 2px;
  bottom: 2px;
  min-width: 28px;
  border-radius: 4px;
  background: rgba(0, 212, 170, 0.55);
  cursor: grab;
  touch-action: none;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 0 10px;
}

.vwm__track.is-active .vwm__track-bar {
  background: rgba(0, 212, 170, 0.88);
  box-shadow: 0 0 0 1px rgba(0, 212, 170, 0.55);
  z-index: 1;
}

.vwm__track-bar:active {
  cursor: grabbing;
}

.vwm__track-name {
  position: relative;
  z-index: 1;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
}

.vwm__track-name:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.vwm__track-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: ew-resize;
  z-index: 2;
}

.vwm__track-handle--l {
  left: 0;
  border-radius: 4px 0 0 4px;
  background: rgba(255, 255, 255, 0.35);
}

.vwm__track-handle--r {
  right: 0;
  border-radius: 0 4px 4px 0;
  background: rgba(255, 255, 255, 0.35);
}

.vwm__track-bar:hover .vwm__track-handle,
.vwm__track.is-active .vwm__track-handle {
  background: rgba(255, 255, 255, 0.55);
}

.vwm__scrub {
  position: relative;
  height: 28px;
  display: flex;
  align-items: center;
  outline: none;
}

.vwm__scrub-track {
  position: relative;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  cursor: pointer;
  overflow: visible;
}

.vwm__scrub-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  border-radius: 4px;
  background: var(--gradient);
  pointer-events: none;
}

.vwm__scrub-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--cyan);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  z-index: 2;
}

.vwm__frame-preview {
  position: absolute;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  background: #111;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 5;
  text-align: center;
}

.vwm__frame-preview canvas {
  display: block;
  width: 160px;
  height: 90px;
  border-radius: 4px;
  background: #000;
  object-fit: contain;
}

.vwm__frame-preview span {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: #ccc;
}

.vwm__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}

.vwm__toolbar .btn {
  padding: 8px 12px;
  font-size: 13px;
}

.vwm__tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.vwm__ico {
  flex-shrink: 0;
  display: block;
}

.vwm__zoom {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
}

.vwm__zoom .btn {
  min-width: 32px;
  padding: 8px 10px;
}

.vwm__zoom span {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  min-width: 42px;
  text-align: center;
}

.vwm__time {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
}

.vwm__side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.vwm__panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(12px);
}

.vwm__panel h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.vwm__modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.vwm__mode {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.vwm__mode:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.vwm__mode.is-active {
  border-color: transparent;
  background: var(--gradient);
  color: #fff;
  box-shadow: var(--btn-primary-shadow);
}

.vwm__mode-hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.vwm__field {
  margin-top: 14px;
}

.vwm__field label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.vwm__field label span {
  font-family: var(--mono);
  color: var(--text);
}

.vwm__field input[type="range"] {
  width: 100%;
  accent-color: var(--cyan);
}

.vwm__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vwm__actions .btn {
  width: 100%;
  justify-content: center;
}

.vwm__actions .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

.vwm__status {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  min-height: 1.4em;
}

.vwm__status.is-error {
  color: var(--orange);
}

.vwm__tips {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
}

.vwm__tips li {
  padding-left: 0;
  margin-bottom: 6px;
}

.vwm__tips li::before {
  content: "·";
  margin-right: 8px;
  color: var(--cyan);
}

.vwm--processing .vwm__overlay {
  pointer-events: none;
  cursor: wait;
}

/* Processing / result modal */
.vwm-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.vwm-modal[hidden] {
  display: none;
}

.vwm-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 16, 0.72);
  backdrop-filter: blur(6px);
}

.vwm-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  padding: 28px 24px;
  text-align: center;
}

.vwm-modal__dialog h2 {
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 8px;
}

.vwm-modal__msg {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 16px;
  line-height: 1.5;
}

.vwm-modal__spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  border: 3px solid var(--border);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: vwm-spin 0.8s linear infinite;
}

@keyframes vwm-spin {
  to {
    transform: rotate(360deg);
  }
}

.vwm-modal__bar {
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
  margin-bottom: 8px;
}

.vwm-modal__bar>i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--gradient);
  transition: width 0.12s linear;
}

.vwm-modal__pct {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.vwm-modal__done video {
  width: 100%;
  border-radius: var(--radius-sm);
  background: #000;
  max-height: 320px;
  margin-bottom: 16px;
}

.vwm-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.vwm-modal__actions .btn {
  min-width: 120px;
  justify-content: center;
}

.nav__links a[aria-current="page"] {
  color: var(--cyan);
}

/* Region detail popover */
.vwm-pop {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.vwm-pop[hidden] {
  display: none;
}

.vwm-pop__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 16, 0.55);
  backdrop-filter: blur(4px);
}

.vwm-pop__dialog {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.3);
  padding: 18px 18px 16px;
  text-align: left;
}

.vwm-pop__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.vwm-pop__head h2 {
  font-size: 16px;
  font-weight: 800;
  margin: 0;
}

.vwm-pop__x {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.vwm-pop__x:hover {
  color: var(--text);
}

.vwm-pop__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.vwm-pop__grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.vwm-pop__grid input,
.vwm-pop__grid select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  padding: 7px 8px;
}

.vwm-pop__grid input:focus,
.vwm-pop__grid select:focus {
  outline: none;
  border-color: var(--cyan);
}

.vwm-pop__full {
  grid-column: 1 / -1;
}

.vwm-pop__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.vwm-pop__actions .btn {
  flex: 1;
  min-width: 0;
  justify-content: center;
}

.vwm-pop__danger {
  color: var(--orange) !important;
  border-color: color-mix(in srgb, var(--orange) 45%, var(--border)) !important;
}

.vwm-pop__danger:hover {
  background: color-mix(in srgb, var(--orange) 12%, transparent) !important;
}